-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Phi-3 produces random gibberish #45
Comments
Hi @LoriBru so there is this report on Hugging Face chat ui huggingface/chat-ui#1139 Have you tried changing the model to see if its related? |
Can you confirm the following
So we would like to help identify the issue your having |
example of a stop sequence in C#
See https://github.com/microsoft/Phi-3CookBook/blob/main/md/07.Labs/Csharp/csharplabs.md labs302 https://github.com/microsoft/Phi-3CookBook/tree/main/md/07.Labs/Csharp/src/LabsPhi302 |
Hi @leestott ! You can also check the termination sequence in the sample, which I took from here: https://github.com/microsoft/Phi3-Chat-WinUI3-Sample/blob/main/ChatAppGenAI/Phi3Runner.cs
|
Hi @LoriBru as this is based of this sample I suggest you open up a issue on that repo https://github.com/microsoft/Phi3-Chat-WinUI3-Sample/ @nmetulev should be able to help provide some more guidance @elbruno has built a number of C# samples on this repo so can provide some additional guidance/tips |
I wonder if this is an issue of the size of the prompt and it happens once it hits a certain threshold or goes beyond the context window size supported by phi3. Have you tried different variants of phi3, such as the Cuda or Cpu version? Or even the larger context window (128K) Phi3 here: https://huggingface.co/microsoft/Phi-3-mini-128k-instruct-onnx? @natke from the Onnx Team might have additional insights. |
Hi @LoriBru, can you try to update to the latest packages and try running again? Can you also try running on CPU to see if you get the same result? Thank you for the repro - we will also try and repro on our end |
Thank you all for your comments! @nmetulev I also had the feeling that this might be related to the length of the prompt, so my question is: is it a good practice to give back the full conversation history to the prompt, formatted in that way? Shall there be a truncation in order not to have a longer and longer prompt? @natke I updated to the latest nuget packages and still have the exact same output. @ both, I did not have time yet to try to run on CPU or to try the 128K model, I'll try as soon as possible. |
So far, I am not able to have the same issue with the 128K model. Its answers by the way are in general always shorter and more direct than the 4k model. I don't know if that's an expected behavior or not. |
OK not true, I managed to get the following answer even with the 128k model:
The behavior is always the following: before outputting this pile of garbage, the application freezes for a few seconds after I send the prompt, then this comes out. |
@natke did you repo this issue? |
I have reproduced the issue with the 4k CPU model. I did not reproduce it with the 128k CPU model. This is the output I get for the 128k CPU:
I will try with the 128k DirectML model |
We are investigating this, as part of this issue: microsoft/onnxruntime-genai#552 |
It is recommended that you use ONNX Runtime for GenAI to call Phi-3 to obtain the best results. |
I've been experiencing a similar issue when fine-tuning phi3 and phi3.5 models as well. Produces a lot of tokens at the end that are gibberish even after fine-tuning. Looks like this has been solved with the latest ONNX release, but fine-tuning these ONNX models by converting them to torch is really tricky. Any solution for that? |
Just confirming it's still happening on all Phi-3 family models. I have tested it, though I have yet to try 3.5. Interestingly, it occurs when we exceed a 4K context window. |
I also confirm it is still happening with the latest ONNX release and Phi-3 models. |
Closing issue as no issues have been reported since Oct 2024 if you experience issues please reopen |
Hi all, thanks a lot for this great repo!
I am a beginner in the field and I started playing with Phi-3 and so far I've been quite impressed.
I am not sure this is the place to discuss the issue I am having, in case please redirect me to a more appropriate place.
My problem is that it is very easy to trigger Phi-3 to start throwing a super long and random amount of words instead as answer to easy question.
Let's take this example of conversation:
As you can see the last answer is pure garbage.
This is my last full prompt:
My question for you is: am I doing something wrong on my side, in terms of usage of Phi-3 or preparation of the prompt?
I am giving back in the prompt also the history of the conversation as done in this project : https://github.com/microsoft/Phi3-Chat-WinUI3-Sample/tree/main/ChatAppGenAI
I prepared a small repo where you can check the project I am using:
https://github.com/LoriBru/Phi-3SimpleChat
Thank you for your help!
The text was updated successfully, but these errors were encountered: