Skip to content

Fix: Raise informative exception when prefix_allowed_tokens_fn return empty set of tokens#27797

Merged
gante merged 2 commits into
huggingface:mainfrom
Saibo-creator:fix_empty_prefix_allowed_tokens_fn
Dec 8, 2023
Merged

Fix: Raise informative exception when prefix_allowed_tokens_fn return empty set of tokens#27797
gante merged 2 commits into
huggingface:mainfrom
Saibo-creator:fix_empty_prefix_allowed_tokens_fn

Conversation

@Saibo-creator

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes #27676 #22890

Before submitting

Who can review?

@gante @ArthurZucker

@Saibo-creator

Copy link
Copy Markdown
Contributor Author

The failing tests seem to be irrelevant

@ArthurZucker ArthurZucker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

Comment thread src/transformers/generation/logits_process.py Outdated
@ArthurZucker

ArthurZucker commented Dec 4, 2023

Copy link
Copy Markdown
Collaborator

Rebase on main will help, It will get fix there

@Saibo-creator
Saibo-creator force-pushed the fix_empty_prefix_allowed_tokens_fn branch from 13f325f to 18f4667 Compare December 7, 2023 07:18
@Saibo-creator
Saibo-creator force-pushed the fix_empty_prefix_allowed_tokens_fn branch from 18f4667 to 8028126 Compare December 7, 2023 13:40
@Saibo-creator

Copy link
Copy Markdown
Contributor Author

@ArthurZucker Rebased

@gante gante left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Saibo-creator perfect, thank you for iterating 💛

@gante

gante commented Dec 7, 2023

Copy link
Copy Markdown
Contributor

(I'd commit Arthur's suggestion, as it saves a redundant computation :) )

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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.

@Saibo-creator

Saibo-creator commented Dec 7, 2023

Copy link
Copy Markdown
Contributor Author

(I'd commit Arthur's suggestion, as it saves a redundant computation :) )

@gante
I somehow missed the suggestion from Arthur. Thanks for reminding me! It's now committed :)

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.

RuntimeError with prefix_allowed_tokens_fn and do_sample=True When Allowed Tokens List is Empty

4 participants