ollama实战(一) :部署自己的模型(Safetensors格式)
1.ollama下载操作
git clone https://www.modelscope.cn/modelscope/ollama-linux.git
cd ollama-linux
sudo chmod 777 ./ollama-modelscope-install.sh
./ollama-modelscope-install.sh
1.1说明
对于llama-chinese-8b进行ollama环境创建 Safetensors格式(这个格式推理比较慢)
对Safetensors weights支持的格式:
- Llama (including Llama 2, Llama 3, and Llama 3.1);
- Mistral (including Mistral 1, Mistral 2, and Mixtral);
- Gemma (including Gemma 1 and Gemma 2); and
- Phi3
注:8b创建环境内存所需空间大约要60g,不支持格式的模型须llamacpp转gguf格式
1.2模型下载
git clone https://www.modelscope.cn/FlagAlpha/Llama3-Chinese-8B-Instruct.git
2.ollama启动
ollama serve
3.创建file文件(非文件夹)
文件内容(即你的模型路径)
FROM ./Llama3-Chinese-8B-Instruct
4.ollama模型创建
file 及你创建的文件名
ollama create mymodel -f file
注:8b模型(safetensors)创建过程约会消耗60g内存
5.ollama运行
ollama run mymodel
注:大约占16个g显存,gguf格式约占6个g