1

使用ollama + AnythingLLM快速且简单的在本地部署llm3 - DbWong_0918

 3 weeks ago
source link: https://www.cnblogs.com/jokingremarks/p/18151827
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

使用ollama + AnythingLLM快速且简单的在本地部署llm3

不多说,直接开始

一、安装ollama

ollama官网:https://ollama.com/
下载地址:https://ollama.com/download

打开以后注册并下载即可

image

安装没有什么好说的,找到自己的系统安装即可,因为我的电脑没有搞虚拟机,所以就直接安装Windows的版本了

二、下载模型并运行ollama

安装ollama以后,通过管理员打开powershell

输入ollama,只要出现下面这些,说明安装成功了

image

打开ollama的模型的网页:https://ollama.com/library

image

我们以llm3为例,双击进入

image

常用的命令有

  serve       Start ollama
  create      Create a model from a Modelfile
  show        Show information for a model
  run         Run a model
  pull        Pull a model from a registry
  push        Push a model to a registry
  list        List models
  cp          Copy a model
  rm          Remove a model
  help        Help about any command

可以看到页面中让执行ollama run llama3即可

一般来说run是用来跑模型的,但是如果本地没有这个模型的话,ollama会自动下载

PS:国内的网络问题不知道有没有解决,下载模型的时候偶尔速度很快,但是很多时候速度很慢以至于提示TLS handshake timeout,这种情况建议重启电脑或者把ollama重启一下(不知道为啥,我同步打开GitHub的时候速度会明显快一些,可能也是错觉)

下载完成以后我们输入ollama list可以查下载了哪些模型

image

这里我们直接输入ollama run llama3,就可以开始对话了

image

三、下载AngthingLLM

AngthingLLM官网:https://useanything.com
下载链接:https://useanything.com/download

同样的选择对应的系统版本即可

image

在使用前,需要启动Ollama服务

执行ollama serve,ollama默认地址为:http://127.0.0.1:11434

然后双击打开AngthingLLM

因为我已经配置过,所以不好截图最开始的配置界面了,不过都能在设置里面找到

首先是LLM Preference,LLM provider选择ollama,URL填写默认地址,后面的模型选择llama3,token填4096

image

Embedding Preferenc同样选择ollama,其余基本一致,max我看默认8192,我也填了8192

image

Vector Database就直接默认的LanceDB即可

image

此时我们新建工作区,名字就随便取,在右边就会有对话界面出现了

image

此时你就有了自己本地的语言模型了

是不是很简单,费时间的地方其实就在下载模型的时候,想用Open WebUI,但是电脑没有搞docker,就用AngthingLLM了,如果实在下不下来,也可以搞离线模型,Windows系统模型默认路径是C:\Users\wbigo.ollama\models,模型库网址:https://modelscope.cn/models


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK