微信扫码
添加专属顾问
我要投稿
掌握深度学习模型部署的详细步骤,从下载到运行,一文全掌握。 核心内容: 1. 获取GGUF格式模型文件,通过ModelScope平台下载并量化 2. 配置Ollama推理框架,安装与环境设置 3. 远程访问配置,修改服务配置以实现跨设备访问
通过ModelScope平台下载量化后的模型文件(推荐Q5_K_M中等量化级别):
pip install modelscope
modelscope download --model unsloth/DeepSeek-R1-Distill-Llama-70B-GGUF DeepSeek-R1-Distill-Llama-70B-Q5_K_M.gguf --local_dir /DeepSeek-R1-Distill-Llama-70B-GGUF
技术说明:GGUF(GPT-Generated Unified Format)是专为LLM设计的跨平台格式,支持CPU/GPU混合推理,特别适合在苹果芯片设备或纯CPU环境运行。Q5_K_M量化在保持94%精度的同时,将模型体积压缩至49GB。
参考官网ollama/ollama: Get up and running with Llama 3.3, Phi 4, Gemma 2, and other large language models.
curl -fsSL https://ollama.com/install.sh | sudo sh
参考ollama/docs/faq.md at main · ollama/ollama
如需通过其他设备访问,需修改服务配置:
sudo nano /etc/systemd/system/ollama.service
在[Service]
部分添加:
Environment="OLLAMA_HOST=0.0.0.0"
Environment="OLLAMA_ORIGINS=*"
刷新服务配置:
sudo systemctl daemon-reload
sudo systemctl restart ollama
创建Modelfile
配置文件:
# 这里填入gguf文件路径
FROM /home/DeepSeek-R1-Distill-Llama-70B-GGUF/DeepSeek-R1-Distill-Llama-70B-Q5_K_M.gguf
# 以下为模型模板配置
TEMPLATE """{{- if .System }}{{ .System }}{{ end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1}}
{{- if eq .Role "user" }}<|User|>{{ .Content }}
{{- else if eq .Role "assistant" }}<|Assistant|>{{ .Content }}{{- if not $last }}<|end▁of▁sentence|>{{- end }}
{{- end }}
{{- if and $last (ne .Role "assistant") }}<|Assistant|>{{- end }}
{{- end }}"""
PARAMETER stop "<|begin▁of▁sentence|>"
PARAMETER stop "<|end▁of▁sentence|>"
PARAMETER stop "<|User|>"
PARAMETER stop "<|Assistant|>"
PARAMETER num_ctx 12800
参数解析:
stop
: 设置对话终止符num_ctx
: 扩展上下文窗口至12800 tokens
ollama create DeepSeek-R1-Distill-Llama-70B-Q5_K_M -f /home/DeepSeek-R1-Distill-Llama-70B-GGUF/Modelfile
ollama list
# 预期输出
NAME ID SIZE MODIFIED
DeepSeek-R1-Distill-Llama-70B-Q5_K_M:latest dd7ae729f6fc 49 GB 46 minutes ago
ollama run DeepSeek-R1-Distill-Llama-70B-Q5_K_M:latest
成功运行后将进入交互式命令行界面。
访问http://{服务器IP}:11434/
,出现以下界面即表示服务正常运行:
界面显示 Ollama is running
,表示可以远程访问
现在可通过以下方式接入模型:
53AI,企业落地大模型首选服务商
产品:场景落地咨询+大模型应用平台+行业解决方案
承诺:免费场景POC验证,效果验证后签署服务协议。零风险落地应用大模型,已交付160+中大型企业
2025-03-08
QwQ总结能力测评,32b小模型真能超过deepseek吗
2025-03-08
为什么vLLM做不到?解密Ollama越级部署黑科技:以DeepSeek-R1-8B为例
2025-03-07
为什么Manus底层模型没用DeepSeek?——Manus六问六答
2025-03-07
Cherry Studio 发布 v1.0.0 版本支持联网搜索
2025-03-07
Claude 3.7 Sonnet 使用结论
2025-03-07
Manus,为何是他们做出来了?
2025-03-07
Cursor 新版本要来了!同一个窗口使用Agent+Chat!上下文增强、UI升级、界面更清爽。
2025-03-07
Cursor + MCP:效率狂飙!一键克隆网站、自动调试错误,社区:每个人都在谈论MCP!
2025-02-04
2025-02-04
2024-09-18
2024-07-11
2024-07-09
2024-07-11
2024-07-26
2025-02-05
2025-01-27
2025-02-01