THUDM / VisualGLM-6B

Chinese and English multimodal conversational language model | 多模态中英双语对话语言模型
Apache License 2.0
4.09k stars 417 forks source link

huggingface上的visualglm-6b模型文件是不是有问题? #11

Closed kingdomad closed 1 year ago

kingdomad commented 1 year ago

下载了模型文件之后,运行web_demo_hf.py,加载模型文件这一步就各种报错

Sleepychord commented 1 year ago

请你详细描述一下报错内容、您下载的文件大小,加载路径,Huggingface相关的环境设置;发布前我下载测试过那个模型文件是没问题的。

JamePeng commented 1 year ago

模型没问题,测试了一晚上,十有八九是deepspeed那个报错,那个可以根据readme指引跳过安装

wayne78ck6 commented 1 year ago

我也是從昨天早上就一直失敗到現在, 也是從hugging face那裏下載檔案來跑的。 看起來是讀取第一個檔案就壞了。 以下是錯誤的資訊:

Loading checkpoint shards: 0%| | 0/5 [00:00<?, ?it/s] Traceback (most recent call last): File "/home/user/.local/lib/python3.8/site-packages/transformers/modeling_utils.py", line 446, in load_state_dict return torch.load(checkpoint_file, map_location="cpu") File "/home/user/.local/lib/python3.8/site-packages/torch/serialization.py", line 713, in load return _legacy_load(opened_file, map_location, pickle_module, pickle_load_args) File "/home/user/.local/lib/python3.8/site-packages/torch/serialization.py", line 905, in _legacy_load return legacy_load(f) File "/home/user/.local/lib/python3.8/site-packages/torch/serialization.py", line 802, in legacy_load tar.extract('storages', path=tmpdir) File "/usr/local/lib/python3.8/tarfile.py", line 2060, in extract tarinfo = self.getmember(member) File "/usr/local/lib/python3.8/tarfile.py", line 1782, in getmember raise KeyError("filename %r not found" % name) KeyError: "filename 'storages' not found"**

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/user/.local/lib/python3.8/site-packages/transformers/modeling_utils.py", line 457, in load_state_dict raise ValueError( ValueError: Unable to locate the file visualglm-6b/pytorch_model-00001-of-00005.bin which is necessary to load this pretrained model. Make sure you have saved the model properly.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "test_VGLM.py", line 3, in model = AutoModel.from_pretrained("visualglm-6b", trust_remote_code=True).half().cuda() File "/home/user/.local/lib/python3.8/site-packages/transformers/models/auto/auto_factory.py", line 462, in from_pretrained return model_class.from_pretrained( File "/home/user/.local/lib/python3.8/site-packages/transformers/modeling_utils.py", line 2777, in from_pretrained ) = cls._load_pretrained_model( File "/home/user/.local/lib/python3.8/site-packages/transformers/modeling_utils.py", line 3104, in _load_pretrained_model state_dict = load_state_dict(shard_file) File "/home/user/.local/lib/python3.8/site-packages/transformers/modeling_utils.py", line 462, in load_state_dict raise OSError( OSError: Unable to load weights from pytorch checkpoint file for 'visualglm-6b/pytorch_model-00001-of-00005.bin' at 'visualglm-6b/pytorch_model-00001-of-00005.bin'. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.

檔案大小看起來應該沒有太大差異: user@6e2c72ae62f1:~/src/visualglm-6b$ ls -hal 總用量 12G drwxr-xr-x 2 user user 4.0K 5月 19 09:45 . drwxrwxr-x 8 user user 4.0K 5月 19 09:45 .. -rw-r--r-- 1 user user 2.0K 5月 18 11:18 config.json -rw-r--r-- 1 user user 4.5K 5月 18 11:18 configuration_chatglm.py -rw-r--r-- 1 user user 1.5K 5月 18 11:18 .gitattributes -rw-r--r-- 1 user user 2.6M 5月 18 11:19 ice_text.model -rw-r--r-- 1 user user 12K 5月 18 11:18 LICENSE -rw-r--r-- 1 user user 61K 5月 18 11:18 modeling_chatglm.py -rw-r--r-- 1 user user 2.4K 5月 18 11:18 MODEL_LICENSE -rw-r--r-- 1 user user 3.8G 5月 18 11:37 pytorch_model-00001-of-00005.bin -rw-r--r-- 1 user user 3.7G 5月 18 11:33 pytorch_model-00002-of-00005.bin -rw-r--r-- 1 user user 3.7G 5月 18 11:31 pytorch_model-00003-of-00005.bin -rw-r--r-- 1 user user 3.7G 5月 18 11:35 pytorch_model-00004-of-00005.bin -rw-r--r-- 1 user user 1.9G 5月 18 11:24 pytorch_model-00005-of-00005.bin -rw-r--r-- 1 user user 106K 5月 18 11:18 pytorch_model.bin.index.json -rw-r--r-- 1 user user 15K 5月 18 11:18 quantization.py -rw-r--r-- 1 user user 3.8K 5月 18 11:18 README.md -rw-r--r-- 1 user user 17K 5月 18 11:18 tokenization_chatglm.py -rw-r--r-- 1 user user 461 5月 18 11:18 tokenizer_config.json -rw-r--r-- 1 user user 3.9K 5月 18 11:18 visual.py

希望能找到是哪邊出錯了

Sleepychord commented 1 year ago

@wayne78ck6 你是不是改代码的时候路径传错了?

zy220 commented 1 year ago

请问问题解决了吗?我也报这个错

wayne78ck6 commented 1 year ago

已經解決了,檢查了很多次代碼完全找不到哪裡有錯誤。 最後去檢查模型檔案的SHA256才發現不相同, 估計是下載的時候出了點問題,檔案一樣大但是內容壞掉。 可以去確認看看SHA256有沒有相同,當作比較是不是檔案複製過程中壞了的參考。