

TITLE
Error when loading a model cloned without git-lfs is quite cryptic

COMMENTS
3

REACTIONS
+1: 0
-1: 0
laugh: 0
hooray: 0
heart: 0
rocket: 0
eyes: 0

BODY
# 🚀 Error message request

If you forget to install git-LFS (e.g. on Google Colab) and you just do:

```python
!git clone https://huggingface.co/facebook/bart-base
from transformers import AutoModel
model = AutoModel.from_pretrained('./bart-base')
```

The cloning seems to work well but the model weights are not downloaded. The error message is then quite cryptic and could probably be tailored to this (probably) common failure case:

```
loading weights file ./bart-large-cnn/pytorch_model.bin
---------------------------------------------------------------------------
UnpicklingError                           Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/transformers/modeling_utils.py in from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
    950             try:
--> 951                 state_dict = torch.load(resolved_archive_file, map_location="cpu")
    952             except Exception:

4 frames
UnpicklingError: invalid load key, 'v'.

During handling of the above exception, another exception occurred:

OSError                                   Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/transformers/modeling_utils.py in from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
    952             except Exception:
    953                 raise OSError(
--> 954                     f"Unable to load weights from pytorch checkpoint file for '{pretrained_model_name_or_path}' "
    955                     f"at '{resolved_archive_file}'"
    956                     "If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True. "

OSError: Unable to load weights from pytorch checkpoint file for './bart-large-cnn' at './bart-large-cnn/pytorch_model.bin'If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True. 
```

git-LFS specification files are pretty simple to parse and typically look like this:
```
version https://git-lfs.github.com/spec/v1
oid sha256:097417381d6c7230bd9e3557456d726de6e83245ec8b24f529f60198a67b203a
size 440473133
```

The first *key* is always `version`: https://github.com/git-lfs/git-lfs/blob/master/docs/spec.md