-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Fix doc examples: cannot import name #14698
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
Conversation
…o the individual methods instead)
| return self.decoder(*args, **kwargs) | ||
|
|
||
|
|
||
| # Copied from transformers.models.bart.modeling_bart.BartForCausalLM with Bart->BigBirdPegasus, 'facebook/bart-large'->"google/bigbird-pegasus-large-arxiv" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't keep copy here, because there is no BigBirdPegasusTokenizer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we try to keep the copy and change Bart->BigBirdPegasus to BartDecoderWrapper->BigBirdPegasusDecoderWrapper and BartForCausalLM->BigBirdPegasusForCausalLM? This way the tokenizer should stay the same :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me try it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following does the trick:
- BartDecoderWrapper->BigBirdPegasusDecoderWrapper
- BartForCausalLM->BigBirdPegasusForCausalLM
- BartPreTrainedModel->BigBirdPegasusPreTrainedModel
- BartTokenizer->PegasusTokenizer
- 'facebook/bart-large'->"google/bigbird-pegasus-large-arxiv"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perfect!
|
Great catch - thanks a lot for fixing it! I think we should do the exact same thing for the speech models (UniSpeech, SEW, UniSpeechSAT) actually. Feel free to open a PR if you want - I'll put it on my ToDo list as well though |
|
So I have seen and |
Yeah there is no |
|
@ydshieh - if ok for you, I would like to merge this one now and then if you want we could open a new one for |
patrickvonplaten
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot!
Sure, ok for me. |
sgugger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing!
What does this PR do?
In doc examples in some PT model files, there are
cannot import nameerror. This PR fixes this issue.Who can review?
@patrickvonplaten
Question:
@patrickvonplaten , in
modeling_unispeech.py, there are examples usingAnd in some docstring, there are
However, these can't be imported
Is there any reason to make these objects invisible to
transformers?