基于llama.cpp项目的LLM量化

1 克隆或者下载llama.cpp项目

项目地址:https://github.com/ggerganov/llama.cpp

                  或者git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp
pip install -r requirements/requirements-convert-hf-to-gguf.txt


2 安装下载CMAKE工具

地址:https://make.org/download

CMAKE工具编译llama.cpp项目

cmake -B build
cmake --build build --config Release

3. huggingface格式转gguf格式


1.在项目文件里面找到咱们要用的转换工具,
>>>convert-hf-to-gguf.py 模型存放的目录路径 --outtype f16 --outfile 输出路径\自定义模型名字.gguf
例如:D:\AI\Qwen2-0.5B-output\my_qwen0.5B.gguf
D:\AI\llama.cpp>
python convert_hf_to_gguf.py D:\AI\qwen7B --outtype f16 --outfile D:\AI\qwen-7b-output\myqwen7b.gguf
 

2.进入到这个路径 
>>>llama.cpp\build\bin\Release
>>>D:\AI\llama.cpp\build\bin\Release\llama-quantize.exe 需要量化模型存放路径\my_qwen1.8B.gguf 输出路径\quantize_model.gguf q4_0

  • 9
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值