JittorLLMs icon indicating copy to clipboard operation
JittorLLMs copied to clipboard

OSError: Unable to load weights from pytorch checkpoint file for ...

Open sreio opened this issue 1 year ago • 4 comments

运行 python api.py chatglm 报错 系统:Windows 10 python 版本: Python 3.10.6

D:\ai\JittorLLMs> python api.py chatglm
[i 0606 21:44:59.561000 32 compiler.py:955] Jittor(1.3.7.16) src: d:\python\lib\site-packages\jittor
[i 0606 21:44:59.588000 32 compiler.py:956] cl at C:\Users\Administrator\.cache\jittor\msvc\VC\_\_\_\_\_\bin\cl.exe(19.29.30133)
[i 0606 21:44:59.588000 32 compiler.py:957] cache_path: C:\Users\Administrator\.cache\jittor\jt1.3.7\cl\py3.10.6\Windows-10-10.x86\12thGenIntelRCxbc\default
[i 0606 21:44:59.591000 32 install_cuda.py:93] cuda_driver_version: [11, 8, 0]
[i 0606 21:44:59.620000 32 __init__.py:411] Found C:\Users\Administrator\.cache\jittor\jtcuda\cuda11.2_cudnn8_win\bin\nvcc.exe(11.2.67) at C:\Users\Administrator\.cache\jittor\jtcuda\cuda11.2_cudnn8_win\bin\nvcc.exe.
[i 0606 21:44:59.692000 32 compiler.py:1010] cuda key:cu11.2.67
[i 0606 21:44:59.694000 32 __init__.py:227] Total mem: 31.86GB, using 10 procs for compiling.
[i 0606 21:45:00.410000 32 jit_compiler.cc:28] Load cc_path: C:\Users\Administrator\.cache\jittor\msvc\VC\_\_\_\_\_\bin\cl.exe
[i 0606 21:45:00.412000 32 init.cc:62] Found cuda archs: [86,]
Explicitly passing a `revision` is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.
Explicitly passing a `revision` is encouraged when loading a configuration with custom code to ensure no malicious code has been contributed in a newer revision.
Explicitly passing a `revision` is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.
Loading checkpoint shards:  88%|█████████████████████████████████████████████████▉       | 7/8 [00:05<00:00,  1.32it/s]
Traceback (most recent call last):
  File "D:\python\lib\site-packages\transformers\modeling_utils.py", line 415, in load_state_dict
    return torch.load(checkpoint_file, map_location="cpu")
  File "D:\python\lib\site-packages\torch\serialization.py", line 797, in load
    with _open_zipfile_reader(opened_file) as opened_zipfile:
  File "D:\python\lib\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 "D:\python\lib\site-packages\transformers\modeling_utils.py", line 419, in load_state_dict
    if f.read(7) == "version":
UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 64: illegal multibyte sequence

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\ai\JittorLLMs\api.py", line 47, in <module>
    model = models.get_model(args)
  File "D:\ai\JittorLLMs\models\__init__.py", line 46, in get_model
    return module.get_model(args)
  File "D:\ai\JittorLLMs\models\chatglm\__init__.py", line 48, in get_model
    return ChatGLMMdoel(args)
  File "D:\ai\JittorLLMs\models\chatglm\__init__.py", line 22, in __init__
    self.model = AutoModel.from_pretrained(os.path.dirname(__file__), trust_remote_code=True)
  File "D:\python\lib\site-packages\transformers\models\auto\auto_factory.py", line 459, in from_pretrained
    return model_class.from_pretrained(
  File "D:\python\lib\site-packages\transformers\modeling_utils.py", line 2478, in from_pretrained
    ) = cls._load_pretrained_model(
  File "D:\python\lib\site-packages\transformers\modeling_utils.py", line 2780, in _load_pretrained_model
    state_dict = load_state_dict(shard_file)
  File "D:\python\lib\site-packages\transformers\modeling_utils.py", line 431, in load_state_dict
    raise OSError(
OSError: Unable to load weights from pytorch checkpoint file for 'D:\ai\JittorLLMs\models\chatglm\pytorch_model-00008-of-00008.bin' at 'D:\ai\JittorLLMs\models\chatglm\pytorch_model-00008-of-00008.bin'. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.

pip扩展版本如下:

 D:\ai\JittorLLMs> pip list
Package            Version
------------------ ---------
aiofiles           23.1.0
aiohttp            3.8.4
aiosignal          1.3.1
altair             5.0.1
anyio              3.6.2
astunparse         1.6.3
async-timeout      4.0.2
attrs              23.1.0
certifi            2022.12.7
charset-normalizer 3.1.0
click              8.1.3
colorama           0.4.6
contourpy          1.0.7
cpm-kernels        1.0.11
cycler             0.11.0
dnspython          2.3.0
email-validator    1.3.1
fastapi            0.90.1
ffmpy              0.3.0
filelock           3.12.0
fonttools          4.39.4
frozenlist         1.3.3
fsspec             2023.5.0
gradio             3.33.1
gradio_client      0.2.5
h11                0.14.0
httpcore           0.16.3
httptools          0.5.0
httpx              0.23.3
huggingface-hub    0.15.1
icetk              0.0.4
idna               3.4
itsdangerous       2.1.2
Jinja2             3.1.2
jittor             1.3.7.16
jsonschema         4.17.3
jtorch             0.1.3
kiwisolver         1.4.4
linkify-it-py      2.0.2
markdown-it-py     2.2.0
MarkupSafe         2.1.2
matplotlib         3.7.1
mdit-py-plugins    0.3.3
mdurl              0.1.2
mpmath             1.3.0
multidict          6.0.4
networkx           3.1
numpy              1.24.3
orjson             3.8.6
packaging          23.1
pandas             2.0.2
Pillow             9.5.0
pip                23.1.2
protobuf           3.19.5
pydantic           1.10.4
pydub              0.25.1
Pygments           2.15.1
pyparsing          3.0.9
pyrsistent         0.19.3
python-dateutil    2.8.2
python-dotenv      0.21.1
python-multipart   0.0.5
pytz               2023.3
pywin32            306
PyYAML             6.0
regex              2023.6.3
requests           2.31.0
rfc3986            1.5.0
semantic-version   2.10.0
sentencepiece      0.1.99
setuptools         63.2.0
six                1.16.0
sniffio            1.3.0
starlette          0.23.0
sympy              1.12
tokenizers         0.13.3
toolz              0.12.0
torch              2.0.1
torchvision        0.15.2
tqdm               4.65.0
transformers       4.26.1
typing_extensions  4.4.0
tzdata             2023.3
uc-micro-py        1.0.2
ujson              5.7.0
urllib3            2.0.2
uvicorn            0.20.0
watchfiles         0.18.1
websockets         10.4
wheel              0.40.0
yarl               1.9.2

sreio avatar Jun 06 '23 13:06 sreio