Hugging Face模型转换GGUF格式模型

LLaMA-Factory微调大模型导出的模型时HF格式的而Ollama框架只支持gguf文件格式的自定义模型,所以需要将模型进行转换
开源项目llama.cpp提供的有模型格式转换工具
项目地址:https://github.com/ggerganov/llama.cpp
先下载项目
在这里插入图片描述

解压,在项目下打开cmd命令窗口
在这里插入图片描述

创建虚拟环境

conda create -n  llama_cpp python==3.10 

激活

 activate llama_cpp 

torch 安装

conda install pytorch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 pytorchcuda=12.1 -c pytorch -c nvidia

依赖安装

pip install --editable . 

安装完成
在这里插入图片描述
llama.cpp官方提供的 convert-hf-to-gguf.py 脚本,用于完成huggingface格式到gguf格式的转换
在这里插入图片描述
格式转换

python convert_hf_to_gguf.py F:\tools\models\export

这里的 F:\tools\models\export 是我微调大模型后导出的模型路径
在这里插入图片描述
在这里插入图片描述
转换后的模型就可以使用ollama进行加载:ollama加载本地自定义模型

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值