使用llama.cpp进行量化和部署

复制代码
git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp

🖥️ CPU 版本

复制代码
cmake -B build_cpu
cmake --build build_cpu --config Release

🖥️ CUDA 版本

复制代码
cmake -B build_cuda -DLLAMA_CUDA=ON
cmake --build build_cuda --config Release -j 12

cmake -B build

cmake --build build --config Release -t llama-server

量化

1.将 safetensors 格式转成 gguf

cd ~/code/llama.cpp/build_cuda/bin

复制代码
python convert-hf-to-gguf.py /mnt/workspace/Qwen2.5-7B-Instruct --outfile /mnt/workspace/Qwen2.5-7B-Instruct-GGUF/Qwen2.5-7B-Instruct-q8_0-v1.gguf --outtype q8_0

2.将 gguf 格式进行(再)量化

cd ~/code/llama.cpp/build_cuda/bin

./quantize --allow-requantize /root/autodl-tmp/models/Llama3-8B-Chinese-Chat-GGUF/Llama3-8B-Chinese-Chat-q8_0-v2_1.gguf /root/autodl-tmp/models/Llama3-8B-Chinese-Chat-GGUF/Llama3-8B-Chinese-Chat-q4_1-v1.gguf Q4_1

部署服务:

cd llama.cpp/build/bin

./llama-server -m /mnt/workspace/Qwen2.5-7B-Instruct-GGUF/Qwen2.5-7B-Instruct-q8_0-v1.gguf/Qwen2.5-7B-Instruct-Q8_0.gguf --port 8080

相关推荐
LiYingL11 小时前
OctoThinker 通过改进 Llama 来支持强化学习,展示了中间学习的威力
人工智能·学习·llama
范男2 天前
Qwen3-VL + LLama-Factory进行针对Grounding任务LoRA微调
人工智能·深度学习·计算机视觉·transformer·llama
忘记5782 天前
下载llama factory
llama
路边草随风2 天前
llama_index简单使用
人工智能·python·llama
王威振的csdn3 天前
法律大模型微调:基于 LLaMA-Factory 的指令微调方案
llama
JoannaJuanCV3 天前
大模型训练:LLaMA-Factory快速上手
llama
java_logo3 天前
LANGFUSE Docker 容器化部署指南
运维·docker·云原生·容器·eureka·llama
weixin_446260854 天前
二、LLaMA Factory 介绍和基本使用
llama
weixin_446260854 天前
三、LLaMA Factory 微调通用设置
llama
木枷5 天前
LLama-factory数据报错
人工智能·机器学习·llama