-
Notifications
You must be signed in to change notification settings - Fork 548
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
Example is underwhelming #1347
Labels
Comments
what happens without outlines? |
This might be a result of not using the proper chat templating in the example. This works better: import outlines
from transformers import AutoTokenizer
model_name = "microsoft/Phi-3-mini-4k-instruct"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = outlines.models.transformers(model_name)
def template(prompt: str) -> str:
return tokenizer.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=}') |
cpfiffer
added a commit
to cpfiffer/outlines
that referenced
this issue
Jan 10, 2025
The existing README has underwhelming or incorrect results (Example is underwhelming dottxt-ai#1347) due to lack of templating for instruct models. This adds special tokens for each instruct model call, as well as provide comments on how to obtain/produce special tokens.
rlouf
pushed a commit
that referenced
this issue
Jan 23, 2025
The existing README has underwhelming or incorrect results (Example is underwhelming #1347) due to lack of templating for instruct models. This adds special tokens for each instruct model call, as well as provide comments on how to obtain/produce special tokens. --------- Co-authored-by: Victoria Terenina <torymur@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: