本地部署运行一下deepseek r1尝鲜

2025-01-20正式发布 DeepSeek-R1,并同步开源模型权重。

DeepSeek-R1 遵循 MIT License,允许用户通过蒸馏技术借助 R1 训练其他模型。 DeepSeek-R1
上线API,对用户开放思维链输出,通过设置 model='deepseek-reasoner' 即可调用。 DeepSeek 官网与
App 即日起同步更新上线。
论文地址:https://github.com/deepseek-ai/DeepSeek-R1/blob/main/DeepSeek_R1.pdf
原文链接:https://blog.csdn.net/sexy19910923/article/details/145271916

开源网站 GitHub - deepseek-ai/DeepSeek-R1Contribute to deepseek-ai/DeepSeek-R1 development by creating an account on GitHub.https://github.com/deepseek-ai/DeepSeek-R1https://github.com/deepseek-ai/DeepSeek-R1https://github.com/deepseek-ai/DeepSeek-R1https://github.com/deepseek-ai/DeepSeek-R1https://github.com/deepseek-ai/DeepSeek-R1https://github.com/deepseek-ai/DeepSeek-R1https://github.com/deepseek-ai/DeepSeek-R1https://github.com/deepseek-ai/DeepSeek-R1https://github.com/deepseek-ai/DeepSeek-R1https://github.com/deepseek-ai/DeepSeek-R1https://github.com/deepseek-ai/DeepSeek-R1https://github.com/deepseek-ai/DeepSeek-R1

使用ollama进行部署

Download Ollama on Linuxhttps://ollama.com/download/linuxhttps://ollama.com/download/linuxhttps://ollama.com/download/linuxhttps://ollama.com/download/linuxhttps://ollama.com/download/linuxhttps://ollama.com/download/linuxhttps://ollama.com/download/linuxhttps://ollama.com/download/linuxhttps://ollama.com/download/linuxhttps://ollama.com/download/linuxhttps://ollama.com/download/linuxhttps://ollama.com/download/linux

不同版本下载不同的版本安装

linux使用命令行

curl -fsSL https://ollama.com/install.sh | sh 

之后会根据不同的版本进行安装

之后Ollamahttps://ollama.com/searchhttps://ollama.com/searchhttps://ollama.com/searchhttps://ollama.com/searchhttps://ollama.com/searchhttps://ollama.com/searchhttps://ollama.com/searchhttps://ollama.com/searchhttps://ollama.com/searchhttps://ollama.com/searchhttps://ollama.com/searchhttps://ollama.com/search

 在这里选一下deepseek r1

其中有1.5b,7b,8b等,32b以上的到671b基本就是普通用户用用不了的了。

 

 安装ollama后运行 

ollama run deepseek-r1:1.5b

ollama run deepseek-r1:7b

ollama run deepseek-r1:8b

就会自动运行了,另外如果觉得这个cmd的窗口交互太不美观,可以使用openwebui,用起来跟chatgpt的web差不多,可以使用docker 安装,下面介绍一下用pip 安装,需要安装

pip install open-webui 

另外在安装这个包后,还会联网安装其它的组件,如语音识别等,需要设定代理才行

在cmd窗口中加入

set http_proxy=http://用户名:密码@代理地址:端口
set https_proxy=http://用户名:密码@代理地址:端口
 

set http_proxy=http://127.0.0.1:7897
set https_proxy=http://127.0.0.1:7897
​export http_proxy=http://10.10.10.215:7897
export https_proxy=http://10.10.10.215:7897
​


再运行

open-webui serve

后面如果更新到最新使用如下命令 

pip install --upgrade open-webui 

linux 部署时也可以用相同的方法

pip install open-webui 

./clash-linux-amd64 -d ./ &

export http_proxy="http://127.0.0.1:7897"
export https_proxy="http://127.0.0.1:7897"

使用别的机器上的代理

export http_proxy="http://10.10.10.251:7897"
export https_proxy="http://10.10.10.251:7897"

在下载完模型后要关闭代理,再重新运行openwebui

另外 使用docker 部署也可以,在rk3588上用docker 部署open-webui,注意docker 要指定本地ollama端口,另外

 /var/snap/docker/current/config/daemon.json
"如果之前在 /etc/docker/daemon.json 下配置过文件,Snap 安装的 Docker 不会读取该路径,必须在 /var/snap/docker/current/config/daemon.json 下进行配置。
编辑 daemon.json 后,务必使用 sudo snap restart docker 重启服务,以使更改生效"


 

{
    "registry-mirrors": [
        "https://docker.m.daocloud.io",
        "https://docker.kejilion.pro",
        "https://ccr.ccs.tencentyun.com",
        "https://hub.rat.dev",
        "https://docker.1panel.live"
    ],
    "insecure-registries": [],
    "debug": false,
    "experimental": false
}

sudo snap restart docker 

sudo docker  run hello-world

然后运行代码如下,然后本地http://localhost:3000端口就是openwebui的界面

sudo docker run -d -p 3000:8080 \
  -v open-webui:/app/backend/data \
  -e OLLAMA_BASE_URL=http://127.0.0.1:11434 \
  --name open-webui \
  --restart always \
  ghcr.io/open-webui/open-webui:main

 然后运行代码如下,然后本地http://localhost:8080端口就是openwebui的界面

sudo docker run -d --network=host \
  -v open-webui:/app/backend/data \
  -e OLLAMA_BASE_URL=http://127.0.0.1:11434 \
  --name open-webui \
  --restart always \
  ghcr.io/open-webui/open-webui:main

sudo docker logs open-webui 

进行查看日志,如果想更新版本 

1. 停止 & 移除旧容器sudo docker stop open-webui && sudo docker rm open-webui
2. 拉取最新 Open-WebUI 镜像sudo docker pull ghcr.io/open-webui/open-webui:main
3. 运行最新容器sudo docker run -d --network=host -v open-webui:/app/backend/data -e OLLAMA_BASE_URL=http://127.0.0.1:11434 --name open-webui --restart always ghcr.io/open-webui/open-webui:main
4. 验证版本`docker logs -f open-webui
5. (可选) 自动更新docker run -d --name watchtower -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower open-webui

 

多去参考下面网站 

GitHub - open-webui/open-webui: User-friendly AI Interface (Supports Ollama, OpenAI API, ...)User-friendly AI Interface (Supports Ollama, OpenAI API, ...) - open-webui/open-webuihttps://github.com/open-webui/open-webui#troubleshooting

注意 OLLAMA_BASE_URL=http://127.0.0.1:11434 如果没有这个,那么他会去默认的 

使用LMstudio 进行部署LM Studio - Discover, download, and run local LLMshttps://lmstudio.ai/https://lmstudio.ai/https://lmstudio.ai/https://lmstudio.ai/https://lmstudio.ai/https://lmstudio.ai/https://lmstudio.ai/https://lmstudio.ai/

下载后,要更换一下源就是模型的下载地址,安装后进入安装目录

cd C:\LM Studio

C:\LM Studio>findstr /s /i /m /c:"huggingface.co" *.*
 得到如下 :

将非exe文件中的huggingface.co字符串替换hf-mirror.com

推荐vscode。然后就可以正常下载,不过我这边网不好,下载的慢

使用AnythingLLM ,这个可以对本地知识库进行加工,美中不足就是没有linux arm的版本,无法在rk3588上面部署。

Download AnythingLLM for Desktophttps://anythingllm.com/desktophttps://anythingllm.com/desktophttps://anythingllm.com/desktophttps://anythingllm.com/desktophttps://anythingllm.com/desktophttps://anythingllm.com/desktophttps://anythingllm.com/desktopGitHub - Mintplex-Labs/anything-llm: The all-in-one Desktop & Docker AI application with built-in RAG, AI agents, and more.The all-in-one Desktop & Docker AI application with built-in RAG, AI agents, and more. - Mintplex-Labs/anything-llmhttps://github.com/Mintplex-Labs/anything-llm/https://github.com/Mintplex-Labs/anything-llm/https://github.com/Mintplex-Labs/anything-llm/https://github.com/Mintplex-Labs/anything-llm/https://github.com/Mintplex-Labs/anything-llm/https://github.com/Mintplex-Labs/anything-llm/https://github.com/Mintplex-Labs/anything-llm/

使用chatbox部署 ,这个版本啥都有,可以尝试

https://github.com/Bin-Huang/chatboxhttps://github.com/Bin-Huang/chatboxhttps://github.com/Bin-Huang/chatboxhttps://github.com/Bin-Huang/chatboxhttps://github.com/Bin-Huang/chatboxhttps://github.com/Bin-Huang/chatboxhttps://github.com/Bin-Huang/chatboxhttps://github.com/Bin-Huang/chatbox

使用Cherry Studio

官网下载地址:https://cherry-ai.com

GitHub地址:https://github.com/kangfenmao/cherry-studio

在Android手机上编译一个离线版本的deepseek运行环境,使用termux安装一个虚拟的kail系统

apt install git cmake golang
git clone --depth 1 https://github.com/ollama/ollama.git
cd ollama
go generate .
go build .
等待构建完成后,目录下会有一个 Ollama的应用
运行
./Ollama server&
服务启动后运行
./Ollama run DeepSeek-r1:1.5b
注用1.5b吧,因为没有gpu加速好像慢得很一秒2个字吧

另外chatbox的arm64版本也可以运行起来
https://chatboxai.app/zh/install?download=linux-arm64
下载后
./Chatbox-1.9.8-arm64.AppImage --appimage-extract
cd squashfs-root
./AppRun --no-sandbox

使用npu加速

rknn-llm/examples/DeepSeek-R1-Distill-Qwen-1.5B_Demo at main · airockchip/rknn-llm · GitHub

### 如何在本地环境中部署运行 Deepseek R1 #### 环境准备 为了成功地在本地环境中部署运行 Deepseek R1,首先需要准备好相应的环境。这通常涉及到操作系统的选择以及必要的软件安装。 对于 Windows 用户来说,具体的准备工作包括访问 Ollama 的官方网站来获取适合该操作系统的安装包[^3]。一旦下载完成,则可以按照提示进行安装过程,在此期间需指定好 Ollama 及其所需大模型的存储路径。 #### 安装 Ollama 和配置环境 针对 Windows 平台上的具体步骤如下: - **访问官方站点**:前往 Ollama 的官网寻找最新的版本信息。 - **下载对应平台的安装文件**:确保选择了匹配当前使用的 Windows 版本的选项。 - **执行安装程序**:遵循向导指示逐步完成整个流程;在此过程中记得设置合适的默认保存位置以便后续管理。 - **设定工作区**:为即将加载的大规模预训练模型挑选一块足够的磁盘空间作为专用区域。 ```bash ollama install deepseek-r1 ``` 这段命令用于通过 Ollama 工具安装特定名称为 `deepseek-r1` 的大型语言模型实例[^1]。 #### 启动与验证服务状态 当一切就绪之后,可以通过下面这条简单的指令来激活已安装的服务端口,并检验是否能够正常运作: ```bash ollama run deepseek-r1 ``` 上述命令会尝试启动名为 `deepseek-r1` 的应用组件,使之处于待命接收请求的状态中。 #### 使用 Chatbox 进行交互测试 最后一步则是集成聊天界面以实现更便捷的人机对话体验。这里推荐使用专门为此设计的应用——Chatbox 来辅助沟通交流活动。用户可以从相应渠道获得最新版客户端并依照指南快速上手操作。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值