-
Notifications
You must be signed in to change notification settings - Fork 27.7k
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
Loading mBART Large 50 MMT (many-to-many) is slow #10364
Comments
Related: #9205 |
Thanks. I'll rerun the benchmarks once patrick makes the changes. |
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
Has there been an updated to #9205 timeline? |
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
Environment info
I'm installing the library directly from
master
and running it in a kaggle notebook.transformers
version: 4.4.0.dev0Who can help
Information
Model I am using (Bert, XLNet ...): mBART-Large 50 MMT (many-to-many)
The problem arises when using:
After caching the weights of the model, load it with
from_pretrained
is significantly slower compared withtorch.load
.The tasks I am working on is:
Machine Translation
To reproduce
Here's the kaggle notebook reproducing the issue. Here's a colab notebook showing essentially the same thing.
Steps to reproduce the behavior:
model = MBartForConditionalGeneration.load_pretrained("facebook/mbart-large-50-many-to-many-mmt")
model.save_pretrained('./my-model')
torch.save(model, 'model.pt')
MBartForConditionalGeneration.load_pretrained('./my-model')
torch.load('model.pt')
The step above can be reproduced inside a kaggle notebook:
We will notice that loading with
from_pretrained
(step 4) is significantly slower thantorch.load
(step 5); the former takes over 1 minute and the latter just a few seconds (or around 20s if it hasn't been previously loaded in memory; see notebook).Expected behavior
The model should take less than 1 minute to load if it has already been cached (see step 1)
The text was updated successfully, but these errors were encountered: