Convert GGUF
下载 llama.cpp 项目,需要用到其 Python 部分
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
llama.cpp 下创建虚拟环境及安装依赖
本来想用 uv init
创建虚拟环境,但是本地已经有 pyproject.toml 文件了。venv
python 自带的。
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
# 查看是否使用的 .venv 目录下的 python, pip
which python
which pip
确保安装无报错。我因为安装不完整,执行 convert 脚本报错了,一度以为 llama.cpp 还不支持 Qwen,很惊讶。
FileNotFoundError: File not found: Qwen3-0.6B/tokenizer.model
下载模型到本地
前序工作,lfs 需要额外安装。以下是 ubuntu 下的指令。一次性工作。
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
git lfs install
huggingface 上下载模型。