Skip to content

Adding a new return_full_text parameter to TextGenerationPipeline.#9852

Merged
Narsil merged 2 commits into
masterfrom
text_generation_pipeline
Jan 29, 2021
Merged

Adding a new return_full_text parameter to TextGenerationPipeline.#9852
Narsil merged 2 commits into
masterfrom
text_generation_pipeline

Conversation

@Narsil
Copy link
Copy Markdown
Contributor

@Narsil Narsil commented Jan 27, 2021

What does this PR do?

For text-generation, it's sometimes used as prompting text.
In that context, prefixing generated_text with the actual input
forces the caller to take an extra step to remove it.

The proposed change adds a new parameter (for backward compatibility).
return_full_text that enables the caller to prevent adding the prefix.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

@LysandreJik
@patrickvonplaten

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors which may be interested in your PR.

For text-generation, it's sometimes used as prompting text.
In that context, prefixing `generated_text` with the actual input
forces the caller to take an extra step to remove it.

The proposed change adds a new parameter (for backward compatibility).
`return_full_text` that enables the caller to prevent adding the prefix.
Copy link
Copy Markdown
Contributor

@patrickvonplaten patrickvonplaten left a comment

Choose a reason for hiding this comment

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

I'm fine with this change and see the need in having such a feature!

Copy link
Copy Markdown
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

Yes, LGTM! Thanks for adding a test.

@LysandreJik
Copy link
Copy Markdown
Member

Don't mind the failing test, you can merge when ready.

@Narsil Narsil merged commit c2d0ffe into master Jan 29, 2021
@Narsil Narsil deleted the text_generation_pipeline branch January 29, 2021 09:27
Qbiwan pushed a commit to Qbiwan/transformers that referenced this pull request Jan 31, 2021
…uggingface#9852)

* Adding a new `return_full_text` parameter to TextGenerationPipeline.

For text-generation, it's sometimes used as prompting text.
In that context, prefixing `generated_text` with the actual input
forces the caller to take an extra step to remove it.

The proposed change adds a new parameter (for backward compatibility).
`return_full_text` that enables the caller to prevent adding the prefix.

* Doc quality.
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