hf下载的.bin模型转成gguf格式,导入ollama
hf下载模型发布到ollama
·
hf下载的.bin模型转成gguf,导入ollama
一、下载模型
模型下载地址
secgpt 网络安全大模型
二、转换成gguf格式
模型导入ollama需要转换成gguf格式(如果直接下载的gguf格式模型可以跳过这一步)
1.llama.cpp下载及环境搭建
git clone https://github.com/ggerganov/llama.cpp.git
conda create -n llama-cpp-env python=3.10
conda activate llama-cpp-env
pip install -r requirements.txt
2.转换成gguf
python convert_hf_to_gguf.py /home/gu/secgpt/ --outfile /home/gu/secgpt.gguf --outtype f16
如果不量化,保留模型的效果
–outtype f16
如果需要量化(加速并有损效果),直接执行下面脚本就可以
–outtype q8_0
三、模型导入
1.创建ModelFile
因为是新模型,直接写一个新的ModelFile
FROM /home/gu/secgpt.gguf
# set the temperature to 0.7 [higher is more creative, lower is more coherent]
PARAMETER temperature 0.3
PARAMETER top_p 0.7
# set the system message
SYSTEM """
You are a helpful assistant.
"""
2.导入ollama
ollama create secgpt --file ./ModelFile
3.运行模型
ollama run secgpt
更多推荐


所有评论(0)