ollama 项目地址:https://github.com/ollama/ollama
Linux 安装方式:curl -fsSL https://ollama.com/install.sh | sh
教程来源:https://wiki.eryajf.net/pages/97047e/#%E5%89%8D%E8%A8%80
Mac 安装 ollama
模型管理
ollama
安装之后,其同时还是一个命令,与模型交互就是通过命令来进行的。
ollama list
:显示模型列表。ollama show
:显示模型的信息ollama pull
:拉取模型ollama push
:推送模型ollama cp
:拷贝一个模型ollama rm
:删除一个模型ollama run
:运行一个模型
使用 Modelfile 指定模型
Modelfile 内容如下(类似 docker 的 Dockerfile)
FROM qwen:14b
# set the temperature to 1 [higher is more creative, lower is more coherent]
PARAMETER temperature 1
# set the system message
SYSTEM """
请你每句话都以“真是我的小可爱,”开头
"""
$ ollama create qwen:eryajf -f Modelfile
$ ollama run qwen:eryajf
使用 docker 部署
启动命令
$ docker run -itd --name=lobechat -p 3210:3210 -e OLLAMA_PROXY_URL=http://host.docker.internal:11434/v1 docker.mirrors.sjtug.sjtu.edu.cn/lobehub/lobe-chat
使用 docker-compose 启动服务
version: "3"
services:
ollama:
container_name: ollama
image: ollama/ollama:latest
restart: always
ports:
- "11434:11434"
volumes:
- /data/ollama:/root/.ollama
environment:
OLLAMA_ORIGINS: "*"
OLLAMA_HOST: "0.0.0.0"