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

Make sharded checkpoints work in offline mode #18125

Merged
merged 2 commits into from
Jul 13, 2022
Merged

Conversation

sgugger
Copy link
Collaborator

@sgugger sgugger commented Jul 13, 2022

What does this PR do?

This PR make sharded checkpoint work in offline mode and add more information to an error we return.
The crux of the issue is that the from_pretrained method of the various models will catch EntryNotFoundError on the regular model weights file, but we return a FileNotFoundError in offline mode. I changed the error type at the root, to avoid making three modifications in the PyTorch/TF/Flax model classes, but can change if you don't find this suitable.

@sgugger sgugger requested review from stas00 and LysandreJik July 13, 2022 14:56
Copy link
Contributor

@stas00 stas00 left a comment

Choose a reason for hiding this comment

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

I think that's a perfect solution, @sgugger

Thank you!

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

Impressive test!

mname = "lysandre/tiny-bert-random"
mname = "hf-internal-testing/tiny-random-bert"
Copy link
Member

Choose a reason for hiding this comment

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

Nice :)

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jul 13, 2022

The documentation is not available anymore as the PR was closed or merged.

@sgugger sgugger merged commit 37aeb57 into main Jul 13, 2022
@sgugger sgugger deleted the offline_mode_sharded branch July 13, 2022 16:43
viclzhu pushed a commit to viclzhu/transformers that referenced this pull request Jul 18, 2022
* Make sharded checkpoints work in offline mode

* Add test
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.

4 participants