Download models for local loading

You can now (since the switch to git models explained here: [Announcement] Model Versioning: Upcoming changes to the model hub) just git clone a model to your laptop and make from_pretrained point to it:

# In a google colab install git-lfs
!sudo apt-get install git-lfs
!git lfs install

# Then
!git clone https://huggingface.co/ORGANIZATION_OR_USER/MODEL_NAME

from transformers import AutoModel

model = AutoModel.from_pretrained('./MODEL_NAME')

For instance:

# In a google colab install git-lfs
!sudo apt-get install git-lfs
!git lfs install

# Then
!git clone https://huggingface.co/facebook/bart-base

from transformers import AutoModel

model = AutoModel.from_pretrained('./bart-base')

cc @julien-c for confirmation

7 Likes