Skip to content

Conversation

@guillaume-be
Copy link
Contributor

@guillaume-be guillaume-be commented Jan 20, 2021

What does this PR do?

The configuration for ProphetNetForCausalLM is overwritten at initialization to ensure that it is used as a decoder (and not as an encoder_decoder) for text generation.

The initialization of the parent class for ProphetNetForCausalLM is done before this overwrite, causing the model.config.is_encoder_decoder to remain possibly True. This leads to an error if the generate method of the model is later called as the non-existing method get_encoder is called.

Fixes #9702

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?

@patrickvonplaten

@patrickvonplaten
Copy link
Contributor

Thanks a lot for fixing it @guillaume-be

@patrickvonplaten patrickvonplaten merged commit fb36c27 into huggingface:master Jan 21, 2021
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.

ProphetNetForCausalLM text generation fails

2 participants