Skip to content
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

Some answers in phi3-vision just return </s> #823

Open
elephantpanda opened this issue Aug 20, 2024 · 7 comments
Open

Some answers in phi3-vision just return </s> #823

elephantpanda opened this issue Aug 20, 2024 · 7 comments

Comments

@elephantpanda
Copy link

elephantpanda commented Aug 20, 2024

In phi-3 vision directml using either python or c# certain questions just return </s>

For example "Why is the sky blue?" returns a complete answer but "What is the capital of France?" consistently returns just </s> (i.e. it returns blank).

Not sure this is a bug specifically with genai but it may be a bug with the model itself. Either way, is there a suggested way to combat this? And has anyone else noticed this?

Perhaps genai needs to be fixed so that it doesn't generate the "STOP" token as it's first token! (Also it shouldn't be writing the stop token to the screen)

@elephantpanda
Copy link
Author

I have noticed it works better if I leave out the newline characters \n from the prompt. Was the vision model trained with these newline characters?

@elephantpanda
Copy link
Author

(Same things happen in version 0.4.0) And there is no way to tell it to ignore this token and pick a different one. There needs to be a way to allow us to have more control on which tokens we choose from the distribution.

@kunal-vaishnavi
Copy link
Contributor

The original config.json in the Phi-3 vision repo says that the EOS token id is 2. However, it appears that the actual EOS token id is 32007. I updated the published genai_config.json files in Hugging Face for Phi-3 vision to fix this.

You can also update your genai_config.json file locally by changing

"eos_token_id": [
    2,
    32000,
    32001,
    32007
]

to

"eos_token_id": 32007

@natke
Copy link
Contributor

natke commented Aug 27, 2024

@elephantpanda did you still see the issue when you update the EOS token?

@elephantpanda
Copy link
Author

@elephantpanda did you still see the issue when you update the EOS token?

Yes, still seems to end without an answer for certain inputs. Although my bigger problem with the vision model is it is crashing for me when trying to give it an image. But I think I narrowed that problem down with more details here.

@natke
Copy link
Contributor

natke commented Sep 6, 2024

@elephantpanda Did you happen to try this on CPU?

@elephantpanda
Copy link
Author

It's the same on GPU and CPU. If I don't include a newline character after "<|assistant|>" in the prompt, that seems to fix it as far as I can tell. I'll keep trying to see if this really does fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants