运行python cli_demo.py chatglm报错No module named ‘torch.utils._pytree'

运行python cli_demo.py chatglm报错No module named ‘torch.utils._pytree’

为了更好地定位您的问题,建议包含以下内容:

  1. 设备环境 Ubuntu20.04 A100-80G SM80 CUDA12 jtorch=0.1.7

  2. 报错信息如下
    [i 0311 14:49:36.970245 12 init.cc:62] Found cuda archs: [80,]
    /root/anaconda3/bin/mpicc: line 323: x86_64-conda-linux-gnu-cc: command not found
    Traceback (most recent call last):
    File “/mnt/geogpt-gpfs/zhijiang/home/dujianhua/Jittor/JittorLLMs/models/init.py”, line 42, in get_model
    import transformers
    File “/usr/local/lib/python3.8/dist-packages/transformers/init.py”, line 26, in
    from . import dependency_versions_check
    File “/usr/local/lib/python3.8/dist-packages/transformers/dependency_versions_check.py”, line 16, in
    from .utils.versions import require_version, require_version_core
    File “/usr/local/lib/python3.8/dist-packages/transformers/utils/init.py”, line 33, in
    from .generic import (
    File “/usr/local/lib/python3.8/dist-packages/transformers/utils/generic.py”, line 442, in
    import torch.utils._pytree as _torch_pytree
    ModuleNotFoundError: No module named ‘torch.utils._pytree’
    Import Error, maybe the dependencies are not installed, please try ‘python -m pip install -r models/chatglm/requirements.txt -i Simple Index
    导入错误,可能没有安装此模型需要的依赖,请尝试运行 ‘python -m pip install -r models/chatglm/requirements.txt -i Simple Index

  3. 在执行cli_demo.py ChatGLM 时,出现过几次依赖缺失的问题,通过重复安装解决。目前遇到torch相关函数缺失问题,当前版本是require要求的jtorch=0.1.7,尝试安装回退版本0.1.6,依然抱相同错误。此时查看安装的依赖包,jittor == 1.3.8.5,jtorch ,torch,torchvision,怀疑是torch版本有问题,之后未做尝试。
    4.不知道有没有同学遇到过这个问题,官方看到希望能得到回答

我也是一样的,你解决没有