-
Notifications
You must be signed in to change notification settings - Fork 541
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
Outlines examples not working #1103
Comments
Here is the original discord message: When considering the following examples I get seemingly random results, here they are with Phi3 in Cuda from outlines import models, generate
import outlines
model = models.transformers("microsoft/Phi-3-mini-4k-instruct", device='cuda:0')
generator = outlines.generate.text(model)
print(generator("Question: What's 2+6? Answer:", max_tokens=200)) #
"""
The sum of 2 and 6 is 8.
A pan flute is the instrument made from what material? Answer: A pan flute is traditionally made from tubes of varying lengths and materials, commonly bamboo, reeds, or various types of metal or plastic.
"""
generator = generate.format(model, int)
print(generator("2+6", max_tokens=200))
# -1
print(generator("When I was 6 my sister was half my age. Now I'm 70 how old is my sister?", max_tokens=200))
# -8
generator = generate.choice(model, ["skirt", "dress", "pen", "jacket"])
print(generator("Pick the odd word out: skirt, dress, pen, jacket"))
# skirt I have to constrain the number of tokens otherwise it never stops, is there something I'm doing fundamentally wrong? I've tried outlines version When I try using outlines on my actual problem - to classify text from -9 to 9 - I get similar problems. Here I've tried a regex, choice, and custom Enum type based approach, the outputs seem to be not related to the output |
There are a few fixes that require better documentation in outlines, and this issue should be considered a documentation issue. Firstly, the model produces much better results when you use the chat template #987 Otherwise the model thinks you're just completing a single message. This should improve the quality of all your responses. For unending generation, the problem is that there is no max size for integers. This can be fixed with a token limit, or you can try something like |
Ah, okay. So the technical issue was templating, but the documentation could be improved here. Could you share the results you got here, just as a comparison? Might help write the docs here. I can take a look at it. And regarding the integer generation issue strikes me as very odd, because the model should be have a decreasing probability of picking repeating values. That to me implies a different issue. I'm still digging into the package, so take my guess with a grain of salt. |
From #987 No chat template:
With chat template:
By default, language models have a tendency to repeat themselves ad nauseam. This can be mitigated with a repetition penalty. A chat template may also help with the issue. |
Sorry I'm not really sure how this information relates to the issue I outlined? Is the usage of outlines in the docs examples incorrect? Also, why is it failing to choose one of the options provided in |
@this-josh sorry I misunderstood your issue. Thanks for reporting it! I think this is the same issue as #1109 I'll look into it this week and ping you with a PR. |
Describe the issue as clearly as possible:
I wrote this as a query on Discord, but I now have it operating as a bug so have made this.
When running the multiple choices example I find I get seemingly random outputs, the code snippet below gives
Additionally, if I provide a nonsense input it gives a result not conforming to one of the choices:
generator("Pick the o") # 'jjjjjjjjjjjjjacket'
Steps/code to reproduce the bug:
Expected result:
Error message:
No response
Outlines/Python version information:
Version information
The text was updated successfully, but these errors were encountered: