Jittor / JittorLLMs

计图大模型推理库,具有高性能、配置要求低、中文支持好、可移植等特点
Apache License 2.0
2.37k stars 183 forks source link

为什么还是要求CUDA呢? #22

Open darren2046 opened 1 year ago

darren2046 commented 1 year ago

系统环境

root@JittorLLMs:~/JittorLLMs# cat /etc/issue
Ubuntu 22.04.2 LTS \n \l

root@JittorLLMs:~/JittorLLMs# uname -a
Linux JittorLLMs 5.15.0-1025-oracle #31-Ubuntu SMP Fri Nov 25 17:03:15 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
root@JittorLLMs:~/JittorLLMs# free -m
               total        used        free      shared  buff/cache   available
Mem:           23988        4654         656         247       18677       18771
Swap:              0           0           0
root@JittorLLMs:~/JittorLLMs# 

结果

root@JittorLLMs:~/JittorLLMs# python cli_demo.py pangualpha
WARNING: APEX is not installed, multi_tensor_applier will not be available.
WARNING: APEX is not installed, using torch.nn.LayerNorm instead of apex.normalization.FusedLayerNorm!
/root/JittorLLMs/models/pangualpha
Traceback (most recent call last):
  File "/root/JittorLLMs/cli_demo.py", line 8, in <module>
    model = models.get_model(args)
  File "/root/JittorLLMs/models/__init__.py", line 42, in get_model
    return module.get_model(args)
  File "/root/JittorLLMs/models/pangualpha/__init__.py", line 173, in get_model
    return PanGuAlphaModel()
  File "/root/JittorLLMs/models/pangualpha/__init__.py", line 134, in __init__
    initialize_megatron(extra_args_provider=add_text_generate_args,
  File "/root/JittorLLMs/models/pangualpha/megatron/initialize.py", line 44, in initialize_megatron
    assert torch.cuda.is_available(), 'Megatron requires CUDA.'
AssertionError: Megatron requires CUDA.
root@JittorLLMs:~/JittorLLMs# 
darren2046 commented 1 year ago

在VPS上面,没得显卡。

darren2046 commented 1 year ago

以及osx上面运行不了。

homebrew 安装的python 3.10.10: brew install python@3.10

$ python cli_demo.py chatglm                                                                                                                 1 ↵
[i 0405 23:00:55.556946 24 compiler.py:955] Jittor(1.3.7.12) src: /opt/homebrew/lib/python3.10/site-packages/jittor
[i 0405 23:00:55.579356 24 compiler.py:956] clang at /usr/bin/clang++(14.0.0)
[i 0405 23:00:55.579446 24 compiler.py:957] cache_path: /Users/user/.cache/jittor/jt1.3.7/clang14.0.0/py3.10.10/macOS-13.2.1-ax6c/AppleM1Pro/stable
[i 0405 23:00:55.598966 24 __init__.py:411] Found addr2line(2.37) at /opt/homebrew/opt/binutils/bin/addr2line.
/opt/homebrew/lib/python3.10/site-packages/jittor/src/utils/tracer.cc:49:9: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
        sprintf(pid_buf, "%d", getpid());
        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
/opt/homebrew/lib/python3.10/site-packages/jittor/src/utils/tracer.cc:145:9: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
        sprintf(pid_buf, "%d", getpid());
        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
/opt/homebrew/lib/python3.10/site-packages/jittor/src/utils/tracer.cc:147:9: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
        sprintf(st_buf, "set backtrace limit %d", trace_depth);
        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
/opt/homebrew/lib/python3.10/site-packages/jittor/src/utils/tracer.cc:213:13: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
            sprintf(syscom,"%s %p -f -p -i -e %.*s", addr2line_path.c_str(), trace[i], p, messages[i]);
            ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
4 warnings generated.
ld: library not found for -lomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Traceback (most recent call last):
  File "/Users/user/tmp/github/JittorLLMs/cli_demo.py", line 8, in <module>
    model = models.get_model(args)
  File "/Users/user/tmp/github/JittorLLMs/models/__init__.py", line 38, in get_model
    globals()[f"get_{model_name}"]()
  File "/Users/user/tmp/github/JittorLLMs/models/util.py", line 51, in get_chatglm
    new_path.append(download_fromhub(f"jittorhub://{f}", tdir="chat-glm"))
  File "/Users/user/tmp/github/JittorLLMs/models/util.py", line 5, in download_fromhub
    import jittor as jt
  File "/opt/homebrew/lib/python3.10/site-packages/jittor/__init__.py", line 18, in <module>
    from . import compiler
  File "/opt/homebrew/lib/python3.10/site-packages/jittor/compiler.py", line 1189, in <module>
    check_cache_compile()
  File "/opt/homebrew/lib/python3.10/site-packages/jittor/compiler.py", line 884, in check_cache_compile
    recompile = compile(cc_path, cc_flags+f" {opt_flags} ", files, jit_utils.cache_path+'/jit_utils_core'+extension_suffix, True)
  File "/opt/homebrew/lib/python3.10/site-packages/jittor/compiler.py", line 126, in compile
    return do_compile(fix_cl_flags(cmd))
  File "/opt/homebrew/lib/python3.10/site-packages/jittor/compiler.py", line 91, in do_compile
    run_cmd(cmd)
  File "/opt/homebrew/lib/python3.10/site-packages/jittor_utils/__init__.py", line 188, in run_cmd
    raise Exception(err_msg)
Exception: Run cmd failed: "/usr/bin/clang++" "/opt/homebrew/lib/python3.10/site-packages/jittor/src/utils/cache_compile.cc" "/opt/homebrew/lib/python3.10/site-packages/jittor/src/utils/log.cc" "/opt/homebrew/lib/python3.10/site-packages/jittor/src/utils/tracer.cc" "/opt/homebrew/lib/python3.10/site-packages/jittor/src/utils/jit_utils.cc" "/opt/homebrew/lib/python3.10/site-packages/jittor/src/utils/str_utils.cc"   -Wall -Wno-unknown-pragmas -std=c++14 -fPIC  -mcpu=apple-m1  -fdiagnostics-color=always  -undefined dynamic_lookup -lomp  -lstdc++ -ldl -shared  -I"/opt/homebrew/lib/python3.10/site-packages/jittor/src" -I/opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10 -I/opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10  -O2   -o "/Users/user/.cache/jittor/jt1.3.7/clang14.0.0/py3.10.10/macOS-13.2.1-ax6c/AppleM1Pro/stable/jit_utils_core.cpython-310-darwin.so"
darren2046 commented 1 year ago

还有windows这个是啥情况呢?我当前用户git clone下来的目录,在桌面。我应该有权限的呀。

系统环境windows11,chocolatey安装的python3.10.8

PS C:\Users\user\Desktop\tmp\JittorLLMs> python cli_demo.py chatglm
[i 0405 23:05:26.822000 84 compiler.py:955] Jittor(1.3.7.12) src: c:\users\user\appdata\roaming\python\python310\site-packages\jittor
[i 0405 23:05:26.851000 84 compiler.py:956] cl at C:\Users\user\.cache\jittor\msvc\VC\_\_\_\_\_\bin\cl.exe(19.29.30133)
[i 0405 23:05:26.851000 84 compiler.py:957] cache_path: C:\Users\user\.cache\jittor\jt1.3.7\cl\py3.10.8\Windows-10-10.xcb\IntelRCoreTMi7x12\default
[i 0405 23:05:26.867000 84 install_cuda.py:93] cuda_driver_version: [11, 6, 0]
[i 0405 23:05:26.898000 84 __init__.py:411] Found C:\Users\user\.cache\jittor\jtcuda\cuda11.2_cudnn8_win\bin\nvcc.exe(11.2.67) at C:\Users\user\.cache\jittor\jtcuda\cuda11.2_cudnn8_win\bin\nvcc.exe.
[i 0405 23:05:26.953000 84 compiler.py:1010] cuda key:cu11.2.67
[i 0405 23:05:26.953000 84 __init__.py:227] Total mem: 63.79GB, using 16 procs for compiling.
[i 0405 23:05:33.837000 84 jit_compiler.cc:28] Load cc_path: C:\Users\user\.cache\jittor\msvc\VC\_\_\_\_\_\bin\cl.exe
[i 0405 23:05:33.871000 84 init.cc:62] Found cuda archs: [75,]
[i 0405 23:05:35.269000 84 compile_extern.py:522] mpicc not found, distribution disabled.
Traceback (most recent call last):
  File "C:\Users\user\Desktop\tmp\JittorLLMs\cli_demo.py", line 8, in <module>
    model = models.get_model(args)
  File "C:\Users\user\Desktop\tmp\JittorLLMs\models\__init__.py", line 38, in get_model
    globals()[f"get_{model_name}"]()
  File "C:\Users\user\Desktop\tmp\JittorLLMs\models\util.py", line 54, in get_chatglm
    os.symlink(new_path[-1], os.path.join(ln_dir, f))
OSError: [WinError 1314] 客户端没有所需的特权。: 'C:\\Users\\user\\.cache\\jittor\\jt1.3.7\\cl\\py3.10.8\\Windows-10-10.xcb\\IntelRCoreTMi7x12\\default\\cu11.2.67\\checkpoints\\chat-glm/pytorch_model-00005-of-00008.bin' -> 'C:\\Users\\user\\Desktop\\tmp\\JittorLLMs\\models\\chatglm\\pytorch_model-00005-of-00008.bin'
PS C:\Users\user\Desktop\tmp\JittorLLMs>
Jittor commented 1 year ago

您没有安装requirements, 请按照readme运行

---原始邮件--- 发件人: @.> 发送时间: 2023年4月6日(周四) 凌晨1:38 收件人: @.>; 抄送: @.***>; 主题: [Jittor/JittorLLMs] 为什么还是要求CUDA呢? (Issue #22)

系统环境 @.:~/JittorLLMs# cat /etc/issue Ubuntu 22.04.2 LTS \n \l @.:~/JittorLLMs# uname -a Linux JittorLLMs 5.15.0-1025-oracle #31-Ubuntu SMP Fri Nov 25 17:03:15 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux @.:~/JittorLLMs# free -m total used free shared buff/cache available Mem: 23988 4654 656 247 18677 18771 Swap: 0 0 0 @.:~/JittorLLMs#
结果 @.:~/JittorLLMs# python cli_demo.py pangualpha WARNING: APEX is not installed, multi_tensor_applier will not be available. WARNING: APEX is not installed, using torch.nn.LayerNorm instead of apex.normalization.FusedLayerNorm! /root/JittorLLMs/models/pangualpha Traceback (most recent call last): File "/root/JittorLLMs/cli_demo.py", line 8, in <module> model = models.get_model(args) File "/root/JittorLLMs/models/init.py", line 42, in get_model return module.get_model(args) File "/root/JittorLLMs/models/pangualpha/init.py", line 173, in get_model return PanGuAlphaModel() File "/root/JittorLLMs/models/pangualpha/init.py", line 134, in init initialize_megatron(extra_args_provider=add_text_generate_args, File "/root/JittorLLMs/models/pangualpha/megatron/initialize.py", line 44, in initialize_megatron assert torch.cuda.is_available(), 'Megatron requires CUDA.' AssertionError: Megatron requires CUDA. @.:~/JittorLLMs#
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Jittor commented 1 year ago

mac安装请参考 https://cg.cs.tsinghua.edu.cn/jittor/download/ windows安装请参考:https://cg.cs.tsinghua.edu.cn/jittor/download/

---原始邮件--- 发件人: @.> 发送时间: 2023年4月6日(周四) 凌晨1:38 收件人: @.>; 抄送: @.***>; 主题: [Jittor/JittorLLMs] 为什么还是要求CUDA呢? (Issue #22)

系统环境 @.:~/JittorLLMs# cat /etc/issue Ubuntu 22.04.2 LTS \n \l @.:~/JittorLLMs# uname -a Linux JittorLLMs 5.15.0-1025-oracle #31-Ubuntu SMP Fri Nov 25 17:03:15 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux @.:~/JittorLLMs# free -m total used free shared buff/cache available Mem: 23988 4654 656 247 18677 18771 Swap: 0 0 0 @.:~/JittorLLMs#
结果 @.:~/JittorLLMs# python cli_demo.py pangualpha WARNING: APEX is not installed, multi_tensor_applier will not be available. WARNING: APEX is not installed, using torch.nn.LayerNorm instead of apex.normalization.FusedLayerNorm! /root/JittorLLMs/models/pangualpha Traceback (most recent call last): File "/root/JittorLLMs/cli_demo.py", line 8, in <module> model = models.get_model(args) File "/root/JittorLLMs/models/init.py", line 42, in get_model return module.get_model(args) File "/root/JittorLLMs/models/pangualpha/init.py", line 173, in get_model return PanGuAlphaModel() File "/root/JittorLLMs/models/pangualpha/init.py", line 134, in init initialize_megatron(extra_args_provider=add_text_generate_args, File "/root/JittorLLMs/models/pangualpha/megatron/initialize.py", line 44, in initialize_megatron assert torch.cuda.is_available(), 'Megatron requires CUDA.' AssertionError: Megatron requires CUDA. @.:~/JittorLLMs#
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

cjld commented 1 year ago

建议您jittorLLMs也使用最新版本,并且通过虚拟环境运行

shirubei commented 1 year ago

还有windows这个是啥情况呢?我当前用户git clone下来的目录,在桌面。我应该有权限的呀。

系统环境windows11,chocolatey安装的python3.10.8

PS C:\Users\user\Desktop\tmp\JittorLLMs> python cli_demo.py chatglm
[i 0405 23:05:26.822000 84 compiler.py:955] Jittor(1.3.7.12) src: c:\users\user\appdata\roaming\python\python310\site-packages\jittor
[i 0405 23:05:26.851000 84 compiler.py:956] cl at C:\Users\user\.cache\jittor\msvc\VC\_\_\_\_\_\bin\cl.exe(19.29.30133)
[i 0405 23:05:26.851000 84 compiler.py:957] cache_path: C:\Users\user\.cache\jittor\jt1.3.7\cl\py3.10.8\Windows-10-10.xcb\IntelRCoreTMi7x12\default
[i 0405 23:05:26.867000 84 install_cuda.py:93] cuda_driver_version: [11, 6, 0]
[i 0405 23:05:26.898000 84 __init__.py:411] Found C:\Users\user\.cache\jittor\jtcuda\cuda11.2_cudnn8_win\bin\nvcc.exe(11.2.67) at C:\Users\user\.cache\jittor\jtcuda\cuda11.2_cudnn8_win\bin\nvcc.exe.
[i 0405 23:05:26.953000 84 compiler.py:1010] cuda key:cu11.2.67
[i 0405 23:05:26.953000 84 __init__.py:227] Total mem: 63.79GB, using 16 procs for compiling.
[i 0405 23:05:33.837000 84 jit_compiler.cc:28] Load cc_path: C:\Users\user\.cache\jittor\msvc\VC\_\_\_\_\_\bin\cl.exe
[i 0405 23:05:33.871000 84 init.cc:62] Found cuda archs: [75,]
[i 0405 23:05:35.269000 84 compile_extern.py:522] mpicc not found, distribution disabled.
Traceback (most recent call last):
  File "C:\Users\user\Desktop\tmp\JittorLLMs\cli_demo.py", line 8, in <module>
    model = models.get_model(args)
  File "C:\Users\user\Desktop\tmp\JittorLLMs\models\__init__.py", line 38, in get_model
    globals()[f"get_{model_name}"]()
  File "C:\Users\user\Desktop\tmp\JittorLLMs\models\util.py", line 54, in get_chatglm
    os.symlink(new_path[-1], os.path.join(ln_dir, f))
OSError: [WinError 1314] 客户端没有所需的特权。: 'C:\\Users\\user\\.cache\\jittor\\jt1.3.7\\cl\\py3.10.8\\Windows-10-10.xcb\\IntelRCoreTMi7x12\\default\\cu11.2.67\\checkpoints\\chat-glm/pytorch_model-00005-of-00008.bin' -> 'C:\\Users\\user\\Desktop\\tmp\\JittorLLMs\\models\\chatglm\\pytorch_model-00005-of-00008.bin'
PS C:\Users\user\Desktop\tmp\JittorLLMs>

刚刚也碰到这个问题了,打开开发者模式就可以了。具体操纵:搜索栏里面输入 for developer 就会蹦出开发者模式这个菜单项,然后到设定页面打开。再重新来过。