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

Python bindings: reverse prompts #1232

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

385olt
Copy link
Contributor

@385olt 385olt commented Jul 20, 2023

I added reverse prompts to the generate method. Now you can specify a list of prompts (! combinations of tokens !) that will stop the generation once they where generated.

Note: the reverse prompts must be combination of tokens, for example, notice the reverse prompt " Biden" in the demo. It is prepended with a space because Biden is made out of two tokens: B and iden.

Checklist before requesting a review

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.
  • I have added thorough documentation for my code.
  • I have tagged PR with relevant project labels. I acknowledge that a PR without labels may be dismissed.
  • If this PR addresses a bug, I have provided both a screenshot/video of the original bug and the working solution.

Demo

You can see how it works here: https://pastebin.com/iKid3zSy

@385olt
Copy link
Contributor Author

385olt commented Jul 20, 2023

Moved all login to pyllmodel. Now it works properly in streaming mode. Also, having a token cache in pyllmodel will be necessary to handle unicode decoding anyway. However, now the token cache is in str, while for unicode it needs to be bytes.

@385olt 385olt marked this pull request as draft July 20, 2023 10:43
@cosmic-snow cosmic-snow added the python-bindings gpt4all-bindings Python specific issues label Jul 23, 2023
@manyoso
Copy link
Collaborator

manyoso commented Mar 13, 2024

@cebtenzzre this is quite old. anything to salvage from this or close?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python-bindings gpt4all-bindings Python specific issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants