Cannot load model files with pytorch 2.0.1
I'm having trouble loading the model files downloaded from this repo. As a very basic test, using pytorch 2.0.1:
>>> import torch
>>> torch.load('pytorch_model-00001-of-00005.bin')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.11/site-packages/torch/serialization.py", line 815, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/torch/serialization.py", line 1033, in _legacy_load
magic_number = pickle_module.load(f, **pickle_load_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_pickle.UnpicklingError: invalid load key, '\x00'.
None of the shards load correctly, mostly invalid load keys but one _pickle.UnpicklingError: unpickling stack underflow
. I checked, and all of my sha256sums match the ones on HuggingFace. Perhaps there was some kind of line endings conversion or other incorrect postprocessing that happened when the files were added to git?
They are .Safetensors file I have to rename in .bin
All my 20B models have this problem because the tools I used was not renaming/taking name correctly, but it's fixed now, so you don't need to do that anymore for my future work.
Just change the extention from "bin" to "safetensors".
Update: I fixed all my 20B model naming, should work now.
If it worked, please close the issue, and enjoy!
OSError: Undi95/MLewd-ReMM-L2-Chat-20B does not appear to have a file named pytorch_model.bin, tf_model.h5, model.ckpt or flax_model.msgpack.
OSError: Undi95/MLewd-ReMM-L2-Chat-20B does not appear to have a file named pytorch_model.bin, tf_model.h5, model.ckpt or flax_model.msgpack.
I'm clueless.
Rename Model_... by Pytorch_model...
Tell me if it work!
My version of HF transformers looks for model.safetensors.index.json, not model.bin.index.json.
My version of HF transformers looks for model.safetensors.index.json, not model.bin.index.json.
Fixed!