使用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

相关推荐
kakaZhui2 小时前
【多模态大模型】GLM-4-Voice端到端语音交互机器人VoiceAI
人工智能·chatgpt·机器人·aigc·llama
智模睿脑君19 小时前
Ollama部署本地大模型DeepSeek-R1-Distill-Llama-70B
人工智能·深度学习·语言模型·自然语言处理·chatgpt·transformer·llama
火云牌神1 天前
本地大模型编程实战(22)用langchain实现基于SQL数据构建问答系统(1)
python·sql·langchain·llama·qwen2.5
神秘的土鸡1 天前
本地部署 DeepSeek-R1大模型详细教程(桌面客户端美观UI)
人工智能·机器学习·自然语言处理·llama·ollama
PeterClerk2 天前
AIGC-LLAMA模型介绍
人工智能·python·语言模型·自然语言处理·aigc·llama
智模睿脑君2 天前
huggingface部署本地大模型DeepSeek-R1-Distill-Llama-70B使用streamlit构建交互式 Web 应用
前端·人工智能·深度学习·神经网络·语言模型·自然语言处理·llama
yuleicqut2 天前
llaMa模型的创新
llama
耿子6663 天前
llama.cpp 一键运行本地大模型 - Windows
大模型·私有化部署·llama
skywalk81633 天前
尝试在exo集群下使用deepseek模型:第一步,调通llama
人工智能·llama·exo
dgiij3 天前
对免认证服务提供apikey验证
nginx·http·lua·llama·openresty