You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fu-hsi-service/docker/ollama/README.md

1.5 KiB

文件目录说明

  • /data/ollama : 本项目根目录,本项目所有目录都在这个路径下面

使用Docker构建步骤

  • 首先安装容器工具包
    1. 首先配置源:curl -s -L https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo | sudo tee /etc/yum.repos.d/nvidia-container-toolkit.repo
    2. 安装: sudo yum install -y nvidia-container-toolkit
    3. 配置docker: sudo nvidia-ctk runtime configure --runtime=docker
    4. 重启docker: systemctl restart docker
  • 构建步骤
    1. 拉取ollama的镜像
      • 在线拉取: docker pull ollama/ollama:0.3.5
      • 本地加载: docker load -i ollama-0.3.5.tar
    2. 运行容器: sudo docker run -d --gpus=all -e NVIDIA_VISIBLE_DEVICES=all -v /data/ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
    3. 将模型文件复制本地目录/data/ollama/gguf下
    4. 创建文件:touch Modlefile
    5. 编辑Modlefile,并粘贴内容
    FROM ./这里替换成需要部署的模型名称.gguf
    
    TEMPLATE """
    {{ if .System }}<|start_header_id|>system<|end_header_id|>\n\n{{ .System }}<|eot_id|>{{ end }}
    {{ if .Prompt }}<|start_header_id|>user<|end_header_id|>\n\n{{ .Prompt }}<|eot_id|>{{ end }}
    <|start_header_id|>assistant<|end_header_id|>\n\n{{ .Response }}<|eot_id|>
    """
    
    1. 进入容器: docker exec -it ollama bash
    2. 进入目录: cd /root/.ollama/gguf
    3. ollama create llama3-chinese:8b -f Modelfile (将 llama3-chinese:8b修改成你想要命名的名称)