通过ollama本地部署deepseek
总共两步
1.模型部署
2.[web页面]
参考官网
ollama:模型部署
https://ollama.com/
open-webui:web页面
https://github.com/open-webui/open-webui
设备参考 Mac M 芯片 windows未知
蒸馏模型版本:deepseek-r1:14b 运行情况macminim2 24+256 本地部署后内存舒缓,不影响电脑其他软件使用macminim4 16+256 本地部署后内存紧张,影响电脑其他软件使用内存占用情况:11G -> 21.72G 模型思考时,大概会占用11到12G的内存
1.ollama:模型部署
# 下载 ollamahttps://ollama.com/# 运行 deepseek 选择自己设备适合的版本[:14b],官网看命令 ollama run deepseek-r1:14b # 当前终端运行,可在终端交互ollama run deepseek-r1:14b & disown # 放到后台去跑,终端页面关掉也不会关闭此模型
2.open-webui:web页面 推荐python的终端部署方式
2.1 docker部署web页面
#docker pull ghcr.io/open-webui/open-webui:main# 创建本地目录,避免重启后数据丢失mkdir /Users/admin/program/docker/instance/open-webui/datacd /Users/admin/program/docker/instance/open-webui# 启动容器docker run -d -p 3000:8080 -v $PWD/data:/app/backend/data --name open-webui ghcr.io/open-webui/open-webui:main
2.2 python部署web页面 需要在有python环境下执行 推荐
pip install open-webuiopen-webui serveopen-webui serve & disown # This will start the Open WebUI server, which you can access at http://localhost:8080
2.3 [忽略] conda创建python环境
conda create -n openwebui python=3.12 -y # python=3.12:指定 Python 版本 -y:自动确认安装conda initconda activate openwebuipip install open-webuiopen-webui serve # 这个不能关闭终端open-webui serve & disown # 使用这个启动成功后,可以关闭终端了open-webui serve > /dev/null 2>&1 & disown # 使用这个启动成功后,可以关闭终端了# This will start the Open WebUI server, which you can access at http://localhost:8080# 放在后台的任务如何查看呢jobs # 使用 jobs 命令查看当前作业状态。ps aux | grep "your-command" # 或者使用 ps aux | grep "your-command" 检查进程是否存在。