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

Add constrained generation cookbook #64

Merged
merged 6 commits into from
May 22, 2024

Conversation

aymeric-roucher
Copy link
Collaborator

What does this PR do?

Add a cookbook on constrained generation.

Who can review?

@MKhalusova

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@aymeric-roucher aymeric-roucher changed the title [Draft] Add constrained generation cookbook Add constrained generation cookbook May 15, 2024
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

notebooks/en/constrained_generation.ipynb Outdated Show resolved Hide resolved
notebooks/en/constrained_generation.ipynb Outdated Show resolved Hide resolved
notebooks/en/constrained_generation.ipynb Outdated Show resolved Hide resolved
notebooks/en/constrained_generation.ipynb Outdated Show resolved Hide resolved
@stevhliu
Copy link
Member

Sweet recipe!

I think the structure can be improved a bit so its clearer what users are doing exactly in a specific section. You started with saying "This notebook demonstrates structured generation on two inference methods", so I think my expectation was for the notebook to be structured that way. The two topics, prompting and grammar, can be discussed within the larger context of these two sections.

# RAG with source highlighting using constrained generation
## Hugging Face Inference Endpoints
## Outlines

Copy link
Collaborator Author

Thank you! Since I think the distinction of prompting VS constrained generation is more interesting than HF vs Outlines, I prefer to emphasize in the intro the prompting VS constrained generation dichotomy, then only mention the use of Outlines as an extra.

@aymeric-roucher
Copy link
Collaborator Author

@stevhliu I changed the name of the notebook to "structured_generation" to represent a wider topic ("constrained generation" is only a method to achieve "structured generation"). Then its subparts are prompting (naive approach) and constrained generation (advanced approach).

Copy link
Member

@stevhliu stevhliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few more suggestions, but otherwise, I think this looks very good and can be merged once the comments are addressed!

@aymeric-roucher aymeric-roucher merged commit e133256 into huggingface:main May 22, 2024
1 check passed
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.

3 participants