THUDM / ChatGLM2-6B

ChatGLM2-6B: An Open Bilingual Chat LLM | 开源双语对话语言模型
Other
15.65k stars 1.85k forks source link

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 iaoxuesheng opened 4 months ago

iaoxuesheng commented 4 months ago

Is there an existing issue for this?

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?