Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chatglm-cpp 无法使用mps #166

Open
timoyang opened this issue Oct 30, 2023 · 2 comments
Open

chatglm-cpp 无法使用mps #166

timoyang opened this issue Oct 30, 2023 · 2 comments

Comments

@timoyang
Copy link

环境:macos m2 python3.11.4

按照指引中:
CMAKE_ARGS="-DGGML_METAL=ON" pip install -U chatglm-cpp

安装成功提示:
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting chatglm-cpp
Using cached chatglm_cpp-0.2.10-cp311-cp311-macosx_14_0_arm64.whl
Installing collected packages: chatglm-cpp
Successfully installed chatglm-cpp-0.2.10

在使用python样例测试的过程中:

import chatglm_cpp
pipeline = chatglm_cpp.Pipeline("chatglm3-ggml.bin")
pipeline.chat(["介绍一下深圳的历史"])

观察系统监控,发现实际使用了cpu而不是gpu
image


同时按照官方实例:

./build/bin/main -m chatglm-ggml.bin -i

进行测试的时候,通过观察系统监控是可以使用gpu的
image

请问是我在安装chatglm_cpp的过程中,什么环节出了问题导致无法使用mps?

@dcw4code
Copy link

image

我猜大概率是因为你当前目录下有一个 chatglm_cpp 的子目录
我是先吧项目的 chatglm_cpp 子目录重新命名后再安装 pip 扩展
验证 mps 后端使用 GPU 的

@li-plus
Copy link
Owner

li-plus commented Nov 22, 2023

看到输出的log里有

Using cached chatglm_cpp-0.2.10-cp311-cp311-macosx_14_0_arm64.whl

应该是使用了缓存的 cpu wheel,尝试下加上 --no-cache-dir 参数来安装

CMAKE_ARGS="-DGGML_METAL=ON" pip install -U chatglm-cpp --no-cache-dir --force-reinstall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants