llama.cpp qwen2

开发环境

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

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容