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

Phi-3 mini stop token not recognized #74

Closed
DePasqualeOrg opened this issue May 16, 2024 · 5 comments
Closed

Phi-3 mini stop token not recognized #74

DePasqualeOrg opened this issue May 16, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@DePasqualeOrg
Copy link
Contributor

DePasqualeOrg commented May 16, 2024

This Phi 3 model used in the LLMEval app doesn't behave as expected. It looks like the stop token is not being recognized.

Prompt:

Name a color.

Output:

Blue.<|end|><|assistant|> Blue is a primary color that is often associated with calmness, stability, and serenity. It is a color that can be found in nature, from the vast ocean to the clear sky.<|end|><|assistant|> Here is a color:

Purple.<|end|><|assistant|> Purple is a secondary color created by mixing equal parts of red and blue. It is often associated with creativity, wisdom, and luxury. Purple can evoke a sense of royalty and is sometimes linked to spirituality and mysticism.<|end|><|assistant|> Another color is:

Green.

Green is a primary color that symbolizes growth, harmony, and freshness. It is the color of nature, often associated with renewal and vitality. Green is also commonly linked to environmentalism and sustainability.<|end|>

Related issues:
ggerganov/llama.cpp#6903
nomic-ai/gpt4all#2271
huggingface/swift-transformers#98

@davidkoski
Copy link
Collaborator

Per the tokenizer config, the end of text is:

  "eos_token": "<|endoftext|>",

It looks like people are manually modifying the config or manipulating the runtime. Ideally the shipping tokenizer config would indicate the correct eos tokens.

That said, the swift-transformers code only allows a single eos token.

We have a couple options here:

@awni
Copy link
Member

awni commented May 20, 2024

In Python, we do a combination of 1 (change the config) and 3. The argument is nice because it adds a lot of flexibility. Regarding 2, it's not clear to me if the original model authors intended the model to have two EOS tokens or if it was just an oversight not to update it in the tokenizer...

@davidkoski
Copy link
Collaborator

OK, then let's plan on adding #3 -- that will make it flexible at least.

@davidkoski davidkoski added the enhancement New feature or request label May 20, 2024
@davidkoski
Copy link
Collaborator

OK, I am working on the model configuration for #53 so it will be included with that.

davidkoski added a commit that referenced this issue May 20, 2024
- fix for #53 #71 #69 #74
- in order to test the models
	- I added a default prompt of an appropriate form
	- while working on the model configuration also added additional stop tokens (#74)
- fixed the repetitionPenalty code (#71)
davidkoski added a commit that referenced this issue May 28, 2024
* handle partially quantized models

- fix for #53 #71 #69 #74
- in order to test the models
	- I added a default prompt of an appropriate form
	- while working on the model configuration also added additional stop tokens (#74)
- fixed the repetitionPenalty code (#71)
@davidkoski
Copy link
Collaborator

#76 should fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants