Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"Overview","local":"overview","sections":[{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"User-Friendly Quantization Tools","local":"user-friendly-quantization-tools","sections":[],"depth":2}],"depth":1}"> | |
| <link href="/docs/transformers/pr_36839/en/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload"> | |
| <link rel="modulepreload" href="/docs/transformers/pr_36839/en/_app/immutable/entry/start.6be8d590.js"> | |
| <link rel="modulepreload" href="/docs/transformers/pr_36839/en/_app/immutable/chunks/scheduler.01eeda35.js"> | |
| <link rel="modulepreload" href="/docs/transformers/pr_36839/en/_app/immutable/chunks/singletons.177df05e.js"> | |
| <link rel="modulepreload" href="/docs/transformers/pr_36839/en/_app/immutable/chunks/index.4862150a.js"> | |
| <link rel="modulepreload" href="/docs/transformers/pr_36839/en/_app/immutable/chunks/paths.517376d1.js"> | |
| <link rel="modulepreload" href="/docs/transformers/pr_36839/en/_app/immutable/entry/app.09748b4b.js"> | |
| <link rel="modulepreload" href="/docs/transformers/pr_36839/en/_app/immutable/chunks/index.6dd51b66.js"> | |
| <link rel="modulepreload" href="/docs/transformers/pr_36839/en/_app/immutable/nodes/0.8897c14d.js"> | |
| <link rel="modulepreload" href="/docs/transformers/pr_36839/en/_app/immutable/chunks/each.e59479a4.js"> | |
| <link rel="modulepreload" href="/docs/transformers/pr_36839/en/_app/immutable/nodes/444.bbe1e263.js"> | |
| <link rel="modulepreload" href="/docs/transformers/pr_36839/en/_app/immutable/chunks/EditOnGithub.7faefd25.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{"title":"Overview","local":"overview","sections":[{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"User-Friendly Quantization Tools","local":"user-friendly-quantization-tools","sections":[],"depth":2}],"depth":1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <h1 class="relative group"><a id="overview" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#overview"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Overview</span></h1> <p data-svelte-h="svelte-656w9r">Quantization lowers the memory requirements of loading and using a model by storing the weights in a lower precision while trying to preserve as much accuracy as possible. Weights are typically stored in full-precision (fp32) floating point representations, but half-precision (fp16 or bf16) are increasingly popular data types given the large size of models today. Some quantization methods can reduce the precision even further to integer representations, like int8 or int4.</p> <p data-svelte-h="svelte-17h48vd">Transformers supports many quantization methods, each with their pros and cons, so you can pick the best one for your specific use case. Some methods require calibration for greater accuracy and extreme compression (1-2 bits), while other methods work out of the box with on-the-fly quantization.</p> <p data-svelte-h="svelte-1drhu8y">Use the Space below to help you pick a quantization method depending on your hardware and number of bits to quantize to.</p> <table data-svelte-h="svelte-1v6tkm3"><thead><tr><th>Quantization Method</th> <th>On the fly quantization</th> <th>CPU</th> <th>CUDA GPU</th> <th>ROCm GPU</th> <th>Metal (Apple Silicon)</th> <th>Intel GPU</th> <th>Torch compile()</th> <th>Bits</th> <th>PEFT Fine Tuning</th> <th>Serializable with ๐คTransformers</th> <th>๐คTransformers Support</th> <th>Link to library</th></tr></thead> <tbody><tr><td><a href="./aqlm">AQLM</a></td> <td>๐ด</td> <td>๐ข</td> <td>๐ข</td> <td>๐ด</td> <td>๐ด</td> <td>๐ด</td> <td>๐ข</td> <td>1/2</td> <td>๐ข</td> <td>๐ข</td> <td>๐ข</td> <td><a href="https://github.com/Vahe1994/AQLM" rel="nofollow">https://github.com/Vahe1994/AQLM</a></td></tr> <tr><td><a href="./awq">AWQ</a></td> <td>๐ด</td> <td>๐ข</td> <td>๐ข</td> <td>๐ข</td> <td>๐ด</td> <td>๐ข</td> <td>?</td> <td>4</td> <td>๐ข</td> <td>๐ข</td> <td>๐ข</td> <td><a href="https://github.com/casper-hansen/AutoAWQ" rel="nofollow">https://github.com/casper-hansen/AutoAWQ</a></td></tr> <tr><td><a href="./bitsandbytes">bitsandbytes</a></td> <td>๐ข</td> <td>๐ก</td> <td>๐ข</td> <td>๐ก</td> <td>๐ด</td> <td>๐ก</td> <td>๐ด</td> <td>4/8</td> <td>๐ข</td> <td>๐ข</td> <td>๐ข</td> <td><a href="https://github.com/bitsandbytes-foundation/bitsandbytes" rel="nofollow">https://github.com/bitsandbytes-foundation/bitsandbytes</a></td></tr> <tr><td><a href="./compressed_tensors">compressed-tensors</a></td> <td>๐ด</td> <td>๐ข</td> <td>๐ข</td> <td>๐ข</td> <td>๐ด</td> <td>๐ด</td> <td>๐ด</td> <td>1/8</td> <td>๐ข</td> <td>๐ข</td> <td>๐ข</td> <td><a href="https://github.com/neuralmagic/compressed-tensors" rel="nofollow">https://github.com/neuralmagic/compressed-tensors</a></td></tr> <tr><td><a href="./eetq">EETQ</a></td> <td>๐ข</td> <td>๐ด</td> <td>๐ข</td> <td>๐ด</td> <td>๐ด</td> <td>๐ด</td> <td>?</td> <td>8</td> <td>๐ข</td> <td>๐ข</td> <td>๐ข</td> <td><a href="https://github.com/NetEase-FuXi/EETQ" rel="nofollow">https://github.com/NetEase-FuXi/EETQ</a></td></tr> <tr><td><a href="../gguf">GGUF / GGML (llama.cpp)</a></td> <td>๐ข</td> <td>๐ข</td> <td>๐ข</td> <td>๐ด</td> <td>๐ข</td> <td>๐ด</td> <td>๐ด</td> <td>1/8</td> <td>๐ด</td> <td><a href="../gguf">See Notes</a></td> <td><a href="../gguf">See Notes</a></td> <td><a href="https://github.com/ggerganov/llama.cpp" rel="nofollow">https://github.com/ggerganov/llama.cpp</a></td></tr> <tr><td><a href="./gptq">GPTQModel</a></td> <td>๐ด</td> <td>๐ข</td> <td>๐ข</td> <td>๐ข</td> <td>๐ข</td> <td>๐ข</td> <td>๐ด</td> <td>2/3/4/8</td> <td>๐ข</td> <td>๐ข</td> <td>๐ข</td> <td><a href="https://github.com/ModelCloud/GPTQModel" rel="nofollow">https://github.com/ModelCloud/GPTQModel</a></td></tr> <tr><td><a href="./gptq">AutoGPTQ</a></td> <td>๐ด</td> <td>๐ด</td> <td>๐ข</td> <td>๐ข</td> <td>๐ด</td> <td>๐ด</td> <td>๐ด</td> <td>2/3/4/8</td> <td>๐ข</td> <td>๐ข</td> <td>๐ข</td> <td><a href="https://github.com/AutoGPTQ/AutoGPTQ" rel="nofollow">https://github.com/AutoGPTQ/AutoGPTQ</a></td></tr> <tr><td><a href="./higgs">HIGGS</a></td> <td>๐ข</td> <td>๐ด</td> <td>๐ข</td> <td>๐ด</td> <td>๐ด</td> <td>๐ด</td> <td>๐ข</td> <td>2/4</td> <td>๐ด</td> <td>๐ข</td> <td>๐ข</td> <td><a href="https://github.com/HanGuo97/flute" rel="nofollow">https://github.com/HanGuo97/flute</a></td></tr> <tr><td><a href="./hqq">HQQ</a></td> <td>๐ข</td> <td>๐ข</td> <td>๐ข</td> <td>๐ด</td> <td>๐ด</td> <td>๐ด</td> <td>๐ข</td> <td>1/8</td> <td>๐ข</td> <td>๐ด</td> <td>๐ข</td> <td><a href="https://github.com/mobiusml/hqq/" rel="nofollow">https://github.com/mobiusml/hqq/</a></td></tr> <tr><td><a href="./quanto">optimum-quanto</a></td> <td>๐ข</td> <td>๐ข</td> <td>๐ข</td> <td>๐ด</td> <td>๐ข</td> <td>๐ด</td> <td>๐ข</td> <td>2/4/8</td> <td>๐ด</td> <td>๐ด</td> <td>๐ข</td> <td><a href="https://github.com/huggingface/optimum-quanto" rel="nofollow">https://github.com/huggingface/optimum-quanto</a></td></tr> <tr><td><a href="./fbgemm_fp8">FBGEMM_FP8</a></td> <td>๐ข</td> <td>๐ด</td> <td>๐ข</td> <td>๐ด</td> <td>๐ด</td> <td>๐ด</td> <td>๐ด</td> <td>8</td> <td>๐ด</td> <td>๐ข</td> <td>๐ข</td> <td><a href="https://github.com/pytorch/FBGEMM" rel="nofollow">https://github.com/pytorch/FBGEMM</a></td></tr> <tr><td><a href="./torchao">torchao</a></td> <td>๐ข</td> <td>๐ข</td> <td>๐ข</td> <td>๐ด</td> <td>๐ก</td> <td>๐ด</td> <td></td> <td>4/8</td> <td></td> <td>๐ข๐ด</td> <td>๐ข</td> <td><a href="https://github.com/pytorch/ao" rel="nofollow">https://github.com/pytorch/ao</a></td></tr> <tr><td><a href="./vptq">VPTQ</a></td> <td>๐ด</td> <td>๐ด</td> <td>๐ข</td> <td>๐ก</td> <td>๐ด</td> <td>๐ด</td> <td>๐ข</td> <td>1/8</td> <td>๐ด</td> <td>๐ข</td> <td>๐ข</td> <td><a href="https://github.com/microsoft/VPTQ" rel="nofollow">https://github.com/microsoft/VPTQ</a></td></tr> <tr><td><a href="./finegrained_fp8">FINEGRAINED_FP8</a></td> <td>๐ข</td> <td>๐ด</td> <td>๐ข</td> <td>๐ด</td> <td>๐ด</td> <td>๐ด</td> <td>๐ด</td> <td>8</td> <td>๐ด</td> <td>๐ข</td> <td>๐ข</td> <td></td></tr> <tr><td><a href="./spqr">SpQR</a></td> <td>๐ด</td> <td>๐ด</td> <td>๐ข</td> <td>๐ด</td> <td>๐ด</td> <td>๐ด</td> <td>๐ข</td> <td>3</td> <td>๐ด</td> <td>๐ข</td> <td>๐ข</td> <td><a href="https://github.com/Vahe1994/SpQR/" rel="nofollow">https://github.com/Vahe1994/SpQR/</a></td></tr></tbody></table> <h2 class="relative group"><a id="resources" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#resources"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Resources</span></h2> <p data-svelte-h="svelte-yp93ig">If you are new to quantization, we recommend checking out these beginner-friendly quantization courses in collaboration with DeepLearning.AI.</p> <ul data-svelte-h="svelte-1xrrw6l"><li><a href="https://www.deeplearning.ai/short-courses/quantization-fundamentals-with-hugging-face/" rel="nofollow">Quantization Fundamentals with Hugging Face</a></li> <li><a href="https://www.deeplearning.ai/short-courses/quantization-in-depth" rel="nofollow">Quantization in Depth</a></li></ul> <h2 class="relative group"><a id="user-friendly-quantization-tools" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#user-friendly-quantization-tools"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>User-Friendly Quantization Tools</span></h2> <p data-svelte-h="svelte-1dwueou">If you are looking for a user-friendly quantization experience, you can use the following community spaces and notebooks:</p> <ul data-svelte-h="svelte-imzktw"><li><a href="https://huggingface.co/spaces/bnb-community/bnb-my-repo" rel="nofollow">Bitsandbytes Space</a></li> <li><a href="https://huggingface.co/spaces/ggml-org/gguf-my-repo" rel="nofollow">GGUF Space</a></li> <li><a href="https://huggingface.co/spaces/mlx-community/mlx-my-repo" rel="nofollow">MLX Space</a></li> <li><a href="https://colab.research.google.com/drive/1b6nqC7UZVt8bx4MksX7s656GXPM-eWw4?usp=sharing#scrollTo=ZC9Nsr9u5WhN" rel="nofollow">AuoQuant Notebook</a></li></ul> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/transformers/blob/main/docs/source/en/quantization/overview.md" target="_blank"><span data-svelte-h="svelte-1kd6by1"><</span> <span data-svelte-h="svelte-x0xyl0">></span> <span data-svelte-h="svelte-1dajgef"><span class="underline ml-1.5">Update</span> on GitHub</span></a> <p></p> | |
| <script> | |
| { | |
| __sveltekit_1bm5psi = { | |
| assets: "/docs/transformers/pr_36839/en", | |
| base: "/docs/transformers/pr_36839/en", | |
| env: {} | |
| }; | |
| const element = document.currentScript.parentElement; | |
| const data = [null,null]; | |
| Promise.all([ | |
| import("/docs/transformers/pr_36839/en/_app/immutable/entry/start.6be8d590.js"), | |
| import("/docs/transformers/pr_36839/en/_app/immutable/entry/app.09748b4b.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 444], | |
| data, | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 14.2 kB
- Xet hash:
- a128b5297e80c996b2d14e8364d46751883ee590da107920fc9655b4d01280f0
ยท
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.