开发环境
Apple M2
https://zhuanlan.zhihu.com/p/690548599
通义千问
1、准备模型
brew install git-lfs
git clone https://www.modelscope.cn/qwen/Qwen-7B-Chat.git
2、准备llama.cpp
brew install ccache
git clone git@github.com:ggerganov/llama.cpp.git
cd llama.cpp
make
conda create -n llama-cpp python=3.10
conda activate llama-cpp
pip install -r requirements.txt
pip install tiktoken
3、模型转换
将下载的Qwen模型转换为GGUF文件格式。
这里可以写篇文章介绍GGUF、Qwen模型表示
python convert-hf-to-gguf.py ~/workspaces/ai/Qwen1.5-7B-Chat/
4、量化模型
./quantize ~/workspaces/ai/Qwen-7B-Chat/ggml-model-f16.gguf ./models/qwen-chat-ggml-model-Q4_K_M.gguf Q4_K_M
5、测试
./main -m models/qwen-chat-ggml-model-Q4_K_M.gguf -p "Building a website can be done in 10 simple steps:\nStep 1:" -n 400 -e
Ascend NPU
网友评论