Ollama 默认 pull 到的模型都是量化过的

image

 

要使用非量化的模型就需要自己导入

 

但是 Hugging Face 不用魔法是打不开的

我们找个镜像站下载模型:

比如这个吧:https://hf-mirror.com/deepseek-ai/DeepSeek-R1-Distill-Qwen-7B

 

首先安装 git lfs

git lfs install

 

然后下载模型:

git clone https://hf-mirror.com/deepseek-ai/DeepSeek-R1-Distill-Qwen-7B

 

 

ollama(旧版本)貌似只能直接导入GGUF格式的模型

我们下面用 llama.cpp 来转换下

 

首先下载 llama.cpp

git clone https://github.com/ggerganov/llama.cpp.git

 

进行安装:

cd llama.cpp pip install -r requirements.txt

 

看下转换语句的参数:

python convert_hf_to_gguf.py -h

image

 

 

然后开始转换:

python convert_hf_to_gguf.py ./DeepSeek-R1-Distill-Qwen-7B --outfile ./DeepSeek-R1-Distill-Qwen-7B/DeepSeek-R1-Distill-Qwen-7B.gguf --outtype f16

image

 

转换完成后,要将模型导入到 Ollama

首先建立一个 Modelfile 文件,文件内容:

FROM ./DeepSeek-R1-Distill-Qwen-7B/DeepSeek-R1-Distill-Qwen-7B.gguf

image

 

看下模型:

ollama list

image

 

看下模型详情:

ollama show deepseek-r1-qwen:7b

image

 

 

但是有个问题

你运行模型后,会发现它在胡言乱语…

image

 

这个时候我们需要改下 Modelfile 文件

FROM ./DeepSeek-R1-Distill-Qwen-7B/DeepSeek-R1-Distill-Qwen-7B.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|>"

 

 

删除模型后,重新导入模型

image

 

再运行模型,这看起来正常多了….

image

 

再看下模型详情:

ollama show deepseek-r1-qwen:7b

image

posted @ 2025-03-03 10:27 sun8134 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 项目Github:https://github.com/xorbitsai/inference/文档:https://inference.readthedocs.io/zh-cn/latest/getting_started/index.html安装的时候如果还是 0.16.3pip install 阅读全文
posted @ 2025-02-25 15:33 sun8134 阅读(47) 评论(0) 推荐(0) 编辑
摘要: 最近发现C盘空间紧张一看 Nuget 文件夹 30G+…还默认在 C 盘用户文件下…看下 Nuget 的文件路径dotnet nuget locals all –list我们要修改 globalPackages 的路径挪去其他位置找到 nuget 的 config 文件%AppData%\NuGet 阅读全文
posted @ 2024-12-19 10:39 sun8134 阅读(68) 评论(0) 推荐(1) 编辑
摘要: 突然发现我运行了8万多小时的硬盘报 C5 警告了…抓紧换了块硬盘懒得重装系统直接pe下把文件拷贝到新盘启动后 OneDrive 报错 0x8004def5…参考下:https://www.minitool.com/news/onedrive-error-code-0x8004def5.html简单判 阅读全文
posted @ 2024-12-18 12:18 sun8134 阅读(40) 评论(0) 推荐(0) 编辑
摘要: 项目地址:https://github.com/chatchat-space/Langchain-Chatchat前面装好了 Xinference 现在开始安装 Langchain-Chatchat我们还是要先 conda 创建个环境conda create --prefix D:\AI\Chatc 阅读全文
posted @ 2024-11-21 10:09 sun8134 阅读(290) 评论(0) 推荐(0) 编辑
摘要: 在开始前先做下准备工作首先要用nv显卡的话先要装cuda:https://developer.nvidia.com/cuda-toolkit-archive常用的是11.8,12.1或者12.4装完可以查看下版本:nvcc -V不过这个时候可能会报错这个时候需要装vc++最简单的可以装 visual 阅读全文
posted @ 2024-11-12 10:12 sun8134 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Langchain-Chatchat 0.3的版本更新到了 0.3本地不再使用 fastchat 了,这次准备使用 Xinference为了方便 python 的版本管理,这次使用 miniconda安装 miniconda 其实很简单的,下载对应的版本下一步下一步就行了https://docs.a 阅读全文
posted @ 2024-11-11 15:47 sun8134 阅读(28) 评论(0) 推荐(0) 编辑
摘要: 发现表里数据相同,但 group by 后竟然是俩数据…仔细一看原来有数据里有 特殊字符 不间断空格 \u00a0\u00A0 是 Unicode 字符,在 MS SQL 中可以使用 NCHAR(160) 来表示这个不间断空格字符…那么替换就容易了update Table1 set Column1 阅读全文
posted @ 2024-10-06 23:59 sun8134 阅读(27) 评论(0) 推荐(0) 编辑
摘要: 前面讲了如何给PDF文件加水印:https://www.cnblogs.com/sun8134/p/18109237当我们需要加多组水印的时候,该如何处理呢?其实很简单,多加点 Paragraph 用 document.ShowTextAligned 加上去就行了修改下之前的代码,我们加两个 Par 阅读全文
posted @ 2024-09-24 16:10 sun8134 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 朋友下了N多视频记不住文件夹下都有啥了…问批处理怎么导出文件夹下所有文件名及视频时长…批处理导出文件名好弄,获取视频时长真没用过…想到 .net 控制台程序 AOT 发布,不和批处理差不多效果…新建个控制台项目选下使用AOT 首先要获取文件的时长,我们需要用下 TagLibSharpInstall- 阅读全文
posted @ 2024-09-09 13:42 sun8134 阅读(46) 评论(0) 推荐(0) 编辑
分享按钮
点击右上角即可分享
微信分享提示