Buckets:

hf-doc-build/doc / transformers /main /fr /quantization /compressed_tensors.html
mishig's picture
download
raw
44.1 kB
<meta charset="utf-8" /><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;compressed-tensors&quot;,&quot;local&quot;:&quot;compressed-tensors&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Modes de chargement&quot;,&quot;local&quot;:&quot;loading-modes&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Accélération des noyaux FP8&quot;,&quot;local&quot;:&quot;fp8-kernel-acceleration&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Chargement d'un modèle FP8 pré-quantifié&quot;,&quot;local&quot;:&quot;loading-a-pre-quantized-fp8-model&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Désquantification au moment du chargement&quot;,&quot;local&quot;:&quot;dequantizing-at-load-time&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Point de contrôle du modèle&quot;,&quot;local&quot;:&quot;model-checkpoint&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;:1}"/>
<link href="/docs/transformers/main/en/_app/immutable/entry/start.DYIO-UII.js" rel="modulepreload">
<link href="/docs/transformers/main/en/_app/immutable/chunks/DSYYoqAA.js" rel="modulepreload">
<link href="/docs/transformers/main/en/_app/immutable/chunks/BovLmb3z.js" rel="modulepreload">
<link href="/docs/transformers/main/en/_app/immutable/entry/app.D2_KizbC.js" rel="modulepreload">
<link href="/docs/transformers/main/en/_app/immutable/chunks/WyYpyc-L.js" rel="modulepreload">
<link href="/docs/transformers/main/en/_app/immutable/chunks/DYBfcveH.js" rel="modulepreload">
<link href="/docs/transformers/main/en/_app/immutable/chunks/DOLBYqcr.js" rel="modulepreload">
<link href="/docs/transformers/main/en/_app/immutable/chunks/DsnmJJEf.js" rel="modulepreload">
<link href="/docs/transformers/main/en/_app/immutable/nodes/0.ByO_lNbj.js" rel="modulepreload">
<link href="/docs/transformers/main/en/_app/immutable/chunks/ZtBhN-Ei.js" rel="modulepreload">
<link href="/docs/transformers/main/en/_app/immutable/nodes/701.DJOCfMvb.js" rel="modulepreload">
<link href="/docs/transformers/main/en/_app/immutable/chunks/D-dvW--N.js" rel="modulepreload">
<link href="/docs/transformers/main/en/_app/immutable/chunks/BDdFI6Uf.js" rel="modulepreload">
<!--6pfp--><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;compressed-tensors&quot;,&quot;local&quot;:&quot;compressed-tensors&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Loading modes&quot;,&quot;local&quot;:&quot;loading-modes&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;FP8 kernel acceleration&quot;,&quot;local&quot;:&quot;fp8-kernel-acceleration&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Loading a pre-quantized FP8 model&quot;,&quot;local&quot;:&quot;loading-a-pre-quantized-fp8-model&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;Dequantizing at load time&quot;,&quot;local&quot;:&quot;dequantizing-at-load-time&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Model checkpoint&quot;,&quot;local&quot;:&quot;model-checkpoint&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;:1}"/><!---->
<link href="/docs/transformers/main/en/_app/immutable/assets/0.tn0RQdqM.css" rel="modulepreload"> <!--[--><!--[0--><!--[--><!--[0--><!--[--><p></p> <div class="items-center shrink-0 min-w-[100px] max-sm:min-w-[50px] justify-end ml-auto flex" style="float: inline-end; margin-inline-start: 10px; display: inline-flex; position: relative; z-index: 10;"><div dir="ltr" class="inline-flex rounded-md max-sm:rounded-sm"><button class="inline-flex items-center gap-1 h-7 max-sm:h-7 px-2 max-sm:px-1.5 text-sm font-medium text-gray-800 border border-r-0 rounded-l-md max-sm:rounded-l-sm border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-live="polite"><span class="inline-flex items-center justify-center rounded-md p-0.5 max-sm:p-0 hover:text-gray-800 dark:hover:text-gray-200"><svg class="sm:size-3.5 size-3" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----></span> <span dir="auto">Copy page</span></button> <button class="inline-flex items-center justify-center w-6 max-sm:w-5 h-7 max-sm:h-7 disabled:pointer-events-none text-sm text-gray-500 hover:text-gray-700 dark:hover:text-white rounded-r-md max-sm:rounded-r-sm border border-l transition border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-haspopup="menu" aria-expanded="false" aria-label="Open copy menu"><svg class="transition-transform text-gray-400 overflow-visible sm:size-3.5 size-3 rotate-0" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg><!----></button></div> <!--[-1--><!--]--></div><!----> <!--[0--><h1 class="relative group"><a id="compressed-tensors" 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="#compressed-tensors"><span><svg 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><!---->compressed-tensors<!----></span></h1><!--]--><!----> <p><a href="https://github.com/neuralmagic/compressed-tensors" rel="nofollow">compressed-tensors</a> étend les fichiers <a href="https://github.com/huggingface/safetensors" rel="nofollow">safetensors</a> avec des types de tenseurs compressés afin de fournir un format de checkpoint unifié pour le stockage et le chargement de divers formats de quantification, tels que dense, quantifié en entier (int8), quantifié en virgule flottante (fp8) et quantifié par paquets (int4 ou int8, poids quantifiés regroupés en int32).</p> <p>compressed-tensors prend en charge le fine-tuning avec <a href="https://huggingface.co/docs/peft" rel="nofollow">PEFT</a> et inclut également les fonctionnalités suivantes.</p> <ul><li>Précisions de poids et d'activation fp8, int4, int8.</li> <li>Stratégies d'échelles de quantification et de points zéro pour <a href="https://github.com/neuralmagic/compressed-tensors/blob/83b2e7a969d70606421a76b9a3d112646077c8de/src/compressed_tensors/quantization/quant_args.py#L43-L52" rel="nofollow">tensor, channel, group, block, token</a>.</li> <li>Quantification dynamique d'activation par jeton (ou toute stratégie statique).</li> <li>Quantification de modules arbitraires, et non uniquement des modules <a href="https://pytorch.org/docs/stable/generated/torch.nn.Linear.html" rel="nofollow">nn.Linear</a>.</li> <li>Prise en charge ciblée de modules spécifiques par nom ou par classe.</li></ul> <p>Installez compressed-tensors depuis <a href="https://pypi.org/project/compressed-tensors" rel="nofollow">PyPI</a> pour obtenir la dernière version stable (recommandé) ou installez-le depuis le code source pour bénéficier des dernières fonctionnalités.</p> <div class="flex space-x-2 items-center my-1.5 mr-8 h-7 !pl-0 -mx-3 md:mx-0"><!--[--><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd border-gray-800 bg-black dark:bg-gray-700 text-white">PyPI</div><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm">code source</div><!--]--></div> <div class="language-select"><div><div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copié</div><!----></button><!----></div> <pre class="language-bash "><!---->pip install compressed-tensors<!----></pre></div><!----></div><!----> <div hidden=""><div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copié</div><!----></button><!----></div> <pre class="language-bash "><!---->git <span class="hljs-built_in">clone</span> https://github.com/neuralmagic/compressed-tensors
<span class="hljs-built_in">cd</span> compressed-tensors
pip install -e .<!----></pre></div><!----></div><!----><!----></div><!----> <p>Recherchez à l'aide de la balise <a href="https://huggingface.co/models?other=compressed-tensors" rel="nofollow">tag</a> compressed-tensors pour trouver un modèle compatible sur le Hugging Face Hub.</p> <p>Les modèles pré-quantifiés peuvent être chargés directement. Pour quantifier un modèle au format compressed-tensors, consultez <a href="https://github.com/vllm-project/llm-compressor" rel="nofollow">llm-compressor</a>. Alternativement, les modèles peuvent être créés de manière indépendante et sérialisés avec une configuration compressed-tensors.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copié</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM
ct_model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;nm-testing/Meta-Llama-3.1-8B-Instruct-FP8-hf&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>)
<span class="hljs-comment"># measure memory usage</span>
mem_params = <span class="hljs-built_in">sum</span>([param.nelement()*param.element_size() <span class="hljs-keyword">for</span> param <span class="hljs-keyword">in</span> ct_model.parameters()])
<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;<span class="hljs-subst">{mem_params/<span class="hljs-number">2</span>**<span class="hljs-number">30</span>:<span class="hljs-number">.4</span>f}</span> GB&quot;</span>)
<span class="hljs-comment"># 8.4575 GB</span><!----></pre></div><!----> <!--[1--><h2 class="relative group"><a id="loading-modes" 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="#loading-modes"><span><svg 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><!---->Modes de chargement<!----></span></h2><!--]--><!----> <p>Un point de contrôle compressed-tensors stocke ses poids compressés (fp8, ou int4/int8 empilés). Leur exécution est déterminée par deux arguments de <a href="/docs/transformers/main/fr/main_classes/quantization#transformers.CompressedTensorsConfig">CompressedTensorsConfig</a>.</p> <table><thead><tr><th>Configuration</th><th>Poids après chargement</th><th>Exécution</th></tr></thead><tbody><tr><td>default</td><td>conservé au format compressed-tensors : chaque tenseur sérialisé (<code>weight_packed</code>, <code>weight_scale</code>, <code>weight_zero_point</code>, …) est chargé tel qu’il est stocké</td><td>compressed-tensors possède les couches et décompresse le modèle lors du premier passage avant</td></tr><tr><td><code>dequantize=True</code></td><td>décompressé lors du chargement dans le dtype du modèle (par exemple BF16)</td><td>un modèle dense classique sans <code>quantization_scheme</code> restant, de sorte que les activations w8a8 ne sont pas non plus quantisées ; il peut être affiné ou enregistré dans ce dtype</td></tr><tr><td><code>use_optimized_inference=True</code></td><td>resté quantifié</td><td>les couches dont le schéma comporte un noyau, actuellement W8A8 fp8 ; inférence uniquement</td></tr></tbody></table> <p>Par défaut, <a href="/docs/transformers/main/fr/main_classes/model#transformers.PreTrainedModel.save_pretrained">save_pretrained()</a> réécrit les tenseurs compressés sans les modifier, de sorte qu'un modèle chargé est enregistré dans le même format compressed-tensors.</p> <!--[1--><h2 class="relative group"><a id="fp8-kernel-acceleration" 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="#fp8-kernel-acceleration"><span><svg 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><!---->Accélération des noyaux FP8<!----></span></h2><!--]--><!----> <p>Passez <code>use_optimized_inference=True</code> pour conserver un modèle compressed-tensors en FP8 et exécuter ses produits matriciels via des noyaux FP8 accélérés par le matériel (<a href="https://pytorch.org/docs/stable/generated/torch.nn.functional.scaled_mm.html" rel="nofollow">torch.nn.functional.scaled_mm</a>, qui délègue à <code>torch._scaled_mm_v2</code> ; les versions antérieures de torch basculent sur <code>torch._scaled_mm</code>), au lieu de déquantiser les poids en BF16. Conserver les poids en FP8 tout au long de l'inférence réduit l'utilisation de la mémoire et accélère les calculs. Cette option est réservée à l'inférence ; désactivez-la pour l'ajustement fin.</p> <table><thead><tr><th>Appareil</th><th>Kernel</th><th>Notes</th></tr></thead><tbody><tr><td>Intel XPU</td><td><code>torch.nn.functional.scaled_mm</code></td><td>Tous les appareils XPU prenant en charge FP8</td></tr><tr><td>NVIDIA CUDA (SM89+)</td><td><code>torch.nn.functional.scaled_mm</code></td><td>Ada Lovelace (L4, L40), Hopper (H100), Blackwell et plus récentes</td></tr><tr><td>Apple silicon (MPS)</td><td><code>torch.nn.functional.scaled_mm</code></td><td>Nécessite torch &gt;= 2.15</td></tr><tr><td>CPU / CUDA SM80 (A100) / MPS avec torch &lt; 2.15</td><td>Repli</td><td><code>use_optimized_inference=True</code> est ignoré, le modèle est exécuté sans quantification</td></tr></tbody></table> <p>Le chemin du noyau FP8 prend en charge ces dispositions de quantification.</p> <table><thead><tr><th>Stratégie</th><th>Modèle d'exemple</th></tr></thead><tbody><tr><td>Dynamique par canal</td><td><a href="https://huggingface.co/RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic" rel="nofollow">RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic</a></td></tr><tr><td>Statique par tenseur</td><td><a href="https://huggingface.co/RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8" rel="nofollow">RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8</a></td></tr></tbody></table> <!--[2--><h3 class="relative group"><a id="loading-a-pre-quantized-fp8-model" 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="#loading-a-pre-quantized-fp8-model"><span><svg 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><!---->Chargement d'un modèle FP8 pré-quantifié<!----></span></h3><!--]--><!----> <p>Les noyaux FP8 sont activés sur demande : demandez-les avec <code>use_optimized_inference=True</code>, et ils sont utilisés lorsque la configuration du modèle spécifie une quantification FP8 et qu’un GPU pris en charge est disponible.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copié</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer, CompressedTensorsConfig
model = AutoModelForCausalLM.from_pretrained(
<span class="hljs-string">&quot;RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic&quot;</span>,
quantization_config=CompressedTensorsConfig(use_optimized_inference=<span class="hljs-literal">True</span>),
device_map=<span class="hljs-string">&quot;auto&quot;</span>,
)
tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic&quot;</span>)
inputs = tokenizer(<span class="hljs-string">&quot;Hello, how are you?&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=<span class="hljs-number">20</span>)
<span class="hljs-built_in">print</span>(tokenizer.decode(outputs[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>))<!----></pre></div><!----> <!--[2--><h3 class="relative group"><a id="dequantizing-at-load-time" 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="#dequantizing-at-load-time"><span><svg 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><!---->Désquantification au moment du chargement<!----></span></h3><!--]--><!----> <p>Sans <code>use_optimized_inference=True</code>, le modèle suit la voie standard de compressed-tensors : les poids restent compressés et compressed-tensors les décompresse lors du premier passage avant. Passez <code>dequantize=True</code> pour les décompresser au moment du chargement, ce qui est souhaitable si vous souhaitez affiner le modèle ou le sauvegarder dans sa précision d’origine (par exemple BF16). Le résultat est un modèle dense classique : aucun schéma compressed-tensors n’est associé, de sorte que la quantification des activations (par exemple w8a8) est également abandonnée.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copié</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, CompressedTensorsConfig
model = AutoModelForCausalLM.from_pretrained(
<span class="hljs-string">&quot;RedHatAI/Meta-Llama-3.1-8B-Instruct-FP8-dynamic&quot;</span>,
quantization_config=CompressedTensorsConfig(dequantize=<span class="hljs-literal">True</span>),
device_map=<span class="hljs-string">&quot;auto&quot;</span>,
)<!----></pre></div><!----> <!--[1--><h2 class="relative group"><a id="model-checkpoint" 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="#model-checkpoint"><span><svg 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><!---->Point de contrôle du modèle<!----></span></h2><!--]--><!----> <p>Les modèles compressed-tensor sont définis par leur entrée de configuration. L’exemple suivant est extrait du fichier <code>config.json</code> de <a href="https://huggingface.co/nm-testing/Meta-Llama-3.1-8B-Instruct-FP8-hf/blob/main/config.json" rel="nofollow">nm-testing/Meta-Llama-3.1-8B-Instruct-FP8-hf</a>.</p> <p>Il existe de nombreuses entrées pour permettre une expression flexible, tant pendant qu’après la compression, mais les entrées relatives au chargement et à l’inférence peuvent être simplifiées afin de se concentrer sur quelques entrées clés.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copié</div><!----></button><!----></div> <pre class="language-json "><!----><span class="hljs-attr">&quot;quantization_config&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
<span class="hljs-attr">&quot;config_groups&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
<span class="hljs-attr">&quot;group_0&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
<span class="hljs-attr">&quot;input_activations&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
<span class="hljs-attr">&quot;num_bits&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-number">8</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;strategy&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;tensor&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;type&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;float&quot;</span>
<span class="hljs-punctuation">}</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;targets&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">&quot;Linear&quot;</span><span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;weights&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
<span class="hljs-attr">&quot;num_bits&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-number">8</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;strategy&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;tensor&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;type&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;float&quot;</span>
<span class="hljs-punctuation">}</span>
<span class="hljs-punctuation">}</span>
<span class="hljs-punctuation">}</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;format&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;naive-quantized&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;ignore&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">&quot;lm_head&quot;</span><span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;quant_method&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;compressed-tensors&quot;</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">&quot;quantization_status&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;frozen&quot;</span>
<span class="hljs-punctuation">}</span><span class="hljs-punctuation">,</span><!----></pre></div><!----> <p>Le fichier de configuration spécifie la quantification d’un groupe de configuration (<code>group_0</code>), qui comprend la quantification des poids et des activations en fp8 avec une stratégie statique par tenseur. Le module <code>lm_head</code> n’est pas quantifié, comme indiqué par la clé <code>ignore</code>.</p> <p>Pour un examen plus détaillé des poids du modèle, utilisez le <a href="https://huggingface.co/nm-testing/Meta-Llama-3.1-8B-Instruct-FP8-hf?show_file_info=model.safetensors.index.json" rel="nofollow">safetensors viewer</a> sur la carte du modèle pour visualiser les poids quantifiés, l'échelle d'entrée et l'échelle des poids de tous les modules <a href="https://pytorch.org/docs/stable/generated/torch.nn.Linear.html" rel="nofollow">nn.Linear</a>.</p> <table><thead><tr><th>Tenseurs</th><th>Forme</th><th>Précision</th></tr></thead><tbody><tr><td>model.layers.0.input_layernorm.weight</td><td>[4 096]</td><td>BF16</td></tr><tr><td>model.layers.0.mlp.down_proj.input_scale</td><td>[1]</td><td>BF16</td></tr><tr><td>model.layers.0.mlp.down_proj.weight</td><td>[4 096, 14 336]</td><td>F8_E4M3</td></tr><tr><td>model.layers.0.mlp.down_proj.weight_scale</td><td>[1]</td><td>BF16</td></tr><tr><td>model.layers.0.mlp.gate_proj.input_scale</td><td>[1]</td><td>BF16</td></tr><tr><td>model.layers.0.mlp.gate_proj.weight</td><td>[14 336, 4 096]</td><td>F8_E4M3</td></tr><tr><td>model.layers.0.mlp.gate_proj.weight_scale</td><td>[1]</td><td>BF16</td></tr><tr><td>model.layers.0.mlp.up_proj.input_scale</td><td>[1]</td><td>BF16</td></tr><tr><td>model.layers.0.mlp.up_proj.weight</td><td>[14 336, 4 096]</td><td>F8_E4M3</td></tr><tr><td>model.layers.0.mlp.up_proj.weight_scale</td><td>[1]</td><td>BF16</td></tr><tr><td>model.layers.0.post_attention_layernorm.weight</td><td>[4 096]</td><td>BF16</td></tr><tr><td>model.layers.0.self_attn.k_proj.input_scale</td><td>[1]</td><td>BF16</td></tr><tr><td>model.layers.0.self_attn.k_proj.weight</td><td>[1 024, 4 096]</td><td>F8_E4M3</td></tr><tr><td>model.layers.0.self_attn.k_proj.weight_scale</td><td>[1]</td><td>BF16</td></tr><tr><td>model.layers.0.self_attn.o_proj.input_scale</td><td>[1]</td><td>BF16</td></tr><tr><td>model.layers.0.self_attn.o_proj.weight</td><td>[4 096, 4 096]</td><td>F8_E4M3</td></tr><tr><td>model.layers.0.self_attn.o_proj.weight_scale</td><td>[1]</td><td>BF16</td></tr><tr><td>model.layers.0.self_attn.q_proj.input_scale</td><td>[1]</td><td>BF16</td></tr><tr><td>model.layers.0.self_attn.q_proj.weight</td><td>[4 096, 4 096]</td><td>F8_E4M3</td></tr><tr><td>model.layers.0.self_attn.q_proj.weight_scale</td><td>[1]</td><td>BF16</td></tr><tr><td>model.layers.0.self_attn.v_proj.input_scale</td><td>[1]</td><td>BF16</td></tr><tr><td>model.layers.0.self_attn.v_proj.weight</td><td>[1 024, 4 096]</td><td>F8_E4M3</td></tr><tr><td>model.layers.0.self_attn.v_proj.weight_scale</td><td>[1]</td><td>BF16</td></tr></tbody></table> <p>Lors du chargement d'un modèle compressed-tensors avec l'intégration <code>~quantizers.HFQuantizer</code>, les modules cibles sont transmis à compressed-tensors : celui-ci attache le <code>quantization_scheme</code> résolu, définit <code>quantization_status</code>, enregistre les paramètres stockés dans le checkpoint (<code>weight</code> en fp8, ainsi que <code>weight_scale</code> et, pour une stratégie statique, <code>input_scale</code>) et installe son propre passage avant sur ces derniers. Ils restent des instances de <a href="https://pytorch.org/docs/stable/generated/torch.nn.Linear.html" rel="nofollow">nn.Linear</a>, c'est donc ce que montre <code>print</code> — les versions récentes de compressed-tensors ne les encapsulent plus dans une sous-classe <code>CompressedLinear</code>. Les modules répertoriés sous <code>ignore</code>, tels que <code>lm_head</code>, sont laissés inchangés.</p> <p>Avec <code>dequantize=False</code> (par défaut), les poids restent compressés une fois le chargement terminé, et compressed-tensors décompresse l’ensemble du modèle lors du premier passage avant. <code>dequantize=True</code> décompresse chaque poids au moment de son chargement, de sorte qu’aucun passage avant n’est nécessaire pour obtenir des poids denses, et les modules sont de simples couches denses sans <code>quantization_scheme</code>.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copié</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, CompressedTensorsConfig
model_id = <span class="hljs-string">&quot;nm-testing/Meta-Llama-3.1-8B-Instruct-FP8-hf&quot;</span>
ct_model = AutoModelForCausalLM.from_pretrained(
model_id,
quantization_config=CompressedTensorsConfig(dequantize=<span class="hljs-literal">False</span>),
device_map=<span class="hljs-string">&quot;auto&quot;</span>,
)
q_proj = ct_model.model.layers[<span class="hljs-number">0</span>].self_attn.q_proj
<span class="hljs-built_in">print</span>(q_proj, q_proj.quantization_status)
<span class="hljs-comment"># Linear(in_features=4096, out_features=4096, bias=False) QuantizationStatus.COMPRESSED</span>
<span class="hljs-comment"># ^ compressed-tensors module: fp8 weight, weight_scale, and its own forward</span>
ct_model(input_ids=torch.tensor([[<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>]], device=ct_model.device))
<span class="hljs-built_in">print</span>(q_proj, q_proj.quantization_status)
<span class="hljs-comment"># Linear(in_features=4096, out_features=4096, bias=False) QuantizationStatus.DECOMPRESSED</span>
<span class="hljs-comment"># ^ weight is BF16 now, decompressed by that forward pass</span>
ct_model = AutoModelForCausalLM.from_pretrained(
model_id,
quantization_config=CompressedTensorsConfig(dequantize=<span class="hljs-literal">True</span>),
device_map=<span class="hljs-string">&quot;auto&quot;</span>,
)
<span class="hljs-built_in">print</span>(ct_model.model.layers[<span class="hljs-number">0</span>].self_attn.q_proj)
<span class="hljs-comment"># Linear(in_features=4096, out_features=4096, bias=False) weight: BF16</span><!----></pre></div><!----> <p>Avec <code>use_optimized_inference=True</code>, les couches couvertes par un groupe de configuration fp8 sont remplacées par <code>CompressedTensorsFP8Linear</code>, qui conserve le poids fp8 et son échelle dans la disposition attendue par son noyau de multiplication matricielle par ligne. Ces poids restent en fp8, y compris lors des passes avant.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copié</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, CompressedTensorsConfig
ct_model = AutoModelForCausalLM.from_pretrained(
<span class="hljs-string">&quot;nm-testing/Meta-Llama-3.1-8B-Instruct-FP8-hf&quot;</span>,
quantization_config=CompressedTensorsConfig(use_optimized_inference=<span class="hljs-literal">True</span>),
device_map=<span class="hljs-string">&quot;auto&quot;</span>,
)
<span class="hljs-built_in">print</span>(ct_model.model.layers[<span class="hljs-number">0</span>].self_attn.q_proj)
<span class="hljs-comment"># CompressedTensorsFP8Linear(in_features=4096, out_features=4096, bias=False) weight: F8_E4M3</span><!----></pre></div><!----> <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/compressed_tensors.md" target="_blank"><svg class="mr-1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M31,16l-7,7l-1.41-1.41L28.17,16l-5.58-5.59L24,9l7,7z"></path><path d="M1,16l7-7l1.41,1.41L3.83,16l5.58,5.59L8,23l-7-7z"></path><path d="M12.419,25.484L17.639,6.552l1.932,0.518L14.351,26.002z"></path></svg><!----> <span><span class="underline">Update</span> on GitHub</span></a><!----> <p></p><!--]--><!----><!--]--><!--]--><!--]--> <!--[-1--><!--]--><!--]-->
<script>
{
__sveltekit_1m6yd5j = {
base: "/docs/transformers/main/en",
assets: "/docs/transformers/main/en"
};
const element = document.currentScript.parentElement;
Promise.all([
import("/docs/transformers/main/en/_app/immutable/entry/start.DYIO-UII.js"),
import("/docs/transformers/main/en/_app/immutable/entry/app.D2_KizbC.js")
]).then(([kit, app]) => {
kit.start(app, element, {
node_ids: [0, 701],
data: [null,null],
form: null,
error: null
});
});
}
</script>

Xet Storage Details

Size:
44.1 kB
·
Xet hash:
6640fc44c3036cfe9abcab348230bfb6ee65f13d73d3b19f15323dfc1c8a0872

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.