Mac下部署llama.cpp推理框架

确定当前网络环境支持科学上网,并且使用下面的设置命令让命令行也具备翻墙网络环境:

export https_proxy=http://127.0.0.1:7890
export http_proxy=http://127.0.0.1:7890

1、拉取llama.cpp项目

git clone https://github.com/ggml-org/llama.cpp.git && cd llama.cpp



2、创建虚拟环境

uv venv && source .venv/bin/activate


3、安装项目依赖库

uv pip install -r requirements.txt --index-strategy unsafe-best-match

4、下载模型

停止翻墙环境(重新打开一个命令行窗口)

export HF_ENDPOINT=https://hf-mirror.com


hf download Hcompany/Holo-3.1-4B


5、将模型转换为gguf格式

重新进入llama.cpp文件夹

python3 convert-hf-to-gguf.py ~/.cache/huggingface/hub/models--Hcompany--Holo-3.1-4B/snapshots/f43fdd9d95493e04c813c2d765a764ba636fd899 --outfile ./holo-4b.gguf

python3 convert_hf_to_gguf.py ~/.cache/huggingface/hub/models--Hcompany--Holo-3.1-4B/snapshots/b63fb9bacd968a20b31d0c704b14429c0aad3a84 --outfile ./holo-4b.gguf


6、启动llama.cpp服务

 llama-server -m ./holo-4b.gguf --port 8080 -c 2048


7、浏览器访问

http://127.0.0.1:8080

API地址:
http://127.0.0.1:8080/v1

查看模型名称:
http://localhost:8080/v1/models




评论

此博客中的热门博文

通过命令行在Github上发布项目的新版本

利用GitHub免费的静态页面托管空间发布网页

本地部署OpenAvatarChat实时交互数字人系统