Model OS Error
I am trying to load the model with the sample inference described in the model card.
I end up with
OSError: Unable to load weights from pytorch checkpoint file for '/home/ubuntu/.cache/huggingface/hub/models--allenai--MolmoE-1B-0924/snapshots/68e0611d5c8fef185a0cb6e7357a595ca40e8e88/pytorch_model.bin' at '/home/ubuntu/.cache/huggingface/hub/models--allenai--MolmoE-1B-0924/snapshots/68e0611d5c8fef185a0cb6e7357a595ca40e8e88/pytorch_model.bin'. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.
My simple search revealed that the pytorch model might have been corrupted or something. Any idea on this?
Maybe check that the SHA of your file matches the SHA of https://huggingface.co/allenai/MolmoE-1B-0924/blob/main/pytorch_model.bin ; could be that it didn't download the full file
I'm getting the same error. I have downloaded the model twice, no luck.
Here is the stacktrace:
processor_config.json: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 121/121 [00:00<00:00, 1.87MB/s]
preprocessing_molmo.py: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 6.43k/6.43k [00:00<00:00, 76.2MB/s]
A new version of the following files was downloaded from https://huggingface.co/allenai/MolmoE-1B-0924:
- preprocessing_molmo.py
. Make sure to double-check they do not contain any added malicious code. To avoid downloading new versions of the code file, you can pin a revision.
preprocessor_config.json: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 634/634 [00:00<00:00, 10.3MB/s]
image_preprocessing_molmo.py: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 22.2k/22.2k [00:00<00:00, 10.8MB/s]
tokenizer_config.json: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 6.25k/6.25k [00:00<00:00, 82.4MB/s]
tokenizer.json: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 2.12M/2.12M [00:00<00:00, 9.26MB/s]
added_tokens.json: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 118/118 [00:00<00:00, 2.21MB/s]
special_tokens_map.json: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 703/703 [00:00<00:00, 10.3MB/s]
The tokenizer class you load from this checkpoint is not the same type as the class this function is called from. It may result in unexpected tokenization.
The tokenizer class you load from this checkpoint is 'GPTNeoXTokenizer'.
The class this function is called from is 'GPT2TokenizerFast'.
config.json: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 3.52k/3.52k [00:00<00:00, 57.5MB/s]
config_molmoe.py: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 17.5k/17.5k [00:00<00:00, 26.1MB/s]
A new version of the following files was downloaded from https://huggingface.co/allenai/MolmoE-1B-0924:
- config_molmoe.py
. Make sure to double-check they do not contain any added malicious code. To avoid downloading new versions of the code file, you can pin a revision.
modeling_molmoe.py: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 104k/104k [00:00<00:00, 50.9MB/s]
A new version of the following files was downloaded from https://huggingface.co/allenai/MolmoE-1B-0924:
- modeling_molmoe.py
. Make sure to double-check they do not contain any added malicious code. To avoid downloading new versions of the code file, you can pin a revision.
pytorch_model.bin: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 28.9G/28.9G [07:14<00:00, 66.4MB/s]
Traceback (most recent call last):
File "/home/yustee/.cache/pypoetry/virtualenvs/mlm4pdf2text-ixWs2z-I-py3.11/lib/python3.11/site-packages/transformers/modeling_utils.py", line 575, in load_state_dict
return torch.load(
^^^^^^^^^^^
File "/home/yustee/.cache/pypoetry/virtualenvs/mlm4pdf2text-ixWs2z-I-py3.11/lib/python3.11/site-packages/torch/serialization.py", line 1087, in load
overall_storage = torch.UntypedStorage.from_file(os.fspath(f), shared, size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: unable to mmap 28888362419 bytes from file </home/yustee/.cache/huggingface/hub/models--allenai--MolmoE-1B-0924/snapshots/68e0611d5c8fef185a0cb6e7357a595ca40e8e88/pytorch_model.bin>: Cannot allocate memory (12)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/yustee/.cache/pypoetry/virtualenvs/mlm4pdf2text-ixWs2z-I-py3.11/lib/python3.11/site-packages/transformers/modeling_utils.py", line 584, in load_state_dict
if f.read(7) == "version":
^^^^^^^^^
File "<frozen codecs>", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 64: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/mnt/c/Users/justa/Projects/mlm4pdf2text/1b.py", line 14, in <module>
model = AutoModelForCausalLM.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/yustee/.cache/pypoetry/virtualenvs/mlm4pdf2text-ixWs2z-I-py3.11/lib/python3.11/site-packages/transformers/models/auto/auto_factory.py", line 559, in from_pretrained
return model_class.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/yustee/.cache/pypoetry/virtualenvs/mlm4pdf2text-ixWs2z-I-py3.11/lib/python3.11/site-packages/transformers/modeling_utils.py", line 3814, in from_pretrained
state_dict = load_state_dict(resolved_archive_file)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/yustee/.cache/pypoetry/virtualenvs/mlm4pdf2text-ixWs2z-I-py3.11/lib/python3.11/site-packages/transformers/modeling_utils.py", line 596, in load_state_dict
raise OSError(
OSError: Unable to load weights from pytorch checkpoint file for '/home/yustee/.cache/huggingface/hub/models--allenai--MolmoE-1B-0924/snapshots/68e0611d5c8fef185a0cb6e7357a595ca40e8e88/pytorch_model.bin' at '/home/yustee/.cache/huggingface/hub/models--allenai--MolmoE-1B-0924/snapshots/68e0611d5c8fef185a0cb6e7357a595ca40e8e88/pytorch_model.bin'. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.
Not sure why am I getting the cannot allocate memory error, since I have 24G of VRAM (RTX3090)
Hm the model has 7.2B total parameters ; if you load it in fp32 that's 4 bytes per parameter so 28GB I think? Maybe try loading it in bf16 or use a bigger gpu