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.
|
7 months ago | |
---|---|---|
.. | ||
README.md | 7 months ago | |
ollama.tar.gz | 7 months ago |
README.md
文件目录说明
- /data/ollama : 本项目根目录,本项目所有目录都在这个路径下面
前置条件
- 本机安装了Docker
- 安装了Nvidia GPU驱动
- 安装了容器工具包nvidia-container-toolkit
下载gguf模型:
- 网址: https://hf-mirror.com/
- 搜要下载的模型,比如,想现在llama3 8b的模型,则搜索: llama3 8b gguf
- 找到gguf字样的进去,下载,下载建议下载k4_0级别的,效果和效率最优,注意下载文件格式一定是.gguf的才行
Modelfile文件
- 创建文件:touch Modlefile
- 编辑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|>
"""
使用Docker构建步骤
- 首先安装容器工具包(必须,如果已安装可以不安装)
- 首先配置源: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
- 安装: sudo yum install -y nvidia-container-toolkit
- 配置docker: sudo nvidia-ctk runtime configure --runtime=docker
- 重启docker: systemctl restart docker
- 构建步骤
- 加载ollama的镜像,镜像版本0.2.8
- 本地加载: docker load -i ollama.tar.gz
- 运行容器: sudo docker run -d --gpus=all -e NVIDIA_VISIBLE_DEVICES=all -v /data/ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
- 将模型文件复制本地目录/data/ollama/gguf下
- 在/data/ollama/gguf目录下创建Modlefile文件,并将FROM的模型的名称修改为对应的.gguf文件名称
- 进入容器: docker exec -it ollama bash
- 进入目录: cd /root/.ollama/gguf
- 执行命令ollama create llama3-chinese:8b -f Modelfile (将 llama3-chinese:8b修改成你想要命名的名称)
- 加载ollama的镜像,镜像版本0.2.8