【DeepSeek】本地DeepSeek下载慢,中断、内网无法安装方案来了

news/2025/2/11 23:26:12/文章来源:https://www.cnblogs.com/o-O-oO/p/18710684

最近在群里有不少人反馈,ollama安装deepseek有以下几个问题。

1,特别慢,或者多次中断,导致下载不下来

2,无魔法

3,想在内网环境安装,没有网络

我研究了下解决方案。通过已经下载的模型,可以直接导入。

反向解析模型

查看本地的模型

ollama listNAME                      ID              SIZE      MODIFIED
bge-m3:latest             790764642607    1.2 GB    5 days ago
deepseek-r1:32b           38056bbcbb2d    19 GB     6 days ago
deepseek-r1:14b           ea35dfe18182    9.0 GB    2 weeks ago
deepseek-r1:8b            28f8fd6cdc67    4.9 GB    2 weeks ago
llama3.2-vision:latest    085a1fdae525    7.9 GB    3 weeks ago

查看模型的modefile

ollama show deepseek-r1:8b --modelfile# Modelfile generated by "ollama show"
# To build a new Modelfile based on this, replace FROM with:
# FROM deepseek-r1:8bFROM E:\ai\ollama\models\blobs\sha256-6340dc3229b0d08ea9cc49b75d4098702983e17b4c096d57afbbf2ffc813f2be
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|>
LICENSE """MIT LicenseCopyright (c) 2023 DeepSeekPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

这里有个关键FROM,标识模型所在的位置,在我这里FROM的地址是:

E:\ai\ollama\models\blobs\sha256-6340dc3229b0d08ea9cc49b75d4098702983e17b4c096d57afbbf2ffc813f2be

备份模型我先把我的文件备份下。备份到E:\ai\ollama\models 目录下

删除模型

ollama rm deepseek-r1:8b

配置模型文件

在任何一个地方创建Modelfile,复制刚才show出来的信息,并修改FROM的路径。示例如下:

# Modelfile generated by "ollama show"
# To build a new Modelfile based on this, replace FROM with:
# FROM deepseek-r1:8bFROM E:\ai\ollama\models\sha256-6340dc3229b0d08ea9cc49b75d4098702983e17b4c096d57afbbf2ffc813f2be
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|>
LICENSE """MIT LicenseCopyright (c) 2023 DeepSeekPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

执行创建模型名称自己可以改,比如r18b 这样

ollama create deepseek-r1:8b -f Modelfile

使用

:几个个常用模型的Modelfile。 8b的示例就是。

向量模型:

ollama show bge-m3:latest --modelfile# Modelfile generated by "ollama show"
# To build a new Modelfile based on this, replace FROM with:
# FROM bge-m3:latestFROM E:\ai\ollama\models\blobs\sha256-daec91ffb5dd0c27411bd71f29932917c49cf529a641d0168496c3a501e3062c
TEMPLATE {{ .Prompt }}
LICENSE """MIT LicenseCopyright (c) [year] [fullname]Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE."""

7b的

ollama show deepseek-r1  --modelfile# Modelfile generated by "ollama show"
# To build a new Modelfile based on this, replace FROM with:
# FROM deepseek-r1:latestFROM E:\ai\ollama\models\blobs\sha256-96c415656d377afbff962f6cdb2394ab092ccbcbaab4b82525bc4ca800fe8a49
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|>
LICENSE """MIT LicenseCopyright (c) 2023 DeepSeekPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

14b的

ollama show deepseek-r1:14b  --modelfile# Modelfile generated by "ollama show"
# To build a new Modelfile based on this, replace FROM with:
# FROM deepseek-r1:14bFROM E:\ai\ollama\models\blobs\sha256-6e9f90f02bb3b39b59e81916e8cfce9deb45aeaeb9a54a5be4414486b907dc1e
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|>
LICENSE """MIT LicenseCopyright (c) 2023 DeepSeekPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

32b 的

ollama show deepseek-r1:32b  --modelfile# Modelfile generated by "ollama show"
# To build a new Modelfile based on this, replace FROM with:
# FROM deepseek-r1:32bFROM E:\ai\ollama\models\blobs\sha256-6150cb382311b69f09cc0f9a1b69fc029cbd742b66bb8ec531aa5ecf5c613e93
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|>
LICENSE """MIT LicenseCopyright (c) 2023 DeepSeekPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

我上传网盘以后在家里的mac电脑上创建成功。

我把相关的模型和Modefile上传到网盘了,本地使用可以直接下载,生产内网使用,建议自己下载,自己获取。

链接:

https://pan.quark.cn/s/512e627c261a

注意事项:

1,Modefile中的From 路径,可以是绝对路径也可以是相对路径

2,From 路径的后的模型文件名称一定要和文件名一样

原创 yxkong 5ycode

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/882314.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【Windows 日志】Windows 日志清理秘籍:基于登录日志精准清扫术

免责声明 如果使用本文档中的信息导致任何直接或间接的后果和损失,我们提醒您,这将由您个人承担。我们不承担由此产生的任何责任。前言 痕迹清理技术是渗透测试中的关键环节,它旨在消除操作痕迹以防止溯源、隐藏攻击手法,并为进一步的渗透活动争取时间。然而,并非每次渗透…

shell自动化编程简介0

自动化运维是未来的运维的必然趋势会写代码 会用工具Shell编程的特点简单、高效 功能强大 可移植性好作为运维开发人员,编写Shell脚本是第一步 误区:Shell编程就是Linux命令堆积?简单理解:Linux命令+编程语法(if/else、for、while、判断)经验之谈运维的核心就是执行正确的…

【免杀系列】 进程镂空

# 恶意软件 # 进程镂空免责声明 请注意,任何未经授权的使用或由此产生的直接或间接后果和损失,均由使用者自行承担。我们提供的资源和工具仅供学习和研究之用,我们不鼓励也不支持任何非法活动。前言 进程镂空(Process Hollowing),又称为“傀儡进程”,是一种恶意软件(…

关于this的练习

题目: 刚开始没有想到用面向对象的方法对书这个类进行操作 /* 我在练习中出现的问题: 1.读题时,不确定方法有没有返回值,以为自己在方法中写了输出语句,但是没有 2.在main函数中,发先需要返回值,并误将double认为int类型 3.在方法中修改返回值之后忘记加return语句 其实…

昆明理工大学25考研计算机调剂名额

--昆工昆明理工大学计算机技术人工智能软件工程网络空间安全计算机系统结构计算机软件与理论计算机应用技术网络与信息安全408考研综合程序设计891计算机专业核心综合数据库系统原理

【DeepSeek】打造智能微信机器人:wxauto 与 DeepSeek 的完美结合

免责声明: 本文仅用于交流学习,请大家务必保护好自己的账号安全,谨慎使用相关技术。# 自动化工具 在当今的数字化时代,自动化工具和人工智能技术的结合为我们的生活和工作带来了极大的便利。微信作为中国最流行的即时通讯工具之一,拥有庞大的用户群体。本文将介绍如何使用…

ZR 省选摆烂记

Day 1 - 数据结构 链表 Problem 1 - 洛谷 P10061 很精妙的链表题。 首先考虑特殊性质,旋转整个矩阵改怎么做。 显然只需要维护矩阵旋转了多少次即可。 特殊性质好做的原因正是矩阵的“结构”没有变,原来相邻的数还是相邻,即旋转后的修改可以映射到原来矩阵的修改。 因此考虑…

【Deepseek】教你将Deepseek接入WPS和Word/Excel日常办公使用

以下文章来源于像梦又似花 ,作者小编 以下是将DeepSeek功能集成到WPS中的详细步骤,无需本地部署模型,直接通过官网连接使用: 1、下载并安装OfficeAI插件 (1)访问OfficeAI插件下载地址:https://www.office-ai.cn/,下载插件(目前只支持windows系统)。 OfficeAI 助手 是…

4.2 内存的逻辑模型是楼房

编程语言中的数据类型表示存储的是何种类型的数据 根据程序中所指定的变量的数据类型的不同,读写的物理内存大小也会随之发生变化 在不同的编程语言中,变量可以指定的数据类型的最大长度也不相同 C语言中,8字节(=64位)的double类型是最大的

题解:SP6517 JOCHEF - Farmer Sepp

怎么题解全是 dp?可以用笛卡尔树啊!笛卡尔树的介绍 笛卡尔树,是一种二叉搜索树,它满足如下条件:每个节点的编号满足二叉搜索树的性质。 每个节点的权值满足小根堆或大根堆的性质。大概是这个样子:笛卡尔树的建树 请看这里。 笛卡尔树的用途 它可以用来解决区间最值问题,…

4.1 内存的物理机制很简单

内存实际上是一种名为内存IC的电子元件。 内存IC中有电源、地址信号、数据信号、控制信号等用于输入输出的大量引脚(IC的引脚),通过为其指定地址,来进行数据的书写。 虽然这是一个虚拟的内存IC,但他的引脚和实际的内存IC是一样的。1024=1K 8位=1字节 计算机使用的内存IC中…