部署 ollama AI 服务

创建日期: 2024-09-09 14:28 | 作者: 风波 | 浏览次数: 14 | 分类: AI

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 安装之后,其同时还是一个命令,与模型交互就是通过命令来进行的。

使用 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"
14 浏览
0 评论