li-plus / chatglm.cpp

C++ implementation of ChatGLM-6B & ChatGLM2-6B & ChatGLM3 & GLM4(V)
MIT License
2.93k stars 335 forks source link

[Mac Python Binding] zsh: illegal hardware instruction python3 web_demo.py -m ../chatglm2-ggml.bin #58

Open Robin2333 opened 1 year ago

Robin2333 commented 1 year ago

./build/bin/main -m chatglm-ggml.bin -i 可以正常使用 但是使用cd examples && python3 cli_chat.py -m ../chatglm2-ggml.bin -i 的时候报错显示 zsh: illegal hardware instruction python3 web_demo.py -m ../chatglm2-ggml.bin

Stefan-Yu404 commented 1 year ago

我也遇到这个问题了,请问你解决了吗?

pengxiulin commented 1 year ago

同样遇到这个问题,examples里面的 cli_chat.py和 web_demo.py 两个文件都会报错。 看了一下,是执行到这句的时候报的错:pipeline = chatglm_cpp.Pipeline(args.model)

环境是mac m1

Python@3.10.12 chatglm-cpp@0.2.1

Robin2333 commented 1 year ago

这个问题我解决了。我同样是mac m1。我不太清楚原因,但解决的方式很简单——新建了一个Python环境,只安装必要的库(甚至不包括torch),问题就自然解决了。

pengxiulin commented 1 year ago

终于找到原因了: 之前的conda版本所安装的python是x86格式的,卸载重装了一个arm版的conda,然后安装了一个新环境,确保是arm64的环境

image

安装后可以使用 file $(which python)命令查看python版本。 如果是这个就是正常的:Mach-O 64-bit executable arm64e

victoryangn commented 1 year ago

[ import chatglm_cpp._C as _C ModuleNotFoundError: No module named 'chatglm_cpp._C'

有谁遇到这个问题么](zsh: illegal hardware instruction python3 cli_chat.py -m ../chatglm-ggml.bin -i)

guoduan127 commented 11 months ago

[ import chatglm_cpp._C as _C ModuleNotFoundError: No module named 'chatglm_cpp._C'

有谁遇到这个问题么](zsh: illegal hardware instruction python3 cli_chat.py -m ../chatglm-ggml.bin -i)

这个问题,可以尝试pwd离开chatglm_cpp根目录,换到其他目录可以避开

guoduan127 commented 11 months ago

仅供参考:完全一样的部署操作,cpu 是e5 1220v2(win10),e5 2620V2(server 2022)都不行,另外两台可以,一台cpu是i5 i5-10400F,一台 i7-10750H。难道是指令集不一样?AVX2?

jingxuansd commented 11 months ago

$ ./build/bin/main -m chatglm3-ggml.bin -p 你好 --top_p 0.8 --temp 0.8 [1] 93052 illegal hardware instruction ./build/bin/main -m chatglm3-ggml.bin -p 你好 --top_p 0.8 --temp 0.8

我遇到了同样的问题,Mac mini M1

oldturkey commented 11 months ago

我遇到了同样的问题,Mbp M2

taliszhou commented 10 months ago

这个问题还没得到解决吗

jeceldx commented 10 months ago

同样的问题,web-demo一样跑不起来?提示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))),这不知道为啥我本地编译完安装的是x86的