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

Implement top_p / nucleus sampling #819

Merged
merged 6 commits into from
Sep 12, 2023
Merged

Conversation

jbochi
Copy link
Contributor

@jbochi jbochi commented Sep 11, 2023

This is an implementation of nucleus sampling, introduced in the paper The Curious Case of Neural Text Degeneration.

It's supported by llama-cpp, llama2.c, open ai and others.

@LaurentMazare
Copy link
Collaborator

Looks great, thanks! Could you describe a bit the testing that you've done? Just want to be sure that it covers running all the modified CLIs as well as the different web UIs.
Also could you add an entry to the top level CHANGELOG.md file?

@jbochi
Copy link
Contributor Author

jbochi commented Sep 12, 2023

Looks great, thanks!

Thank you! And thank you for creating candle!

Could you describe a bit the testing that you've done? Just want to be sure that it covers running all the modified CLIs as well as the different web UIs.

Here's trunk serve:
image

I also tested that even with high temperature, the output is close to greedy decoding (temperature=0) if top_p is low:

image

And here's lib-example.html:

image

Also could you add an entry to the top level CHANGELOG.md file?

Done

@LaurentMazare
Copy link
Collaborator

Great thanks, will merge once the CI has run!

@LaurentMazare
Copy link
Collaborator

rustfmt seems to fail, could you have a look please?

@jbochi
Copy link
Contributor Author

jbochi commented Sep 12, 2023

rustfmt seems to fail, could you have a look please?

sorry about that! Should be fixed now.

I also added the new test file I forgot to commit before

@LaurentMazare
Copy link
Collaborator

Thank for apply rustfmt, clippy seems to be having some failures now :)

@jbochi
Copy link
Contributor Author

jbochi commented Sep 12, 2023

Sorry again. Hopefully, it's all fixed now 🙏

@LaurentMazare LaurentMazare merged commit 805bf9f into huggingface:main Sep 12, 2023
@LaurentMazare
Copy link
Collaborator

Thanks, merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants