Huggingface Transformers量化方案概览

1,659次阅读
没有评论

HF地址:https://huggingface.co/blog/overview-quantization-transformers

1. 量化模型主要用于两个目的:在较小的设备上运行大模型的推理;在量化模型的基础上微调adapter。
2. Huggingface Transformers中目前主要支持两种量化方案:bitsandbytes和auto-gptq。
3. bitsandbytes的优势:
– 使用简单,可以开箱即用对任何包含torch.nn.Linear模块的模型进行量化。
– 跨模态兼容性好,任意包含torch.nn.Linear的模型都可以直接量化,如Whisper、ViT、Blip2等。
– 与adapter合并后性能不降低。

 

Huggingface Transformers量化方案概览

 

4. auto-gptq的优势:
– 对文本生成速度快。
– 支持2-bit量化,但可能精度损失严重。
– 可以序列化任意bit数的模型。
– 支持AMD GPU
5. bitsandbytes的改进空间:
– 对文本生成速度较慢。
– 4-bit模型目前不支持序列化。
6. auto-gptq的改进空间:
– 需要校准数据集,可能会让部分用户望而却步。
– 目前只支持语言模型量化。
7. 基准测试显示bitsandbytes更适合微调,auto-gptq更适合生成。
8. 一种获取更好合并模型的方法:
– 用bitsandbytes量化基模型
– 微调adapter
– 将adapter合并到基模型或反量化模型
– 用auto-gptq量化合并后的模型用于部署
9. 量化导致的性能下降很小,大模型下降更小。
10. 整体而言,两种量化方案各有优势,可以根据实际使用场景选择。

 

 

Read More 

正文完
可以使用微信扫码关注公众号(ID:xzluomor)
post-qrcode
 0
评论(没有评论)

文心AIGC

2023 年 9 月
 123
45678910
11121314151617
18192021222324
252627282930  
文心AIGC
文心AIGC
人工智能ChatGPT,AIGC指利用人工智能技术来生成内容,其中包括文字、语音、代码、图像、视频、机器人动作等等。被认为是继PGC、UGC之后的新型内容创作方式。AIGC作为元宇宙的新方向,近几年迭代速度呈现指数级爆发,谷歌、Meta、百度等平台型巨头持续布局
文章搜索
热门文章
手把手教你用AI 10分钟生成一个APP!零基础也能搞定

手把手教你用AI 10分钟生成一个APP!零基础也能搞定

今日,我将向大家展示DeepSeek的全新玩法——从零开始,利用AI创建一个完整的应用程序。借助DeepSee...
最新评论
ufabet ufabet มีเกมให้เลือกเล่นมากมาย: เกมเดิมพันหลากหลาย ครบทุกค่ายดัง
tornado crypto mixer tornado crypto mixer Discover the power of privacy with TornadoCash! Learn how this decentralized mixer ensures your transactions remain confidential.
ดูบอลสด ดูบอลสด Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
ดูบอลสด ดูบอลสด Pretty! This has been a really wonderful post. Many thanks for providing these details.
ดูบอลสด ดูบอลสด Pretty! This has been a really wonderful post. Many thanks for providing these details.
ดูบอลสด ดูบอลสด Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
Obrazy Sztuka Nowoczesna Obrazy Sztuka Nowoczesna Thank you for this wonderful contribution to the topic. Your ability to explain complex ideas simply is admirable.
ufabet ufabet Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
ufabet ufabet You’re so awesome! I don’t believe I have read a single thing like that before. So great to find someone with some original thoughts on this topic. Really.. thank you for starting this up. This website is something that is needed on the internet, someone with a little originality!
ufabet ufabet Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
热评文章
手把手教你用AI 10分钟生成一个APP!零基础也能搞定

手把手教你用AI 10分钟生成一个APP!零基础也能搞定

今日,我将向大家展示DeepSeek的全新玩法——从零开始,利用AI创建一个完整的应用程序。借助DeepSee...