import{s as co,o as Mo,n as I}from"../chunks/scheduler.25b97de1.js";import{S as bo,i as go,g as r,s as n,r as u,A as yo,h as p,f as l,c as s,j as ho,u as d,x as m,k as et,y as To,a,v as f,d as h,t as c,w as M}from"../chunks/index.d9030fc9.js";import{T as W}from"../chunks/Tip.baa67368.js";import{C as $}from"../chunks/CodeBlock.e6cd0d95.js";import{H as k,E as wo}from"../chunks/EditOnGithub.91d95064.js";import{H as _s,a as Zl}from"../chunks/HfOption.1e589c90.js";function $o(J){let i,y='Interested in adding a new quantization method to Transformers? Read the <a href="./hf_quantizer">HfQuantizer</a> guide to learn how!';return{c(){i=r("p"),i.innerHTML=y},l(o){i=p(o,"P",{"data-svelte-h":!0}),m(i)!=="svelte-px0yfi"&&(i.innerHTML=y)},m(o,g){a(o,i,g)},p:I,d(o){o&&l(i)}}}function Jo(J){let i,y='Try Quanto + transformers with this <a href="https://colab.research.google.com/drive/16CXfVmtdQvciSh9BopZUDYcmXCDpvgrT?usp=sharing" rel="nofollow">notebook</a>!';return{c(){i=r("p"),i.innerHTML=y},l(o){i=p(o,"P",{"data-svelte-h":!0}),m(i)!=="svelte-1m6vmvl"&&(i.innerHTML=y)},m(o,g){a(o,i,g)},p:I,d(o){o&&l(i)}}}function Uo(J){let i,y='Try AWQ quantization with this <a href="https://colab.research.google.com/drive/1HzZH89yAXJaZgwJDhQj9LqSBux932BvY" rel="nofollow">notebook</a>!';return{c(){i=r("p"),i.innerHTML=y},l(o){i=p(o,"P",{"data-svelte-h":!0}),m(i)!=="svelte-1yzcfmc"&&(i.innerHTML=y)},m(o,g){a(o,i,g)},p:I,d(o){o&&l(i)}}}function vo(J){let i,y="Fused modules cannot be combined with other optimization techniques such as FlashAttention-2.";return{c(){i=r("p"),i.textContent=y},l(o){i=p(o,"P",{"data-svelte-h":!0}),m(i)!=="svelte-hwgpn3"&&(i.textContent=y)},m(o,g){a(o,i,g)},p:I,d(o){o&&l(i)}}}function jo(J){let i,y='To enable fused modules for supported architectures, create an <a href="/docs/transformers/main/en/main_classes/quantization#transformers.AwqConfig">AwqConfig</a> and set the parameters <code>fuse_max_seq_len</code> and <code>do_fuse=True</code>. The <code>fuse_max_seq_len</code> parameter is the total sequence length and it should include the context length and the expected generation length. You can set it to a larger value to be safe.',o,g,b='For example, to fuse the AWQ modules of the <a href="https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-AWQ" rel="nofollow">TheBloke/Mistral-7B-OpenOrca-AWQ</a> model.',T,j,C;return j=new $({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXdxQ29uZmlnJTJDJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMEElMEFtb2RlbF9pZCUyMCUzRCUyMCUyMlRoZUJsb2tlJTJGTWlzdHJhbC03Qi1PcGVuT3JjYS1BV1ElMjIlMEElMEFxdWFudGl6YXRpb25fY29uZmlnJTIwJTNEJTIwQXdxQ29uZmlnKCUwQSUyMCUyMCUyMCUyMGJpdHMlM0Q0JTJDJTBBJTIwJTIwJTIwJTIwZnVzZV9tYXhfc2VxX2xlbiUzRDUxMiUyQyUwQSUyMCUyMCUyMCUyMGRvX2Z1c2UlM0RUcnVlJTJDJTBBKSUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkJTJDJTIwcXVhbnRpemF0aW9uX2NvbmZpZyUzRHF1YW50aXphdGlvbl9jb25maWcpLnRvKDAp",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AwqConfig, AutoModelForCausalLM

model_id = <span class="hljs-string">&quot;TheBloke/Mistral-7B-OpenOrca-AWQ&quot;</span>

quantization_config = AwqConfig(
    bits=<span class="hljs-number">4</span>,
    fuse_max_seq_len=<span class="hljs-number">512</span>,
    do_fuse=<span class="hljs-literal">True</span>,
)

model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=quantization_config).to(<span class="hljs-number">0</span>)`,wrap:!1}}),{c(){i=r("p"),i.innerHTML=y,o=n(),g=r("p"),g.innerHTML=b,T=n(),u(j.$$.fragment)},l(w){i=p(w,"P",{"data-svelte-h":!0}),m(i)!=="svelte-cvz4de"&&(i.innerHTML=y),o=s(w),g=p(w,"P",{"data-svelte-h":!0}),m(g)!=="svelte-1zxz2i"&&(g.innerHTML=b),T=s(w),d(j.$$.fragment,w)},m(w,q){a(w,i,q),a(w,o,q),a(w,g,q),a(w,T,q),f(j,w,q),C=!0},p:I,i(w){C||(h(j.$$.fragment,w),C=!0)},o(w){c(j.$$.fragment,w),C=!1},d(w){w&&(l(i),l(o),l(g),l(T)),M(j,w)}}}function _o(J){let i,y='For architectures that don’t support fused modules yet, you need to create a custom fusing mapping to define which modules need to be fused with the <code>modules_to_fuse</code> parameter. For example, to fuse the AWQ modules of the <a href="https://huggingface.co/TheBloke/Yi-34B-AWQ" rel="nofollow">TheBloke/Yi-34B-AWQ</a> model.',o,g,b,T,j="The parameter <code>modules_to_fuse</code> should include:",C,w,q="<li><code>&quot;attention&quot;</code>: The names of the attention layers to fuse in the following order: query, key, value and output projection layer. If you don’t want to fuse these layers, pass an empty list.</li> <li><code>&quot;layernorm&quot;</code>: The names of all the LayerNorm layers you want to replace with a custom fused LayerNorm. If you don’t want to fuse these layers, pass an empty list.</li> <li><code>&quot;mlp&quot;</code>: The names of the MLP layers you want to fuse into a single MLP layer in the order: (gate (dense, layer, post-attention) / up / down layers).</li> <li><code>&quot;use_alibi&quot;</code>: If your model uses ALiBi positional embedding.</li> <li><code>&quot;num_attention_heads&quot;</code>: The number of attention heads.</li> <li><code>&quot;num_key_value_heads&quot;</code>: The number of key value heads that should be used to implement Grouped Query Attention (GQA). If <code>num_key_value_heads=num_attention_heads</code>, the model will use Multi Head Attention (MHA), if <code>num_key_value_heads=1</code> the model will use Multi Query Attention (MQA), otherwise GQA is used.</li> <li><code>&quot;hidden_size&quot;</code>: The dimension of the hidden representations.</li>",G;return g=new $({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXdxQ29uZmlnJTJDJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMEElMEFtb2RlbF9pZCUyMCUzRCUyMCUyMlRoZUJsb2tlJTJGWWktMzRCLUFXUSUyMiUwQSUwQXF1YW50aXphdGlvbl9jb25maWclMjAlM0QlMjBBd3FDb25maWcoJTBBJTIwJTIwJTIwJTIwYml0cyUzRDQlMkMlMEElMjAlMjAlMjAlMjBmdXNlX21heF9zZXFfbGVuJTNENTEyJTJDJTBBJTIwJTIwJTIwJTIwbW9kdWxlc190b19mdXNlJTNEJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyYXR0ZW50aW9uJTIyJTNBJTIwJTVCJTIycV9wcm9qJTIyJTJDJTIwJTIya19wcm9qJTIyJTJDJTIwJTIydl9wcm9qJTIyJTJDJTIwJTIyb19wcm9qJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIybGF5ZXJub3JtJTIyJTNBJTIwJTVCJTIybG4xJTIyJTJDJTIwJTIybG4yJTIyJTJDJTIwJTIybm9ybSUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMm1scCUyMiUzQSUyMCU1QiUyMmdhdGVfcHJvaiUyMiUyQyUyMCUyMnVwX3Byb2olMjIlMkMlMjAlMjJkb3duX3Byb2olMjIlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJ1c2VfYWxpYmklMjIlM0ElMjBGYWxzZSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMm51bV9hdHRlbnRpb25faGVhZHMlMjIlM0ElMjA1NiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMm51bV9rZXlfdmFsdWVfaGVhZHMlMjIlM0ElMjA4JTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyaGlkZGVuX3NpemUlMjIlM0ElMjA3MTY4JTBBJTIwJTIwJTIwJTIwJTdEJTBBKSUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkJTJDJTIwcXVhbnRpemF0aW9uX2NvbmZpZyUzRHF1YW50aXphdGlvbl9jb25maWcpLnRvKDAp",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AwqConfig, AutoModelForCausalLM

model_id = <span class="hljs-string">&quot;TheBloke/Yi-34B-AWQ&quot;</span>

quantization_config = AwqConfig(
    bits=<span class="hljs-number">4</span>,
    fuse_max_seq_len=<span class="hljs-number">512</span>,
    modules_to_fuse={
        <span class="hljs-string">&quot;attention&quot;</span>: [<span class="hljs-string">&quot;q_proj&quot;</span>, <span class="hljs-string">&quot;k_proj&quot;</span>, <span class="hljs-string">&quot;v_proj&quot;</span>, <span class="hljs-string">&quot;o_proj&quot;</span>],
        <span class="hljs-string">&quot;layernorm&quot;</span>: [<span class="hljs-string">&quot;ln1&quot;</span>, <span class="hljs-string">&quot;ln2&quot;</span>, <span class="hljs-string">&quot;norm&quot;</span>],
        <span class="hljs-string">&quot;mlp&quot;</span>: [<span class="hljs-string">&quot;gate_proj&quot;</span>, <span class="hljs-string">&quot;up_proj&quot;</span>, <span class="hljs-string">&quot;down_proj&quot;</span>],
        <span class="hljs-string">&quot;use_alibi&quot;</span>: <span class="hljs-literal">False</span>,
        <span class="hljs-string">&quot;num_attention_heads&quot;</span>: <span class="hljs-number">56</span>,
        <span class="hljs-string">&quot;num_key_value_heads&quot;</span>: <span class="hljs-number">8</span>,
        <span class="hljs-string">&quot;hidden_size&quot;</span>: <span class="hljs-number">7168</span>
    }
)

model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=quantization_config).to(<span class="hljs-number">0</span>)`,wrap:!1}}),{c(){i=r("p"),i.innerHTML=y,o=n(),u(g.$$.fragment),b=n(),T=r("p"),T.innerHTML=j,C=n(),w=r("ul"),w.innerHTML=q},l(_){i=p(_,"P",{"data-svelte-h":!0}),m(i)!=="svelte-ecilwg"&&(i.innerHTML=y),o=s(_),d(g.$$.fragment,_),b=s(_),T=p(_,"P",{"data-svelte-h":!0}),m(T)!=="svelte-1divolh"&&(T.innerHTML=j),C=s(_),w=p(_,"UL",{"data-svelte-h":!0}),m(w)!=="svelte-ln3msn"&&(w.innerHTML=q)},m(_,Z){a(_,i,Z),a(_,o,Z),f(g,_,Z),a(_,b,Z),a(_,T,Z),a(_,C,Z),a(_,w,Z),G=!0},p:I,i(_){G||(h(g.$$.fragment,_),G=!0)},o(_){c(g.$$.fragment,_),G=!1},d(_){_&&(l(i),l(o),l(b),l(T),l(C),l(w)),M(g,_)}}}function Co(J){let i,y,o,g;return i=new Zl({props:{id:"fuse",option:"supported architectures",$$slots:{default:[jo]},$$scope:{ctx:J}}}),o=new Zl({props:{id:"fuse",option:"unsupported architectures",$$slots:{default:[_o]},$$scope:{ctx:J}}}),{c(){u(i.$$.fragment),y=n(),u(o.$$.fragment)},l(b){d(i.$$.fragment,b),y=s(b),d(o.$$.fragment,b)},m(b,T){f(i,b,T),a(b,y,T),f(o,b,T),g=!0},p(b,T){const j={};T&2&&(j.$$scope={dirty:T,ctx:b}),i.$set(j);const C={};T&2&&(C.$$scope={dirty:T,ctx:b}),o.$set(C)},i(b){g||(h(i.$$.fragment,b),h(o.$$.fragment,b),g=!0)},o(b){c(i.$$.fragment,b),c(o.$$.fragment,b),g=!1},d(b){b&&l(y),M(i,b),M(o,b)}}}function qo(J){let i,y="Note this feature is supported on AMD GPUs.";return{c(){i=r("p"),i.textContent=y},l(o){i=p(o,"P",{"data-svelte-h":!0}),m(i)!=="svelte-147si7w"&&(i.textContent=y)},m(o,g){a(o,i,g)},p:I,d(o){o&&l(i)}}}function Zo(J){let i,y='Try GPTQ quantization with PEFT in this <a href="https://colab.research.google.com/drive/1_TIrmuKOFhuRRiTWN94iLKUFu6ZX4ceb?usp=sharing" rel="nofollow">notebook</a> and learn more about it’s details in this <a href="https://huggingface.co/blog/gptq-integration" rel="nofollow">blog post</a>!';return{c(){i=r("p"),i.innerHTML=y},l(o){i=p(o,"P",{"data-svelte-h":!0}),m(i)!=="svelte-1tfpiad"&&(i.innerHTML=y)},m(o,g){a(o,i,g)},p:I,d(o){o&&l(i)}}}function ko(J){let i,y='Depending on your hardware, it can take some time to quantize a model from scratch. It can take ~5 minutes to quantize the <a href="https://huggingface.co/facebook/opt-350m" rel="nofollow">facebook/opt-350m</a> model on a free-tier Google Colab GPU, but it’ll take ~4 hours to quantize a 175B parameter model on a NVIDIA A100. Before you quantize a model, it is a good idea to check the Hub if a GPTQ-quantized version of the model already exists.';return{c(){i=r("p"),i.innerHTML=y},l(o){i=p(o,"P",{"data-svelte-h":!0}),m(i)!=="svelte-jdzahk"&&(i.innerHTML=y)},m(o,g){a(o,i,g)},p:I,d(o){o&&l(i)}}}function Go(J){let i,y="Only 4-bit models are supported, and we recommend deactivating the ExLlama kernels if you’re finetuning a quantized model with PEFT.";return{c(){i=r("p"),i.textContent=y},l(o){i=p(o,"P",{"data-svelte-h":!0}),m(i)!=="svelte-14ppi1y"&&(i.textContent=y)},m(o,g){a(o,i,g)},p:I,d(o){o&&l(i)}}}function zo(J){let i,y;return i=new $({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGFjY2VsZXJhdGUlMjBiaXRzYW5kYnl0ZXMlM0UwLjM3LjA=",highlighted:"pip install transformers accelerate bitsandbytes&gt;0.37.0",wrap:!1}}),{c(){u(i.$$.fragment)},l(o){d(i.$$.fragment,o)},m(o,g){f(i,o,g),y=!0},p:I,i(o){y||(h(i.$$.fragment,o),y=!0)},o(o){c(i.$$.fragment,o),y=!1},d(o){M(i,o)}}}function Qo(J){let i,y;return i=new $({props:{code:"cGlwJTIwaW5zdGFsbCUyMGJpdHNhbmRieXRlcyUzRSUzRDAuMzkuMCUwQXBpcCUyMGluc3RhbGwlMjAtLXVwZ3JhZGUlMjBhY2NlbGVyYXRlJTBBcGlwJTIwaW5zdGFsbCUyMC0tdXBncmFkZSUyMHRyYW5zZm9ybWVycw==",highlighted:`pip install bitsandbytes&gt;=0.39.0
pip install --upgrade accelerate
pip install --upgrade transformers`,wrap:!1}}),{c(){u(i.$$.fragment)},l(o){d(i.$$.fragment,o)},m(o,g){f(i,o,g),y=!0},p:I,i(o){y||(h(i.$$.fragment,o),y=!0)},o(o){c(i.$$.fragment,o),y=!1},d(o){M(i,o)}}}function Io(J){let i,y,o,g;return i=new Zl({props:{id:"bnb",option:"8-bit",$$slots:{default:[zo]},$$scope:{ctx:J}}}),o=new Zl({props:{id:"bnb",option:"4-bit",$$slots:{default:[Qo]},$$scope:{ctx:J}}}),{c(){u(i.$$.fragment),y=n(),u(o.$$.fragment)},l(b){d(i.$$.fragment,b),y=s(b),d(o.$$.fragment,b)},m(b,T){f(i,b,T),a(b,y,T),f(o,b,T),g=!0},p(b,T){const j={};T&2&&(j.$$scope={dirty:T,ctx:b}),i.$set(j);const C={};T&2&&(C.$$scope={dirty:T,ctx:b}),o.$set(C)},i(b){g||(h(i.$$.fragment,b),h(o.$$.fragment,b),g=!0)},o(b){c(i.$$.fragment,b),c(o.$$.fragment,b),g=!1},d(b){b&&l(y),M(i,b),M(o,b)}}}function Wo(J){let i,y="Quantizing a model in 8-bit halves the memory-usage, and for large models, set <code>device_map=&quot;auto&quot;</code> to efficiently use the GPUs available:",o,g,b,T,j="By default, all the other modules such as <code>torch.nn.LayerNorm</code> are converted to <code>torch.float16</code>. You can change the data type of these modules with the <code>torch_dtype</code> parameter if you want:",C,w,q,G,_='Once a model is quantized to 8-bit, you can’t push the quantized weights to the Hub unless you’re using the latest version of Transformers and bitsandbytes. If you have the latest versions, then you can push the 8-bit model to the Hub with the <a href="/docs/transformers/main/en/main_classes/model#transformers.utils.PushToHubMixin.push_to_hub">push_to_hub()</a> method. The quantization config.json file is pushed first, followed by the quantized model weights.',Z,U,z;return g=new $({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTBBJTBBbW9kZWxfOGJpdCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJiaWdzY2llbmNlJTJGYmxvb20tMWI3JTIyJTJDJTIwZGV2aWNlX21hcCUzRCUyMmF1dG8lMjIlMkMlMjBsb2FkX2luXzhiaXQlM0RUcnVlKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM

model_8bit = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;bigscience/bloom-1b7&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>, load_in_8bit=<span class="hljs-literal">True</span>)`,wrap:!1}}),w=new $({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMEElMEFtb2RlbF84Yml0JTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGb3B0LTM1MG0lMjIlMkMlMjBsb2FkX2luXzhiaXQlM0RUcnVlJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDMyKSUwQW1vZGVsXzhiaXQubW9kZWwuZGVjb2Rlci5sYXllcnMlNUItMSU1RC5maW5hbF9sYXllcl9ub3JtLndlaWdodC5kdHlwZQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM

model_8bit = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;facebook/opt-350m&quot;</span>, load_in_8bit=<span class="hljs-literal">True</span>, torch_dtype=torch.float32)
model_8bit.model.decoder.layers[-<span class="hljs-number">1</span>].final_layer_norm.weight.dtype`,wrap:!1}}),U=new $({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmJpZ3NjaWVuY2UlMkZibG9vbS01NjBtJTIyJTJDJTIwZGV2aWNlX21hcCUzRCUyMmF1dG8lMjIlMkMlMjBsb2FkX2luXzhiaXQlM0RUcnVlKSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmJpZ3NjaWVuY2UlMkZibG9vbS01NjBtJTIyKSUwQSUwQW1vZGVsLnB1c2hfdG9faHViKCUyMmJsb29tLTU2MG0tOGJpdCUyMik=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;bigscience/bloom-560m&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>, load_in_8bit=<span class="hljs-literal">True</span>)
tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;bigscience/bloom-560m&quot;</span>)

model.push_to_hub(<span class="hljs-string">&quot;bloom-560m-8bit&quot;</span>)`,wrap:!1}}),{c(){i=r("p"),i.innerHTML=y,o=n(),u(g.$$.fragment),b=n(),T=r("p"),T.innerHTML=j,C=n(),u(w.$$.fragment),q=n(),G=r("p"),G.innerHTML=_,Z=n(),u(U.$$.fragment)},l(v){i=p(v,"P",{"data-svelte-h":!0}),m(i)!=="svelte-1dz8xeq"&&(i.innerHTML=y),o=s(v),d(g.$$.fragment,v),b=s(v),T=p(v,"P",{"data-svelte-h":!0}),m(T)!=="svelte-kfzkum"&&(T.innerHTML=j),C=s(v),d(w.$$.fragment,v),q=s(v),G=p(v,"P",{"data-svelte-h":!0}),m(G)!=="svelte-951rn"&&(G.innerHTML=_),Z=s(v),d(U.$$.fragment,v)},m(v,Q){a(v,i,Q),a(v,o,Q),f(g,v,Q),a(v,b,Q),a(v,T,Q),a(v,C,Q),f(w,v,Q),a(v,q,Q),a(v,G,Q),a(v,Z,Q),f(U,v,Q),z=!0},p:I,i(v){z||(h(g.$$.fragment,v),h(w.$$.fragment,v),h(U.$$.fragment,v),z=!0)},o(v){c(g.$$.fragment,v),c(w.$$.fragment,v),c(U.$$.fragment,v),z=!1},d(v){v&&(l(i),l(o),l(b),l(T),l(C),l(q),l(G),l(Z)),M(g,v),M(w,v),M(U,v)}}}function Fo(J){let i,y="Quantizing a model in 4-bit reduces your memory-usage by 4x, and for large models, set <code>device_map=&quot;auto&quot;</code> to efficiently use the GPUs available:",o,g,b,T,j="By default, all the other modules such as <code>torch.nn.LayerNorm</code> are converted to <code>torch.float16</code>. You can change the data type of these modules with the <code>torch_dtype</code> parameter if you want:",C,w,q,G,_="If you have <code>bitsandbytes&gt;=0.41.3</code>, you can serialize 4-bit models and push them on Hugging Face Hub. Simply call <code>model.push_to_hub()</code> after loading it in 4-bit precision. You can also save the serialized 4-bit models locally with <code>model.save_pretrained()</code> command.",Z;return g=new $({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTBBJTBBbW9kZWxfNGJpdCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJiaWdzY2llbmNlJTJGYmxvb20tMWI3JTIyJTJDJTIwZGV2aWNlX21hcCUzRCUyMmF1dG8lMjIlMkMlMjBsb2FkX2luXzRiaXQlM0RUcnVlKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM

model_4bit = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;bigscience/bloom-1b7&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>, load_in_4bit=<span class="hljs-literal">True</span>)`,wrap:!1}}),w=new $({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMEElMEFtb2RlbF80Yml0JTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGb3B0LTM1MG0lMjIlMkMlMjBsb2FkX2luXzRiaXQlM0RUcnVlJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDMyKSUwQW1vZGVsXzRiaXQubW9kZWwuZGVjb2Rlci5sYXllcnMlNUItMSU1RC5maW5hbF9sYXllcl9ub3JtLndlaWdodC5kdHlwZQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM

model_4bit = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;facebook/opt-350m&quot;</span>, load_in_4bit=<span class="hljs-literal">True</span>, torch_dtype=torch.float32)
model_4bit.model.decoder.layers[-<span class="hljs-number">1</span>].final_layer_norm.weight.dtype`,wrap:!1}}),{c(){i=r("p"),i.innerHTML=y,o=n(),u(g.$$.fragment),b=n(),T=r("p"),T.innerHTML=j,C=n(),u(w.$$.fragment),q=n(),G=r("p"),G.innerHTML=_},l(U){i=p(U,"P",{"data-svelte-h":!0}),m(i)!=="svelte-1b6jp1p"&&(i.innerHTML=y),o=s(U),d(g.$$.fragment,U),b=s(U),T=p(U,"P",{"data-svelte-h":!0}),m(T)!=="svelte-kfzkum"&&(T.innerHTML=j),C=s(U),d(w.$$.fragment,U),q=s(U),G=p(U,"P",{"data-svelte-h":!0}),m(G)!=="svelte-1pmx2wb"&&(G.innerHTML=_)},m(U,z){a(U,i,z),a(U,o,z),f(g,U,z),a(U,b,z),a(U,T,z),a(U,C,z),f(w,U,z),a(U,q,z),a(U,G,z),Z=!0},p:I,i(U){Z||(h(g.$$.fragment,U),h(w.$$.fragment,U),Z=!0)},o(U){c(g.$$.fragment,U),c(w.$$.fragment,U),Z=!1},d(U){U&&(l(i),l(o),l(b),l(T),l(C),l(q),l(G)),M(g,U),M(w,U)}}}function xo(J){let i,y,o,g;return i=new Zl({props:{id:"bnb",option:"8-bit",$$slots:{default:[Wo]},$$scope:{ctx:J}}}),o=new Zl({props:{id:"bnb",option:"4-bit",$$slots:{default:[Fo]},$$scope:{ctx:J}}}),{c(){u(i.$$.fragment),y=n(),u(o.$$.fragment)},l(b){d(i.$$.fragment,b),y=s(b),d(o.$$.fragment,b)},m(b,T){f(i,b,T),a(b,y,T),f(o,b,T),g=!0},p(b,T){const j={};T&2&&(j.$$scope={dirty:T,ctx:b}),i.$set(j);const C={};T&2&&(C.$$scope={dirty:T,ctx:b}),o.$set(C)},i(b){g||(h(i.$$.fragment,b),h(o.$$.fragment,b),g=!0)},o(b){c(i.$$.fragment,b),c(o.$$.fragment,b),g=!1},d(b){b&&l(y),M(i,b),M(o,b)}}}function Bo(J){let i,y="Training with 8-bit and 4-bit weights are only supported for training <em>extra</em> parameters.";return{c(){i=r("p"),i.innerHTML=y},l(o){i=p(o,"P",{"data-svelte-h":!0}),m(i)!=="svelte-of9sym"&&(i.innerHTML=y)},m(o,g){a(o,i,g)},p:I,d(o){o&&l(i)}}}function Vo(J){let i,y='Learn more about the details of 8-bit quantization in this <a href="https://huggingface.co/blog/hf-bitsandbytes-integration" rel="nofollow">blog post</a>!';return{c(){i=r("p"),i.innerHTML=y},l(o){i=p(o,"P",{"data-svelte-h":!0}),m(i)!=="svelte-1bb05fp"&&(i.innerHTML=y)},m(o,g){a(o,i,g)},p:I,d(o){o&&l(i)}}}function Xo(J){let i,y='Try 4-bit quantization in this <a href="https://colab.research.google.com/drive/1ge2F1QSK8Q7h0hn3YKuBCOAS0bK8E0wf" rel="nofollow">notebook</a> and learn more about it’s details in this <a href="https://huggingface.co/blog/4bit-transformers-bitsandbytes" rel="nofollow">blog post</a>.';return{c(){i=r("p"),i.innerHTML=y},l(o){i=p(o,"P",{"data-svelte-h":!0}),m(i)!=="svelte-rme94c"&&(i.innerHTML=y)},m(o,g){a(o,i,g)},p:I,d(o){o&&l(i)}}}function Ro(J){let i,y,o,g,b,T,j,C="Quantization techniques focus on representing data with less information while also trying to not lose too much accuracy. This often means converting a data type to represent the same information with fewer bits. For example, if your model weights are stored as 32-bit floating points and they’re quantized to 16-bit floating points, this halves the model size which makes it easier to store and reduces memory-usage. Lower precision can also speedup inference because it takes less time to perform calculations with fewer bits.",w,q,G="Transformers supports several quantization schemes to help you run inference with large language models (LLMs) and finetune adapters on quantized models. This guide will show you how to use Activation-aware Weight Quantization (AWQ), AutoGPTQ, and bitsandbytes.",_,Z,U,z,v,Q,Gl,lt,Cs='<a href="https://github.com/huggingface/quanto" rel="nofollow">🤗 Quanto</a> library is a versatile pytorch quantization toolkit. The quantization method used is the linear quantization. Quanto provides several unique features such as:',zl,at,qs="<li>weights quantization (<code>float8</code>,<code>int8</code>,<code>int4</code>,<code>int2</code>)</li> <li>activation quantization (<code>float8</code>,<code>int8</code>)</li> <li>modality agnostic (e.g CV,LLM)</li> <li>device agnostic (e.g CUDA,MPS,CPU)</li> <li>compatibility with <code>torch.compile</code></li> <li>easy to add custom kernel for specific device</li> <li>supports quantization aware training</li>",Ql,nt,Zs="Before you begin, make sure the following libraries are installed:",Il,st,Wl,it,ks='Now you can quantize a model by passing <a href="/docs/transformers/main/en/main_classes/quantization#transformers.QuantoConfig">QuantoConfig</a> object in the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method. This works for any model in any modality, as long as it contains <code>torch.nn.Linear</code> layers.',Fl,ot,Gs='The integration with transformers only supports weights quantization. For the more complex use case such as activation quantization, calibration and quantization aware training, you should use <a href="https://github.com/huggingface/quanto" rel="nofollow">quanto</a> library instead.',xl,rt,Bl,pt,zs="Note that serialization is not supported yet with transformers but it is coming soon! If you want to save the model, you can use quanto library instead.",Vl,mt,Qs='Quanto library uses linear quantization algorithm for quantization. Even though this is a basic quantization technique, we get very good results! Have a look at the following becnhmark (llama-2-7b on perplexity metric). You can find more benchamarks <a href="https://github.com/huggingface/quanto/tree/main/bench/generation" rel="nofollow">here</a>',Xl,F,Is='<div><img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/quantization/NousResearch-Llama-2-7b-hf_Perplexity.png" alt="llama-2-7b-quanto-perplexity"/></div>',Rl,ut,Ws="The library is versatible enough to be compatible with most PTQ optimization algorithms. The plan in the future is to integrate the most popular algorithms in the most seamless possible way (AWQ, Smoothquant).",El,dt,Nl,ft,Fs='Try AQLM on <a href="https://colab.research.google.com/drive/1-xZmBRXT5Fm3Ghn4Mwa2KRypORXb855X?usp=sharing" rel="nofollow">Google Colab</a>!',Hl,ht,xs='Additive Quantization of Language Models (<a href="https://arxiv.org/abs/2401.06118" rel="nofollow">AQLM</a>) is a Large Language Models compression method. It quantizes multiple weights together and take advantage of interdependencies between them. AQLM represents groups of 8-16 weights as a sum of multiple vector codes.',Ll,ct,Bs="Inference support for AQLM is realised in the <code>aqlm</code> library. Make sure to install it to run the models (note aqlm works only with python&gt;=3.10):",Al,Mt,Yl,bt,Vs="The library provides efficient kernels for both GPU and CPU inference and training.",Pl,gt,Xs='The instructions on how to quantize models yourself, as well as all the relevant code can be found in the corresponding GitHub <a href="https://github.com/Vahe1994/AQLM" rel="nofollow">repository</a>.',Sl,yt,Dl,Tt,Rs='Starting with version <code>aqlm 1.0.2</code>, AQLM supports Parameter-Efficient Fine-Tuning in a form of <a href="https://huggingface.co/docs/peft/package_reference/lora" rel="nofollow">LoRA</a> integrated into the <a href="https://huggingface.co/blog/peft" rel="nofollow">PEFT</a> library.',Kl,wt,Ol,$t,Es="AQLM quantization setups vary mainly on the number of codebooks used as well as codebook sizes in bits. The most popular setups, as well as inference kernels they support are:",ta,Jt,Ns="<thead><tr><th>Kernel</th> <th>Number of codebooks</th> <th>Codebook size, bits</th> <th>Notation</th> <th>Accuracy</th> <th>Speedup</th> <th>Fast GPU inference</th> <th>Fast CPU inference</th></tr></thead> <tbody><tr><td>Triton</td> <td>K</td> <td>N</td> <td>KxN</td> <td>-</td> <td>Up to ~0.7x</td> <td>✅</td> <td>❌</td></tr> <tr><td>CUDA</td> <td>1</td> <td>16</td> <td>1x16</td> <td>Best</td> <td>Up to ~1.3x</td> <td>✅</td> <td>❌</td></tr> <tr><td>CUDA</td> <td>2</td> <td>8</td> <td>2x8</td> <td>OK</td> <td>Up to ~3.0x</td> <td>✅</td> <td>❌</td></tr> <tr><td>Numba</td> <td>K</td> <td>8</td> <td>Kx8</td> <td>Good</td> <td>Up to ~4.0x</td> <td>❌</td> <td>✅</td></tr></tbody>",ea,Ut,la,x,aa,vt,Hs='<a href="https://hf.co/papers/2306.00978" rel="nofollow">Activation-aware Weight Quantization (AWQ)</a> doesn’t quantize all the weights in a model, and instead, it preserves a small percentage of weights that are important for LLM performance. This significantly reduces quantization loss such that you can run models in 4-bit precision without experiencing any performance degradation.',na,jt,Ls='There are several libraries for quantizing models with the AWQ algorithm, such as <a href="https://github.com/mit-han-lab/llm-awq" rel="nofollow">llm-awq</a>, <a href="https://github.com/casper-hansen/AutoAWQ" rel="nofollow">autoawq</a> or <a href="https://huggingface.co/docs/optimum/main/en/intel/optimization_inc" rel="nofollow">optimum-intel</a>. Transformers supports loading models quantized with the llm-awq and autoawq libraries. This guide will show you how to load models quantized with autoawq, but the process is similar for llm-awq quantized models.',sa,_t,As="Make sure you have autoawq installed:",ia,Ct,oa,qt,Ys='AWQ-quantized models can be identified by checking the <code>quantization_config</code> attribute in the model’s <a href="https://huggingface.co/TheBloke/zephyr-7B-alpha-AWQ/blob/main/config.json" rel="nofollow">config.json</a> file:',ra,Zt,pa,kt,Ps='A quantized model is loaded with the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method. If you loaded your model on the CPU, make sure to move it to a GPU device first. Use the <code>device_map</code> parameter to specify where to place the model:',ma,Gt,ua,zt,Ss="Loading an AWQ-quantized model automatically sets other weights to fp16 by default for performance reasons. If you want to load these other weights in a different format, use the <code>torch_dtype</code> parameter:",da,Qt,fa,It,Ds='AWQ quantization can also be combined with <a href="perf_infer_gpu_one#flashattention-2">FlashAttention-2</a> to further accelerate inference:',ha,Wt,ca,Ft,Ma,xt,Ks='Fused modules offers improved accuracy and performance and it is supported out-of-the-box for AWQ modules for <a href="https://huggingface.co/meta-llama" rel="nofollow">Llama</a> and <a href="https://huggingface.co/mistralai/Mistral-7B-v0.1" rel="nofollow">Mistral</a> architectures, but you can also fuse AWQ modules for unsupported architectures.',ba,B,ga,V,ya,Bt,Ta,Vt,Os="Recent versions of <code>autoawq</code> supports exllama-v2 kernels for faster prefill and decoding. To get started, first install the latest version of <code>autoawq</code> by running:",wa,Xt,$a,Rt,ti="Get started by passing an <code>AwqConfig()</code> with <code>version=&quot;exllama&quot;</code>.",Ja,Et,Ua,X,va,Nt,ja,R,_a,Ht,ei='The <a href="https://github.com/PanQiWei/AutoGPTQ" rel="nofollow">AutoGPTQ</a> library implements the GPTQ algorithm, a post-training quantization technique where each row of the weight matrix is quantized independently to find a version of the weights that minimizes the error. These weights are quantized to int4, but they’re restored to fp16 on the fly during inference. This can save your memory-usage by 4x because the int4 weights are dequantized in a fused kernel rather than a GPU’s global memory, and you can also expect a speedup in inference because using a lower bitwidth takes less time to communicate.',Ca,Lt,li="Before you begin, make sure the following libraries are installed:",qa,At,Za,Yt,ai='To quantize a model (currently only supported for text models), you need to create a <a href="/docs/transformers/main/en/main_classes/quantization#transformers.GPTQConfig">GPTQConfig</a> class and set the number of bits to quantize to, a dataset to calibrate the weights for quantization, and a tokenizer to prepare the dataset.',ka,Pt,Ga,St,ni="You could also pass your own dataset as a list of strings, but it is highly recommended to use the same dataset from the GPTQ paper.",za,Dt,Qa,Kt,si='Load a model to quantize and pass the <code>gptq_config</code> to the <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoModel.from_pretrained">from_pretrained()</a> method. Set <code>device_map=&quot;auto&quot;</code> to automatically offload the model to a CPU to help fit the model in memory, and allow the model modules to be moved between the CPU and GPU for quantization.',Ia,Ot,Wa,te,ii="If you’re running out of memory because a dataset is too large, disk offloading is not supported. If this is the case, try passing the <code>max_memory</code> parameter to allocate the amount of memory to use on your device (GPU and CPU):",Fa,ee,xa,E,Ba,le,oi='Once your model is quantized, you can push the model and tokenizer to the Hub where it can be easily shared and accessed. Use the <a href="/docs/transformers/main/en/main_classes/model#transformers.utils.PushToHubMixin.push_to_hub">push_to_hub()</a> method to save the <a href="/docs/transformers/main/en/main_classes/quantization#transformers.GPTQConfig">GPTQConfig</a>:',Va,ae,Xa,ne,ri='You could also save your quantized model locally with the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.save_pretrained">save_pretrained()</a> method. If the model was quantized with the <code>device_map</code> parameter, make sure to move the entire model to a GPU or CPU before saving it. For example, to save the model on a CPU:',Ra,se,Ea,ie,pi='Reload a quantized model with the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method, and set <code>device_map=&quot;auto&quot;</code> to automatically distribute the model on all available GPUs to load the model faster without using more memory than needed.',Na,oe,Ha,re,La,pe,mi='<a href="https://github.com/turboderp/exllama" rel="nofollow">ExLlama</a> is a Python/C++/CUDA implementation of the <a href="model_doc/llama">Llama</a> model that is designed for faster inference with 4-bit GPTQ weights (check out these <a href="https://github.com/huggingface/optimum/tree/main/tests/benchmark#gptq-benchmark" rel="nofollow">benchmarks</a>). The ExLlama kernel is activated by default when you create a <a href="/docs/transformers/main/en/main_classes/quantization#transformers.GPTQConfig">GPTQConfig</a> object. To boost inference speed even further, use the <a href="https://github.com/turboderp/exllamav2" rel="nofollow">ExLlamaV2</a> kernels by configuring the <code>exllama_config</code> parameter:',Aa,me,Ya,N,Pa,ue,ui="The ExLlama kernels are only supported when the entire model is on the GPU. If you’re doing inference on a CPU with AutoGPTQ (version > 0.4.2), then you’ll need to disable the ExLlama kernel. This overwrites the attributes related to the ExLlama kernels in the quantization config of the config.json file.",Sa,de,Da,fe,Ka,he,di='<a href="https://github.com/TimDettmers/bitsandbytes" rel="nofollow">bitsandbytes</a> is the easiest option for quantizing a model to 8 and 4-bit. 8-bit quantization multiplies outliers in fp16 with non-outliers in int8, converts the non-outlier values back to fp16, and then adds them together to return the weights in fp16. This reduces the degradative effect outlier values have on a model’s performance. 4-bit quantization compresses a model even further, and it is commonly used with <a href="https://hf.co/papers/2305.14314" rel="nofollow">QLoRA</a> to finetune quantized LLMs.',Oa,ce,fi="To use bitsandbytes, make sure you have the following libraries installed:",tn,H,en,Me,hi='Now you can quantize a model with the <code>load_in_8bit</code> or <code>load_in_4bit</code> parameters in the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method. This works for any model in any modality, as long as it supports loading with Accelerate and contains <code>torch.nn.Linear</code> layers.',ln,L,an,A,nn,be,ci="You can check your memory footprint with the <code>get_memory_footprint</code> method:",sn,ge,on,ye,Mi='Quantized models can be loaded from the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method without needing to specify the <code>load_in_8bit</code> or <code>load_in_4bit</code> parameters:',rn,Te,pn,we,mn,Y,un,$e,bi="This section explores some of the specific features of 8-bit models, such as offloading, outlier thresholds, skipping module conversion, and finetuning.",dn,Je,fn,Ue,gi='8-bit models can offload weights between the CPU and GPU to support fitting very large models into memory. The weights dispatched to the CPU are actually stored in <strong>float32</strong>, and aren’t converted to 8-bit. For example, to enable offloading for the <a href="https://huggingface.co/bigscience/bloom-1b7" rel="nofollow">bigscience/bloom-1b7</a> model, start by creating a <a href="/docs/transformers/main/en/main_classes/quantization#transformers.BitsAndBytesConfig">BitsAndBytesConfig</a>:',hn,ve,cn,je,yi="Design a custom device map to fit everything on your GPU except for the <code>lm_head</code>, which you’ll dispatch to the CPU:",Mn,_e,bn,Ce,Ti="Now load your model with the custom <code>device_map</code> and <code>quantization_config</code>:",gn,qe,yn,Ze,Tn,ke,wi="An “outlier” is a hidden state value greater than a certain threshold, and these values are computed in fp16. While the values are usually normally distributed ([-3.5, 3.5]), this distribution can be very different for large models ([-60, 6] or [6, 60]). 8-bit quantization works well for values ~5, but beyond that, there is a significant performance penalty. A good default threshold value is 6, but a lower threshold may be needed for more unstable models (small models or finetuning).",wn,Ge,$i='To find the best threshold for your model, we recommend experimenting with the <code>llm_int8_threshold</code> parameter in <a href="/docs/transformers/main/en/main_classes/quantization#transformers.BitsAndBytesConfig">BitsAndBytesConfig</a>:',$n,ze,Jn,Qe,Un,Ie,Ji='For some models, like <a href="model_doc/jukebox">Jukebox</a>, you don’t need to quantize every module to 8-bit which can actually cause instability. With Jukebox, there are several <code>lm_head</code> modules that should be skipped using the <code>llm_int8_skip_modules</code> parameter in <a href="/docs/transformers/main/en/main_classes/quantization#transformers.BitsAndBytesConfig">BitsAndBytesConfig</a>:',vn,We,jn,Fe,_n,xe,Ui='With the <a href="https://github.com/huggingface/peft" rel="nofollow">PEFT</a> library, you can finetune large models like <a href="https://huggingface.co/google/flan-t5-large" rel="nofollow">flan-t5-large</a> and <a href="https://huggingface.co/facebook/opt-6.7b" rel="nofollow">facebook/opt-6.7b</a> with 8-bit quantization. You don’t need to pass the <code>device_map</code> parameter for training because it’ll automatically load your model on a GPU. However, you can still customize the device map with the <code>device_map</code> parameter if you want to (<code>device_map=&quot;auto&quot;</code> should only be used for inference).',Cn,Be,qn,P,Zn,Ve,vi="This section explores some of the specific features of 4-bit models, such as changing the compute data type, using the Normal Float 4 (NF4) data type, and using nested quantization.",kn,Xe,Gn,Re,ji='To speedup computation, you can change the data type from float32 (the default value) to bf16 using the <code>bnb_4bit_compute_dtype</code> parameter in <a href="/docs/transformers/main/en/main_classes/quantization#transformers.BitsAndBytesConfig">BitsAndBytesConfig</a>:',zn,Ee,Qn,Ne,In,He,_i='NF4 is a 4-bit data type from the <a href="https://hf.co/papers/2305.14314" rel="nofollow">QLoRA</a> paper, adapted for weights initialized from a normal distribution. You should use NF4 for training 4-bit base models. This can be configured with the <code>bnb_4bit_quant_type</code> parameter in the <a href="/docs/transformers/main/en/main_classes/quantization#transformers.BitsAndBytesConfig">BitsAndBytesConfig</a>:',Wn,Le,Fn,Ae,Ci="For inference, the <code>bnb_4bit_quant_type</code> does not have a huge impact on performance. However, to remain consistent with the model weights, you should use the <code>bnb_4bit_compute_dtype</code> and <code>torch_dtype</code> values.",xn,Ye,Bn,Pe,qi='Nested quantization is a technique that can save additional memory at no additional performance cost. This feature performs a second quantization of the already quantized weights to save an addition 0.4 bits/parameter. For example, with nested quantization, you can finetune a <a href="https://huggingface.co/meta-llama/Llama-2-13b" rel="nofollow">Llama-13b</a> model on a 16GB NVIDIA T4 GPU with a sequence length of 1024, a batch size of 1, and enabling gradient accumulation with 4 steps.',Vn,Se,Xn,De,Rn,Ke,Zi='The <a href="https://github.com/NetEase-FuXi/EETQ" rel="nofollow">EETQ</a> library supports int8 per-channel weight-only quantization for NVIDIA GPUS. The high-performance GEMM and GEMV kernels are from FasterTransformer and TensorRT-LLM. It requires no calibration dataset and does not need to pre-quantize your model. Moreover, the accuracy degradation is negligible owing to the per-channel quantization.',En,Oe,ki='Make sure you have eetq installed from the <a href="https://github.com/NetEase-FuXi/EETQ/releases" rel="nofollow">relase page</a>',Nn,tl,Hn,el,Gi='or via the source code <a href="https://github.com/NetEase-FuXi/EETQ" rel="nofollow">https://github.com/NetEase-FuXi/EETQ</a>. EETQ requires CUDA capability &lt;= 8.9 and &gt;= 7.0',Ln,ll,An,al,zi="An unquantized model can be quantized via “from_pretrained”.",Yn,nl,Pn,sl,Qi="A quantized model can be saved via “saved_pretrained” and be reused again via the “from_pretrained”.",Sn,il,Dn,ol,Kn,rl,Ii='The <a href="https://huggingface.co/docs/optimum/index" rel="nofollow">Optimum</a> library supports quantization for Intel, Furiosa, ONNX Runtime, GPTQ, and lower-level PyTorch quantization functions. Consider using Optimum for quantization if you’re using specific and optimized hardware like Intel CPUs, Furiosa NPUs or a model accelerator like ONNX Runtime.',On,pl,ts,ml,Wi='To compare the speed, throughput, and latency of each quantization scheme, check the following benchmarks obtained from the <a href="https://github.com/huggingface/optimum-benchmark" rel="nofollow">optimum-benchmark</a> library. The benchmark was run on a NVIDIA A1000 for the <a href="https://huggingface.co/TheBloke/Mistral-7B-v0.1-AWQ" rel="nofollow">TheBloke/Mistral-7B-v0.1-AWQ</a> and <a href="https://huggingface.co/TheBloke/Mistral-7B-v0.1-GPTQ" rel="nofollow">TheBloke/Mistral-7B-v0.1-GPTQ</a> models. These were also tested against the bitsandbytes quantization methods as well as a native fp16 model.',es,S,Fi='<div><img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/quantization/forward_memory_plot.png" alt="forward peak memory per batch size"/> <figcaption class="mt-2 text-center text-sm text-gray-500">forward peak memory/batch size</figcaption></div> <div><img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/quantization/generate_memory_plot.png" alt="generate peak memory per batch size"/> <figcaption class="mt-2 text-center text-sm text-gray-500">generate peak memory/batch size</figcaption></div>',ls,D,xi='<div><img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/quantization/generate_throughput_plot.png" alt="generate throughput per batch size"/> <figcaption class="mt-2 text-center text-sm text-gray-500">generate throughput/batch size</figcaption></div> <div><img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/quantization/forward_latency_plot.png" alt="forward latency per batch size"/> <figcaption class="mt-2 text-center text-sm text-gray-500">forward latency/batch size</figcaption></div>',as,ul,Bi='The benchmarks indicate AWQ quantization is the fastest for inference, text generation, and has the lowest peak memory for text generation. However, AWQ has the largest forward latency per batch size. For a more detailed discussion about the pros and cons of each quantization method, read the <a href="https://huggingface.co/blog/overview-quantization-transformers" rel="nofollow">Overview of natively supported quantization schemes in 🤗 Transformers</a> blog post.',ns,dl,ss,fl,Vi='The <a href="https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-AWQ" rel="nofollow">TheBloke/Mistral-7B-OpenOrca-AWQ</a> model was benchmarked with <code>batch_size=1</code> with and without fused modules.',is,K,Xi="Unfused module",os,hl,Ri='<thead><tr><th align="right">Batch Size</th> <th align="right">Prefill Length</th> <th align="right">Decode Length</th> <th align="right">Prefill tokens/s</th> <th align="right">Decode tokens/s</th> <th align="left">Memory (VRAM)</th></tr></thead> <tbody><tr><td align="right">1</td> <td align="right">32</td> <td align="right">32</td> <td align="right">60.0984</td> <td align="right">38.4537</td> <td align="left">4.50 GB (5.68%)</td></tr> <tr><td align="right">1</td> <td align="right">64</td> <td align="right">64</td> <td align="right">1333.67</td> <td align="right">31.6604</td> <td align="left">4.50 GB (5.68%)</td></tr> <tr><td align="right">1</td> <td align="right">128</td> <td align="right">128</td> <td align="right">2434.06</td> <td align="right">31.6272</td> <td align="left">4.50 GB (5.68%)</td></tr> <tr><td align="right">1</td> <td align="right">256</td> <td align="right">256</td> <td align="right">3072.26</td> <td align="right">38.1731</td> <td align="left">4.50 GB (5.68%)</td></tr> <tr><td align="right">1</td> <td align="right">512</td> <td align="right">512</td> <td align="right">3184.74</td> <td align="right">31.6819</td> <td align="left">4.59 GB (5.80%)</td></tr> <tr><td align="right">1</td> <td align="right">1024</td> <td align="right">1024</td> <td align="right">3148.18</td> <td align="right">36.8031</td> <td align="left">4.81 GB (6.07%)</td></tr> <tr><td align="right">1</td> <td align="right">2048</td> <td align="right">2048</td> <td align="right">2927.33</td> <td align="right">35.2676</td> <td align="left">5.73 GB (7.23%)</td></tr></tbody>',rs,O,Ei="Fused module",ps,cl,Ni='<thead><tr><th align="right">Batch Size</th> <th align="right">Prefill Length</th> <th align="right">Decode Length</th> <th align="right">Prefill tokens/s</th> <th align="right">Decode tokens/s</th> <th align="left">Memory (VRAM)</th></tr></thead> <tbody><tr><td align="right">1</td> <td align="right">32</td> <td align="right">32</td> <td align="right">81.4899</td> <td align="right">80.2569</td> <td align="left">4.00 GB (5.05%)</td></tr> <tr><td align="right">1</td> <td align="right">64</td> <td align="right">64</td> <td align="right">1756.1</td> <td align="right">106.26</td> <td align="left">4.00 GB (5.05%)</td></tr> <tr><td align="right">1</td> <td align="right">128</td> <td align="right">128</td> <td align="right">2479.32</td> <td align="right">105.631</td> <td align="left">4.00 GB (5.06%)</td></tr> <tr><td align="right">1</td> <td align="right">256</td> <td align="right">256</td> <td align="right">1813.6</td> <td align="right">85.7485</td> <td align="left">4.01 GB (5.06%)</td></tr> <tr><td align="right">1</td> <td align="right">512</td> <td align="right">512</td> <td align="right">2848.9</td> <td align="right">97.701</td> <td align="left">4.11 GB (5.19%)</td></tr> <tr><td align="right">1</td> <td align="right">1024</td> <td align="right">1024</td> <td align="right">3044.35</td> <td align="right">87.7323</td> <td align="left">4.41 GB (5.57%)</td></tr> <tr><td align="right">1</td> <td align="right">2048</td> <td align="right">2048</td> <td align="right">2715.11</td> <td align="right">89.4709</td> <td align="left">5.57 GB (7.04%)</td></tr></tbody>',ms,Ml,Hi='The speed and throughput of fused and unfused modules were also tested with the <a href="https://github.com/huggingface/optimum-benchmark" rel="nofollow">optimum-benchmark</a> library.',us,tt,Li='<div><img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/quantization/fused_forward_memory_plot.png" alt="generate throughput per batch size"/> <figcaption class="mt-2 text-center text-sm text-gray-500">forward peak memory/batch size</figcaption></div> <div><img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/quantization/fused_generate_throughput_plot.png" alt="forward latency per batch size"/> <figcaption class="mt-2 text-center text-sm text-gray-500">generate throughput/batch size</figcaption></div>',ds,bl,fs,gl,Ai=`Half-Quadratic Quantization (HQQ) implements on-the-fly quantization via fast robust optimization. It doesn’t require calibration data and can be used to quantize any model.<br/>
Please refer to the <a href="https://github.com/mobiusml/hqq/">official package</a> for more details.`,hs,yl,Yi="For installation, we recommend you use the following approach to get the latest version and build its corresponding CUDA kernels:",cs,Tl,Ms,wl,Pi='To quantize a model, you need to create an <a href="/docs/transformers/main/en/main_classes/quantization#transformers.HqqConfig">HqqConfig</a>. There are two ways of doing it:',bs,$l,gs,Jl,ys,Ul,Si="The second approach is especially interesting for quantizing Mixture-of-Experts (MoEs) because the experts are less affected by lower quantization settings.",Ts,vl,Di="Then you simply quantize the model as follows",ws,jl,$s,_l,Js,Cl,Ki=`HQQ supports various backends, including pure Pytorch and custom dequantization CUDA kernels. These backends are suitable for older gpus and peft/QLoRA training.
For faster inference, HQQ supports 4-bit fused kernels (TorchAO and Marlin), reaching up to 200 tokens/sec on a single 4090.
For more details on how to use the backends, please refer to <a href="https://github.com/mobiusml/hqq/?tab=readme-ov-file#backend" rel="nofollow">https://github.com/mobiusml/hqq/?tab=readme-ov-file#backend</a>`,Us,ql,vs,kl,js;return b=new k({props:{title:"Quantization",local:"quantization",headingTag:"h1"}}),Z=new W({props:{$$slots:{default:[$o]},$$scope:{ctx:J}}}),z=new k({props:{title:"Quanto",local:"quanto",headingTag:"h2"}}),Q=new W({props:{$$slots:{default:[Jo]},$$scope:{ctx:J}}}),st=new $({props:{code:"cGlwJTIwaW5zdGFsbCUyMHF1YW50byUwQXBpcCUyMGluc3RhbGwlMjBnaXQlMkJodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkZodWdnaW5nZmFjZSUyRmFjY2VsZXJhdGUuZ2l0JTBBcGlwJTIwaW5zdGFsbCUyMGdpdCUyQmh0dHBzJTNBJTJGJTJGZ2l0aHViLmNvbSUyRmh1Z2dpbmdmYWNlJTJGdHJhbnNmb3JtZXJzLmdpdA==",highlighted:`pip install quanto
pip install git+https://github.com/huggingface/accelerate.git
pip install git+https://github.com/huggingface/transformers.git`,wrap:!1}}),rt=new $({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUyQyUyMFF1YW50b0NvbmZpZyUwQSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIyZmFjZWJvb2slMkZvcHQtMTI1bSUyMiUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkKSUwQXF1YW50aXphdGlvbl9jb25maWclMjAlM0QlMjBRdWFudG9Db25maWcod2VpZ2h0cyUzRCUyMmludDglMjIpJTBBcXVhbnRpemVkX21vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkJTJDJTIwZGV2aWNlX21hcCUzRCUyMmN1ZGElM0EwJTIyJTJDJTIwcXVhbnRpemF0aW9uX2NvbmZpZyUzRHF1YW50aXphdGlvbl9jb25maWcp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer, QuantoConfig

model_id = <span class="hljs-string">&quot;facebook/opt-125m&quot;</span>
tokenizer = AutoTokenizer.from_pretrained(model_id)
quantization_config = QuantoConfig(weights=<span class="hljs-string">&quot;int8&quot;</span>)
quantized_model = AutoModelForCausalLM.from_pretrained(model_id, device_map=<span class="hljs-string">&quot;cuda:0&quot;</span>, quantization_config=quantization_config)`,wrap:!1}}),dt=new k({props:{title:"AQLM",local:"aqlm",headingTag:"h2"}}),Mt=new $({props:{code:"cGlwJTIwaW5zdGFsbCUyMGFxbG0lNUJncHUlMkNjcHUlNUQ=",highlighted:"pip install aqlm[gpu,cpu]",wrap:!1}}),yt=new k({props:{title:"PEFT",local:"peft",headingTag:"h3"}}),wt=new k({props:{title:"AQLM configurations",local:"aqlm-configurations",headingTag:"h3"}}),Ut=new k({props:{title:"AWQ",local:"awq",headingTag:"h2"}}),x=new W({props:{$$slots:{default:[Uo]},$$scope:{ctx:J}}}),Ct=new $({props:{code:"cGlwJTIwaW5zdGFsbCUyMGF1dG9hd3E=",highlighted:"pip install autoawq",wrap:!1}}),Zt=new $({props:{code:"JTdCJTBBJTIwJTIwJTIyX25hbWVfb3JfcGF0aCUyMiUzQSUyMCUyMiUyRndvcmtzcGFjZSUyRnByb2Nlc3MlMkZodWdnaW5nZmFjZWg0X3plcGh5ci03Yi1hbHBoYSUyRnNvdXJjZSUyMiUyQyUwQSUyMCUyMCUyMmFyY2hpdGVjdHVyZXMlMjIlM0ElMjAlNUIlMEElMjAlMjAlMjAlMjAlMjJNaXN0cmFsRm9yQ2F1c2FsTE0lMjIlMEElMjAlMjAlNUQlMkMlMEElMjAlMjAuLi4lMEElMjAlMjAuLi4lMEElMjAlMjAuLi4lMEElMjAlMjAlMjJxdWFudGl6YXRpb25fY29uZmlnJTIyJTNBJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIycXVhbnRfbWV0aG9kJTIyJTNBJTIwJTIyYXdxJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIyemVyb19wb2ludCUyMiUzQSUyMHRydWUlMkMlMEElMjAlMjAlMjAlMjAlMjJncm91cF9zaXplJTIyJTNBJTIwMTI4JTJDJTBBJTIwJTIwJTIwJTIwJTIyYml0cyUyMiUzQSUyMDQlMkMlMEElMjAlMjAlMjAlMjAlMjJ2ZXJzaW9uJTIyJTNBJTIwJTIyZ2VtbSUyMiUwQSUyMCUyMCU3RCUwQSU3RA==",highlighted:`<span class="hljs-punctuation">{</span>
  <span class="hljs-attr">&quot;_name_or_path&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;/workspace/process/huggingfaceh4_zephyr-7b-alpha/source&quot;</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;architectures&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
    <span class="hljs-string">&quot;MistralForCausalLM&quot;</span>
  <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
  ...
  ...
  ...
  <span class="hljs-attr">&quot;quantization_config&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;awq&quot;</span><span class="hljs-punctuation">,</span>
    <span class="hljs-attr">&quot;zero_point&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">true</span></span><span class="hljs-punctuation">,</span>
    <span class="hljs-attr">&quot;group_size&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-number">128</span><span class="hljs-punctuation">,</span>
    <span class="hljs-attr">&quot;bits&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-number">4</span><span class="hljs-punctuation">,</span>
    <span class="hljs-attr">&quot;version&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;gemm&quot;</span>
  <span class="hljs-punctuation">}</span>
<span class="hljs-punctuation">}</span>`,wrap:!1}}),Gt=new $({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUwQSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIyVGhlQmxva2UlMkZ6ZXBoeXItN0ItYWxwaGEtQVdRJTIyJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQlMkMlMjBkZXZpY2VfbWFwJTNEJTIyY3VkYSUzQTAlMjIp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer

model_id = <span class="hljs-string">&quot;TheBloke/zephyr-7B-alpha-AWQ&quot;</span>
model = AutoModelForCausalLM.from_pretrained(model_id, device_map=<span class="hljs-string">&quot;cuda:0&quot;</span>)`,wrap:!1}}),Qt=new $({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUwQSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIyVGhlQmxva2UlMkZ6ZXBoeXItN0ItYWxwaGEtQVdRJTIyJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MzIp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer

model_id = <span class="hljs-string">&quot;TheBloke/zephyr-7B-alpha-AWQ&quot;</span>
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float32)`,wrap:!1}}),Wt=new $({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMlRoZUJsb2tlJTJGemVwaHlyLTdCLWFscGhhLUFXUSUyMiUyQyUyMGF0dG5faW1wbGVtZW50YXRpb24lM0QlMjJmbGFzaF9hdHRlbnRpb25fMiUyMiUyQyUyMGRldmljZV9tYXAlM0QlMjJjdWRhJTNBMCUyMik=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;TheBloke/zephyr-7B-alpha-AWQ&quot;</span>, attn_implementation=<span class="hljs-string">&quot;flash_attention_2&quot;</span>, device_map=<span class="hljs-string">&quot;cuda:0&quot;</span>)`,wrap:!1}}),Ft=new k({props:{title:"Fused modules",local:"fused-modules",headingTag:"h3"}}),B=new W({props:{warning:!0,$$slots:{default:[vo]},$$scope:{ctx:J}}}),V=new _s({props:{id:"fuse",options:["supported architectures","unsupported architectures"],$$slots:{default:[Co]},$$scope:{ctx:J}}}),Bt=new k({props:{title:"Exllama-v2 support",local:"exllama-v2-support",headingTag:"h3"}}),Xt=new $({props:{code:"cGlwJTIwaW5zdGFsbCUyMGdpdCUyQmh0dHBzJTNBJTJGJTJGZ2l0aHViLmNvbSUyRmNhc3Blci1oYW5zZW4lMkZBdXRvQVdRLmdpdA==",highlighted:"pip install git+https://github.com/casper-hansen/AutoAWQ.git",wrap:!1}}),Et=new $({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMkMlMjBBdXRvVG9rZW5pemVyJTJDJTIwQXdxQ29uZmlnJTBBJTBBcXVhbnRpemF0aW9uX2NvbmZpZyUyMCUzRCUyMEF3cUNvbmZpZyh2ZXJzaW9uJTNEJTIyZXhsbGFtYSUyMiklMEElMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJUaGVCbG9rZSUyRk1pc3RyYWwtN0ItSW5zdHJ1Y3QtdjAuMS1BV1ElMjIlMkMlMEElMjAlMjAlMjAlMjBxdWFudGl6YXRpb25fY29uZmlnJTNEcXVhbnRpemF0aW9uX2NvbmZpZyUyQyUwQSUyMCUyMCUyMCUyMGRldmljZV9tYXAlM0QlMjJhdXRvJTIyJTJDJTBBKSUwQSUwQWlucHV0X2lkcyUyMCUzRCUyMHRvcmNoLnJhbmRpbnQoMCUyQyUyMDEwMCUyQyUyMCgxJTJDJTIwMTI4KSUyQyUyMGR0eXBlJTNEdG9yY2gubG9uZyUyQyUyMGRldmljZSUzRCUyMmN1ZGElMjIpJTBBb3V0cHV0JTIwJTNEJTIwbW9kZWwoaW5wdXRfaWRzKSUwQXByaW50KG91dHB1dC5sb2dpdHMpJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyVGhlQmxva2UlMkZNaXN0cmFsLTdCLUluc3RydWN0LXYwLjEtQVdRJTIyKSUwQWlucHV0X2lkcyUyMCUzRCUyMHRva2VuaXplci5lbmNvZGUoJTIySG93JTIwdG8lMjBtYWtlJTIwYSUyMGNha2UlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS50byhtb2RlbC5kZXZpY2UpJTBBb3V0cHV0JTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRfaWRzJTJDJTIwZG9fc2FtcGxlJTNEVHJ1ZSUyQyUyMG1heF9sZW5ndGglM0Q1MCUyQyUyMHBhZF90b2tlbl9pZCUzRDUwMjU2KSUwQXByaW50KHRva2VuaXplci5kZWNvZGUob3V0cHV0JTVCMCU1RCUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSk=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer, AwqConfig

quantization_config = AwqConfig(version=<span class="hljs-string">&quot;exllama&quot;</span>)

model = AutoModelForCausalLM.from_pretrained(
    <span class="hljs-string">&quot;TheBloke/Mistral-7B-Instruct-v0.1-AWQ&quot;</span>,
    quantization_config=quantization_config,
    device_map=<span class="hljs-string">&quot;auto&quot;</span>,
)

input_ids = torch.randint(<span class="hljs-number">0</span>, <span class="hljs-number">100</span>, (<span class="hljs-number">1</span>, <span class="hljs-number">128</span>), dtype=torch.long, device=<span class="hljs-string">&quot;cuda&quot;</span>)
output = model(input_ids)
<span class="hljs-built_in">print</span>(output.logits)

tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;TheBloke/Mistral-7B-Instruct-v0.1-AWQ&quot;</span>)
input_ids = tokenizer.encode(<span class="hljs-string">&quot;How to make a cake&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(model.device)
output = model.generate(input_ids, do_sample=<span class="hljs-literal">True</span>, max_length=<span class="hljs-number">50</span>, pad_token_id=<span class="hljs-number">50256</span>)
<span class="hljs-built_in">print</span>(tokenizer.decode(output[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>))`,wrap:!1}}),X=new W({props:{warning:!0,$$slots:{default:[qo]},$$scope:{ctx:J}}}),Nt=new k({props:{title:"AutoGPTQ",local:"autogptq",headingTag:"h2"}}),R=new W({props:{$$slots:{default:[Zo]},$$scope:{ctx:J}}}),At=new $({props:{code:"cGlwJTIwaW5zdGFsbCUyMGF1dG8tZ3B0cSUwQXBpcCUyMGluc3RhbGwlMjBnaXQlMkJodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkZodWdnaW5nZmFjZSUyRm9wdGltdW0uZ2l0JTBBcGlwJTIwaW5zdGFsbCUyMGdpdCUyQmh0dHBzJTNBJTJGJTJGZ2l0aHViLmNvbSUyRmh1Z2dpbmdmYWNlJTJGdHJhbnNmb3JtZXJzLmdpdCUwQXBpcCUyMGluc3RhbGwlMjAtLXVwZ3JhZGUlMjBhY2NlbGVyYXRl",highlighted:`pip install auto-gptq
pip install git+https://github.com/huggingface/optimum.git
pip install git+https://github.com/huggingface/transformers.git
pip install --upgrade accelerate`,wrap:!1}}),Pt=new $({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUyQyUyMEdQVFFDb25maWclMEElMEFtb2RlbF9pZCUyMCUzRCUyMCUyMmZhY2Vib29rJTJGb3B0LTEyNW0lMjIlMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCklMEFncHRxX2NvbmZpZyUyMCUzRCUyMEdQVFFDb25maWcoYml0cyUzRDQlMkMlMjBkYXRhc2V0JTNEJTIyYzQlMjIlMkMlMjB0b2tlbml6ZXIlM0R0b2tlbml6ZXIp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer, GPTQConfig

model_id = <span class="hljs-string">&quot;facebook/opt-125m&quot;</span>
tokenizer = AutoTokenizer.from_pretrained(model_id)
gptq_config = GPTQConfig(bits=<span class="hljs-number">4</span>, dataset=<span class="hljs-string">&quot;c4&quot;</span>, tokenizer=tokenizer)`,wrap:!1}}),Dt=new $({props:{code:"ZGF0YXNldCUyMCUzRCUyMCU1QiUyMmF1dG8tZ3B0cSUyMGlzJTIwYW4lMjBlYXN5LXRvLXVzZSUyMG1vZGVsJTIwcXVhbnRpemF0aW9uJTIwbGlicmFyeSUyMHdpdGglMjB1c2VyLWZyaWVuZGx5JTIwYXBpcyUyQyUyMGJhc2VkJTIwb24lMjBHUFRRJTIwYWxnb3JpdGhtLiUyMiU1RCUwQWdwdHFfY29uZmlnJTIwJTNEJTIwR1BUUUNvbmZpZyhiaXRzJTNENCUyQyUyMGRhdGFzZXQlM0RkYXRhc2V0JTJDJTIwdG9rZW5pemVyJTNEdG9rZW5pemVyKQ==",highlighted:`dataset = [<span class="hljs-string">&quot;auto-gptq is an easy-to-use model quantization library with user-friendly apis, based on GPTQ algorithm.&quot;</span>]
gptq_config = GPTQConfig(bits=<span class="hljs-number">4</span>, dataset=dataset, tokenizer=tokenizer)`,wrap:!1}}),Ot=new $({props:{code:"cXVhbnRpemVkX21vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkJTJDJTIwZGV2aWNlX21hcCUzRCUyMmF1dG8lMjIlMkMlMjBxdWFudGl6YXRpb25fY29uZmlnJTNEZ3B0cV9jb25maWcp",highlighted:'quantized_model = AutoModelForCausalLM.from_pretrained(model_id, device_map=<span class="hljs-string">&quot;auto&quot;</span>, quantization_config=gptq_config)',wrap:!1}}),ee=new $({props:{code:"cXVhbnRpemVkX21vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkJTJDJTIwZGV2aWNlX21hcCUzRCUyMmF1dG8lMjIlMkMlMjBtYXhfbWVtb3J5JTNEJTdCMCUzQSUyMCUyMjMwR2lCJTIyJTJDJTIwMSUzQSUyMCUyMjQ2R2lCJTIyJTJDJTIwJTIyY3B1JTIyJTNBJTIwJTIyMzBHaUIlMjIlN0QlMkMlMjBxdWFudGl6YXRpb25fY29uZmlnJTNEZ3B0cV9jb25maWcp",highlighted:'quantized_model = AutoModelForCausalLM.from_pretrained(model_id, device_map=<span class="hljs-string">&quot;auto&quot;</span>, max_memory={<span class="hljs-number">0</span>: <span class="hljs-string">&quot;30GiB&quot;</span>, <span class="hljs-number">1</span>: <span class="hljs-string">&quot;46GiB&quot;</span>, <span class="hljs-string">&quot;cpu&quot;</span>: <span class="hljs-string">&quot;30GiB&quot;</span>}, quantization_config=gptq_config)',wrap:!1}}),E=new W({props:{warning:!0,$$slots:{default:[ko]},$$scope:{ctx:J}}}),ae=new $({props:{code:"cXVhbnRpemVkX21vZGVsLnB1c2hfdG9faHViKCUyMm9wdC0xMjVtLWdwdHElMjIpJTBBdG9rZW5pemVyLnB1c2hfdG9faHViKCUyMm9wdC0xMjVtLWdwdHElMjIp",highlighted:`quantized_model.push_to_hub(<span class="hljs-string">&quot;opt-125m-gptq&quot;</span>)
tokenizer.push_to_hub(<span class="hljs-string">&quot;opt-125m-gptq&quot;</span>)`,wrap:!1}}),se=new $({props:{code:"cXVhbnRpemVkX21vZGVsLnNhdmVfcHJldHJhaW5lZCglMjJvcHQtMTI1bS1ncHRxJTIyKSUwQXRva2VuaXplci5zYXZlX3ByZXRyYWluZWQoJTIyb3B0LTEyNW0tZ3B0cSUyMiklMEElMEElMjMlMjBpZiUyMHF1YW50aXplZCUyMHdpdGglMjBkZXZpY2VfbWFwJTIwc2V0JTBBcXVhbnRpemVkX21vZGVsLnRvKCUyMmNwdSUyMiklMEFxdWFudGl6ZWRfbW9kZWwuc2F2ZV9wcmV0cmFpbmVkKCUyMm9wdC0xMjVtLWdwdHElMjIp",highlighted:`quantized_model.save_pretrained(<span class="hljs-string">&quot;opt-125m-gptq&quot;</span>)
tokenizer.save_pretrained(<span class="hljs-string">&quot;opt-125m-gptq&quot;</span>)

<span class="hljs-comment"># if quantized with device_map set</span>
quantized_model.to(<span class="hljs-string">&quot;cpu&quot;</span>)
quantized_model.save_pretrained(<span class="hljs-string">&quot;opt-125m-gptq&quot;</span>)`,wrap:!1}}),oe=new $({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIyJTdCeW91cl91c2VybmFtZSU3RCUyRm9wdC0xMjVtLWdwdHElMjIlMkMlMjBkZXZpY2VfbWFwJTNEJTIyYXV0byUyMik=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM

model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;{your_username}/opt-125m-gptq&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>)`,wrap:!1}}),re=new k({props:{title:"ExLlama",local:"exllama",headingTag:"h3"}}),me=new $({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMkMlMjBHUFRRQ29uZmlnJTBBJTBBZ3B0cV9jb25maWclMjAlM0QlMjBHUFRRQ29uZmlnKGJpdHMlM0Q0JTJDJTIwZXhsbGFtYV9jb25maWclM0QlN0IlMjJ2ZXJzaW9uJTIyJTNBMiU3RCklMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjIlN0J5b3VyX3VzZXJuYW1lJTdEJTJGb3B0LTEyNW0tZ3B0cSUyMiUyQyUyMGRldmljZV9tYXAlM0QlMjJhdXRvJTIyJTJDJTIwcXVhbnRpemF0aW9uX2NvbmZpZyUzRGdwdHFfY29uZmlnKQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, GPTQConfig

gptq_config = GPTQConfig(bits=<span class="hljs-number">4</span>, exllama_config={<span class="hljs-string">&quot;version&quot;</span>:<span class="hljs-number">2</span>})
model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;{your_username}/opt-125m-gptq&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>, quantization_config=gptq_config)`,wrap:!1}}),N=new W({props:{warning:!0,$$slots:{default:[Go]},$$scope:{ctx:J}}}),de=new $({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMkMlMjBHUFRRQ29uZmlnJTBBZ3B0cV9jb25maWclMjAlM0QlMjBHUFRRQ29uZmlnKGJpdHMlM0Q0JTJDJTIwdXNlX2V4bGxhbWElM0RGYWxzZSklMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjIlN0J5b3VyX3VzZXJuYW1lJTdEJTJGb3B0LTEyNW0tZ3B0cSUyMiUyQyUyMGRldmljZV9tYXAlM0QlMjJjcHUlMjIlMkMlMjBxdWFudGl6YXRpb25fY29uZmlnJTNEZ3B0cV9jb25maWcp",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, GPTQConfig
gptq_config = GPTQConfig(bits=<span class="hljs-number">4</span>, use_exllama=<span class="hljs-literal">False</span>)
model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;{your_username}/opt-125m-gptq&quot;</span>, device_map=<span class="hljs-string">&quot;cpu&quot;</span>, quantization_config=gptq_config)`,wrap:!1}}),fe=new k({props:{title:"bitsandbytes",local:"bitsandbytes",headingTag:"h2"}}),H=new _s({props:{id:"bnb",options:["8-bit","4-bit"],$$slots:{default:[Io]},$$scope:{ctx:J}}}),L=new _s({props:{id:"bnb",options:["8-bit","4-bit"],$$slots:{default:[xo]},$$scope:{ctx:J}}}),A=new W({props:{warning:!0,$$slots:{default:[Bo]},$$scope:{ctx:J}}}),ge=new $({props:{code:"cHJpbnQobW9kZWwuZ2V0X21lbW9yeV9mb290cHJpbnQoKSk=",highlighted:'<span class="hljs-built_in">print</span>(model.get_memory_footprint())',wrap:!1}}),Te=new $({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMiU3QnlvdXJfdXNlcm5hbWUlN0QlMkZibG9vbS01NjBtLThiaXQlMjIlMkMlMjBkZXZpY2VfbWFwJTNEJTIyYXV0byUyMik=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;{your_username}/bloom-560m-8bit&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>)`,wrap:!1}}),we=new k({props:{title:"8-bit",local:"8-bit",headingTag:"h3"}}),Y=new W({props:{$$slots:{default:[Vo]},$$scope:{ctx:J}}}),Je=new k({props:{title:"Offloading",local:"offloading",headingTag:"h4"}}),ve=new $({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQml0c0FuZEJ5dGVzQ29uZmlnJTBBJTBBcXVhbnRpemF0aW9uX2NvbmZpZyUyMCUzRCUyMEJpdHNBbmRCeXRlc0NvbmZpZyhsbG1faW50OF9lbmFibGVfZnAzMl9jcHVfb2ZmbG9hZCUzRFRydWUp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, BitsAndBytesConfig

quantization_config = BitsAndBytesConfig(llm_int8_enable_fp32_cpu_offload=<span class="hljs-literal">True</span>)`,wrap:!1}}),_e=new $({props:{code:"ZGV2aWNlX21hcCUyMCUzRCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMnRyYW5zZm9ybWVyLndvcmRfZW1iZWRkaW5ncyUyMiUzQSUyMDAlMkMlMEElMjAlMjAlMjAlMjAlMjJ0cmFuc2Zvcm1lci53b3JkX2VtYmVkZGluZ3NfbGF5ZXJub3JtJTIyJTNBJTIwMCUyQyUwQSUyMCUyMCUyMCUyMCUyMmxtX2hlYWQlMjIlM0ElMjAlMjJjcHUlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjJ0cmFuc2Zvcm1lci5oJTIyJTNBJTIwMCUyQyUwQSUyMCUyMCUyMCUyMCUyMnRyYW5zZm9ybWVyLmxuX2YlMjIlM0ElMjAwJTJDJTBBJTdE",highlighted:`device_map = {
    <span class="hljs-string">&quot;transformer.word_embeddings&quot;</span>: <span class="hljs-number">0</span>,
    <span class="hljs-string">&quot;transformer.word_embeddings_layernorm&quot;</span>: <span class="hljs-number">0</span>,
    <span class="hljs-string">&quot;lm_head&quot;</span>: <span class="hljs-string">&quot;cpu&quot;</span>,
    <span class="hljs-string">&quot;transformer.h&quot;</span>: <span class="hljs-number">0</span>,
    <span class="hljs-string">&quot;transformer.ln_f&quot;</span>: <span class="hljs-number">0</span>,
}`,wrap:!1}}),qe=new $({props:{code:"bW9kZWxfOGJpdCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJiaWdzY2llbmNlJTJGYmxvb20tMWI3JTIyJTJDJTBBJTIwJTIwJTIwJTIwZGV2aWNlX21hcCUzRGRldmljZV9tYXAlMkMlMEElMjAlMjAlMjAlMjBxdWFudGl6YXRpb25fY29uZmlnJTNEcXVhbnRpemF0aW9uX2NvbmZpZyUyQyUwQSk=",highlighted:`model_8bit = AutoModelForCausalLM.from_pretrained(
    <span class="hljs-string">&quot;bigscience/bloom-1b7&quot;</span>,
    device_map=device_map,
    quantization_config=quantization_config,
)`,wrap:!1}}),Ze=new k({props:{title:"Outlier threshold",local:"outlier-threshold",headingTag:"h4"}}),ze=new $({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQml0c0FuZEJ5dGVzQ29uZmlnJTBBJTBBbW9kZWxfaWQlMjAlM0QlMjAlMjJiaWdzY2llbmNlJTJGYmxvb20tMWI3JTIyJTBBJTBBcXVhbnRpemF0aW9uX2NvbmZpZyUyMCUzRCUyMEJpdHNBbmRCeXRlc0NvbmZpZyglMEElMjAlMjAlMjAlMjBsbG1faW50OF90aHJlc2hvbGQlM0QxMCUyQyUwQSklMEElMEFtb2RlbF84Yml0JTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMG1vZGVsX2lkJTJDJTBBJTIwJTIwJTIwJTIwZGV2aWNlX21hcCUzRGRldmljZV9tYXAlMkMlMEElMjAlMjAlMjAlMjBxdWFudGl6YXRpb25fY29uZmlnJTNEcXVhbnRpemF0aW9uX2NvbmZpZyUyQyUwQSk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, BitsAndBytesConfig

model_id = <span class="hljs-string">&quot;bigscience/bloom-1b7&quot;</span>

quantization_config = BitsAndBytesConfig(
    llm_int8_threshold=<span class="hljs-number">10</span>,
)

model_8bit = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map=device_map,
    quantization_config=quantization_config,
)`,wrap:!1}}),Qe=new k({props:{title:"Skip module conversion",local:"skip-module-conversion",headingTag:"h4"}}),We=new $({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUyQyUyMEJpdHNBbmRCeXRlc0NvbmZpZyUwQSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIyYmlnc2NpZW5jZSUyRmJsb29tLTFiNyUyMiUwQSUwQXF1YW50aXphdGlvbl9jb25maWclMjAlM0QlMjBCaXRzQW5kQnl0ZXNDb25maWcoJTBBJTIwJTIwJTIwJTIwbGxtX2ludDhfc2tpcF9tb2R1bGVzJTNEJTVCJTIybG1faGVhZCUyMiU1RCUyQyUwQSklMEElMEFtb2RlbF84Yml0JTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMG1vZGVsX2lkJTJDJTBBJTIwJTIwJTIwJTIwZGV2aWNlX21hcCUzRCUyMmF1dG8lMjIlMkMlMEElMjAlMjAlMjAlMjBxdWFudGl6YXRpb25fY29uZmlnJTNEcXVhbnRpemF0aW9uX2NvbmZpZyUyQyUwQSk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig

model_id = <span class="hljs-string">&quot;bigscience/bloom-1b7&quot;</span>

quantization_config = BitsAndBytesConfig(
    llm_int8_skip_modules=[<span class="hljs-string">&quot;lm_head&quot;</span>],
)

model_8bit = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map=<span class="hljs-string">&quot;auto&quot;</span>,
    quantization_config=quantization_config,
)`,wrap:!1}}),Fe=new k({props:{title:"Finetuning",local:"finetuning",headingTag:"h4"}}),Be=new k({props:{title:"4-bit",local:"4-bit",headingTag:"h3"}}),P=new W({props:{$$slots:{default:[Xo]},$$scope:{ctx:J}}}),Xe=new k({props:{title:"Compute data type",local:"compute-data-type",headingTag:"h4"}}),Ee=new $({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQml0c0FuZEJ5dGVzQ29uZmlnJTBBJTBBcXVhbnRpemF0aW9uX2NvbmZpZyUyMCUzRCUyMEJpdHNBbmRCeXRlc0NvbmZpZyhsb2FkX2luXzRiaXQlM0RUcnVlJTJDJTIwYm5iXzRiaXRfY29tcHV0ZV9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2KQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BitsAndBytesConfig

quantization_config = BitsAndBytesConfig(load_in_4bit=<span class="hljs-literal">True</span>, bnb_4bit_compute_dtype=torch.bfloat16)`,wrap:!1}}),Ne=new k({props:{title:"Normal Float 4 (NF4)",local:"normal-float-4-nf4",headingTag:"h4"}}),Le=new $({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJpdHNBbmRCeXRlc0NvbmZpZyUwQSUwQW5mNF9jb25maWclMjAlM0QlMjBCaXRzQW5kQnl0ZXNDb25maWcoJTBBJTIwJTIwJTIwJTIwbG9hZF9pbl80Yml0JTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMGJuYl80Yml0X3F1YW50X3R5cGUlM0QlMjJuZjQlMjIlMkMlMEEpJTBBJTBBbW9kZWxfbmY0JTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkJTJDJTIwcXVhbnRpemF0aW9uX2NvbmZpZyUzRG5mNF9jb25maWcp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BitsAndBytesConfig

nf4_config = BitsAndBytesConfig(
    load_in_4bit=<span class="hljs-literal">True</span>,
    bnb_4bit_quant_type=<span class="hljs-string">&quot;nf4&quot;</span>,
)

model_nf4 = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=nf4_config)`,wrap:!1}}),Ye=new k({props:{title:"Nested quantization",local:"nested-quantization",headingTag:"h4"}}),Se=new $({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJpdHNBbmRCeXRlc0NvbmZpZyUwQSUwQWRvdWJsZV9xdWFudF9jb25maWclMjAlM0QlMjBCaXRzQW5kQnl0ZXNDb25maWcoJTBBJTIwJTIwJTIwJTIwbG9hZF9pbl80Yml0JTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMGJuYl80Yml0X3VzZV9kb3VibGVfcXVhbnQlM0RUcnVlJTJDJTBBKSUwQSUwQW1vZGVsX2RvdWJsZV9xdWFudCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJtZXRhLWxsYW1hJTJGTGxhbWEtMi0xM2IlMjIlMkMlMjBxdWFudGl6YXRpb25fY29uZmlnJTNEZG91YmxlX3F1YW50X2NvbmZpZyk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BitsAndBytesConfig

double_quant_config = BitsAndBytesConfig(
    load_in_4bit=<span class="hljs-literal">True</span>,
    bnb_4bit_use_double_quant=<span class="hljs-literal">True</span>,
)

model_double_quant = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;meta-llama/Llama-2-13b&quot;</span>, quantization_config=double_quant_config)`,wrap:!1}}),De=new k({props:{title:"EETQ",local:"eetq",headingTag:"h2"}}),tl=new $({props:{code:"cGlwJTIwaW5zdGFsbCUyMC0tbm8tY2FjaGUtZGlyJTIwaHR0cHMlM0ElMkYlMkZnaXRodWIuY29tJTJGTmV0RWFzZS1GdVhpJTJGRUVUUSUyRnJlbGVhc2VzJTJGZG93bmxvYWQlMkZ2MS4wLjAlMkZFRVRRLTEuMC4wJTJCY3UxMjElMkJ0b3JjaDIuMS4yLWNwMzEwLWNwMzEwLWxpbnV4X3g4Nl82NC53aGw=",highlighted:'pip install --no-cache-dir https:<span class="hljs-regexp">//gi</span>thub.com<span class="hljs-regexp">/NetEase-FuXi/</span>EETQ<span class="hljs-regexp">/releases/</span>download<span class="hljs-regexp">/v1.0.0/</span>EETQ-<span class="hljs-number">1.0</span>.<span class="hljs-number">0</span>+cu121+torch2.<span class="hljs-number">1.2</span>-cp310-cp310-linux_x86_64.whl',wrap:!1}}),ll=new $({props:{code:"Z2l0JTIwY2xvbmUlMjBodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkZOZXRFYXNlLUZ1WGklMkZFRVRRLmdpdCUwQWNkJTIwRUVUUSUyRiUwQWdpdCUyMHN1Ym1vZHVsZSUyMHVwZGF0ZSUyMC0taW5pdCUyMC0tcmVjdXJzaXZlJTBBcGlwJTIwaW5zdGFsbCUyMC4=",highlighted:`git clone https:<span class="hljs-regexp">//gi</span>thub.com<span class="hljs-regexp">/NetEase-FuXi/</span>EETQ.git
cd EETQ/
git submodule update --init --recursive
pip install .`,wrap:!1}}),nl=new $({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwRWV0cUNvbmZpZyUwQXBhdGglMjAlM0QlMjAlMjIlMkZwYXRoJTJGdG8lMkZtb2RlbCUyMiUwQXF1YW50aXphdGlvbl9jb25maWclMjAlM0QlMjBFZXRxQ29uZmlnKCUyMmludDglMjIpJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQocGF0aCUyQyUyMGRldmljZV9tYXAlM0QlMjJhdXRvJTIyJTJDJTIwcXVhbnRpemF0aW9uX2NvbmZpZyUzRHF1YW50aXphdGlvbl9jb25maWcp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, EetqConfig
path = <span class="hljs-string">&quot;/path/to/model&quot;</span>
quantization_config = EetqConfig(<span class="hljs-string">&quot;int8&quot;</span>)
model = AutoModelForCausalLM.from_pretrained(path, device_map=<span class="hljs-string">&quot;auto&quot;</span>, quantization_config=quantization_config)`,wrap:!1}}),il=new $({props:{code:"cXVhbnRfcGF0aCUyMCUzRCUyMCUyMiUyRnBhdGglMkZ0byUyRnNhdmUlMkZxdWFudGl6ZWQlMkZtb2RlbCUyMiUwQW1vZGVsLnNhdmVfcHJldHJhaW5lZChxdWFudF9wYXRoKSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKHF1YW50X3BhdGglMkMlMjBkZXZpY2VfbWFwJTNEJTIyYXV0byUyMik=",highlighted:`quant_path = <span class="hljs-string">&quot;/path/to/save/quantized/model&quot;</span>
model.save_pretrained(quant_path)
model = AutoModelForCausalLM.from_pretrained(quant_path, device_map=<span class="hljs-string">&quot;auto&quot;</span>)`,wrap:!1}}),ol=new k({props:{title:"Optimum",local:"optimum",headingTag:"h2"}}),pl=new k({props:{title:"Benchmarks",local:"benchmarks",headingTag:"h2"}}),dl=new k({props:{title:"Fused AWQ modules",local:"fused-awq-modules",headingTag:"h3"}}),bl=new k({props:{title:"HQQ",local:"hqq",headingTag:"h2"}}),Tl=new $({props:{code:"cGlwJTIwaW5zdGFsbCUyMGhxcQ==",highlighted:'pip <span class="hljs-keyword">install</span> hqq',wrap:!1}}),$l=new $({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUyQyUyMEhxcUNvbmZpZyUwQSUwQSUyMyUyME1ldGhvZCUyMDElM0ElMjBhbGwlMjBsaW5lYXIlMjBsYXllcnMlMjB3aWxsJTIwdXNlJTIwdGhlJTIwc2FtZSUyMHF1YW50aXphdGlvbiUyMGNvbmZpZyUwQXF1YW50X2NvbmZpZyUyMCUyMCUzRCUyMEhxcUNvbmZpZyhuYml0cyUzRDglMkMlMjBncm91cF9zaXplJTNENjQlMkMlMjBxdWFudF96ZXJvJTNERmFsc2UlMkMlMjBxdWFudF9zY2FsZSUzREZhbHNlJTJDJTIwYXhpcyUzRDApJTIwJTIzYXhpcyUzRDAlMjBpcyUyMHVzZWQlMjBieSUyMGRlZmF1bHQ=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer, HqqConfig

<span class="hljs-comment"># Method 1: all linear layers will use the same quantization config</span>
quant_config  = HqqConfig(nbits=<span class="hljs-number">8</span>, group_size=<span class="hljs-number">64</span>, quant_zero=<span class="hljs-literal">False</span>, quant_scale=<span class="hljs-literal">False</span>, axis=<span class="hljs-number">0</span>) <span class="hljs-comment">#axis=0 is used by default</span>`,wrap:!1}}),Jl=new $({props:{code:"JTIzJTIwTWV0aG9kJTIwMiUzQSUyMGVhY2glMjBsaW5lYXIlMjBsYXllciUyMHdpdGglMjB0aGUlMjBzYW1lJTIwdGFnJTIwd2lsbCUyMHVzZSUyMGElMjBkZWRpY2F0ZWQlMjBxdWFudGl6YXRpb24lMjBjb25maWclMEFxNF9jb25maWclMjAlM0QlMjAlN0InbmJpdHMnJTNBNCUyQyUyMCdncm91cF9zaXplJyUzQTY0JTJDJTIwJ3F1YW50X3plcm8nJTNBRmFsc2UlMkMlMjAncXVhbnRfc2NhbGUnJTNBRmFsc2UlN0QlMEFxM19jb25maWclMjAlM0QlMjAlN0InbmJpdHMnJTNBMyUyQyUyMCdncm91cF9zaXplJyUzQTMyJTJDJTIwJ3F1YW50X3plcm8nJTNBRmFsc2UlMkMlMjAncXVhbnRfc2NhbGUnJTNBRmFsc2UlN0QlMEFxdWFudF9jb25maWclMjAlMjAlM0QlMjBIcXFDb25maWcoZHluYW1pY19jb25maWclM0QlN0IlMEElMjAlMjAnc2VsZl9hdHRuLnFfcHJvaiclM0FxNF9jb25maWclMkMlMEElMjAlMjAnc2VsZl9hdHRuLmtfcHJvaiclM0FxNF9jb25maWclMkMlMEElMjAlMjAnc2VsZl9hdHRuLnZfcHJvaiclM0FxNF9jb25maWclMkMlMEElMjAlMjAnc2VsZl9hdHRuLm9fcHJvaiclM0FxNF9jb25maWclMkMlMEElMEElMjAlMjAnbWxwLmdhdGVfcHJvaiclM0FxM19jb25maWclMkMlMEElMjAlMjAnbWxwLnVwX3Byb2onJTIwJTIwJTNBcTNfY29uZmlnJTJDJTBBJTIwJTIwJ21scC5kb3duX3Byb2onJTNBcTNfY29uZmlnJTJDJTBBJTdEKQ==",highlighted:`<span class="hljs-comment"># Method 2: each linear layer with the same tag will use a dedicated quantization config</span>
q4_config = {<span class="hljs-string">&#x27;nbits&#x27;</span>:<span class="hljs-number">4</span>, <span class="hljs-string">&#x27;group_size&#x27;</span>:<span class="hljs-number">64</span>, <span class="hljs-string">&#x27;quant_zero&#x27;</span>:<span class="hljs-literal">False</span>, <span class="hljs-string">&#x27;quant_scale&#x27;</span>:<span class="hljs-literal">False</span>}
q3_config = {<span class="hljs-string">&#x27;nbits&#x27;</span>:<span class="hljs-number">3</span>, <span class="hljs-string">&#x27;group_size&#x27;</span>:<span class="hljs-number">32</span>, <span class="hljs-string">&#x27;quant_zero&#x27;</span>:<span class="hljs-literal">False</span>, <span class="hljs-string">&#x27;quant_scale&#x27;</span>:<span class="hljs-literal">False</span>}
quant_config  = HqqConfig(dynamic_config={
  <span class="hljs-string">&#x27;self_attn.q_proj&#x27;</span>:q4_config,
  <span class="hljs-string">&#x27;self_attn.k_proj&#x27;</span>:q4_config,
  <span class="hljs-string">&#x27;self_attn.v_proj&#x27;</span>:q4_config,
  <span class="hljs-string">&#x27;self_attn.o_proj&#x27;</span>:q4_config,

  <span class="hljs-string">&#x27;mlp.gate_proj&#x27;</span>:q3_config,
  <span class="hljs-string">&#x27;mlp.up_proj&#x27;</span>  :q3_config,
  <span class="hljs-string">&#x27;mlp.down_proj&#x27;</span>:q3_config,
})`,wrap:!1}}),jl=new $({props:{code:"bW9kZWwlMjAlM0QlMjB0cmFuc2Zvcm1lcnMuQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMG1vZGVsX2lkJTJDJTIwJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwJTBBJTIwJTIwJTIwJTIwZGV2aWNlX21hcCUzRCUyMmN1ZGElMjIlMkMlMjAlMEElMjAlMjAlMjAlMjBxdWFudGl6YXRpb25fY29uZmlnJTNEcXVhbnRfY29uZmlnJTBBKQ==",highlighted:`model = transformers.AutoModelForCausalLM.from_pretrained(
    model_id, 
    torch_dtype=torch.float16, 
    device_map=<span class="hljs-string">&quot;cuda&quot;</span>, 
    quantization_config=quant_config
)`,wrap:!1}}),_l=new k({props:{title:"Optimized Runtime",local:"optimized-runtime",headingTag:"h3"}}),ql=new wo({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/quantization.md"}}),{c(){i=r("meta"),y=n(),o=r("p"),g=n(),u(b.$$.fragment),T=n(),j=r("p"),j.textContent=C,w=n(),q=r("p"),q.textContent=G,_=n(),u(Z.$$.fragment),U=n(),u(z.$$.fragment),v=n(),u(Q.$$.fragment),Gl=n(),lt=r("p"),lt.innerHTML=Cs,zl=n(),at=r("ul"),at.innerHTML=qs,Ql=n(),nt=r("p"),nt.textContent=Zs,Il=n(),u(st.$$.fragment),Wl=n(),it=r("p"),it.innerHTML=ks,Fl=n(),ot=r("p"),ot.innerHTML=Gs,xl=n(),u(rt.$$.fragment),Bl=n(),pt=r("p"),pt.textContent=zs,Vl=n(),mt=r("p"),mt.innerHTML=Qs,Xl=n(),F=r("div"),F.innerHTML=Is,Rl=n(),ut=r("p"),ut.textContent=Ws,El=n(),u(dt.$$.fragment),Nl=n(),ft=r("p"),ft.innerHTML=Fs,Hl=n(),ht=r("p"),ht.innerHTML=xs,Ll=n(),ct=r("p"),ct.innerHTML=Bs,Al=n(),u(Mt.$$.fragment),Yl=n(),bt=r("p"),bt.textContent=Vs,Pl=n(),gt=r("p"),gt.innerHTML=Xs,Sl=n(),u(yt.$$.fragment),Dl=n(),Tt=r("p"),Tt.innerHTML=Rs,Kl=n(),u(wt.$$.fragment),Ol=n(),$t=r("p"),$t.textContent=Es,ta=n(),Jt=r("table"),Jt.innerHTML=Ns,ea=n(),u(Ut.$$.fragment),la=n(),u(x.$$.fragment),aa=n(),vt=r("p"),vt.innerHTML=Hs,na=n(),jt=r("p"),jt.innerHTML=Ls,sa=n(),_t=r("p"),_t.textContent=As,ia=n(),u(Ct.$$.fragment),oa=n(),qt=r("p"),qt.innerHTML=Ys,ra=n(),u(Zt.$$.fragment),pa=n(),kt=r("p"),kt.innerHTML=Ps,ma=n(),u(Gt.$$.fragment),ua=n(),zt=r("p"),zt.innerHTML=Ss,da=n(),u(Qt.$$.fragment),fa=n(),It=r("p"),It.innerHTML=Ds,ha=n(),u(Wt.$$.fragment),ca=n(),u(Ft.$$.fragment),Ma=n(),xt=r("p"),xt.innerHTML=Ks,ba=n(),u(B.$$.fragment),ga=n(),u(V.$$.fragment),ya=n(),u(Bt.$$.fragment),Ta=n(),Vt=r("p"),Vt.innerHTML=Os,wa=n(),u(Xt.$$.fragment),$a=n(),Rt=r("p"),Rt.innerHTML=ti,Ja=n(),u(Et.$$.fragment),Ua=n(),u(X.$$.fragment),va=n(),u(Nt.$$.fragment),ja=n(),u(R.$$.fragment),_a=n(),Ht=r("p"),Ht.innerHTML=ei,Ca=n(),Lt=r("p"),Lt.textContent=li,qa=n(),u(At.$$.fragment),Za=n(),Yt=r("p"),Yt.innerHTML=ai,ka=n(),u(Pt.$$.fragment),Ga=n(),St=r("p"),St.textContent=ni,za=n(),u(Dt.$$.fragment),Qa=n(),Kt=r("p"),Kt.innerHTML=si,Ia=n(),u(Ot.$$.fragment),Wa=n(),te=r("p"),te.innerHTML=ii,Fa=n(),u(ee.$$.fragment),xa=n(),u(E.$$.fragment),Ba=n(),le=r("p"),le.innerHTML=oi,Va=n(),u(ae.$$.fragment),Xa=n(),ne=r("p"),ne.innerHTML=ri,Ra=n(),u(se.$$.fragment),Ea=n(),ie=r("p"),ie.innerHTML=pi,Na=n(),u(oe.$$.fragment),Ha=n(),u(re.$$.fragment),La=n(),pe=r("p"),pe.innerHTML=mi,Aa=n(),u(me.$$.fragment),Ya=n(),u(N.$$.fragment),Pa=n(),ue=r("p"),ue.textContent=ui,Sa=n(),u(de.$$.fragment),Da=n(),u(fe.$$.fragment),Ka=n(),he=r("p"),he.innerHTML=di,Oa=n(),ce=r("p"),ce.textContent=fi,tn=n(),u(H.$$.fragment),en=n(),Me=r("p"),Me.innerHTML=hi,ln=n(),u(L.$$.fragment),an=n(),u(A.$$.fragment),nn=n(),be=r("p"),be.innerHTML=ci,sn=n(),u(ge.$$.fragment),on=n(),ye=r("p"),ye.innerHTML=Mi,rn=n(),u(Te.$$.fragment),pn=n(),u(we.$$.fragment),mn=n(),u(Y.$$.fragment),un=n(),$e=r("p"),$e.textContent=bi,dn=n(),u(Je.$$.fragment),fn=n(),Ue=r("p"),Ue.innerHTML=gi,hn=n(),u(ve.$$.fragment),cn=n(),je=r("p"),je.innerHTML=yi,Mn=n(),u(_e.$$.fragment),bn=n(),Ce=r("p"),Ce.innerHTML=Ti,gn=n(),u(qe.$$.fragment),yn=n(),u(Ze.$$.fragment),Tn=n(),ke=r("p"),ke.textContent=wi,wn=n(),Ge=r("p"),Ge.innerHTML=$i,$n=n(),u(ze.$$.fragment),Jn=n(),u(Qe.$$.fragment),Un=n(),Ie=r("p"),Ie.innerHTML=Ji,vn=n(),u(We.$$.fragment),jn=n(),u(Fe.$$.fragment),_n=n(),xe=r("p"),xe.innerHTML=Ui,Cn=n(),u(Be.$$.fragment),qn=n(),u(P.$$.fragment),Zn=n(),Ve=r("p"),Ve.textContent=vi,kn=n(),u(Xe.$$.fragment),Gn=n(),Re=r("p"),Re.innerHTML=ji,zn=n(),u(Ee.$$.fragment),Qn=n(),u(Ne.$$.fragment),In=n(),He=r("p"),He.innerHTML=_i,Wn=n(),u(Le.$$.fragment),Fn=n(),Ae=r("p"),Ae.innerHTML=Ci,xn=n(),u(Ye.$$.fragment),Bn=n(),Pe=r("p"),Pe.innerHTML=qi,Vn=n(),u(Se.$$.fragment),Xn=n(),u(De.$$.fragment),Rn=n(),Ke=r("p"),Ke.innerHTML=Zi,En=n(),Oe=r("p"),Oe.innerHTML=ki,Nn=n(),u(tl.$$.fragment),Hn=n(),el=r("p"),el.innerHTML=Gi,Ln=n(),u(ll.$$.fragment),An=n(),al=r("p"),al.textContent=zi,Yn=n(),u(nl.$$.fragment),Pn=n(),sl=r("p"),sl.textContent=Qi,Sn=n(),u(il.$$.fragment),Dn=n(),u(ol.$$.fragment),Kn=n(),rl=r("p"),rl.innerHTML=Ii,On=n(),u(pl.$$.fragment),ts=n(),ml=r("p"),ml.innerHTML=Wi,es=n(),S=r("div"),S.innerHTML=Fi,ls=n(),D=r("div"),D.innerHTML=xi,as=n(),ul=r("p"),ul.innerHTML=Bi,ns=n(),u(dl.$$.fragment),ss=n(),fl=r("p"),fl.innerHTML=Vi,is=n(),K=r("figcaption"),K.textContent=Xi,os=n(),hl=r("table"),hl.innerHTML=Ri,rs=n(),O=r("figcaption"),O.textContent=Ei,ps=n(),cl=r("table"),cl.innerHTML=Ni,ms=n(),Ml=r("p"),Ml.innerHTML=Hi,us=n(),tt=r("div"),tt.innerHTML=Li,ds=n(),u(bl.$$.fragment),fs=n(),gl=r("p"),gl.innerHTML=Ai,hs=n(),yl=r("p"),yl.textContent=Yi,cs=n(),u(Tl.$$.fragment),Ms=n(),wl=r("p"),wl.innerHTML=Pi,bs=n(),u($l.$$.fragment),gs=n(),u(Jl.$$.fragment),ys=n(),Ul=r("p"),Ul.textContent=Si,Ts=n(),vl=r("p"),vl.textContent=Di,ws=n(),u(jl.$$.fragment),$s=n(),u(_l.$$.fragment),Js=n(),Cl=r("p"),Cl.innerHTML=Ki,Us=n(),u(ql.$$.fragment),vs=n(),kl=r("p"),this.h()},l(t){const e=yo("svelte-u9bgzb",document.head);i=p(e,"META",{name:!0,content:!0}),e.forEach(l),y=s(t),o=p(t,"P",{}),ho(o).forEach(l),g=s(t),d(b.$$.fragment,t),T=s(t),j=p(t,"P",{"data-svelte-h":!0}),m(j)!=="svelte-1euzkei"&&(j.textContent=C),w=s(t),q=p(t,"P",{"data-svelte-h":!0}),m(q)!=="svelte-1f5pv07"&&(q.textContent=G),_=s(t),d(Z.$$.fragment,t),U=s(t),d(z.$$.fragment,t),v=s(t),d(Q.$$.fragment,t),Gl=s(t),lt=p(t,"P",{"data-svelte-h":!0}),m(lt)!=="svelte-1uxysak"&&(lt.innerHTML=Cs),zl=s(t),at=p(t,"UL",{"data-svelte-h":!0}),m(at)!=="svelte-1rrl1p8"&&(at.innerHTML=qs),Ql=s(t),nt=p(t,"P",{"data-svelte-h":!0}),m(nt)!=="svelte-13c61n1"&&(nt.textContent=Zs),Il=s(t),d(st.$$.fragment,t),Wl=s(t),it=p(t,"P",{"data-svelte-h":!0}),m(it)!=="svelte-a77ps0"&&(it.innerHTML=ks),Fl=s(t),ot=p(t,"P",{"data-svelte-h":!0}),m(ot)!=="svelte-acy0np"&&(ot.innerHTML=Gs),xl=s(t),d(rt.$$.fragment,t),Bl=s(t),pt=p(t,"P",{"data-svelte-h":!0}),m(pt)!=="svelte-1sscg20"&&(pt.textContent=zs),Vl=s(t),mt=p(t,"P",{"data-svelte-h":!0}),m(mt)!=="svelte-1woqmtc"&&(mt.innerHTML=Qs),Xl=s(t),F=p(t,"DIV",{class:!0,"data-svelte-h":!0}),m(F)!=="svelte-196rp13"&&(F.innerHTML=Is),Rl=s(t),ut=p(t,"P",{"data-svelte-h":!0}),m(ut)!=="svelte-5v5thh"&&(ut.textContent=Ws),El=s(t),d(dt.$$.fragment,t),Nl=s(t),ft=p(t,"P",{"data-svelte-h":!0}),m(ft)!=="svelte-vu1jh7"&&(ft.innerHTML=Fs),Hl=s(t),ht=p(t,"P",{"data-svelte-h":!0}),m(ht)!=="svelte-11fbd25"&&(ht.innerHTML=xs),Ll=s(t),ct=p(t,"P",{"data-svelte-h":!0}),m(ct)!=="svelte-1rdkef8"&&(ct.innerHTML=Bs),Al=s(t),d(Mt.$$.fragment,t),Yl=s(t),bt=p(t,"P",{"data-svelte-h":!0}),m(bt)!=="svelte-6sf1ac"&&(bt.textContent=Vs),Pl=s(t),gt=p(t,"P",{"data-svelte-h":!0}),m(gt)!=="svelte-mrigan"&&(gt.innerHTML=Xs),Sl=s(t),d(yt.$$.fragment,t),Dl=s(t),Tt=p(t,"P",{"data-svelte-h":!0}),m(Tt)!=="svelte-1uurbap"&&(Tt.innerHTML=Rs),Kl=s(t),d(wt.$$.fragment,t),Ol=s(t),$t=p(t,"P",{"data-svelte-h":!0}),m($t)!=="svelte-1ouechy"&&($t.textContent=Es),ta=s(t),Jt=p(t,"TABLE",{"data-svelte-h":!0}),m(Jt)!=="svelte-mgp7ro"&&(Jt.innerHTML=Ns),ea=s(t),d(Ut.$$.fragment,t),la=s(t),d(x.$$.fragment,t),aa=s(t),vt=p(t,"P",{"data-svelte-h":!0}),m(vt)!=="svelte-1c5vyni"&&(vt.innerHTML=Hs),na=s(t),jt=p(t,"P",{"data-svelte-h":!0}),m(jt)!=="svelte-vomabp"&&(jt.innerHTML=Ls),sa=s(t),_t=p(t,"P",{"data-svelte-h":!0}),m(_t)!=="svelte-1ozln1k"&&(_t.textContent=As),ia=s(t),d(Ct.$$.fragment,t),oa=s(t),qt=p(t,"P",{"data-svelte-h":!0}),m(qt)!=="svelte-1lxz9t"&&(qt.innerHTML=Ys),ra=s(t),d(Zt.$$.fragment,t),pa=s(t),kt=p(t,"P",{"data-svelte-h":!0}),m(kt)!=="svelte-108eg93"&&(kt.innerHTML=Ps),ma=s(t),d(Gt.$$.fragment,t),ua=s(t),zt=p(t,"P",{"data-svelte-h":!0}),m(zt)!=="svelte-19un5li"&&(zt.innerHTML=Ss),da=s(t),d(Qt.$$.fragment,t),fa=s(t),It=p(t,"P",{"data-svelte-h":!0}),m(It)!=="svelte-ptrt24"&&(It.innerHTML=Ds),ha=s(t),d(Wt.$$.fragment,t),ca=s(t),d(Ft.$$.fragment,t),Ma=s(t),xt=p(t,"P",{"data-svelte-h":!0}),m(xt)!=="svelte-jywid1"&&(xt.innerHTML=Ks),ba=s(t),d(B.$$.fragment,t),ga=s(t),d(V.$$.fragment,t),ya=s(t),d(Bt.$$.fragment,t),Ta=s(t),Vt=p(t,"P",{"data-svelte-h":!0}),m(Vt)!=="svelte-1fw2pai"&&(Vt.innerHTML=Os),wa=s(t),d(Xt.$$.fragment,t),$a=s(t),Rt=p(t,"P",{"data-svelte-h":!0}),m(Rt)!=="svelte-in32kr"&&(Rt.innerHTML=ti),Ja=s(t),d(Et.$$.fragment,t),Ua=s(t),d(X.$$.fragment,t),va=s(t),d(Nt.$$.fragment,t),ja=s(t),d(R.$$.fragment,t),_a=s(t),Ht=p(t,"P",{"data-svelte-h":!0}),m(Ht)!=="svelte-sq0x7n"&&(Ht.innerHTML=ei),Ca=s(t),Lt=p(t,"P",{"data-svelte-h":!0}),m(Lt)!=="svelte-13c61n1"&&(Lt.textContent=li),qa=s(t),d(At.$$.fragment,t),Za=s(t),Yt=p(t,"P",{"data-svelte-h":!0}),m(Yt)!=="svelte-ur342m"&&(Yt.innerHTML=ai),ka=s(t),d(Pt.$$.fragment,t),Ga=s(t),St=p(t,"P",{"data-svelte-h":!0}),m(St)!=="svelte-1cjo88z"&&(St.textContent=ni),za=s(t),d(Dt.$$.fragment,t),Qa=s(t),Kt=p(t,"P",{"data-svelte-h":!0}),m(Kt)!=="svelte-k2ugu3"&&(Kt.innerHTML=si),Ia=s(t),d(Ot.$$.fragment,t),Wa=s(t),te=p(t,"P",{"data-svelte-h":!0}),m(te)!=="svelte-1tle3a0"&&(te.innerHTML=ii),Fa=s(t),d(ee.$$.fragment,t),xa=s(t),d(E.$$.fragment,t),Ba=s(t),le=p(t,"P",{"data-svelte-h":!0}),m(le)!=="svelte-jjj96e"&&(le.innerHTML=oi),Va=s(t),d(ae.$$.fragment,t),Xa=s(t),ne=p(t,"P",{"data-svelte-h":!0}),m(ne)!=="svelte-l9o6va"&&(ne.innerHTML=ri),Ra=s(t),d(se.$$.fragment,t),Ea=s(t),ie=p(t,"P",{"data-svelte-h":!0}),m(ie)!=="svelte-42jvja"&&(ie.innerHTML=pi),Na=s(t),d(oe.$$.fragment,t),Ha=s(t),d(re.$$.fragment,t),La=s(t),pe=p(t,"P",{"data-svelte-h":!0}),m(pe)!=="svelte-1y1pnbl"&&(pe.innerHTML=mi),Aa=s(t),d(me.$$.fragment,t),Ya=s(t),d(N.$$.fragment,t),Pa=s(t),ue=p(t,"P",{"data-svelte-h":!0}),m(ue)!=="svelte-m9nw5y"&&(ue.textContent=ui),Sa=s(t),d(de.$$.fragment,t),Da=s(t),d(fe.$$.fragment,t),Ka=s(t),he=p(t,"P",{"data-svelte-h":!0}),m(he)!=="svelte-5a92xi"&&(he.innerHTML=di),Oa=s(t),ce=p(t,"P",{"data-svelte-h":!0}),m(ce)!=="svelte-gf36q7"&&(ce.textContent=fi),tn=s(t),d(H.$$.fragment,t),en=s(t),Me=p(t,"P",{"data-svelte-h":!0}),m(Me)!=="svelte-1tamrid"&&(Me.innerHTML=hi),ln=s(t),d(L.$$.fragment,t),an=s(t),d(A.$$.fragment,t),nn=s(t),be=p(t,"P",{"data-svelte-h":!0}),m(be)!=="svelte-1bxp667"&&(be.innerHTML=ci),sn=s(t),d(ge.$$.fragment,t),on=s(t),ye=p(t,"P",{"data-svelte-h":!0}),m(ye)!=="svelte-17ps4nd"&&(ye.innerHTML=Mi),rn=s(t),d(Te.$$.fragment,t),pn=s(t),d(we.$$.fragment,t),mn=s(t),d(Y.$$.fragment,t),un=s(t),$e=p(t,"P",{"data-svelte-h":!0}),m($e)!=="svelte-1yx1x2g"&&($e.textContent=bi),dn=s(t),d(Je.$$.fragment,t),fn=s(t),Ue=p(t,"P",{"data-svelte-h":!0}),m(Ue)!=="svelte-1v0jh01"&&(Ue.innerHTML=gi),hn=s(t),d(ve.$$.fragment,t),cn=s(t),je=p(t,"P",{"data-svelte-h":!0}),m(je)!=="svelte-15oy7am"&&(je.innerHTML=yi),Mn=s(t),d(_e.$$.fragment,t),bn=s(t),Ce=p(t,"P",{"data-svelte-h":!0}),m(Ce)!=="svelte-k1g8c2"&&(Ce.innerHTML=Ti),gn=s(t),d(qe.$$.fragment,t),yn=s(t),d(Ze.$$.fragment,t),Tn=s(t),ke=p(t,"P",{"data-svelte-h":!0}),m(ke)!=="svelte-ur5rgd"&&(ke.textContent=wi),wn=s(t),Ge=p(t,"P",{"data-svelte-h":!0}),m(Ge)!=="svelte-v5sezx"&&(Ge.innerHTML=$i),$n=s(t),d(ze.$$.fragment,t),Jn=s(t),d(Qe.$$.fragment,t),Un=s(t),Ie=p(t,"P",{"data-svelte-h":!0}),m(Ie)!=="svelte-1ba1s3u"&&(Ie.innerHTML=Ji),vn=s(t),d(We.$$.fragment,t),jn=s(t),d(Fe.$$.fragment,t),_n=s(t),xe=p(t,"P",{"data-svelte-h":!0}),m(xe)!=="svelte-4nvx4q"&&(xe.innerHTML=Ui),Cn=s(t),d(Be.$$.fragment,t),qn=s(t),d(P.$$.fragment,t),Zn=s(t),Ve=p(t,"P",{"data-svelte-h":!0}),m(Ve)!=="svelte-7ob7j"&&(Ve.textContent=vi),kn=s(t),d(Xe.$$.fragment,t),Gn=s(t),Re=p(t,"P",{"data-svelte-h":!0}),m(Re)!=="svelte-15j4whk"&&(Re.innerHTML=ji),zn=s(t),d(Ee.$$.fragment,t),Qn=s(t),d(Ne.$$.fragment,t),In=s(t),He=p(t,"P",{"data-svelte-h":!0}),m(He)!=="svelte-7qr54g"&&(He.innerHTML=_i),Wn=s(t),d(Le.$$.fragment,t),Fn=s(t),Ae=p(t,"P",{"data-svelte-h":!0}),m(Ae)!=="svelte-1qoc2ct"&&(Ae.innerHTML=Ci),xn=s(t),d(Ye.$$.fragment,t),Bn=s(t),Pe=p(t,"P",{"data-svelte-h":!0}),m(Pe)!=="svelte-l0u9eq"&&(Pe.innerHTML=qi),Vn=s(t),d(Se.$$.fragment,t),Xn=s(t),d(De.$$.fragment,t),Rn=s(t),Ke=p(t,"P",{"data-svelte-h":!0}),m(Ke)!=="svelte-ayxv4l"&&(Ke.innerHTML=Zi),En=s(t),Oe=p(t,"P",{"data-svelte-h":!0}),m(Oe)!=="svelte-k0d3tz"&&(Oe.innerHTML=ki),Nn=s(t),d(tl.$$.fragment,t),Hn=s(t),el=p(t,"P",{"data-svelte-h":!0}),m(el)!=="svelte-1jc8itq"&&(el.innerHTML=Gi),Ln=s(t),d(ll.$$.fragment,t),An=s(t),al=p(t,"P",{"data-svelte-h":!0}),m(al)!=="svelte-1ti9l12"&&(al.textContent=zi),Yn=s(t),d(nl.$$.fragment,t),Pn=s(t),sl=p(t,"P",{"data-svelte-h":!0}),m(sl)!=="svelte-b8ansb"&&(sl.textContent=Qi),Sn=s(t),d(il.$$.fragment,t),Dn=s(t),d(ol.$$.fragment,t),Kn=s(t),rl=p(t,"P",{"data-svelte-h":!0}),m(rl)!=="svelte-opujmz"&&(rl.innerHTML=Ii),On=s(t),d(pl.$$.fragment,t),ts=s(t),ml=p(t,"P",{"data-svelte-h":!0}),m(ml)!=="svelte-10oh9lm"&&(ml.innerHTML=Wi),es=s(t),S=p(t,"DIV",{class:!0,"data-svelte-h":!0}),m(S)!=="svelte-10jjm5l"&&(S.innerHTML=Fi),ls=s(t),D=p(t,"DIV",{class:!0,"data-svelte-h":!0}),m(D)!=="svelte-48at03"&&(D.innerHTML=xi),as=s(t),ul=p(t,"P",{"data-svelte-h":!0}),m(ul)!=="svelte-1sm7gom"&&(ul.innerHTML=Bi),ns=s(t),d(dl.$$.fragment,t),ss=s(t),fl=p(t,"P",{"data-svelte-h":!0}),m(fl)!=="svelte-81zmsw"&&(fl.innerHTML=Vi),is=s(t),K=p(t,"FIGCAPTION",{class:!0,"data-svelte-h":!0}),m(K)!=="svelte-grefv0"&&(K.textContent=Xi),os=s(t),hl=p(t,"TABLE",{"data-svelte-h":!0}),m(hl)!=="svelte-19aactm"&&(hl.innerHTML=Ri),rs=s(t),O=p(t,"FIGCAPTION",{class:!0,"data-svelte-h":!0}),m(O)!=="svelte-1r15bg7"&&(O.textContent=Ei),ps=s(t),cl=p(t,"TABLE",{"data-svelte-h":!0}),m(cl)!=="svelte-19fczbk"&&(cl.innerHTML=Ni),ms=s(t),Ml=p(t,"P",{"data-svelte-h":!0}),m(Ml)!=="svelte-gu8e8k"&&(Ml.innerHTML=Hi),us=s(t),tt=p(t,"DIV",{class:!0,"data-svelte-h":!0}),m(tt)!=="svelte-1ke50ja"&&(tt.innerHTML=Li),ds=s(t),d(bl.$$.fragment,t),fs=s(t),gl=p(t,"P",{"data-svelte-h":!0}),m(gl)!=="svelte-1fxt6gs"&&(gl.innerHTML=Ai),hs=s(t),yl=p(t,"P",{"data-svelte-h":!0}),m(yl)!=="svelte-d1mcqh"&&(yl.textContent=Yi),cs=s(t),d(Tl.$$.fragment,t),Ms=s(t),wl=p(t,"P",{"data-svelte-h":!0}),m(wl)!=="svelte-1sh2kek"&&(wl.innerHTML=Pi),bs=s(t),d($l.$$.fragment,t),gs=s(t),d(Jl.$$.fragment,t),ys=s(t),Ul=p(t,"P",{"data-svelte-h":!0}),m(Ul)!=="svelte-1domfft"&&(Ul.textContent=Si),Ts=s(t),vl=p(t,"P",{"data-svelte-h":!0}),m(vl)!=="svelte-1gckzen"&&(vl.textContent=Di),ws=s(t),d(jl.$$.fragment,t),$s=s(t),d(_l.$$.fragment,t),Js=s(t),Cl=p(t,"P",{"data-svelte-h":!0}),m(Cl)!=="svelte-1w4zqho"&&(Cl.innerHTML=Ki),Us=s(t),d(ql.$$.fragment,t),vs=s(t),kl=p(t,"P",{}),ho(kl).forEach(l),this.h()},h(){et(i,"name","hf:doc:metadata"),et(i,"content",Eo),et(F,"class","flex gap-4"),et(S,"class","flex gap-4"),et(D,"class","flex gap-4"),et(K,"class","text-center text-gray-500 text-lg"),et(O,"class","text-center text-gray-500 text-lg"),et(tt,"class","flex gap-4")},m(t,e){To(document.head,i),a(t,y,e),a(t,o,e),a(t,g,e),f(b,t,e),a(t,T,e),a(t,j,e),a(t,w,e),a(t,q,e),a(t,_,e),f(Z,t,e),a(t,U,e),f(z,t,e),a(t,v,e),f(Q,t,e),a(t,Gl,e),a(t,lt,e),a(t,zl,e),a(t,at,e),a(t,Ql,e),a(t,nt,e),a(t,Il,e),f(st,t,e),a(t,Wl,e),a(t,it,e),a(t,Fl,e),a(t,ot,e),a(t,xl,e),f(rt,t,e),a(t,Bl,e),a(t,pt,e),a(t,Vl,e),a(t,mt,e),a(t,Xl,e),a(t,F,e),a(t,Rl,e),a(t,ut,e),a(t,El,e),f(dt,t,e),a(t,Nl,e),a(t,ft,e),a(t,Hl,e),a(t,ht,e),a(t,Ll,e),a(t,ct,e),a(t,Al,e),f(Mt,t,e),a(t,Yl,e),a(t,bt,e),a(t,Pl,e),a(t,gt,e),a(t,Sl,e),f(yt,t,e),a(t,Dl,e),a(t,Tt,e),a(t,Kl,e),f(wt,t,e),a(t,Ol,e),a(t,$t,e),a(t,ta,e),a(t,Jt,e),a(t,ea,e),f(Ut,t,e),a(t,la,e),f(x,t,e),a(t,aa,e),a(t,vt,e),a(t,na,e),a(t,jt,e),a(t,sa,e),a(t,_t,e),a(t,ia,e),f(Ct,t,e),a(t,oa,e),a(t,qt,e),a(t,ra,e),f(Zt,t,e),a(t,pa,e),a(t,kt,e),a(t,ma,e),f(Gt,t,e),a(t,ua,e),a(t,zt,e),a(t,da,e),f(Qt,t,e),a(t,fa,e),a(t,It,e),a(t,ha,e),f(Wt,t,e),a(t,ca,e),f(Ft,t,e),a(t,Ma,e),a(t,xt,e),a(t,ba,e),f(B,t,e),a(t,ga,e),f(V,t,e),a(t,ya,e),f(Bt,t,e),a(t,Ta,e),a(t,Vt,e),a(t,wa,e),f(Xt,t,e),a(t,$a,e),a(t,Rt,e),a(t,Ja,e),f(Et,t,e),a(t,Ua,e),f(X,t,e),a(t,va,e),f(Nt,t,e),a(t,ja,e),f(R,t,e),a(t,_a,e),a(t,Ht,e),a(t,Ca,e),a(t,Lt,e),a(t,qa,e),f(At,t,e),a(t,Za,e),a(t,Yt,e),a(t,ka,e),f(Pt,t,e),a(t,Ga,e),a(t,St,e),a(t,za,e),f(Dt,t,e),a(t,Qa,e),a(t,Kt,e),a(t,Ia,e),f(Ot,t,e),a(t,Wa,e),a(t,te,e),a(t,Fa,e),f(ee,t,e),a(t,xa,e),f(E,t,e),a(t,Ba,e),a(t,le,e),a(t,Va,e),f(ae,t,e),a(t,Xa,e),a(t,ne,e),a(t,Ra,e),f(se,t,e),a(t,Ea,e),a(t,ie,e),a(t,Na,e),f(oe,t,e),a(t,Ha,e),f(re,t,e),a(t,La,e),a(t,pe,e),a(t,Aa,e),f(me,t,e),a(t,Ya,e),f(N,t,e),a(t,Pa,e),a(t,ue,e),a(t,Sa,e),f(de,t,e),a(t,Da,e),f(fe,t,e),a(t,Ka,e),a(t,he,e),a(t,Oa,e),a(t,ce,e),a(t,tn,e),f(H,t,e),a(t,en,e),a(t,Me,e),a(t,ln,e),f(L,t,e),a(t,an,e),f(A,t,e),a(t,nn,e),a(t,be,e),a(t,sn,e),f(ge,t,e),a(t,on,e),a(t,ye,e),a(t,rn,e),f(Te,t,e),a(t,pn,e),f(we,t,e),a(t,mn,e),f(Y,t,e),a(t,un,e),a(t,$e,e),a(t,dn,e),f(Je,t,e),a(t,fn,e),a(t,Ue,e),a(t,hn,e),f(ve,t,e),a(t,cn,e),a(t,je,e),a(t,Mn,e),f(_e,t,e),a(t,bn,e),a(t,Ce,e),a(t,gn,e),f(qe,t,e),a(t,yn,e),f(Ze,t,e),a(t,Tn,e),a(t,ke,e),a(t,wn,e),a(t,Ge,e),a(t,$n,e),f(ze,t,e),a(t,Jn,e),f(Qe,t,e),a(t,Un,e),a(t,Ie,e),a(t,vn,e),f(We,t,e),a(t,jn,e),f(Fe,t,e),a(t,_n,e),a(t,xe,e),a(t,Cn,e),f(Be,t,e),a(t,qn,e),f(P,t,e),a(t,Zn,e),a(t,Ve,e),a(t,kn,e),f(Xe,t,e),a(t,Gn,e),a(t,Re,e),a(t,zn,e),f(Ee,t,e),a(t,Qn,e),f(Ne,t,e),a(t,In,e),a(t,He,e),a(t,Wn,e),f(Le,t,e),a(t,Fn,e),a(t,Ae,e),a(t,xn,e),f(Ye,t,e),a(t,Bn,e),a(t,Pe,e),a(t,Vn,e),f(Se,t,e),a(t,Xn,e),f(De,t,e),a(t,Rn,e),a(t,Ke,e),a(t,En,e),a(t,Oe,e),a(t,Nn,e),f(tl,t,e),a(t,Hn,e),a(t,el,e),a(t,Ln,e),f(ll,t,e),a(t,An,e),a(t,al,e),a(t,Yn,e),f(nl,t,e),a(t,Pn,e),a(t,sl,e),a(t,Sn,e),f(il,t,e),a(t,Dn,e),f(ol,t,e),a(t,Kn,e),a(t,rl,e),a(t,On,e),f(pl,t,e),a(t,ts,e),a(t,ml,e),a(t,es,e),a(t,S,e),a(t,ls,e),a(t,D,e),a(t,as,e),a(t,ul,e),a(t,ns,e),f(dl,t,e),a(t,ss,e),a(t,fl,e),a(t,is,e),a(t,K,e),a(t,os,e),a(t,hl,e),a(t,rs,e),a(t,O,e),a(t,ps,e),a(t,cl,e),a(t,ms,e),a(t,Ml,e),a(t,us,e),a(t,tt,e),a(t,ds,e),f(bl,t,e),a(t,fs,e),a(t,gl,e),a(t,hs,e),a(t,yl,e),a(t,cs,e),f(Tl,t,e),a(t,Ms,e),a(t,wl,e),a(t,bs,e),f($l,t,e),a(t,gs,e),f(Jl,t,e),a(t,ys,e),a(t,Ul,e),a(t,Ts,e),a(t,vl,e),a(t,ws,e),f(jl,t,e),a(t,$s,e),f(_l,t,e),a(t,Js,e),a(t,Cl,e),a(t,Us,e),f(ql,t,e),a(t,vs,e),a(t,kl,e),js=!0},p(t,[e]){const Oi={};e&2&&(Oi.$$scope={dirty:e,ctx:t}),Z.$set(Oi);const to={};e&2&&(to.$$scope={dirty:e,ctx:t}),Q.$set(to);const eo={};e&2&&(eo.$$scope={dirty:e,ctx:t}),x.$set(eo);const lo={};e&2&&(lo.$$scope={dirty:e,ctx:t}),B.$set(lo);const ao={};e&2&&(ao.$$scope={dirty:e,ctx:t}),V.$set(ao);const no={};e&2&&(no.$$scope={dirty:e,ctx:t}),X.$set(no);const so={};e&2&&(so.$$scope={dirty:e,ctx:t}),R.$set(so);const io={};e&2&&(io.$$scope={dirty:e,ctx:t}),E.$set(io);const oo={};e&2&&(oo.$$scope={dirty:e,ctx:t}),N.$set(oo);const ro={};e&2&&(ro.$$scope={dirty:e,ctx:t}),H.$set(ro);const po={};e&2&&(po.$$scope={dirty:e,ctx:t}),L.$set(po);const mo={};e&2&&(mo.$$scope={dirty:e,ctx:t}),A.$set(mo);const uo={};e&2&&(uo.$$scope={dirty:e,ctx:t}),Y.$set(uo);const fo={};e&2&&(fo.$$scope={dirty:e,ctx:t}),P.$set(fo)},i(t){js||(h(b.$$.fragment,t),h(Z.$$.fragment,t),h(z.$$.fragment,t),h(Q.$$.fragment,t),h(st.$$.fragment,t),h(rt.$$.fragment,t),h(dt.$$.fragment,t),h(Mt.$$.fragment,t),h(yt.$$.fragment,t),h(wt.$$.fragment,t),h(Ut.$$.fragment,t),h(x.$$.fragment,t),h(Ct.$$.fragment,t),h(Zt.$$.fragment,t),h(Gt.$$.fragment,t),h(Qt.$$.fragment,t),h(Wt.$$.fragment,t),h(Ft.$$.fragment,t),h(B.$$.fragment,t),h(V.$$.fragment,t),h(Bt.$$.fragment,t),h(Xt.$$.fragment,t),h(Et.$$.fragment,t),h(X.$$.fragment,t),h(Nt.$$.fragment,t),h(R.$$.fragment,t),h(At.$$.fragment,t),h(Pt.$$.fragment,t),h(Dt.$$.fragment,t),h(Ot.$$.fragment,t),h(ee.$$.fragment,t),h(E.$$.fragment,t),h(ae.$$.fragment,t),h(se.$$.fragment,t),h(oe.$$.fragment,t),h(re.$$.fragment,t),h(me.$$.fragment,t),h(N.$$.fragment,t),h(de.$$.fragment,t),h(fe.$$.fragment,t),h(H.$$.fragment,t),h(L.$$.fragment,t),h(A.$$.fragment,t),h(ge.$$.fragment,t),h(Te.$$.fragment,t),h(we.$$.fragment,t),h(Y.$$.fragment,t),h(Je.$$.fragment,t),h(ve.$$.fragment,t),h(_e.$$.fragment,t),h(qe.$$.fragment,t),h(Ze.$$.fragment,t),h(ze.$$.fragment,t),h(Qe.$$.fragment,t),h(We.$$.fragment,t),h(Fe.$$.fragment,t),h(Be.$$.fragment,t),h(P.$$.fragment,t),h(Xe.$$.fragment,t),h(Ee.$$.fragment,t),h(Ne.$$.fragment,t),h(Le.$$.fragment,t),h(Ye.$$.fragment,t),h(Se.$$.fragment,t),h(De.$$.fragment,t),h(tl.$$.fragment,t),h(ll.$$.fragment,t),h(nl.$$.fragment,t),h(il.$$.fragment,t),h(ol.$$.fragment,t),h(pl.$$.fragment,t),h(dl.$$.fragment,t),h(bl.$$.fragment,t),h(Tl.$$.fragment,t),h($l.$$.fragment,t),h(Jl.$$.fragment,t),h(jl.$$.fragment,t),h(_l.$$.fragment,t),h(ql.$$.fragment,t),js=!0)},o(t){c(b.$$.fragment,t),c(Z.$$.fragment,t),c(z.$$.fragment,t),c(Q.$$.fragment,t),c(st.$$.fragment,t),c(rt.$$.fragment,t),c(dt.$$.fragment,t),c(Mt.$$.fragment,t),c(yt.$$.fragment,t),c(wt.$$.fragment,t),c(Ut.$$.fragment,t),c(x.$$.fragment,t),c(Ct.$$.fragment,t),c(Zt.$$.fragment,t),c(Gt.$$.fragment,t),c(Qt.$$.fragment,t),c(Wt.$$.fragment,t),c(Ft.$$.fragment,t),c(B.$$.fragment,t),c(V.$$.fragment,t),c(Bt.$$.fragment,t),c(Xt.$$.fragment,t),c(Et.$$.fragment,t),c(X.$$.fragment,t),c(Nt.$$.fragment,t),c(R.$$.fragment,t),c(At.$$.fragment,t),c(Pt.$$.fragment,t),c(Dt.$$.fragment,t),c(Ot.$$.fragment,t),c(ee.$$.fragment,t),c(E.$$.fragment,t),c(ae.$$.fragment,t),c(se.$$.fragment,t),c(oe.$$.fragment,t),c(re.$$.fragment,t),c(me.$$.fragment,t),c(N.$$.fragment,t),c(de.$$.fragment,t),c(fe.$$.fragment,t),c(H.$$.fragment,t),c(L.$$.fragment,t),c(A.$$.fragment,t),c(ge.$$.fragment,t),c(Te.$$.fragment,t),c(we.$$.fragment,t),c(Y.$$.fragment,t),c(Je.$$.fragment,t),c(ve.$$.fragment,t),c(_e.$$.fragment,t),c(qe.$$.fragment,t),c(Ze.$$.fragment,t),c(ze.$$.fragment,t),c(Qe.$$.fragment,t),c(We.$$.fragment,t),c(Fe.$$.fragment,t),c(Be.$$.fragment,t),c(P.$$.fragment,t),c(Xe.$$.fragment,t),c(Ee.$$.fragment,t),c(Ne.$$.fragment,t),c(Le.$$.fragment,t),c(Ye.$$.fragment,t),c(Se.$$.fragment,t),c(De.$$.fragment,t),c(tl.$$.fragment,t),c(ll.$$.fragment,t),c(nl.$$.fragment,t),c(il.$$.fragment,t),c(ol.$$.fragment,t),c(pl.$$.fragment,t),c(dl.$$.fragment,t),c(bl.$$.fragment,t),c(Tl.$$.fragment,t),c($l.$$.fragment,t),c(Jl.$$.fragment,t),c(jl.$$.fragment,t),c(_l.$$.fragment,t),c(ql.$$.fragment,t),js=!1},d(t){t&&(l(y),l(o),l(g),l(T),l(j),l(w),l(q),l(_),l(U),l(v),l(Gl),l(lt),l(zl),l(at),l(Ql),l(nt),l(Il),l(Wl),l(it),l(Fl),l(ot),l(xl),l(Bl),l(pt),l(Vl),l(mt),l(Xl),l(F),l(Rl),l(ut),l(El),l(Nl),l(ft),l(Hl),l(ht),l(Ll),l(ct),l(Al),l(Yl),l(bt),l(Pl),l(gt),l(Sl),l(Dl),l(Tt),l(Kl),l(Ol),l($t),l(ta),l(Jt),l(ea),l(la),l(aa),l(vt),l(na),l(jt),l(sa),l(_t),l(ia),l(oa),l(qt),l(ra),l(pa),l(kt),l(ma),l(ua),l(zt),l(da),l(fa),l(It),l(ha),l(ca),l(Ma),l(xt),l(ba),l(ga),l(ya),l(Ta),l(Vt),l(wa),l($a),l(Rt),l(Ja),l(Ua),l(va),l(ja),l(_a),l(Ht),l(Ca),l(Lt),l(qa),l(Za),l(Yt),l(ka),l(Ga),l(St),l(za),l(Qa),l(Kt),l(Ia),l(Wa),l(te),l(Fa),l(xa),l(Ba),l(le),l(Va),l(Xa),l(ne),l(Ra),l(Ea),l(ie),l(Na),l(Ha),l(La),l(pe),l(Aa),l(Ya),l(Pa),l(ue),l(Sa),l(Da),l(Ka),l(he),l(Oa),l(ce),l(tn),l(en),l(Me),l(ln),l(an),l(nn),l(be),l(sn),l(on),l(ye),l(rn),l(pn),l(mn),l(un),l($e),l(dn),l(fn),l(Ue),l(hn),l(cn),l(je),l(Mn),l(bn),l(Ce),l(gn),l(yn),l(Tn),l(ke),l(wn),l(Ge),l($n),l(Jn),l(Un),l(Ie),l(vn),l(jn),l(_n),l(xe),l(Cn),l(qn),l(Zn),l(Ve),l(kn),l(Gn),l(Re),l(zn),l(Qn),l(In),l(He),l(Wn),l(Fn),l(Ae),l(xn),l(Bn),l(Pe),l(Vn),l(Xn),l(Rn),l(Ke),l(En),l(Oe),l(Nn),l(Hn),l(el),l(Ln),l(An),l(al),l(Yn),l(Pn),l(sl),l(Sn),l(Dn),l(Kn),l(rl),l(On),l(ts),l(ml),l(es),l(S),l(ls),l(D),l(as),l(ul),l(ns),l(ss),l(fl),l(is),l(K),l(os),l(hl),l(rs),l(O),l(ps),l(cl),l(ms),l(Ml),l(us),l(tt),l(ds),l(fs),l(gl),l(hs),l(yl),l(cs),l(Ms),l(wl),l(bs),l(gs),l(ys),l(Ul),l(Ts),l(vl),l(ws),l($s),l(Js),l(Cl),l(Us),l(vs),l(kl)),l(i),M(b,t),M(Z,t),M(z,t),M(Q,t),M(st,t),M(rt,t),M(dt,t),M(Mt,t),M(yt,t),M(wt,t),M(Ut,t),M(x,t),M(Ct,t),M(Zt,t),M(Gt,t),M(Qt,t),M(Wt,t),M(Ft,t),M(B,t),M(V,t),M(Bt,t),M(Xt,t),M(Et,t),M(X,t),M(Nt,t),M(R,t),M(At,t),M(Pt,t),M(Dt,t),M(Ot,t),M(ee,t),M(E,t),M(ae,t),M(se,t),M(oe,t),M(re,t),M(me,t),M(N,t),M(de,t),M(fe,t),M(H,t),M(L,t),M(A,t),M(ge,t),M(Te,t),M(we,t),M(Y,t),M(Je,t),M(ve,t),M(_e,t),M(qe,t),M(Ze,t),M(ze,t),M(Qe,t),M(We,t),M(Fe,t),M(Be,t),M(P,t),M(Xe,t),M(Ee,t),M(Ne,t),M(Le,t),M(Ye,t),M(Se,t),M(De,t),M(tl,t),M(ll,t),M(nl,t),M(il,t),M(ol,t),M(pl,t),M(dl,t),M(bl,t),M(Tl,t),M($l,t),M(Jl,t),M(jl,t),M(_l,t),M(ql,t)}}}const Eo='{"title":"Quantization","local":"quantization","sections":[{"title":"Quanto","local":"quanto","sections":[],"depth":2},{"title":"AQLM","local":"aqlm","sections":[{"title":"PEFT","local":"peft","sections":[],"depth":3},{"title":"AQLM configurations","local":"aqlm-configurations","sections":[],"depth":3}],"depth":2},{"title":"AWQ","local":"awq","sections":[{"title":"Fused modules","local":"fused-modules","sections":[],"depth":3},{"title":"Exllama-v2 support","local":"exllama-v2-support","sections":[],"depth":3}],"depth":2},{"title":"AutoGPTQ","local":"autogptq","sections":[{"title":"ExLlama","local":"exllama","sections":[],"depth":3}],"depth":2},{"title":"bitsandbytes","local":"bitsandbytes","sections":[{"title":"8-bit","local":"8-bit","sections":[{"title":"Offloading","local":"offloading","sections":[],"depth":4},{"title":"Outlier threshold","local":"outlier-threshold","sections":[],"depth":4},{"title":"Skip module conversion","local":"skip-module-conversion","sections":[],"depth":4},{"title":"Finetuning","local":"finetuning","sections":[],"depth":4}],"depth":3},{"title":"4-bit","local":"4-bit","sections":[{"title":"Compute data type","local":"compute-data-type","sections":[],"depth":4},{"title":"Normal Float 4 (NF4)","local":"normal-float-4-nf4","sections":[],"depth":4},{"title":"Nested quantization","local":"nested-quantization","sections":[],"depth":4}],"depth":3}],"depth":2},{"title":"EETQ","local":"eetq","sections":[],"depth":2},{"title":"Optimum","local":"optimum","sections":[],"depth":2},{"title":"Benchmarks","local":"benchmarks","sections":[{"title":"Fused AWQ modules","local":"fused-awq-modules","sections":[],"depth":3}],"depth":2},{"title":"HQQ","local":"hqq","sections":[{"title":"Optimized Runtime","local":"optimized-runtime","sections":[],"depth":3}],"depth":2}],"depth":1}';function No(J){return Mo(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Do extends bo{constructor(i){super(),go(this,i,No,Ro,co,{})}}export{Do as component};
