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

Handle empty generation inputs #268

Merged
merged 5 commits into from
Jul 17, 2022
Merged

Conversation

guillaume-be
Copy link
Owner

Improve handling of empty inputs for text generation:

  • Handle empty prompts list (return an empty vector)
  • Handle list of zero-length (or space-only) inputs (pre-populate inputs with BOS token when available).

This behaviour matches the reference Python implementation.
Fixes #267

@guillaume-be guillaume-be merged commit 66d596a into master Jul 17, 2022
@guillaume-be guillaume-be deleted the handle_empty_generation_inputs branch July 17, 2022 08:30
Miezhiko pushed a commit to Masha/rust-bert that referenced this pull request Mar 21, 2023
* Handle zeo-length slice input for text generation (alias to None)

* Handle zeo-length slice input for text generation (return zero-length vector))

* Handle zero-length prompts (seed with BOS token)

* Updated zero-length prompts attention mask to match Python reference

* Fix clippy warnings
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.

Crash when passing empty or whitespace-only input into TextGenerationModel
1 participant