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
When using roles such as with assistant(): combined with stream(), roles are not obeyed and all output is being squished into the last role...
To Reproduce
Give a full working code snippet that can be pasted into a notebook cell or python file. Make sure to include the LLM load step so we know which model you are using.
<|start_header_id|>assistant<|end_header_id>
Hey there! How's it going?<|eot_id|>
<|start_header_id|>assistant<|end_header_id>
Hey there! How's it going? What's on your mind? Do you have<|eot_id|>
<|start_header_id|>assistant<|end_header_id>
Hey there! How's it going? What's on your mind? Do you have any questions or topics you'd like to discuss<|eot_id|>
<|start_header_id|>assistant<|end_header_id>
Hey there! How's it going? What's on your mind? Do you have any questions or topics you'd like to discuss? I'm here to help and provide information<|eot_id|>
<|start_header_id|>assistant<|end_header_id>
Note that the output is all under assistant, and that the sentence being written is a completion of what should have been the user() role.
System info (please complete the following information):
OS (e.g. Ubuntu, Windows 11, Mac OS, etc.): MacOS
Guidance Version (guidance.__version__): 0.1.15
(Temporary) workaround
I found a way around this after reading the source code and attempting to fix it (I couldn't find a way to do it without breaking too much things, so I wait for a dev with more experience for a final fix) - it's not the cleanest but it'll do for now:
@peterwilli thank you for identifying this issue and providing a workaround! It would be nice if we could do this a bit more "automatically" for our users -- I think that the context-manager implementation needs some attention... will continue thinking about this :)
Thank you! Yeah! That was exactly where my thoughts went, but I wasn't experienced enough with your source code to make such change to the context manager. I decided to settle for this workaround for now, but of course automating this, so behavior is the same for stream and not stream is much better
The bug
When using roles such as
with assistant():
combined withstream()
, roles are not obeyed and all output is being squished into the last role...To Reproduce
Give a full working code snippet that can be pasted into a notebook cell or python file. Make sure to include the LLM load step so we know which model you are using.
What I get:
Note that the output is all under assistant, and that the sentence being written is a completion of what should have been the user() role.
System info (please complete the following information):
guidance.__version__
): 0.1.15(Temporary) workaround
I found a way around this after reading the source code and attempting to fix it (I couldn't find a way to do it without breaking too much things, so I wait for a dev with more experience for a final fix) - it's not the cleanest but it'll do for now:
Note that the token iteration is outside of any roles, this is important for the workaround to work.
The text was updated successfully, but these errors were encountered: