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

add base model classes to bart subclassed models #9230

Merged
merged 2 commits into from
Dec 21, 2020

Conversation

patil-suraj
Copy link
Contributor

@patil-suraj patil-suraj commented Dec 21, 2020

What does this PR do?

This PR adds base model classes for MBart, Pegasus and Blenderbot, and adds these in MODEL_MAPPING dict.
This will enable to load these models using the AutoModel class and pipelines.

Right now these models can't be loaded using pipeline since pipeline relies on the AutoModel class.

if isinstance(model, str):
if is_torch_available() and not is_tf_available():
model = AutoModel.from_pretrained(model, revision=revision)
elif is_tf_available() and not is_torch_available():
model = TFAutoModel.from_pretrained(model, revision=revision)
else:

Copy link
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.

Looks good, only thing left to do is to add those new models to the docs as well. To pegasus.rst, ... respectively

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for adding those!

@patil-suraj patil-suraj merged commit f4432b7 into huggingface:master Dec 21, 2020
@patil-suraj patil-suraj deleted the add-base-models branch December 21, 2020 14:26
thevasudevgupta pushed a commit to thevasudevgupta/transformers that referenced this pull request Dec 23, 2020
* add base model classes to  bart subclassed models

* add doc
guyrosin pushed a commit to guyrosin/transformers that referenced this pull request Jan 15, 2021
* add base model classes to  bart subclassed models

* add doc
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