上篇已经合并出了训练好的大模型,现在要搭建起一套chatbot,使得这套大模型能有一个webui用起来。
1.设置环境变量,ollama的模型保存路径,/etc/profile
export ollama_models=/root/autodl-tmp/models/ollama
2.克隆ollama代码
curl -fssl https://ollama.com/install.sh | sh
3.启动ollama
4.建立ollama镜像的配置文件,modelfile
# set the base model
from /root/.ollama/llamafactory-export/saves/llama3-8b/lora/docker-commnad-nlp/export
# set custom parameter values
parameter temperature 1
parameter num_keep 24
parameter stop <|start_header_id|>
parameter stop <|end_header_id|>
parameter stop <|eot_id|>
parameter stop <|reserved_special_token
# set the model template
template """
{{ if .system }}<|start_header_id|>system<|end_header_id|>
{{ .system }}<|eot_id|>{{ end }}{{ if .prompt }}<|start_header_id|>user<|end_header_id|>
{{ .prompt }}<|eot_id|>{{ end }}<|start_header_id|>assistant<|end_header_id|>
{{ .response }}<|eot_id|>
"""
# set the system message
system you are llama3 from meta, customized and hosted @ paul wong (http://paulwong88.tpddns.cn).
# set chinese lora support
#adapter /root/.ollama/models/lora/ggml-adapter-model.bin
建立镜像命令,create-ollama-image-docker-command-nlp.sh
bin_path=$(cd `dirname $0`; pwd)
cd $bin_path/
pwd
ollama create llama3-docker-commnad-nlp:paul -f modelfile
5.运行大模型
llama3-docker-commnad-nlp:paul