li-plus / chatglm.cpp

C++ implementation of ChatGLM-6B & ChatGLM2-6B & ChatGLM3 & GLM4
MIT License
2.84k stars 327 forks source link

mac m1 启动cli_demo.py时,抛出incompatible architecture异常 #236

Closed jeceldx closed 6 months ago

jeceldx commented 6 months ago

OS :12.6.2 python :3.10.13 各位好

[100%] Built target main
(glm3cpp) daixun@Surface-Go-2022 chatglm.cpp % CMAKE_ARGS="-DGGML_METAL=ON" pip3.10 install -U chatglm-cpp
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting chatglm-cpp
  Using cached chatglm_cpp-0.3.0-cp310-cp310-macosx_12_0_arm64.whl
Installing collected packages: chatglm-cpp
Successfully installed chatglm-cpp-0.3.0

[notice] A new release of pip is available: 23.3.1 -> 23.3.2
[notice] To update, run: /opt/homebrew/opt/python@3.10/bin/python3.10 -m pip install --upgrade pip
(glm3cpp) daixun@Surface-Go-2022 chatglm.cpp % cd examples                                                
(glm3cpp) daixun@Surface-Go-2022 examples % python cli_demo.py -m ../chatglm3-ggml.bin -i              
Traceback (most recent call last):
  File "/Users/daixun/IdeaProjects/shine/ai/chatglm.cpp/examples/cli_demo.py", line 5, in <module>
    import chatglm_cpp
  File "/opt/homebrew/lib/python3.10/site-packages/chatglm_cpp/__init__.py", line 6, in <module>
    import chatglm_cpp._C as _C
ImportError: dlopen(/opt/homebrew/lib/python3.10/site-packages/chatglm_cpp/_C.cpython-310-darwin.so, 0x0002): tried: '/opt/homebrew/lib/python3.10/site-packages/chatglm_cpp/_C.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))

通过./build/bin/main -m chatglm3-ggml.bin -i 运行,同样会出现错误提示 zsh: illegal hardware instruction ./build/bin/main -m chatglm3-ggml.bin -i

运行前,依赖安装和转换并未出现错误,有遇到同样问题朋友吗?

jeceldx commented 6 months ago

是因为我本地未切换zsh架构引起的,不好意思