You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used README.md's example, and changed the review to "Review: This restaurant is bad!" -instead of 'good'- or any similar negative phrasing. The answer given back is almost exclusively "Positive".
I understand this is the model's behaviour, but maybe either:
this model isn't up to this task
the prompt is too hard for this example.
Suggestion: We could reconsider a more illustrative example
Steps/code to reproduce the bug:
importoutlinesmodel=outlines.models.transformers("microsoft/Phi-3-mini-4k-instruct")
prompt="""You are a sentiment-labelling assistant.Is the following review positive or negative?Review: This restaurant is bad!"""generator=outlines.generate.choice(model, ["Positive", "Negative"])
answer=generator(prompt)
print(f'{answer=}')
Expected result:
"Negative"
Error message:
"Positive"
Outlines/Python version information:
outlines v 0.1.11
Python 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:51:49) [Clang 16.0.6 ]
Context for the issue:
first time user trying out the example
The text was updated successfully, but these errors were encountered:
This might be a result of not using the proper chat templating in the example. This works better:
importoutlinesfromtransformersimportAutoTokenizermodel_name="microsoft/Phi-3-mini-4k-instruct"tokenizer=AutoTokenizer.from_pretrained(model_name)
model=outlines.models.transformers(model_name)
deftemplate(prompt: str) ->str:
returntokenizer.apply_chat_template(
[{"role": "user", "content": prompt}],
tokenize=False,
add_bos=True,
add_generation_prompt=True,
)
prompt="""You are a sentiment-labelling assistant.Is the following review positive or negative?Review: This restaurant is bad!"""generator=outlines.generate.choice(model, ["Positive", "Negative"])
answer=generator(template(prompt))
print(f'{answer=}')
Describe the issue as clearly as possible:
I used
README.md
's example, and changed the review to "Review: This restaurant is bad!" -instead of 'good'- or any similar negative phrasing. The answer given back is almost exclusively "Positive".I understand this is the model's behaviour, but maybe either:
Suggestion: We could reconsider a more illustrative example
Steps/code to reproduce the bug:
Expected result:
"Negative"
Error message:
"Positive"
Outlines/Python version information:
outlines v 0.1.11
Python 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:51:49) [Clang 16.0.6 ]
Context for the issue:
first time user trying out the example
The text was updated successfully, but these errors were encountered: