当前位置: 首页 > wzjs >正文

五台建设局网站网站发布和推广

五台建设局网站,网站发布和推广,3小时网站建设平台,手机版免费个人简历接上一篇https://blog.csdn.net/Aqu415/article/details/145668678 介绍了win本地运行大模型的方式,这篇简单介绍ollama方式。 下载ollama 官网下载地址:https://ollama.com/download/windows 点击下载,后一路默认安装 校验安装结果 执行…

接上一篇https://blog.csdn.net/Aqu415/article/details/145668678 介绍了win本地运行大模型的方式,这篇简单介绍ollama方式。

下载ollama

官网下载地址:https://ollama.com/download/windows
在这里插入图片描述
点击下载,后一路默认安装

校验安装结果

执行如下命令校验安装结果

ollama -v

在这里插入图片描述

更多命令参看: https://www.runoob.com/ollama/ollama-commands.html

运行模型

由于ollama类似docker模式,模型可以看作docker里的镜像;我们可以先可以把镜像先下载到本地,也可以让ollama帮我们下载;

如下我以 Qwen2.5-7B 为例子说明,

  • 第一步用魔塔sdk方式将模型下载到本地;
from modelscope import snapshot_downloadif __name__ == '__main__':model_name = 'Qwen/Qwen2.5-7B-Instruct-GGUF'download_path = r'F:\model'snapshot_path = snapshot_download(model_name, cache_dir=download_path,allow_file_pattern="qwen2.5-7b-instruct-q5_0*.gguf")print(f'Model downloaded to: {snapshot_path}')
  • 制作Modelfile文件(该文件类型docker里的Dockerfile),内容如下:
FROM F:/model/Qwen/Qwen2___5-7B-Instruct-GGUF/qwen2.5-7b-instruct-q5_0.gguf# set the temperature to 1 [higher is more creative, lower is more coherent]
PARAMETER temperature 0.7
PARAMETER top_p 0.8
PARAMETER repeat_penalty 1.05
PARAMETER top_k 20TEMPLATE """{{ if .Messages }}
{{- if or .System .Tools }}<|im_start|>system
{{ .System }}
{{- if .Tools }}# ToolsYou are provided with function signatures within <tools></tools> XML tags:
<tools>{{- range .Tools }}
{"type": "function", "function": {{ .Function }}}{{- end }}
</tools>For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
<tool_call>
{"name": <function-name>, "arguments": <args-json-object>}
</tool_call>
{{- end }}<|im_end|>
{{ end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 -}}
{{- if eq .Role "user" }}<|im_start|>user
{{ .Content }}<|im_end|>
{{ else if eq .Role "assistant" }}<|im_start|>assistant
{{ if .Content }}{{ .Content }}
{{- else if .ToolCalls }}<tool_call>
{{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
{{ end }}</tool_call>
{{- end }}{{ if not $last }}<|im_end|>
{{ end }}
{{- else if eq .Role "tool" }}<|im_start|>user
<tool_response>
{{ .Content }}
</tool_response><|im_end|>
{{ end }}
{{- if and (ne .Role "assistant") $last }}<|im_start|>assistant
{{ end }}
{{- end }}
{{- else }}
{{- if .System }}<|im_start|>system
{{ .System }}<|im_end|>
{{ end }}{{ if .Prompt }}<|im_start|>user
{{ .Prompt }}<|im_end|>
{{ end }}<|im_start|>assistant
{{ end }}{{ .Response }}{{ if .Response }}<|im_end|>{{ end }}"""# set the system message
SYSTEM """你是阳仔,一个java程序员。"""

这个Modelfile文件是Qwen官网获取的ollama配置文件,链接:https://qwen.readthedocs.io/en/latest/run_locally/ollama.html

其中第一行的模型路径是刚下载的模型绝对路径,最后一行是角色指定;其他的设置参看ollama官网说明:https://www.llamafactory.cn/ollama-docs/modelfile.html

启动模型
  • 在Modelfile文件所在的目录执行如下命令,进行本地模型库加载
ollama create qwen2.5_7b -f Modelfile

在这里插入图片描述
succes表示成功

  • 查看模型库

查看本地模型列表命令

ollama list

在这里插入图片描述

  • 运行模型
    启动模型命令
ollama run qwen2.5_7b

在这里插入图片描述
启动成功,输入问题获得返回值

在这里插入图片描述

  • 停止模型
    执行命令如下
ollama stop qwen2.5_7b

到此使用ollama本地运行千问2.5 7b模型讲解完毕。

over~~

http://www.dtcms.com/wzjs/555000.html

相关文章:

  • 网站设计字体大小规范徐州开发区中学网站
  • 做网站编辑的发展方向晋升Wordpress数据怎么导出
  • 网站建设做什么会计科目山东公司网站开发
  • 贵阳市观山湖区网站建设个人建网站成本
  • 网站开发需要的工具安装 好了wordpress那里进入
  • 行业网站如何推广电子商务能从事什么工作
  • 深圳哪里有网站建设北京互联网营销公司
  • 做外汇的网站wordpress免费版能加标签
  • 石家庄医疗网站建设网站里的活动专题栏怎么做
  • 企业门户网站特征开源php表单系统
  • 房屋中介网站模板怎样做校园网站
  • 银川网站建设哪家优婚纱网站制作
  • 网上做效果图网站如何在手机上做自己的网站6
  • 深圳网站开发设计公司排名郑州设计公司有哪些
  • 南昌网站建设公司网站建设公司哪家好一站式做网站公司
  • php中网站搜索功能实现如何自己做淘宝网站
  • 做外国网站自媒体动漫做暧视频在线观看网站
  • 开发网站过程随州做网站的公司
  • 做百度推广得用网站是吗wordpress文章筛选
  • 网站开发架构分类网站数据丢失
  • 带表情的wordpress留言seo网站建设时文章频率
  • 酒店如何做团购网站个人网站主页怎么做
  • 移动商城 网站建设方法方式网络营销的机遇和挑战
  • 公司 网站 苏州wordpress slider使用
  • 北京网站设计十年乐云seo怎么做网站自己当站长
  • 怎样建设一个网站wordpress 众筹模板
  • 如果建立网站广州网络广告推广公司
  • 一个网站怎么做app有没有做网站的团队
  • 建设银行网站看不到e商百度电话怎么转人工
  • 阿里云建站后台wordpress火车头采集软件发布接口