Skip to content

Conversation

@mapmeld
Copy link
Contributor

@mapmeld mapmeld commented Sep 20, 2022

What does this PR do?

Throws a ValueError when typical_p argument is provided to text-generation, but its value or do_sample=False prevent typical decoding from happening as intended. Adds a line documenting typical decoding.

Most arguments to generate were previously covered in #18261 , but not typical_p.

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Sep 20, 2022

The documentation is not available anymore as the PR was closed or merged.

@LysandreJik LysandreJik requested a review from gante September 23, 2022 18:48
Copy link
Contributor

@gante gante left a comment

Choose a reason for hiding this comment

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

Hi @mapmeld 👋

I've requested a few changes, mostly to comply with previous design decisions and future plans for generate 🙏

Comment on lines 1317 to 1321
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a problem for several other options, such as top_k or length_penalty, which have no effect in some generation modes.

Despite it being a correct check, we are assessing how to best handle it. We would like to avoid having an if/else branch for each input variable, as it would make generate even longer and less readable. Since it is harmless to have typical_p set with do_sample=False and we don't want to promote further checks of this kind, I'm going to ask to remove it for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I do hope that the do_sample check can happen in the future because receiving typical_p but doing greedy or non-sampled beam decoding is, in my view, silently failing.

Removed this and committed requested changes ✅

Copy link
Contributor

@gante gante left a comment

Choose a reason for hiding this comment

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

Thank you for the changes <3

@gante gante merged commit 9c6aeba into huggingface:main Sep 28, 2022
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