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

Unable to load weights from pytorch checkpoint file for '/home/qianlab03/rjs/Langchain-Chatchat-0.2.7/chatglm2-6b/pytorch_model-00001-of-00007.bin #668

Open
1 task done
iaoxuesheng opened this issue Mar 10, 2024 · 0 comments

Comments

@iaoxuesheng
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Traceback (most recent call last):
File "/home/qianlab03/anaconda3/envs/ceshi/lib/python3.10/site-packages/transformers/modeling_utils.py", line 530, in load_state_dict
return torch.load(
File "/home/qianlab03/anaconda3/envs/ceshi/lib/python3.10/site-packages/torch/serialization.py", line 797, in load
with _open_zipfile_reader(opened_file) as opened_zipfile:
File "/home/qianlab03/anaconda3/envs/ceshi/lib/python3.10/site-packages/torch/serialization.py", line 283, in init
super().init(torch._C.PyTorchFileReader(name_or_buffer))
RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/qianlab03/anaconda3/envs/ceshi/lib/python3.10/site-packages/transformers/modeling_utils.py", line 539, in load_state_dict
if f.read(7) == "version":
File "/home/qianlab03/anaconda3/envs/ceshi/lib/python3.10/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 128: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/cpfs01/zhuhai/home/qianlab03/rjs/Langchain-Chatchat-0.2.7/main.py", line 4, in
model = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True)
File "/home/qianlab03/anaconda3/envs/ceshi/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 556, in from_pretrained
return model_class.from_pretrained(
File "/home/qianlab03/anaconda3/envs/ceshi/lib/python3.10/site-packages/transformers/modeling_utils.py", line 3502, in from_pretrained
) = cls._load_pretrained_model(
File "/home/qianlab03/anaconda3/envs/ceshi/lib/python3.10/site-packages/transformers/modeling_utils.py", line 3903, in _load_pretrained_model
state_dict = load_state_dict(shard_file)
File "/home/qianlab03/anaconda3/envs/ceshi/lib/python3.10/site-packages/transformers/modeling_utils.py", line 551, in load_state_dict
raise OSError(
OSError: Unable to load weights from pytorch checkpoint file for '/home/qianlab03/rjs/Langchain-Chatchat-0.2.7/chatglm2-6b/pytorch_model-00001-of-00007.bin' at '/home/qianlab03/rjs/Langchain-Chatchat-0.2.7/chatglm2-6b/pytorch_model-00001-of-00007.bin'. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.

Expected Behavior

正常输出

Steps To Reproduce

跑官方的测试代码都没跑起来

Environment

- OS:Ubuntu
- Python:3.11
- Transformers:4.38.2
- PyTorch:2.0.1
- CUDA Support (`python -c "import torch; print(torch.cuda.is_available())"`) :true

Anything else?

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

No branches or pull requests

1 participant