通過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" 檢查進程是否存在。