import{s as dr,o as mr,n as ki}from"../chunks/scheduler.9bc65507.js";import{S as pr,i as ur,g as i,s as a,r as d,A as fr,h as s,f as n,c as l,j as C,u as m,x as r,k,l as oi,y as h,a as o,v as p,d as u,t as f,w as c,m as cr,n as hr}from"../chunks/index.707bf1b6.js";import{T as ai}from"../chunks/Tip.c2ecdbf4.js";import{D as x}from"../chunks/Docstring.17db21ae.js";import{C as y}from"../chunks/CodeBlock.54a9f38d.js";import{H as b}from"../chunks/Heading.342b1fa6.js";function br(J){let g;return{c(){g=cr("GPTQ quantization only works for text model for now. Futhermore, the quantization process can a lot of time depending on one's hardware (175B model = 4 gpu hours using NVIDIA A100). Please check on the hub if there is not a GPTQ quantized version of the model. If not, you can submit a demand on github.")},l(_){g=hr(_,"GPTQ quantization only works for text model for now. Futhermore, the quantization process can a lot of time depending on one's hardware (175B model = 4 gpu hours using NVIDIA A100). Please check on the hub if there is not a GPTQ quantized version of the model. If not, you can submit a demand on github.")},m(_,$){o(_,g,$)},d(_){_&&n(g)}}}function gr(J){let g,_="Note that once a model has been loaded in 4-bit it is currently not possible to push the quantized weights on the Hub. Note also that you cannot train 4-bit weights as this is not supported yet. However you can use 4-bit models to train extra parameters, this will be covered in the next section.";return{c(){g=i("p"),g.textContent=_},l($){g=s($,"P",{"data-svelte-h":!0}),r(g)!=="svelte-1173kmw"&&(g.textContent=_)},m($,z){o($,g,z)},p:ki,d($){$&&n(g)}}}function yr(J){let g,_=`Note that once a model has been loaded in 8-bit it is currently not possible to push the quantized weights on the Hub except if you use the latest <code>transformers</code> and <code>bitsandbytes</code>. Note also that you cannot train 8-bit weights as this is not supported yet. However you can use 8-bit models to train extra parameters, this will be covered in the next section.
Note also that <code>device_map</code> is optional but setting <code>device_map = &#39;auto&#39;</code> is prefered for inference as it will dispatch efficiently the model on the available ressources.`;return{c(){g=i("p"),g.innerHTML=_},l($){g=s($,"P",{"data-svelte-h":!0}),r(g)!=="svelte-17mr1dr"&&(g.innerHTML=_)},m($,z){o($,g,z)},p:ki,d($){$&&n(g)}}}function $r(J){let g,_="Pushing 8bit models on the Hub is strongely encouraged for large models. This will allow the community to benefit from the memory footprint reduction and loading for example large models on a Google Colab.";return{c(){g=i("p"),g.textContent=_},l($){g=s($,"P",{"data-svelte-h":!0}),r(g)!=="svelte-1bu8wqo"&&(g.textContent=_)},m($,z){o($,g,z)},p:ki,d($){$&&n(g)}}}function wr(J){let g,_,$,z,E,oo,Y,ao,S,qi='AWQ method has been introduced in the <a href="https://arxiv.org/abs/2306.00978" rel="nofollow"><em>AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration</em> paper</a>. With AWQ you can run models in 4-bit precision, while preserving its original quality (i.e. no performance degradation) with a superior throughput that other quantization methods presented below - reaching similar throughput as pure <code>float16</code> inference.',lo,D,xi="We now support inference with any AWQ model, meaning anyone can load and use AWQ weights that are pushed on the Hub or saved locally. Note that using AWQ requires to have access to a NVIDIA GPU. CPU inference is not supported yet.",io,K,so,O,Ji="We advise users to look at different existing tools in the ecosystem to quantize their models with AWQ algorithm, such as:",ro,ee,zi='<li><a href="https://github.com/mit-han-lab/llm-awq" rel="nofollow"><code>llm-awq</code></a> from MIT Han Lab</li> <li><a href="https://github.com/casper-hansen/AutoAWQ" rel="nofollow"><code>autoawq</code></a> from <a href="https://github.com/casper-hansen" rel="nofollow"><code>casper-hansen</code></a></li> <li>Intel neural compressor from Intel - through <a href="https://huggingface.co/docs/optimum/main/en/intel/optimization_inc" rel="nofollow"><code>optimum-intel</code></a></li>',mo,te,Wi=`Many other tools might exist in the ecosystem, please feel free to open a PR to add them to the list.
Currently the integration with 🤗 Transformers is only available for models that have been quantized using <code>autoawq</code> library and <code>llm-awq</code>. Most of the models quantized with <code>auto-awq</code> can be found under <a href="https://huggingface.co/TheBloke" rel="nofollow"><code>TheBloke</code></a> namespace of 🤗 Hub, and to quantize models with <code>llm-awq</code> please refer to the <a href="https://github.com/mit-han-lab/llm-awq/blob/main/examples/convert_to_hf.py" rel="nofollow"><code>convert_to_hf.py</code></a> script in the examples folder of <a href="https://github.com/mit-han-lab/llm-awq/" rel="nofollow"><code>llm-awq</code></a>.`,po,ne,uo,oe,Zi="You can load a quantized model from the Hub using the <code>from_pretrained</code> method. Make sure that the pushed weights are quantized, by checking that the attribute <code>quantization_config</code> is present in the model’s configuration file (<code>configuration.json</code>). You can confirm that the model is quantized in the AWQ format by checking the field <code>quantization_config.quant_method</code> which should be set to <code>&quot;awq&quot;</code>. Note that loading the model will set other weights in <code>float16</code> by default for performance reasons. If you want to change that behavior, you can pass <code>torch_dtype</code> argument to <code>torch.float32</code> or <code>torch.bfloat16</code>. You can find in the sections below some example snippets and notebook.",fo,ae,co,le,Ui='First, you need to install <a href="https://github.com/casper-hansen/AutoAWQ" rel="nofollow"><code>autoawq</code></a> library',ho,ie,bo,se,go,re,Qi="In case you first load your model on CPU, make sure to move it to your GPU device before using",yo,de,$o,me,wo,pe,Gi="You can combine AWQ quantization with Flash Attention to get a model that is both quantized and faster. Simply load the model using <code>from_pretrained</code> and pass <code>use_flash_attention_2=True</code> argument.",_o,ue,To,fe,Mo,ce,ji='We performed some speed, throughput and latency benchmarks using <a href="https://github.com/huggingface/optimum-benchmark" rel="nofollow"><code>optimum-benchmark</code></a> library.',vo,he,Bi="Note at that time of writing this documentation section, the available quantization methods were: <code>awq</code>, <code>gptq</code> and <code>bitsandbytes</code>.",Co,be,Vi='The benchmark was run on a NVIDIA-A100 instance and the model used was <a href="https://huggingface.co/TheBloke/Mistral-7B-v0.1-AWQ" rel="nofollow"><code>TheBloke/Mistral-7B-v0.1-AWQ</code></a> for the AWQ model, <a href="https://huggingface.co/TheBloke/Mistral-7B-v0.1-GPTQ" rel="nofollow"><code>TheBloke/Mistral-7B-v0.1-GPTQ</code></a> for the GPTQ model. We also benchmarked it against <code>bitsandbytes</code> quantization methods and native <code>float16</code> model. Some results are shown below:',ko,Z,Li='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/quantization/forward_memory_plot.png"/>',qo,U,Xi='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/quantization/generate_memory_plot.png"/>',xo,Q,Hi='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/quantization/generate_throughput_plot.png"/>',Jo,G,Fi='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/quantization/forward_latency_plot.png"/>',zo,ge,Ai='You can find the full results together with packages versions in <a href="https://github.com/huggingface/optimum-benchmark/tree/main/examples/running-mistral" rel="nofollow">this link</a>.',Wo,ye,Ri="From the results it appears that AWQ quantization method is the fastest quantization method for inference, text generation and among the lowest peak memory for text generation. However, AWQ seems to have the largest forward latency per batch size.",Zo,$e,Uo,we,Ii='Check out how to use this integration throughout this <a href="https://colab.research.google.com/drive/1HzZH89yAXJaZgwJDhQj9LqSBux932BvY" rel="nofollow">Google Colab demo</a>!',Qo,_e,Go,q,Te,li,An,Ni=`This is a wrapper class about all possible attributes and features that you can play with a model that has been
loaded using <code>auto-awq</code> library awq quantization relying on auto_awq backend.`,ii,j,Me,si,Rn,Pi="Safety checker that arguments are correct",jo,ve,Bo,Ce,Ei="🤗 Transformers has integrated <code>optimum</code> API to perform GPTQ quantization on language models. You can load and quantize your model in 8, 4, 3 or even 2 bits without a big drop of performance and faster inference speed! This is supported by most GPU hardwares.",Vo,ke,Yi="To learn more about the quantization model, check out:",Lo,qe,Si='<li>the <a href="https://arxiv.org/pdf/2210.17323.pdf" rel="nofollow">GPTQ</a> paper</li> <li>the <code>optimum</code> <a href="https://huggingface.co/docs/optimum/llm_quantization/usage_guides/quantization" rel="nofollow">guide</a> on GPTQ quantization</li> <li>the <a href="https://github.com/PanQiWei/AutoGPTQ" rel="nofollow"><code>AutoGPTQ</code></a> library used as the backend</li>',Xo,xe,Ho,Je,Di="You need to have the following requirements installed to run the code below:",Fo,ze,Ki=`<li><p>Install latest <code>AutoGPTQ</code> library
<code>pip install auto-gptq</code></p></li> <li><p>Install latest <code>optimum</code> from source
<code>pip install git+https://github.com/huggingface/optimum.git</code></p></li> <li><p>Install latest <code>transformers</code> from source
<code>pip install git+https://github.com/huggingface/transformers.git</code></p></li> <li><p>Install latest <code>accelerate</code> library
<code>pip install --upgrade accelerate</code></p></li>`,Ao,We,Oi="Note that GPTQ integration supports for now only text models and you may encounter unexpected behaviour for vision, speech or multi-modal models.",Ro,Ze,Io,Ue,es="GPTQ is a quantization method that requires weights calibration before using the quantized models. If you want to quantize transformers model from scratch, it might take some time before producing the quantized model (~5 min on a Google colab for <code>facebook/opt-350m</code> model).",No,Qe,ts="Hence, there are two different scenarios where you want to use GPTQ-quantized models. The first use case would be to load models that has been already quantized by other users that are available on the Hub, the second use case would be to quantize your model from scratch and save it or push it on the Hub so that other users can also use it.",Po,Ge,Eo,je,ns='In order to load and quantize a model, you need to create a <a href="/docs/transformers/main/en/main_classes/quantization#transformers.GPTQConfig">GPTQConfig</a>. You need to pass the number of <code>bits</code>, a <code>dataset</code> in order to calibrate the quantization and the <code>tokenizer</code> of the model in order prepare the dataset.',Yo,Be,So,Ve,os="Note that you can pass your own dataset as a list of string. However, it is highly recommended to use the dataset from the GPTQ paper.",Do,Le,Ko,Xe,Oo,He,as="You can quantize a model by using <code>from_pretrained</code> and setting the <code>quantization_config</code>.",ea,Fe,ta,Ae,ls="Note that you will need a GPU to quantize a model. We will put the model in the cpu and move the modules back and forth to the gpu in order to quantize them.",na,Re,is="If you want to maximize your gpus usage while using cpu offload, you can set <code>device_map = &quot;auto&quot;</code>.",oa,Ie,aa,Ne,ss='Note that disk offload is not supported. Furthermore, if you are out of memory because of the dataset, you may have to pass <code>max_memory</code> in <code>from_pretained</code>. Checkout this <a href="https://huggingface.co/docs/accelerate/usage_guides/big_modeling#designing-a-device-map" rel="nofollow">guide</a> to learn more about <code>device_map</code> and <code>max_memory</code>.',la,B,ia,Pe,sa,Ee,rs="You can push the quantized model like any 🤗 model to Hub with <code>push_to_hub</code>. The quantization config will be saved and pushed along the model.",ra,Ye,da,Se,ds="If you want to save your quantized model on your local machine, you can also do it with <code>save_pretrained</code>:",ma,De,pa,Ke,ms="Note that if you have quantized your model with a <code>device_map</code>, make sure to move the entire model to one of your gpus or the <code>cpu</code> before saving it.",ua,Oe,fa,et,ca,tt,ps=`You can load a quantized model from the Hub by using <code>from_pretrained</code>.
Make sure that the pushed weights are quantized, by checking that the attribute <code>quantization_config</code> is present in the model configuration object.`,ha,nt,ba,ot,us="If you want to load a model faster and without allocating more memory than needed, the <code>device_map</code> argument also works with quantized model. Make sure that you have <code>accelerate</code> library installed.",ga,at,ya,lt,$a,it,fs='For 4-bit model, you can use the exllama kernels in order to a faster inference speed. It is activated by default. You can change that behavior by passing <code>use_exllama</code> in <a href="/docs/transformers/main/en/main_classes/quantization#transformers.GPTQConfig">GPTQConfig</a>. This will overwrite the quantization config stored in the config. Note that you will only be able to overwrite the attributes related to the kernels. Furthermore, you need to have the entire model on gpus if you want to use exllama kernels. Also, you can perform CPU inference using Auto-GPTQ for Auto-GPTQ version &gt; 0.4.2 by passing <code>device_map</code> = “cpu”. For CPU inference, you have to pass <code>use_exllama = False</code> in the <code>GPTQConfig.</code>',wa,st,_a,rt,cs='With the release of the exllamav2 kernels, you can get faster inference speed compared to the exllama kernels. You just need to pass <code>exllama_config={&quot;version&quot;: 2}</code> in <a href="/docs/transformers/main/en/main_classes/quantization#transformers.GPTQConfig">GPTQConfig</a>:',Ta,dt,Ma,mt,hs="Note that only 4-bit models are supported for now. Furthermore, it is recommended to deactivate the exllama kernels if you are finetuning a quantized model with peft.",va,pt,bs='You can find the benchmark of these kernels <a href="https://github.com/huggingface/optimum/tree/main/tests/benchmark#gptq-benchmark" rel="nofollow">here</a>',Ca,ut,ka,ft,gs=`With the official support of adapters in the Hugging Face ecosystem, you can fine-tune models that have been quantized with GPTQ.
Please have a look at <a href="https://github.com/huggingface/peft" rel="nofollow"><code>peft</code></a> library for more details.`,qa,ct,xa,ht,ys='Check out the Google Colab <a href="https://colab.research.google.com/drive/1_TIrmuKOFhuRRiTWN94iLKUFu6ZX4ceb?usp=sharing" rel="nofollow">notebook</a> to learn how to quantize your model with GPTQ and how finetune the quantized model with peft.',Ja,bt,za,M,gt,ri,In,$s=`This is a wrapper class about all possible attributes and features that you can play with a model that has been
loaded using <code>optimum</code> api for gptq quantization relying on auto_gptq backend.`,di,V,yt,mi,Nn,ws="Get compatible class with optimum gptq config dict",pi,L,$t,ui,Pn,_s="Safety checker that arguments are correct",fi,X,wt,ci,En,Ts="Get compatible dict for optimum gptq config",Wa,_t,Za,Tt,Ms=`🤗 Transformers is closely integrated with most used modules on <code>bitsandbytes</code>. You can load your model in 8-bit precision with few lines of code.
This is supported by most of the GPU hardwares since the <code>0.37.0</code> release of <code>bitsandbytes</code>.`,Ua,Mt,vs='Learn more about the quantization method in the <a href="https://arxiv.org/abs/2208.07339" rel="nofollow">LLM.int8()</a> paper, or the <a href="https://huggingface.co/blog/hf-bitsandbytes-integration" rel="nofollow">blogpost</a> about the collaboration.',Qa,vt,Cs="Since its <code>0.39.0</code> release, you can load any model that supports <code>device_map</code> using 4-bit quantization, leveraging FP4 data type.",Ga,Ct,ks='If you want to quantize your own pytorch model, check out this <a href="https://huggingface.co/docs/accelerate/main/en/usage_guides/quantization" rel="nofollow">documentation</a> from 🤗 Accelerate library.',ja,kt,qs="Here are the things you can do using <code>bitsandbytes</code> integration",Ba,qt,Va,xt,xs='You can quantize a model by using the <code>load_in_8bit</code> or <code>load_in_4bit</code> argument when calling the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method as long as your model supports loading with 🤗 Accelerate and contains <code>torch.nn.Linear</code> layers. This should work for any modality as well.',La,Jt,Xa,zt,Js="By default all other modules (e.g. <code>torch.nn.LayerNorm</code>) will be converted in <code>torch.float16</code>, but if you want to change their <code>dtype</code> you can overwrite the <code>torch_dtype</code> argument:",Ha,Wt,Fa,Zt,Aa,Ut,Ra,Qt,zs="Make sure that you have installed the requirements below before running any of the code snippets below.",Ia,Gt,Ws=`<li><p>Latest <code>bitsandbytes</code> library
<code>pip install bitsandbytes&gt;=0.39.0</code></p></li> <li><p>Install latest <code>accelerate</code> <code>pip install --upgrade accelerate</code></p></li> <li><p>Install latest <code>transformers</code> <code>pip install --upgrade transformers</code></p></li>`,Na,jt,Pa,Bt,Zs='<li><p><strong>Advanced usage:</strong> Refer to <a href="https://colab.research.google.com/drive/1ge2F1QSK8Q7h0hn3YKuBCOAS0bK8E0wf" rel="nofollow">this Google Colab notebook</a> for advanced usage of 4-bit quantization with all the possible options.</p></li> <li><p><strong>Faster inference with <code>batch_size=1</code> :</strong> Since the <code>0.40.0</code> release of bitsandbytes, for <code>batch_size=1</code> you can benefit from fast inference. Check out <a href="https://github.com/TimDettmers/bitsandbytes/releases/tag/0.40.0" rel="nofollow">these release notes</a> and make sure to have a version that is greater than <code>0.40.0</code> to benefit from this feature out of the box.</p></li> <li><p><strong>Training:</strong> According to <a href="https://arxiv.org/abs/2305.14314" rel="nofollow">QLoRA paper</a>, for training 4-bit base models (e.g. using LoRA adapters) one should use <code>bnb_4bit_quant_type=&#39;nf4&#39;</code>.</p></li> <li><p><strong>Inference:</strong> For inference, <code>bnb_4bit_quant_type</code> does not have a huge impact on the performance. However for consistency with the model’s weights, make sure you use the same <code>bnb_4bit_compute_dtype</code> and <code>torch_dtype</code> arguments.</p></li>',Ea,Vt,Ya,Lt,Us="By using <code>load_in_4bit=True</code> when calling the <code>.from_pretrained</code> method, you can divide your memory use by 4 (roughly).",Sa,Xt,Da,H,Ka,Ht,Oa,Ft,Qs="You can load a model by roughly halving the memory requirements by using <code>load_in_8bit=True</code> argument when calling <code>.from_pretrained</code> method",el,At,tl,Rt,Gs='Then, use your model as you would usually use a <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>.',nl,It,js="You can check the memory footprint of your model with <code>get_memory_footprint</code> method.",ol,Nt,al,Pt,Bs="With this integration we were able to load large models on smaller devices and run them without any issue.",ll,F,il,Et,sl,Yt,Vs="Here we will cover some advanced use cases you can perform with FP4 quantization",rl,St,dl,Dt,Ls="The compute dtype is used to change the dtype that will be used during computation. For example, hidden states could be in <code>float32</code> but computation can be set to bf16 for speedups. By default, the compute dtype is set to <code>float32</code>.",ml,Kt,pl,Ot,ul,en,Xs="You can also use the NF4 data type, which is a new 4bit datatype adapted for weights that have been initialized using a normal distribution. For that run:",fl,tn,cl,nn,hl,on,Hs="We also advise users to use the nested quantization technique. This saves more memory at no additional performance - from our empirical observations, this enables fine-tuning llama-13b model on an NVIDIA-T4 16GB with a sequence length of 1024, batch size of 1 and gradient accumulation steps of 4.",bl,an,gl,ln,yl,sn,Fs=`You can push a quantized model on the Hub by naively using <code>push_to_hub</code> method. This will first push the quantization configuration file, then push the quantized model weights.
Make sure to use <code>bitsandbytes&gt;0.37.2</code> (at this time of writing, we tested it on <code>bitsandbytes==0.38.0.post1</code>) to be able to use this feature.`,$l,rn,wl,A,_l,dn,Tl,mn,As="You can load a quantized model from the Hub by using <code>from_pretrained</code> method. Make sure that the pushed weights are quantized, by checking that the attribute <code>quantization_config</code> is present in the model configuration object.",Ml,pn,vl,un,Rs=`Note that in this case, you don’t need to specify the arguments <code>load_in_8bit=True</code>, but you need to make sure that <code>bitsandbytes</code> and <code>accelerate</code> are installed.
Note also that <code>device_map</code> is optional but setting <code>device_map = &#39;auto&#39;</code> is prefered for inference as it will dispatch efficiently the model on the available ressources.`,Cl,fn,kl,cn,Is="This section is intended to advanced users, that want to explore what it is possible to do beyond loading and running 8-bit models.",ql,hn,xl,bn,Ns="One of the advanced use case of this is being able to load a model and dispatch the weights between <code>CPU</code> and <code>GPU</code>. Note that the weights that will be dispatched on CPU <strong>will not</strong> be converted in 8-bit, thus kept in <code>float32</code>. This feature is intended for users that want to fit a very large model and dispatch the model between GPU and CPU.",Jl,gn,Ps='First, load a <a href="/docs/transformers/main/en/main_classes/quantization#transformers.BitsAndBytesConfig">BitsAndBytesConfig</a> from <code>transformers</code> and set the attribute <code>llm_int8_enable_fp32_cpu_offload</code> to <code>True</code>:',zl,yn,Wl,$n,Es="Let’s say you want to load <code>bigscience/bloom-1b7</code> model, and you have just enough GPU RAM to fit the entire model except the <code>lm_head</code>. Therefore write a custom device_map as follows:",Zl,wn,Ul,_n,Ys="And load your model as follows:",Ql,Tn,Gl,Mn,Ss="And that’s it! Enjoy your model!",jl,vn,Bl,Cn,Ds=`You can play with the <code>llm_int8_threshold</code> argument to change the threshold of the outliers. An “outlier” is a hidden state value that is greater than a certain threshold.
This corresponds to the outlier threshold for outlier detection as described in <code>LLM.int8()</code> paper. Any hidden states value that is above this threshold will be considered an outlier and the operation on those values will be done in fp16. Values are usually normally distributed, that is, most values are in the range [-3.5, 3.5], but there are some exceptional systematic outliers that are very differently distributed for large models. These outliers are often in the interval [-60, -6] or [6, 60]. Int8 quantization works well for values of magnitude ~5, but beyond that, there is a significant performance penalty. A good default threshold is 6, but a lower threshold might be needed for more unstable models (small models, fine-tuning).
This argument can impact the inference speed of the model. We suggest to play with this parameter to find which one is the best for your use case.`,Vl,kn,Ll,qn,Xl,xn,Ks="Some models has several modules that needs to be not converted in 8-bit to ensure stability. For example Jukebox model has several <code>lm_head</code> modules that should be skipped. Play with <code>llm_int8_skip_modules</code>",Hl,Jn,Fl,zn,Al,Wn,Os=`With the official support of adapters in the Hugging Face ecosystem, you can fine-tune models that have been loaded in 8-bit.
This enables fine-tuning large models such as <code>flan-t5-large</code> or <code>facebook/opt-6.7b</code> in a single google Colab. Please have a look at <a href="https://github.com/huggingface/peft" rel="nofollow"><code>peft</code></a> library for more details.`,Rl,Zn,er="Note that you don’t need to pass <code>device_map</code> when loading the model for training. It will automatically load your model on your GPU. You can also set the device map to a specific device if needed (e.g. <code>cuda:0</code>, <code>0</code>, <code>torch.device(&#39;cuda:0&#39;)</code>). Please note that <code>device_map=auto</code> should be used for inference only.",Il,Un,Nl,w,Qn,hi,Yn,tr=`This is a wrapper class about all possible attributes and features that you can play with a model that has been
loaded using <code>bitsandbytes</code>.`,bi,Sn,nr="This replaces <code>load_in_8bit</code> or <code>load_in_4bit</code>therefore both options are mutually exclusive.",gi,Dn,or=`Currently only supports <code>LLM.int8()</code>, <code>FP4</code>, and <code>NF4</code> quantization. If more methods are added to <code>bitsandbytes</code>,
then more arguments will be added to this class.`,yi,R,Gn,$i,Kn,ar="Returns <code>True</code> if the model is quantizable, <code>False</code> otherwise.",wi,I,jn,_i,On,lr="Safety checker that arguments are correct - also replaces some NoneType arguments with their default values.",Ti,N,Bn,Mi,eo,ir=`This method returns the quantization method used for the model. If the model is not quantizable, it returns
<code>None</code>.`,vi,P,Vn,Ci,to,sr=`Removes all attributes from config which correspond to the default config attributes for better readability and
serializes to a Python dictionary.`,Pl,Ln,El,Xn,rr='Please have a look at <a href="https://huggingface.co/docs/optimum/index" rel="nofollow">Optimum documentation</a> to learn more about quantization methods that are supported by <code>optimum</code> and see if these are applicable for your use case.',Yl,no,Sl;return E=new b({props:{title:"Quantize 🤗 Transformers models",local:"quantize--transformers-models",headingTag:"h1"}}),Y=new b({props:{title:"AWQ integration",local:"awq-integration",headingTag:"h2"}}),K=new b({props:{title:"Quantizing a model",local:"quantizing-a-model",headingTag:"h3"}}),ne=new b({props:{title:"Load a quantized model",local:"load-a-quantized-model",headingTag:"h3"}}),ae=new b({props:{title:"Example usage",local:"example-usage",headingTag:"h2"}}),ie=new y({props:{code:"cGlwJTIwaW5zdGFsbCUyMGF1dG9hd3E=",highlighted:"pip install autoawq",wrap:!1}}),se=new y({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}}),de=new y({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUwQSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIyVGhlQmxva2UlMkZ6ZXBoeXItN0ItYWxwaGEtQVdRJTIyJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQpLnRvKCUyMmN1ZGElM0EwJTIyKQ==",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).to(<span class="hljs-string">&quot;cuda:0&quot;</span>)`,wrap:!1}}),me=new b({props:{title:"Combining AWQ and Flash Attention",local:"combining-awq-and-flash-attention",headingTag:"h3"}}),ue=new y({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMlRoZUJsb2tlJTJGemVwaHlyLTdCLWFscGhhLUFXUSUyMiUyQyUyMHVzZV9mbGFzaF9hdHRlbnRpb25fMiUzRFRydWUlMkMlMjBkZXZpY2VfbWFwJTNEJTIyY3VkYSUzQTAlMjIp",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>, use_flash_attention_2=<span class="hljs-literal">True</span>, device_map=<span class="hljs-string">&quot;cuda:0&quot;</span>)`,wrap:!1}}),fe=new b({props:{title:"Benchmarks",local:"benchmarks",headingTag:"h3"}}),$e=new b({props:{title:"Google colab demo",local:"google-colab-demo",headingTag:"h3"}}),_e=new b({props:{title:"AwqConfig",local:"transformers.AwqConfig",headingTag:"h3"}}),Te=new x({props:{name:"class transformers.AwqConfig",anchor:"transformers.AwqConfig",parameters:[{name:"bits",val:": int = 4"},{name:"group_size",val:": int = 128"},{name:"zero_point",val:": bool = True"},{name:"version",val:": AWQLinearVersion = <AWQLinearVersion.GEMM: 'gemm'>"},{name:"backend",val:": AwqBackendPackingMethod = <AwqBackendPackingMethod.AUTOAWQ: 'autoawq'>"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.AwqConfig.bits",description:`<strong>bits</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The number of bits to quantize to.`,name:"bits"},{anchor:"transformers.AwqConfig.group_size",description:`<strong>group_size</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
The group size to use for quantization. Recommended value is 128 and -1 uses per-column quantization.`,name:"group_size"},{anchor:"transformers.AwqConfig.zero_point",description:`<strong>zero_point</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use zero point quantization.`,name:"zero_point"},{anchor:"transformers.AwqConfig.version",description:`<strong>version</strong> (<code>AWQLinearVersion</code>, <em>optional</em>, defaults to <code>AWQLinearVersion.GEMM</code>) &#x2014;
The version of the quantization algorithm to use. GEMM is better for big batch_size (e.g. &gt;= 8) otherwise,
GEMV is better (e.g. &lt; 8 )`,name:"version"},{anchor:"transformers.AwqConfig.backend",description:`<strong>backend</strong> (<code>AwqBackendPackingMethod</code>, <em>optional</em>, defaults to <code>AwqBackendPackingMethod.AUTOAWQ</code>) &#x2014;
The quantization backend. Some models might be quantized using <code>llm-awq</code> backend. This is useful for users
that quantize their own models using <code>llm-awq</code> library.`,name:"backend"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/utils/quantization_config.py#L518"}}),Me=new x({props:{name:"post_init",anchor:"transformers.AwqConfig.post_init",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/utils/quantization_config.py#L557"}}),ve=new b({props:{title:"AutoGPTQ Integration",local:"autogptq-integration",headingTag:"h2"}}),xe=new b({props:{title:"Requirements",local:"requirements",headingTag:"h3"}}),Ze=new b({props:{title:"Load and quantize a model",local:"load-and-quantize-a-model",headingTag:"h3"}}),Ge=new b({props:{title:"GPTQ Configuration",local:"gptq-configuration",headingTag:"h4"}}),Be=new y({props:{code:"bW9kZWxfaWQlMjAlM0QlMjAlMjJmYWNlYm9vayUyRm9wdC0xMjVtJTIyJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQpJTBBZ3B0cV9jb25maWclMjAlM0QlMjBHUFRRQ29uZmlnKGJpdHMlM0Q0JTJDJTIwZGF0YXNldCUyMCUzRCUyMCUyMmM0JTIyJTJDJTIwdG9rZW5pemVyJTNEdG9rZW5pemVyKQ==",highlighted:`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}}),Le=new y({props:{code:"ZGF0YXNldCUyMCUzRCUyMCU1QiUyMmF1dG8tZ3B0cSUyMGlzJTIwYW4lMjBlYXN5LXRvLXVzZSUyMG1vZGVsJTIwcXVhbnRpemF0aW9uJTIwbGlicmFyeSUyMHdpdGglMjB1c2VyLWZyaWVuZGx5JTIwYXBpcyUyQyUyMGJhc2VkJTIwb24lMjBHUFRRJTIwYWxnb3JpdGhtLiUyMiU1RCUwQXF1YW50aXphdGlvbiUyMCUzRCUyMEdQVFFDb25maWcoYml0cyUzRDQlMkMlMjBkYXRhc2V0JTIwJTNEJTIwZGF0YXNldCUyQyUyMHRva2VuaXplciUzRHRva2VuaXplcik=",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>]
quantization = GPTQConfig(bits=<span class="hljs-number">4</span>, dataset = dataset, tokenizer=tokenizer)`,wrap:!1}}),Xe=new b({props:{title:"Quantization",local:"quantization",headingTag:"h4"}}),Fe=new y({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQlMkMlMjBxdWFudGl6YXRpb25fY29uZmlnJTNEZ3B0cV9jb25maWcpJTBB",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=gptq_config)
`,wrap:!1}}),Ie=new y({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQlMkMlMjBkZXZpY2VfbWFwJTNEJTIyYXV0byUyMiUyQyUyMHF1YW50aXphdGlvbl9jb25maWclM0RncHRxX2NvbmZpZyk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained(model_id, device_map=<span class="hljs-string">&quot;auto&quot;</span>, quantization_config=gptq_config)`,wrap:!1}}),B=new ai({props:{warning:!0,$$slots:{default:[br]},$$scope:{ctx:J}}}),Pe=new b({props:{title:"Push quantized model to 🤗 Hub",local:"push-quantized-model-to--hub",headingTag:"h3"}}),Ye=new y({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}}),De=new y({props:{code:"cXVhbnRpemVkX21vZGVsLnNhdmVfcHJldHJhaW5lZCglMjJvcHQtMTI1bS1ncHRxJTIyKSUwQXRva2VuaXplci5zYXZlX3ByZXRyYWluZWQoJTIyb3B0LTEyNW0tZ3B0cSUyMik=",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>)`,wrap:!1}}),Oe=new y({props:{code:"cXVhbnRpemVkX21vZGVsLnRvKCUyMmNwdSUyMiklMEFxdWFudGl6ZWRfbW9kZWwuc2F2ZV9wcmV0cmFpbmVkKCUyMm9wdC0xMjVtLWdwdHElMjIp",highlighted:`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}}),et=new b({props:{title:"Load a quantized model from the 🤗 Hub",local:"load-a-quantized-model-from-the--hub",headingTag:"h3"}}),nt=new y({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIyJTdCeW91cl91c2VybmFtZSU3RCUyRm9wdC0xMjVtLWdwdHElMjIp",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>)`,wrap:!1}}),at=new y({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIyJTdCeW91cl91c2VybmFtZSU3RCUyRm9wdC0xMjVtLWdwdHElMjIlMkMlMjBkZXZpY2VfbWFwJTNEJTIyYXV0byUyMik=",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}}),lt=new b({props:{title:"Exllama kernels for faster inference",local:"exllama-kernels-for-faster-inference",headingTag:"h3"}}),st=new y({props:{code:"aW1wb3J0JTIwdG9yY2glMEFncHRxX2NvbmZpZyUyMCUzRCUyMEdQVFFDb25maWcoYml0cyUzRDQpJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIyJTdCeW91cl91c2VybmFtZSU3RCUyRm9wdC0xMjVtLWdwdHElMjIlMkMlMjBkZXZpY2VfbWFwJTNEJTIyYXV0byUyMiUyQyUyMHF1YW50aXphdGlvbl9jb25maWclM0RncHRxX2NvbmZpZyk=",highlighted:`<span class="hljs-keyword">import</span> torch
gptq_config = GPTQConfig(bits=<span class="hljs-number">4</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}}),dt=new y({props:{code:"aW1wb3J0JTIwdG9yY2glMEFncHRxX2NvbmZpZyUyMCUzRCUyMEdQVFFDb25maWcoYml0cyUzRDQlMkMlMjBleGxsYW1hX2NvbmZpZyUzRCU3QiUyMnZlcnNpb24lMjIlM0EyJTdEKSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMiU3QnlvdXJfdXNlcm5hbWUlN0QlMkZvcHQtMTI1bS1ncHRxJTIyJTJDJTIwZGV2aWNlX21hcCUzRCUyMmF1dG8lMjIlMkMlMjBxdWFudGl6YXRpb25fY29uZmlnJTIwJTNEJTIwZ3B0cV9jb25maWcp",highlighted:`<span class="hljs-keyword">import</span> torch
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}}),ut=new b({props:{title:"Fine-tune a quantized model",local:"fine-tune-a-quantized-model",headingTag:"h4"}}),ct=new b({props:{title:"Example demo",local:"example-demo",headingTag:"h3"}}),bt=new b({props:{title:"GPTQConfig",local:"transformers.GPTQConfig",headingTag:"h3"}}),gt=new x({props:{name:"class transformers.GPTQConfig",anchor:"transformers.GPTQConfig",parameters:[{name:"bits",val:": int"},{name:"tokenizer",val:": typing.Any = None"},{name:"dataset",val:": typing.Union[typing.List[str], str, NoneType] = None"},{name:"group_size",val:": int = 128"},{name:"damp_percent",val:": float = 0.1"},{name:"desc_act",val:": bool = False"},{name:"sym",val:": bool = True"},{name:"true_sequential",val:": bool = True"},{name:"use_cuda_fp16",val:": bool = False"},{name:"model_seqlen",val:": typing.Optional[int] = None"},{name:"block_name_to_quantize",val:": typing.Optional[str] = None"},{name:"module_name_preceding_first_block",val:": typing.Optional[typing.List[str]] = None"},{name:"batch_size",val:": int = 1"},{name:"pad_token_id",val:": typing.Optional[int] = None"},{name:"use_exllama",val:": typing.Optional[bool] = None"},{name:"max_input_length",val:": typing.Optional[int] = None"},{name:"exllama_config",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"cache_block_outputs",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.GPTQConfig.bits",description:`<strong>bits</strong> (<code>int</code>) &#x2014;
The number of bits to quantize to, supported numbers are (2, 3, 4, 8).`,name:"bits"},{anchor:"transformers.GPTQConfig.tokenizer",description:`<strong>tokenizer</strong> (<code>str</code> or <code>PreTrainedTokenizerBase</code>, <em>optional</em>) &#x2014;
The tokenizer used to process the dataset. You can pass either:<ul>
<li>A custom tokenizer object.</li>
<li>A string, the <em>model id</em> of a predefined tokenizer hosted inside a model repo on huggingface.co.
Valid model ids can be located at the root-level, like <code>bert-base-uncased</code>, or namespaced under a
user or organization name, like <code>dbmdz/bert-base-german-cased</code>.</li>
<li>A path to a <em>directory</em> containing vocabulary files required by the tokenizer, for instance saved
using the <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.save_pretrained">save_pretrained()</a> method, e.g., <code>./my_model_directory/</code>.</li>
</ul>`,name:"tokenizer"},{anchor:"transformers.GPTQConfig.dataset",description:`<strong>dataset</strong> (<code>Union[List[str]]</code>, <em>optional</em>) &#x2014;
The dataset used for quantization. You can provide your own dataset in a list of string or just use the
original datasets used in GPTQ paper [&#x2018;wikitext2&#x2019;,&#x2018;c4&#x2019;,&#x2018;c4-new&#x2019;,&#x2018;ptb&#x2019;,&#x2018;ptb-new&#x2019;]`,name:"dataset"},{anchor:"transformers.GPTQConfig.group_size",description:`<strong>group_size</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
The group size to use for quantization. Recommended value is 128 and -1 uses per-column quantization.`,name:"group_size"},{anchor:"transformers.GPTQConfig.damp_percent",description:`<strong>damp_percent</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The percent of the average Hessian diagonal to use for dampening. Recommended value is 0.1.`,name:"damp_percent"},{anchor:"transformers.GPTQConfig.desc_act",description:`<strong>desc_act</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to quantize columns in order of decreasing activation size. Setting it to False can significantly
speed up inference but the perplexity may become slightly worse. Also known as act-order.`,name:"desc_act"},{anchor:"transformers.GPTQConfig.sym",description:`<strong>sym</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use symetric quantization.`,name:"sym"},{anchor:"transformers.GPTQConfig.true_sequential",description:`<strong>true_sequential</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to perform sequential quantization even within a single Transformer block. Instead of quantizing
the entire block at once, we perform layer-wise quantization. As a result, each layer undergoes
quantization using inputs that have passed through the previously quantized layers.`,name:"true_sequential"},{anchor:"transformers.GPTQConfig.use_cuda_fp16",description:`<strong>use_cuda_fp16</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use optimized cuda kernel for fp16 model. Need to have model in fp16.`,name:"use_cuda_fp16"},{anchor:"transformers.GPTQConfig.model_seqlen",description:`<strong>model_seqlen</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The maximum sequence length that the model can take.`,name:"model_seqlen"},{anchor:"transformers.GPTQConfig.block_name_to_quantize",description:`<strong>block_name_to_quantize</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The transformers block name to quantize.`,name:"block_name_to_quantize"},{anchor:"transformers.GPTQConfig.module_name_preceding_first_block",description:`<strong>module_name_preceding_first_block</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
The layers that are preceding the first Transformer block.`,name:"module_name_preceding_first_block"},{anchor:"transformers.GPTQConfig.batch_size",description:`<strong>batch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The batch size used when processing the dataset`,name:"batch_size"},{anchor:"transformers.GPTQConfig.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The pad token id. Needed to prepare the dataset when <code>batch_size</code> &gt; 1.`,name:"pad_token_id"},{anchor:"transformers.GPTQConfig.use_exllama",description:`<strong>use_exllama</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to use exllama backend. Defaults to <code>True</code> if unset. Only works with <code>bits</code> = 4.`,name:"use_exllama"},{anchor:"transformers.GPTQConfig.max_input_length",description:`<strong>max_input_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The maximum input length. This is needed to initialize a buffer that depends on the maximum expected input
length. It is specific to the exllama backend with act-order.`,name:"max_input_length"},{anchor:"transformers.GPTQConfig.exllama_config",description:`<strong>exllama_config</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
The exllama config. You can specify the version of the exllama kernel through the <code>version</code> key. Defaults
to <code>{&quot;version&quot;: 1}</code> if unset.`,name:"exllama_config"},{anchor:"transformers.GPTQConfig.cache_block_outputs",description:`<strong>cache_block_outputs</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to cache block outputs to reuse as inputs for the succeeding block.`,name:"cache_block_outputs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/utils/quantization_config.py#L319"}}),yt=new x({props:{name:"from_dict_optimum",anchor:"transformers.GPTQConfig.from_dict_optimum",parameters:[{name:"config_dict",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/utils/quantization_config.py#L502"}}),$t=new x({props:{name:"post_init",anchor:"transformers.GPTQConfig.post_init",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/utils/quantization_config.py#L425"}}),wt=new x({props:{name:"to_dict_optimum",anchor:"transformers.GPTQConfig.to_dict_optimum",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/utils/quantization_config.py#L493"}}),_t=new b({props:{title:"bitsandbytes Integration",local:"bitsandbytes-integration",headingTag:"h2"}}),qt=new b({props:{title:"General usage",local:"general-usage",headingTag:"h3"}}),Jt=new y({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTBBJTBBbW9kZWxfOGJpdCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRm9wdC0zNTBtJTIyJTJDJTIwbG9hZF9pbl84Yml0JTNEVHJ1ZSklMEFtb2RlbF80Yml0JTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGb3B0LTM1MG0lMjIlMkMlMjBsb2FkX2luXzRiaXQlM0RUcnVlKQ==",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;facebook/opt-350m&quot;</span>, load_in_8bit=<span class="hljs-literal">True</span>)
model_4bit = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;facebook/opt-350m&quot;</span>, load_in_4bit=<span class="hljs-literal">True</span>)`,wrap:!1}}),Wt=new y({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMEElMEFtb2RlbF84Yml0JTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGb3B0LTM1MG0lMjIlMkMlMjBsb2FkX2luXzhiaXQlM0RUcnVlJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDMyKSUwQW1vZGVsXzhiaXQubW9kZWwuZGVjb2Rlci5sYXllcnMlNUItMSU1RC5maW5hbF9sYXllcl9ub3JtLndlaWdodC5kdHlwZQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>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)
<span class="hljs-meta">&gt;&gt;&gt; </span>model_8bit.model.decoder.layers[-<span class="hljs-number">1</span>].final_layer_norm.weight.dtype
torch.float32`,wrap:!1}}),Zt=new b({props:{title:"FP4 quantization",local:"fp4-quantization",headingTag:"h3"}}),Ut=new b({props:{title:"Requirements",local:"requirements",headingTag:"h4"}}),jt=new b({props:{title:"Tips and best practices",local:"tips-and-best-practices",headingTag:"h4"}}),Vt=new b({props:{title:"Load a large model in 4bit",local:"load-a-large-model-in-4bit",headingTag:"h4"}}),Xt=new y({props:{code:"JTIzJTIwcGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGFjY2VsZXJhdGUlMjBiaXRzYW5kYnl0ZXMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMkMlMjBBdXRvVG9rZW5pemVyJTBBJTBBbW9kZWxfaWQlMjAlM0QlMjAlMjJiaWdzY2llbmNlJTJGYmxvb20tMWI3JTIyJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQpJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQlMkMlMjBkZXZpY2VfbWFwJTNEJTIyYXV0byUyMiUyQyUyMGxvYWRfaW5fNGJpdCUzRFRydWUp",highlighted:`<span class="hljs-comment"># pip install transformers accelerate bitsandbytes</span>
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer

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

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map=<span class="hljs-string">&quot;auto&quot;</span>, load_in_4bit=<span class="hljs-literal">True</span>)`,wrap:!1}}),H=new ai({props:{warning:!0,$$slots:{default:[gr]},$$scope:{ctx:J}}}),Ht=new b({props:{title:"Load a large model in 8bit",local:"load-a-large-model-in-8bit",headingTag:"h3"}}),At=new y({props:{code:"JTIzJTIwcGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGFjY2VsZXJhdGUlMjBiaXRzYW5kYnl0ZXMlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMkMlMjBBdXRvVG9rZW5pemVyJTBBJTBBbW9kZWxfaWQlMjAlM0QlMjAlMjJiaWdzY2llbmNlJTJGYmxvb20tMWI3JTIyJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQpJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQlMkMlMjBkZXZpY2VfbWFwJTNEJTIyYXV0byUyMiUyQyUyMGxvYWRfaW5fOGJpdCUzRFRydWUp",highlighted:`<span class="hljs-comment"># pip install transformers accelerate bitsandbytes</span>
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer

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

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map=<span class="hljs-string">&quot;auto&quot;</span>, load_in_8bit=<span class="hljs-literal">True</span>)`,wrap:!1}}),Nt=new y({props:{code:"cHJpbnQobW9kZWwuZ2V0X21lbW9yeV9mb290cHJpbnQoKSk=",highlighted:'<span class="hljs-built_in">print</span>(model.get_memory_footprint())',wrap:!1}}),F=new ai({props:{warning:!0,$$slots:{default:[yr]},$$scope:{ctx:J}}}),Et=new b({props:{title:"Advanced use cases",local:"advanced-use-cases",headingTag:"h4"}}),St=new b({props:{title:"Change the compute dtype",local:"change-the-compute-dtype",headingTag:"h5"}}),Kt=new y({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}}),Ot=new b({props:{title:"Using NF4 (Normal Float 4) data type",local:"using-nf4-normal-float-4-data-type",headingTag:"h5"}}),tn=new y({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}}),nn=new b({props:{title:"Use nested quantization for more memory efficient inference",local:"use-nested-quantization-for-more-memory-efficient-inference",headingTag:"h5"}}),an=new y({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJpdHNBbmRCeXRlc0NvbmZpZyUwQSUwQWRvdWJsZV9xdWFudF9jb25maWclMjAlM0QlMjBCaXRzQW5kQnl0ZXNDb25maWcoJTBBJTIwJTIwJTIwJTIwbG9hZF9pbl80Yml0JTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMGJuYl80Yml0X3VzZV9kb3VibGVfcXVhbnQlM0RUcnVlJTJDJTBBKSUwQSUwQW1vZGVsX2RvdWJsZV9xdWFudCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCUyQyUyMHF1YW50aXphdGlvbl9jb25maWclM0Rkb3VibGVfcXVhbnRfY29uZmlnKQ==",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(model_id, quantization_config=double_quant_config)`,wrap:!1}}),ln=new b({props:{title:"Push quantized models on the 🤗 Hub",local:"push-quantized-models-on-the--hub",headingTag:"h3"}}),rn=new y({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}}),A=new ai({props:{warning:!0,$$slots:{default:[$r]},$$scope:{ctx:J}}}),dn=new b({props:{title:"Load a quantized model from the 🤗 Hub",local:"load-a-quantized-model-from-the--hub",headingTag:"h3"}}),pn=new y({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}}),fn=new b({props:{title:"Advanced use cases",local:"advanced-use-cases",headingTag:"h3"}}),hn=new b({props:{title:"Offload between cpu and gpu",local:"offload-between-cpu-and-gpu",headingTag:"h4"}}),yn=new y({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUyQyUyMEJpdHNBbmRCeXRlc0NvbmZpZyUwQSUwQXF1YW50aXphdGlvbl9jb25maWclMjAlM0QlMjBCaXRzQW5kQnl0ZXNDb25maWcobGxtX2ludDhfZW5hYmxlX2ZwMzJfY3B1X29mZmxvYWQlM0RUcnVlKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig

quantization_config = BitsAndBytesConfig(llm_int8_enable_fp32_cpu_offload=<span class="hljs-literal">True</span>)`,wrap:!1}}),wn=new y({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}}),Tn=new y({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}}),vn=new b({props:{title:"Play with llm_int8_threshold",local:"play-with-llmint8threshold",headingTag:"h4"}}),kn=new y({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUyQyUyMEJpdHNBbmRCeXRlc0NvbmZpZyUwQSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIyYmlnc2NpZW5jZSUyRmJsb29tLTFiNyUyMiUwQSUwQXF1YW50aXphdGlvbl9jb25maWclMjAlM0QlMjBCaXRzQW5kQnl0ZXNDb25maWcoJTBBJTIwJTIwJTIwJTIwbGxtX2ludDhfdGhyZXNob2xkJTNEMTAlMkMlMEEpJTBBJTBBbW9kZWxfOGJpdCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjBtb2RlbF9pZCUyQyUwQSUyMCUyMCUyMCUyMGRldmljZV9tYXAlM0RkZXZpY2VfbWFwJTJDJTBBJTIwJTIwJTIwJTIwcXVhbnRpemF0aW9uX2NvbmZpZyUzRHF1YW50aXphdGlvbl9jb25maWclMkMlMEEpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQp",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_threshold=<span class="hljs-number">10</span>,
)

model_8bit = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map=device_map,
    quantization_config=quantization_config,
)
tokenizer = AutoTokenizer.from_pretrained(model_id)`,wrap:!1}}),qn=new b({props:{title:"Skip the conversion of some modules",local:"skip-the-conversion-of-some-modules",headingTag:"h4"}}),Jn=new y({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUyQyUyMEJpdHNBbmRCeXRlc0NvbmZpZyUwQSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIyYmlnc2NpZW5jZSUyRmJsb29tLTFiNyUyMiUwQSUwQXF1YW50aXphdGlvbl9jb25maWclMjAlM0QlMjBCaXRzQW5kQnl0ZXNDb25maWcoJTBBJTIwJTIwJTIwJTIwbGxtX2ludDhfc2tpcF9tb2R1bGVzJTNEJTVCJTIybG1faGVhZCUyMiU1RCUyQyUwQSklMEElMEFtb2RlbF84Yml0JTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMG1vZGVsX2lkJTJDJTBBJTIwJTIwJTIwJTIwZGV2aWNlX21hcCUzRGRldmljZV9tYXAlMkMlMEElMjAlMjAlMjAlMjBxdWFudGl6YXRpb25fY29uZmlnJTNEcXVhbnRpemF0aW9uX2NvbmZpZyUyQyUwQSklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCk=",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=device_map,
    quantization_config=quantization_config,
)
tokenizer = AutoTokenizer.from_pretrained(model_id)`,wrap:!1}}),zn=new b({props:{title:"Fine-tune a model that has been loaded in 8-bit",local:"fine-tune-a-model-that-has-been-loaded-in-8-bit",headingTag:"h4"}}),Un=new b({props:{title:"BitsAndBytesConfig",local:"transformers.BitsAndBytesConfig",headingTag:"h3"}}),Qn=new x({props:{name:"class transformers.BitsAndBytesConfig",anchor:"transformers.BitsAndBytesConfig",parameters:[{name:"load_in_8bit",val:" = False"},{name:"load_in_4bit",val:" = False"},{name:"llm_int8_threshold",val:" = 6.0"},{name:"llm_int8_skip_modules",val:" = None"},{name:"llm_int8_enable_fp32_cpu_offload",val:" = False"},{name:"llm_int8_has_fp16_weight",val:" = False"},{name:"bnb_4bit_compute_dtype",val:" = None"},{name:"bnb_4bit_quant_type",val:" = 'fp4'"},{name:"bnb_4bit_use_double_quant",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BitsAndBytesConfig.load_in_8bit",description:`<strong>load_in_8bit</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
This flag is used to enable 8-bit quantization with LLM.int8().`,name:"load_in_8bit"},{anchor:"transformers.BitsAndBytesConfig.load_in_4bit",description:`<strong>load_in_4bit</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
This flag is used to enable 4-bit quantization by replacing the Linear layers with FP4/NF4 layers from
<code>bitsandbytes</code>.`,name:"load_in_4bit"},{anchor:"transformers.BitsAndBytesConfig.llm_int8_threshold",description:`<strong>llm_int8_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 6.0) &#x2014;
This corresponds to the outlier threshold for outlier detection as described in <code>LLM.int8() : 8-bit Matrix Multiplication for Transformers at Scale</code> paper: <a href="https://arxiv.org/abs/2208.07339" rel="nofollow">https://arxiv.org/abs/2208.07339</a> Any hidden states value
that is above this threshold will be considered an outlier and the operation on those values will be done
in fp16. Values are usually normally distributed, that is, most values are in the range [-3.5, 3.5], but
there are some exceptional systematic outliers that are very differently distributed for large models.
These outliers are often in the interval [-60, -6] or [6, 60]. Int8 quantization works well for values of
magnitude ~5, but beyond that, there is a significant performance penalty. A good default threshold is 6,
but a lower threshold might be needed for more unstable models (small models, fine-tuning).`,name:"llm_int8_threshold"},{anchor:"transformers.BitsAndBytesConfig.llm_int8_skip_modules",description:`<strong>llm_int8_skip_modules</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
An explicit list of the modules that we do not want to convert in 8-bit. This is useful for models such as
Jukebox that has several heads in different places and not necessarily at the last position. For example
for <code>CausalLM</code> models, the last <code>lm_head</code> is kept in its original <code>dtype</code>.`,name:"llm_int8_skip_modules"},{anchor:"transformers.BitsAndBytesConfig.llm_int8_enable_fp32_cpu_offload",description:`<strong>llm_int8_enable_fp32_cpu_offload</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
This flag is used for advanced use cases and users that are aware of this feature. If you want to split
your model in different parts and run some parts in int8 on GPU and some parts in fp32 on CPU, you can use
this flag. This is useful for offloading large models such as <code>google/flan-t5-xxl</code>. Note that the int8
operations will not be run on CPU.`,name:"llm_int8_enable_fp32_cpu_offload"},{anchor:"transformers.BitsAndBytesConfig.llm_int8_has_fp16_weight",description:`<strong>llm_int8_has_fp16_weight</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
This flag runs LLM.int8() with 16-bit main weights. This is useful for fine-tuning as the weights do not
have to be converted back and forth for the backward pass.`,name:"llm_int8_has_fp16_weight"},{anchor:"transformers.BitsAndBytesConfig.bnb_4bit_compute_dtype",description:`<strong>bnb_4bit_compute_dtype</strong> (<code>torch.dtype</code> or str, <em>optional</em>, defaults to <code>torch.float32</code>) &#x2014;
This sets the computational type which might be different than the input time. For example, inputs might be
fp32, but computation can be set to bf16 for speedups.`,name:"bnb_4bit_compute_dtype"},{anchor:"transformers.BitsAndBytesConfig.bnb_4bit_quant_type",description:`<strong>bnb_4bit_quant_type</strong> (<code>str</code>,  <em>optional</em>, defaults to <code>&quot;fp4&quot;</code>) &#x2014;
This sets the quantization data type in the bnb.nn.Linear4Bit layers. Options are FP4 and NF4 data types
which are specified by <code>fp4</code> or <code>nf4</code>.`,name:"bnb_4bit_quant_type"},{anchor:"transformers.BitsAndBytesConfig.bnb_4bit_use_double_quant",description:`<strong>bnb_4bit_use_double_quant</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
This flag is used for nested quantization where the quantization constants from the first quantization are
quantized again.`,name:"bnb_4bit_use_double_quant"},{anchor:"transformers.BitsAndBytesConfig.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional parameters from which to initialize the configuration object.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/utils/quantization_config.py#L141"}}),Gn=new x({props:{name:"is_quantizable",anchor:"transformers.BitsAndBytesConfig.is_quantizable",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/utils/quantization_config.py#L256"}}),jn=new x({props:{name:"post_init",anchor:"transformers.BitsAndBytesConfig.post_init",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/utils/quantization_config.py#L225"}}),Bn=new x({props:{name:"quantization_method",anchor:"transformers.BitsAndBytesConfig.quantization_method",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/utils/quantization_config.py#L262"}}),Vn=new x({props:{name:"to_diff_dict",anchor:"transformers.BitsAndBytesConfig.to_diff_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/utils/quantization_config.py#L290",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>Dictionary of all the attributes that make up this configuration instance,</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>Dict[str, Any]</code></p>
`}}),Ln=new b({props:{title:"Quantization with 🤗 optimum",local:"quantization-with--optimum",headingTag:"h2"}}),{c(){g=i("meta"),_=a(),$=i("p"),z=a(),d(E.$$.fragment),oo=a(),d(Y.$$.fragment),ao=a(),S=i("p"),S.innerHTML=qi,lo=a(),D=i("p"),D.textContent=xi,io=a(),d(K.$$.fragment),so=a(),O=i("p"),O.textContent=Ji,ro=a(),ee=i("ul"),ee.innerHTML=zi,mo=a(),te=i("p"),te.innerHTML=Wi,po=a(),d(ne.$$.fragment),uo=a(),oe=i("p"),oe.innerHTML=Zi,fo=a(),d(ae.$$.fragment),co=a(),le=i("p"),le.innerHTML=Ui,ho=a(),d(ie.$$.fragment),bo=a(),d(se.$$.fragment),go=a(),re=i("p"),re.textContent=Qi,yo=a(),d(de.$$.fragment),$o=a(),d(me.$$.fragment),wo=a(),pe=i("p"),pe.innerHTML=Gi,_o=a(),d(ue.$$.fragment),To=a(),d(fe.$$.fragment),Mo=a(),ce=i("p"),ce.innerHTML=ji,vo=a(),he=i("p"),he.innerHTML=Bi,Co=a(),be=i("p"),be.innerHTML=Vi,ko=a(),Z=i("div"),Z.innerHTML=Li,qo=a(),U=i("div"),U.innerHTML=Xi,xo=a(),Q=i("div"),Q.innerHTML=Hi,Jo=a(),G=i("div"),G.innerHTML=Fi,zo=a(),ge=i("p"),ge.innerHTML=Ai,Wo=a(),ye=i("p"),ye.textContent=Ri,Zo=a(),d($e.$$.fragment),Uo=a(),we=i("p"),we.innerHTML=Ii,Qo=a(),d(_e.$$.fragment),Go=a(),q=i("div"),d(Te.$$.fragment),li=a(),An=i("p"),An.innerHTML=Ni,ii=a(),j=i("div"),d(Me.$$.fragment),si=a(),Rn=i("p"),Rn.textContent=Pi,jo=a(),d(ve.$$.fragment),Bo=a(),Ce=i("p"),Ce.innerHTML=Ei,Vo=a(),ke=i("p"),ke.textContent=Yi,Lo=a(),qe=i("ul"),qe.innerHTML=Si,Xo=a(),d(xe.$$.fragment),Ho=a(),Je=i("p"),Je.textContent=Di,Fo=a(),ze=i("ul"),ze.innerHTML=Ki,Ao=a(),We=i("p"),We.textContent=Oi,Ro=a(),d(Ze.$$.fragment),Io=a(),Ue=i("p"),Ue.innerHTML=es,No=a(),Qe=i("p"),Qe.textContent=ts,Po=a(),d(Ge.$$.fragment),Eo=a(),je=i("p"),je.innerHTML=ns,Yo=a(),d(Be.$$.fragment),So=a(),Ve=i("p"),Ve.textContent=os,Do=a(),d(Le.$$.fragment),Ko=a(),d(Xe.$$.fragment),Oo=a(),He=i("p"),He.innerHTML=as,ea=a(),d(Fe.$$.fragment),ta=a(),Ae=i("p"),Ae.textContent=ls,na=a(),Re=i("p"),Re.innerHTML=is,oa=a(),d(Ie.$$.fragment),aa=a(),Ne=i("p"),Ne.innerHTML=ss,la=a(),d(B.$$.fragment),ia=a(),d(Pe.$$.fragment),sa=a(),Ee=i("p"),Ee.innerHTML=rs,ra=a(),d(Ye.$$.fragment),da=a(),Se=i("p"),Se.innerHTML=ds,ma=a(),d(De.$$.fragment),pa=a(),Ke=i("p"),Ke.innerHTML=ms,ua=a(),d(Oe.$$.fragment),fa=a(),d(et.$$.fragment),ca=a(),tt=i("p"),tt.innerHTML=ps,ha=a(),d(nt.$$.fragment),ba=a(),ot=i("p"),ot.innerHTML=us,ga=a(),d(at.$$.fragment),ya=a(),d(lt.$$.fragment),$a=a(),it=i("p"),it.innerHTML=fs,wa=a(),d(st.$$.fragment),_a=a(),rt=i("p"),rt.innerHTML=cs,Ta=a(),d(dt.$$.fragment),Ma=a(),mt=i("p"),mt.textContent=hs,va=a(),pt=i("p"),pt.innerHTML=bs,Ca=a(),d(ut.$$.fragment),ka=a(),ft=i("p"),ft.innerHTML=gs,qa=a(),d(ct.$$.fragment),xa=a(),ht=i("p"),ht.innerHTML=ys,Ja=a(),d(bt.$$.fragment),za=a(),M=i("div"),d(gt.$$.fragment),ri=a(),In=i("p"),In.innerHTML=$s,di=a(),V=i("div"),d(yt.$$.fragment),mi=a(),Nn=i("p"),Nn.textContent=ws,pi=a(),L=i("div"),d($t.$$.fragment),ui=a(),Pn=i("p"),Pn.textContent=_s,fi=a(),X=i("div"),d(wt.$$.fragment),ci=a(),En=i("p"),En.textContent=Ts,Wa=a(),d(_t.$$.fragment),Za=a(),Tt=i("p"),Tt.innerHTML=Ms,Ua=a(),Mt=i("p"),Mt.innerHTML=vs,Qa=a(),vt=i("p"),vt.innerHTML=Cs,Ga=a(),Ct=i("p"),Ct.innerHTML=ks,ja=a(),kt=i("p"),kt.innerHTML=qs,Ba=a(),d(qt.$$.fragment),Va=a(),xt=i("p"),xt.innerHTML=xs,La=a(),d(Jt.$$.fragment),Xa=a(),zt=i("p"),zt.innerHTML=Js,Ha=a(),d(Wt.$$.fragment),Fa=a(),d(Zt.$$.fragment),Aa=a(),d(Ut.$$.fragment),Ra=a(),Qt=i("p"),Qt.textContent=zs,Ia=a(),Gt=i("ul"),Gt.innerHTML=Ws,Na=a(),d(jt.$$.fragment),Pa=a(),Bt=i("ul"),Bt.innerHTML=Zs,Ea=a(),d(Vt.$$.fragment),Ya=a(),Lt=i("p"),Lt.innerHTML=Us,Sa=a(),d(Xt.$$.fragment),Da=a(),d(H.$$.fragment),Ka=a(),d(Ht.$$.fragment),Oa=a(),Ft=i("p"),Ft.innerHTML=Qs,el=a(),d(At.$$.fragment),tl=a(),Rt=i("p"),Rt.innerHTML=Gs,nl=a(),It=i("p"),It.innerHTML=js,ol=a(),d(Nt.$$.fragment),al=a(),Pt=i("p"),Pt.textContent=Bs,ll=a(),d(F.$$.fragment),il=a(),d(Et.$$.fragment),sl=a(),Yt=i("p"),Yt.textContent=Vs,rl=a(),d(St.$$.fragment),dl=a(),Dt=i("p"),Dt.innerHTML=Ls,ml=a(),d(Kt.$$.fragment),pl=a(),d(Ot.$$.fragment),ul=a(),en=i("p"),en.textContent=Xs,fl=a(),d(tn.$$.fragment),cl=a(),d(nn.$$.fragment),hl=a(),on=i("p"),on.textContent=Hs,bl=a(),d(an.$$.fragment),gl=a(),d(ln.$$.fragment),yl=a(),sn=i("p"),sn.innerHTML=Fs,$l=a(),d(rn.$$.fragment),wl=a(),d(A.$$.fragment),_l=a(),d(dn.$$.fragment),Tl=a(),mn=i("p"),mn.innerHTML=As,Ml=a(),d(pn.$$.fragment),vl=a(),un=i("p"),un.innerHTML=Rs,Cl=a(),d(fn.$$.fragment),kl=a(),cn=i("p"),cn.textContent=Is,ql=a(),d(hn.$$.fragment),xl=a(),bn=i("p"),bn.innerHTML=Ns,Jl=a(),gn=i("p"),gn.innerHTML=Ps,zl=a(),d(yn.$$.fragment),Wl=a(),$n=i("p"),$n.innerHTML=Es,Zl=a(),d(wn.$$.fragment),Ul=a(),_n=i("p"),_n.textContent=Ys,Ql=a(),d(Tn.$$.fragment),Gl=a(),Mn=i("p"),Mn.textContent=Ss,jl=a(),d(vn.$$.fragment),Bl=a(),Cn=i("p"),Cn.innerHTML=Ds,Vl=a(),d(kn.$$.fragment),Ll=a(),d(qn.$$.fragment),Xl=a(),xn=i("p"),xn.innerHTML=Ks,Hl=a(),d(Jn.$$.fragment),Fl=a(),d(zn.$$.fragment),Al=a(),Wn=i("p"),Wn.innerHTML=Os,Rl=a(),Zn=i("p"),Zn.innerHTML=er,Il=a(),d(Un.$$.fragment),Nl=a(),w=i("div"),d(Qn.$$.fragment),hi=a(),Yn=i("p"),Yn.innerHTML=tr,bi=a(),Sn=i("p"),Sn.innerHTML=nr,gi=a(),Dn=i("p"),Dn.innerHTML=or,yi=a(),R=i("div"),d(Gn.$$.fragment),$i=a(),Kn=i("p"),Kn.innerHTML=ar,wi=a(),I=i("div"),d(jn.$$.fragment),_i=a(),On=i("p"),On.textContent=lr,Ti=a(),N=i("div"),d(Bn.$$.fragment),Mi=a(),eo=i("p"),eo.innerHTML=ir,vi=a(),P=i("div"),d(Vn.$$.fragment),Ci=a(),to=i("p"),to.textContent=sr,Pl=a(),d(Ln.$$.fragment),El=a(),Xn=i("p"),Xn.innerHTML=rr,Yl=a(),no=i("p"),this.h()},l(e){const t=fr("svelte-u9bgzb",document.head);g=s(t,"META",{name:!0,content:!0}),t.forEach(n),_=l(e),$=s(e,"P",{}),C($).forEach(n),z=l(e),m(E.$$.fragment,e),oo=l(e),m(Y.$$.fragment,e),ao=l(e),S=s(e,"P",{"data-svelte-h":!0}),r(S)!=="svelte-uyrtww"&&(S.innerHTML=qi),lo=l(e),D=s(e,"P",{"data-svelte-h":!0}),r(D)!=="svelte-e2d1xi"&&(D.textContent=xi),io=l(e),m(K.$$.fragment,e),so=l(e),O=s(e,"P",{"data-svelte-h":!0}),r(O)!=="svelte-fc8fip"&&(O.textContent=Ji),ro=l(e),ee=s(e,"UL",{"data-svelte-h":!0}),r(ee)!=="svelte-12m6kv8"&&(ee.innerHTML=zi),mo=l(e),te=s(e,"P",{"data-svelte-h":!0}),r(te)!=="svelte-1bmezd5"&&(te.innerHTML=Wi),po=l(e),m(ne.$$.fragment,e),uo=l(e),oe=s(e,"P",{"data-svelte-h":!0}),r(oe)!=="svelte-1dd3k5w"&&(oe.innerHTML=Zi),fo=l(e),m(ae.$$.fragment,e),co=l(e),le=s(e,"P",{"data-svelte-h":!0}),r(le)!=="svelte-rc065p"&&(le.innerHTML=Ui),ho=l(e),m(ie.$$.fragment,e),bo=l(e),m(se.$$.fragment,e),go=l(e),re=s(e,"P",{"data-svelte-h":!0}),r(re)!=="svelte-3lflk4"&&(re.textContent=Qi),yo=l(e),m(de.$$.fragment,e),$o=l(e),m(me.$$.fragment,e),wo=l(e),pe=s(e,"P",{"data-svelte-h":!0}),r(pe)!=="svelte-1efcz5t"&&(pe.innerHTML=Gi),_o=l(e),m(ue.$$.fragment,e),To=l(e),m(fe.$$.fragment,e),Mo=l(e),ce=s(e,"P",{"data-svelte-h":!0}),r(ce)!=="svelte-11wx0fg"&&(ce.innerHTML=ji),vo=l(e),he=s(e,"P",{"data-svelte-h":!0}),r(he)!=="svelte-1yidrim"&&(he.innerHTML=Bi),Co=l(e),be=s(e,"P",{"data-svelte-h":!0}),r(be)!=="svelte-n4lxyl"&&(be.innerHTML=Vi),ko=l(e),Z=s(e,"DIV",{style:!0,"data-svelte-h":!0}),r(Z)!=="svelte-qy9lc8"&&(Z.innerHTML=Li),qo=l(e),U=s(e,"DIV",{style:!0,"data-svelte-h":!0}),r(U)!=="svelte-1oan9h4"&&(U.innerHTML=Xi),xo=l(e),Q=s(e,"DIV",{style:!0,"data-svelte-h":!0}),r(Q)!=="svelte-1p6kg0n"&&(Q.innerHTML=Hi),Jo=l(e),G=s(e,"DIV",{style:!0,"data-svelte-h":!0}),r(G)!=="svelte-ex9c15"&&(G.innerHTML=Fi),zo=l(e),ge=s(e,"P",{"data-svelte-h":!0}),r(ge)!=="svelte-12trmgs"&&(ge.innerHTML=Ai),Wo=l(e),ye=s(e,"P",{"data-svelte-h":!0}),r(ye)!=="svelte-9jv497"&&(ye.textContent=Ri),Zo=l(e),m($e.$$.fragment,e),Uo=l(e),we=s(e,"P",{"data-svelte-h":!0}),r(we)!=="svelte-dsn0ks"&&(we.innerHTML=Ii),Qo=l(e),m(_e.$$.fragment,e),Go=l(e),q=s(e,"DIV",{class:!0});var W=C(q);m(Te.$$.fragment,W),li=l(W),An=s(W,"P",{"data-svelte-h":!0}),r(An)!=="svelte-1i667it"&&(An.innerHTML=Ni),ii=l(W),j=s(W,"DIV",{class:!0});var Hn=C(j);m(Me.$$.fragment,Hn),si=l(Hn),Rn=s(Hn,"P",{"data-svelte-h":!0}),r(Rn)!=="svelte-1ozftb6"&&(Rn.textContent=Pi),Hn.forEach(n),W.forEach(n),jo=l(e),m(ve.$$.fragment,e),Bo=l(e),Ce=s(e,"P",{"data-svelte-h":!0}),r(Ce)!=="svelte-wivdz5"&&(Ce.innerHTML=Ei),Vo=l(e),ke=s(e,"P",{"data-svelte-h":!0}),r(ke)!=="svelte-1wxhxek"&&(ke.textContent=Yi),Lo=l(e),qe=s(e,"UL",{"data-svelte-h":!0}),r(qe)!=="svelte-1hsfxwl"&&(qe.innerHTML=Si),Xo=l(e),m(xe.$$.fragment,e),Ho=l(e),Je=s(e,"P",{"data-svelte-h":!0}),r(Je)!=="svelte-1nlfwux"&&(Je.textContent=Di),Fo=l(e),ze=s(e,"UL",{"data-svelte-h":!0}),r(ze)!=="svelte-1q0tak7"&&(ze.innerHTML=Ki),Ao=l(e),We=s(e,"P",{"data-svelte-h":!0}),r(We)!=="svelte-i9jsug"&&(We.textContent=Oi),Ro=l(e),m(Ze.$$.fragment,e),Io=l(e),Ue=s(e,"P",{"data-svelte-h":!0}),r(Ue)!=="svelte-19mmsrx"&&(Ue.innerHTML=es),No=l(e),Qe=s(e,"P",{"data-svelte-h":!0}),r(Qe)!=="svelte-1l3vx9e"&&(Qe.textContent=ts),Po=l(e),m(Ge.$$.fragment,e),Eo=l(e),je=s(e,"P",{"data-svelte-h":!0}),r(je)!=="svelte-1m38olz"&&(je.innerHTML=ns),Yo=l(e),m(Be.$$.fragment,e),So=l(e),Ve=s(e,"P",{"data-svelte-h":!0}),r(Ve)!=="svelte-qilh1w"&&(Ve.textContent=os),Do=l(e),m(Le.$$.fragment,e),Ko=l(e),m(Xe.$$.fragment,e),Oo=l(e),He=s(e,"P",{"data-svelte-h":!0}),r(He)!=="svelte-kas648"&&(He.innerHTML=as),ea=l(e),m(Fe.$$.fragment,e),ta=l(e),Ae=s(e,"P",{"data-svelte-h":!0}),r(Ae)!=="svelte-h9bd62"&&(Ae.textContent=ls),na=l(e),Re=s(e,"P",{"data-svelte-h":!0}),r(Re)!=="svelte-1kt63mp"&&(Re.innerHTML=is),oa=l(e),m(Ie.$$.fragment,e),aa=l(e),Ne=s(e,"P",{"data-svelte-h":!0}),r(Ne)!=="svelte-p700d6"&&(Ne.innerHTML=ss),la=l(e),m(B.$$.fragment,e),ia=l(e),m(Pe.$$.fragment,e),sa=l(e),Ee=s(e,"P",{"data-svelte-h":!0}),r(Ee)!=="svelte-l0e993"&&(Ee.innerHTML=rs),ra=l(e),m(Ye.$$.fragment,e),da=l(e),Se=s(e,"P",{"data-svelte-h":!0}),r(Se)!=="svelte-1cc82wc"&&(Se.innerHTML=ds),ma=l(e),m(De.$$.fragment,e),pa=l(e),Ke=s(e,"P",{"data-svelte-h":!0}),r(Ke)!=="svelte-1vy3w4s"&&(Ke.innerHTML=ms),ua=l(e),m(Oe.$$.fragment,e),fa=l(e),m(et.$$.fragment,e),ca=l(e),tt=s(e,"P",{"data-svelte-h":!0}),r(tt)!=="svelte-gsus0a"&&(tt.innerHTML=ps),ha=l(e),m(nt.$$.fragment,e),ba=l(e),ot=s(e,"P",{"data-svelte-h":!0}),r(ot)!=="svelte-1xfcpge"&&(ot.innerHTML=us),ga=l(e),m(at.$$.fragment,e),ya=l(e),m(lt.$$.fragment,e),$a=l(e),it=s(e,"P",{"data-svelte-h":!0}),r(it)!=="svelte-o70coz"&&(it.innerHTML=fs),wa=l(e),m(st.$$.fragment,e),_a=l(e),rt=s(e,"P",{"data-svelte-h":!0}),r(rt)!=="svelte-1419pne"&&(rt.innerHTML=cs),Ta=l(e),m(dt.$$.fragment,e),Ma=l(e),mt=s(e,"P",{"data-svelte-h":!0}),r(mt)!=="svelte-15fps22"&&(mt.textContent=hs),va=l(e),pt=s(e,"P",{"data-svelte-h":!0}),r(pt)!=="svelte-fpw9ll"&&(pt.innerHTML=bs),Ca=l(e),m(ut.$$.fragment,e),ka=l(e),ft=s(e,"P",{"data-svelte-h":!0}),r(ft)!=="svelte-1rghhrt"&&(ft.innerHTML=gs),qa=l(e),m(ct.$$.fragment,e),xa=l(e),ht=s(e,"P",{"data-svelte-h":!0}),r(ht)!=="svelte-178d21p"&&(ht.innerHTML=ys),Ja=l(e),m(bt.$$.fragment,e),za=l(e),M=s(e,"DIV",{class:!0});var v=C(M);m(gt.$$.fragment,v),ri=l(v),In=s(v,"P",{"data-svelte-h":!0}),r(In)!=="svelte-i3efvr"&&(In.innerHTML=$s),di=l(v),V=s(v,"DIV",{class:!0});var Fn=C(V);m(yt.$$.fragment,Fn),mi=l(Fn),Nn=s(Fn,"P",{"data-svelte-h":!0}),r(Nn)!=="svelte-4jdj2l"&&(Nn.textContent=ws),Fn.forEach(n),pi=l(v),L=s(v,"DIV",{class:!0});var Dl=C(L);m($t.$$.fragment,Dl),ui=l(Dl),Pn=s(Dl,"P",{"data-svelte-h":!0}),r(Pn)!=="svelte-1ozftb6"&&(Pn.textContent=_s),Dl.forEach(n),fi=l(v),X=s(v,"DIV",{class:!0});var Kl=C(X);m(wt.$$.fragment,Kl),ci=l(Kl),En=s(Kl,"P",{"data-svelte-h":!0}),r(En)!=="svelte-pjgtd6"&&(En.textContent=Ts),Kl.forEach(n),v.forEach(n),Wa=l(e),m(_t.$$.fragment,e),Za=l(e),Tt=s(e,"P",{"data-svelte-h":!0}),r(Tt)!=="svelte-1w3k2k7"&&(Tt.innerHTML=Ms),Ua=l(e),Mt=s(e,"P",{"data-svelte-h":!0}),r(Mt)!=="svelte-18yxc3j"&&(Mt.innerHTML=vs),Qa=l(e),vt=s(e,"P",{"data-svelte-h":!0}),r(vt)!=="svelte-7usn7e"&&(vt.innerHTML=Cs),Ga=l(e),Ct=s(e,"P",{"data-svelte-h":!0}),r(Ct)!=="svelte-181g9sa"&&(Ct.innerHTML=ks),ja=l(e),kt=s(e,"P",{"data-svelte-h":!0}),r(kt)!=="svelte-1mf5lu3"&&(kt.innerHTML=qs),Ba=l(e),m(qt.$$.fragment,e),Va=l(e),xt=s(e,"P",{"data-svelte-h":!0}),r(xt)!=="svelte-yu9ypk"&&(xt.innerHTML=xs),La=l(e),m(Jt.$$.fragment,e),Xa=l(e),zt=s(e,"P",{"data-svelte-h":!0}),r(zt)!=="svelte-bhhave"&&(zt.innerHTML=Js),Ha=l(e),m(Wt.$$.fragment,e),Fa=l(e),m(Zt.$$.fragment,e),Aa=l(e),m(Ut.$$.fragment,e),Ra=l(e),Qt=s(e,"P",{"data-svelte-h":!0}),r(Qt)!=="svelte-1opqihr"&&(Qt.textContent=zs),Ia=l(e),Gt=s(e,"UL",{"data-svelte-h":!0}),r(Gt)!=="svelte-18dpv7h"&&(Gt.innerHTML=Ws),Na=l(e),m(jt.$$.fragment,e),Pa=l(e),Bt=s(e,"UL",{"data-svelte-h":!0}),r(Bt)!=="svelte-un6hvz"&&(Bt.innerHTML=Zs),Ea=l(e),m(Vt.$$.fragment,e),Ya=l(e),Lt=s(e,"P",{"data-svelte-h":!0}),r(Lt)!=="svelte-raw4uk"&&(Lt.innerHTML=Us),Sa=l(e),m(Xt.$$.fragment,e),Da=l(e),m(H.$$.fragment,e),Ka=l(e),m(Ht.$$.fragment,e),Oa=l(e),Ft=s(e,"P",{"data-svelte-h":!0}),r(Ft)!=="svelte-z16dbi"&&(Ft.innerHTML=Qs),el=l(e),m(At.$$.fragment,e),tl=l(e),Rt=s(e,"P",{"data-svelte-h":!0}),r(Rt)!=="svelte-1sddh41"&&(Rt.innerHTML=Gs),nl=l(e),It=s(e,"P",{"data-svelte-h":!0}),r(It)!=="svelte-1mgfmur"&&(It.innerHTML=js),ol=l(e),m(Nt.$$.fragment,e),al=l(e),Pt=s(e,"P",{"data-svelte-h":!0}),r(Pt)!=="svelte-1h0pju"&&(Pt.textContent=Bs),ll=l(e),m(F.$$.fragment,e),il=l(e),m(Et.$$.fragment,e),sl=l(e),Yt=s(e,"P",{"data-svelte-h":!0}),r(Yt)!=="svelte-11st5ue"&&(Yt.textContent=Vs),rl=l(e),m(St.$$.fragment,e),dl=l(e),Dt=s(e,"P",{"data-svelte-h":!0}),r(Dt)!=="svelte-1qt7jnk"&&(Dt.innerHTML=Ls),ml=l(e),m(Kt.$$.fragment,e),pl=l(e),m(Ot.$$.fragment,e),ul=l(e),en=s(e,"P",{"data-svelte-h":!0}),r(en)!=="svelte-ctju2y"&&(en.textContent=Xs),fl=l(e),m(tn.$$.fragment,e),cl=l(e),m(nn.$$.fragment,e),hl=l(e),on=s(e,"P",{"data-svelte-h":!0}),r(on)!=="svelte-8sil41"&&(on.textContent=Hs),bl=l(e),m(an.$$.fragment,e),gl=l(e),m(ln.$$.fragment,e),yl=l(e),sn=s(e,"P",{"data-svelte-h":!0}),r(sn)!=="svelte-12ibgkx"&&(sn.innerHTML=Fs),$l=l(e),m(rn.$$.fragment,e),wl=l(e),m(A.$$.fragment,e),_l=l(e),m(dn.$$.fragment,e),Tl=l(e),mn=s(e,"P",{"data-svelte-h":!0}),r(mn)!=="svelte-11o118p"&&(mn.innerHTML=As),Ml=l(e),m(pn.$$.fragment,e),vl=l(e),un=s(e,"P",{"data-svelte-h":!0}),r(un)!=="svelte-1a6lfeb"&&(un.innerHTML=Rs),Cl=l(e),m(fn.$$.fragment,e),kl=l(e),cn=s(e,"P",{"data-svelte-h":!0}),r(cn)!=="svelte-bf8u41"&&(cn.textContent=Is),ql=l(e),m(hn.$$.fragment,e),xl=l(e),bn=s(e,"P",{"data-svelte-h":!0}),r(bn)!=="svelte-9xq6i6"&&(bn.innerHTML=Ns),Jl=l(e),gn=s(e,"P",{"data-svelte-h":!0}),r(gn)!=="svelte-77u5w9"&&(gn.innerHTML=Ps),zl=l(e),m(yn.$$.fragment,e),Wl=l(e),$n=s(e,"P",{"data-svelte-h":!0}),r($n)!=="svelte-fbn7z"&&($n.innerHTML=Es),Zl=l(e),m(wn.$$.fragment,e),Ul=l(e),_n=s(e,"P",{"data-svelte-h":!0}),r(_n)!=="svelte-1pv013b"&&(_n.textContent=Ys),Ql=l(e),m(Tn.$$.fragment,e),Gl=l(e),Mn=s(e,"P",{"data-svelte-h":!0}),r(Mn)!=="svelte-nsev1w"&&(Mn.textContent=Ss),jl=l(e),m(vn.$$.fragment,e),Bl=l(e),Cn=s(e,"P",{"data-svelte-h":!0}),r(Cn)!=="svelte-2188jb"&&(Cn.innerHTML=Ds),Vl=l(e),m(kn.$$.fragment,e),Ll=l(e),m(qn.$$.fragment,e),Xl=l(e),xn=s(e,"P",{"data-svelte-h":!0}),r(xn)!=="svelte-1k96tv8"&&(xn.innerHTML=Ks),Hl=l(e),m(Jn.$$.fragment,e),Fl=l(e),m(zn.$$.fragment,e),Al=l(e),Wn=s(e,"P",{"data-svelte-h":!0}),r(Wn)!=="svelte-11ahrdq"&&(Wn.innerHTML=Os),Rl=l(e),Zn=s(e,"P",{"data-svelte-h":!0}),r(Zn)!=="svelte-1acgju7"&&(Zn.innerHTML=er),Il=l(e),m(Un.$$.fragment,e),Nl=l(e),w=s(e,"DIV",{class:!0});var T=C(w);m(Qn.$$.fragment,T),hi=l(T),Yn=s(T,"P",{"data-svelte-h":!0}),r(Yn)!=="svelte-woamwr"&&(Yn.innerHTML=tr),bi=l(T),Sn=s(T,"P",{"data-svelte-h":!0}),r(Sn)!=="svelte-ki5gis"&&(Sn.innerHTML=nr),gi=l(T),Dn=s(T,"P",{"data-svelte-h":!0}),r(Dn)!=="svelte-8qsk2q"&&(Dn.innerHTML=or),yi=l(T),R=s(T,"DIV",{class:!0});var Ol=C(R);m(Gn.$$.fragment,Ol),$i=l(Ol),Kn=s(Ol,"P",{"data-svelte-h":!0}),r(Kn)!=="svelte-10tvzyv"&&(Kn.innerHTML=ar),Ol.forEach(n),wi=l(T),I=s(T,"DIV",{class:!0});var ei=C(I);m(jn.$$.fragment,ei),_i=l(ei),On=s(ei,"P",{"data-svelte-h":!0}),r(On)!=="svelte-gy26u4"&&(On.textContent=lr),ei.forEach(n),Ti=l(T),N=s(T,"DIV",{class:!0});var ti=C(N);m(Bn.$$.fragment,ti),Mi=l(ti),eo=s(ti,"P",{"data-svelte-h":!0}),r(eo)!=="svelte-19bn0da"&&(eo.innerHTML=ir),ti.forEach(n),vi=l(T),P=s(T,"DIV",{class:!0});var ni=C(P);m(Vn.$$.fragment,ni),Ci=l(ni),to=s(ni,"P",{"data-svelte-h":!0}),r(to)!=="svelte-1p6bdas"&&(to.textContent=sr),ni.forEach(n),T.forEach(n),Pl=l(e),m(Ln.$$.fragment,e),El=l(e),Xn=s(e,"P",{"data-svelte-h":!0}),r(Xn)!=="svelte-pdn3hl"&&(Xn.innerHTML=rr),Yl=l(e),no=s(e,"P",{}),C(no).forEach(n),this.h()},h(){k(g,"name","hf:doc:metadata"),k(g,"content",_r),oi(Z,"text-align","center"),oi(U,"text-align","center"),oi(Q,"text-align","center"),oi(G,"text-align","center"),k(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),k(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){h(document.head,g),o(e,_,t),o(e,$,t),o(e,z,t),p(E,e,t),o(e,oo,t),p(Y,e,t),o(e,ao,t),o(e,S,t),o(e,lo,t),o(e,D,t),o(e,io,t),p(K,e,t),o(e,so,t),o(e,O,t),o(e,ro,t),o(e,ee,t),o(e,mo,t),o(e,te,t),o(e,po,t),p(ne,e,t),o(e,uo,t),o(e,oe,t),o(e,fo,t),p(ae,e,t),o(e,co,t),o(e,le,t),o(e,ho,t),p(ie,e,t),o(e,bo,t),p(se,e,t),o(e,go,t),o(e,re,t),o(e,yo,t),p(de,e,t),o(e,$o,t),p(me,e,t),o(e,wo,t),o(e,pe,t),o(e,_o,t),p(ue,e,t),o(e,To,t),p(fe,e,t),o(e,Mo,t),o(e,ce,t),o(e,vo,t),o(e,he,t),o(e,Co,t),o(e,be,t),o(e,ko,t),o(e,Z,t),o(e,qo,t),o(e,U,t),o(e,xo,t),o(e,Q,t),o(e,Jo,t),o(e,G,t),o(e,zo,t),o(e,ge,t),o(e,Wo,t),o(e,ye,t),o(e,Zo,t),p($e,e,t),o(e,Uo,t),o(e,we,t),o(e,Qo,t),p(_e,e,t),o(e,Go,t),o(e,q,t),p(Te,q,null),h(q,li),h(q,An),h(q,ii),h(q,j),p(Me,j,null),h(j,si),h(j,Rn),o(e,jo,t),p(ve,e,t),o(e,Bo,t),o(e,Ce,t),o(e,Vo,t),o(e,ke,t),o(e,Lo,t),o(e,qe,t),o(e,Xo,t),p(xe,e,t),o(e,Ho,t),o(e,Je,t),o(e,Fo,t),o(e,ze,t),o(e,Ao,t),o(e,We,t),o(e,Ro,t),p(Ze,e,t),o(e,Io,t),o(e,Ue,t),o(e,No,t),o(e,Qe,t),o(e,Po,t),p(Ge,e,t),o(e,Eo,t),o(e,je,t),o(e,Yo,t),p(Be,e,t),o(e,So,t),o(e,Ve,t),o(e,Do,t),p(Le,e,t),o(e,Ko,t),p(Xe,e,t),o(e,Oo,t),o(e,He,t),o(e,ea,t),p(Fe,e,t),o(e,ta,t),o(e,Ae,t),o(e,na,t),o(e,Re,t),o(e,oa,t),p(Ie,e,t),o(e,aa,t),o(e,Ne,t),o(e,la,t),p(B,e,t),o(e,ia,t),p(Pe,e,t),o(e,sa,t),o(e,Ee,t),o(e,ra,t),p(Ye,e,t),o(e,da,t),o(e,Se,t),o(e,ma,t),p(De,e,t),o(e,pa,t),o(e,Ke,t),o(e,ua,t),p(Oe,e,t),o(e,fa,t),p(et,e,t),o(e,ca,t),o(e,tt,t),o(e,ha,t),p(nt,e,t),o(e,ba,t),o(e,ot,t),o(e,ga,t),p(at,e,t),o(e,ya,t),p(lt,e,t),o(e,$a,t),o(e,it,t),o(e,wa,t),p(st,e,t),o(e,_a,t),o(e,rt,t),o(e,Ta,t),p(dt,e,t),o(e,Ma,t),o(e,mt,t),o(e,va,t),o(e,pt,t),o(e,Ca,t),p(ut,e,t),o(e,ka,t),o(e,ft,t),o(e,qa,t),p(ct,e,t),o(e,xa,t),o(e,ht,t),o(e,Ja,t),p(bt,e,t),o(e,za,t),o(e,M,t),p(gt,M,null),h(M,ri),h(M,In),h(M,di),h(M,V),p(yt,V,null),h(V,mi),h(V,Nn),h(M,pi),h(M,L),p($t,L,null),h(L,ui),h(L,Pn),h(M,fi),h(M,X),p(wt,X,null),h(X,ci),h(X,En),o(e,Wa,t),p(_t,e,t),o(e,Za,t),o(e,Tt,t),o(e,Ua,t),o(e,Mt,t),o(e,Qa,t),o(e,vt,t),o(e,Ga,t),o(e,Ct,t),o(e,ja,t),o(e,kt,t),o(e,Ba,t),p(qt,e,t),o(e,Va,t),o(e,xt,t),o(e,La,t),p(Jt,e,t),o(e,Xa,t),o(e,zt,t),o(e,Ha,t),p(Wt,e,t),o(e,Fa,t),p(Zt,e,t),o(e,Aa,t),p(Ut,e,t),o(e,Ra,t),o(e,Qt,t),o(e,Ia,t),o(e,Gt,t),o(e,Na,t),p(jt,e,t),o(e,Pa,t),o(e,Bt,t),o(e,Ea,t),p(Vt,e,t),o(e,Ya,t),o(e,Lt,t),o(e,Sa,t),p(Xt,e,t),o(e,Da,t),p(H,e,t),o(e,Ka,t),p(Ht,e,t),o(e,Oa,t),o(e,Ft,t),o(e,el,t),p(At,e,t),o(e,tl,t),o(e,Rt,t),o(e,nl,t),o(e,It,t),o(e,ol,t),p(Nt,e,t),o(e,al,t),o(e,Pt,t),o(e,ll,t),p(F,e,t),o(e,il,t),p(Et,e,t),o(e,sl,t),o(e,Yt,t),o(e,rl,t),p(St,e,t),o(e,dl,t),o(e,Dt,t),o(e,ml,t),p(Kt,e,t),o(e,pl,t),p(Ot,e,t),o(e,ul,t),o(e,en,t),o(e,fl,t),p(tn,e,t),o(e,cl,t),p(nn,e,t),o(e,hl,t),o(e,on,t),o(e,bl,t),p(an,e,t),o(e,gl,t),p(ln,e,t),o(e,yl,t),o(e,sn,t),o(e,$l,t),p(rn,e,t),o(e,wl,t),p(A,e,t),o(e,_l,t),p(dn,e,t),o(e,Tl,t),o(e,mn,t),o(e,Ml,t),p(pn,e,t),o(e,vl,t),o(e,un,t),o(e,Cl,t),p(fn,e,t),o(e,kl,t),o(e,cn,t),o(e,ql,t),p(hn,e,t),o(e,xl,t),o(e,bn,t),o(e,Jl,t),o(e,gn,t),o(e,zl,t),p(yn,e,t),o(e,Wl,t),o(e,$n,t),o(e,Zl,t),p(wn,e,t),o(e,Ul,t),o(e,_n,t),o(e,Ql,t),p(Tn,e,t),o(e,Gl,t),o(e,Mn,t),o(e,jl,t),p(vn,e,t),o(e,Bl,t),o(e,Cn,t),o(e,Vl,t),p(kn,e,t),o(e,Ll,t),p(qn,e,t),o(e,Xl,t),o(e,xn,t),o(e,Hl,t),p(Jn,e,t),o(e,Fl,t),p(zn,e,t),o(e,Al,t),o(e,Wn,t),o(e,Rl,t),o(e,Zn,t),o(e,Il,t),p(Un,e,t),o(e,Nl,t),o(e,w,t),p(Qn,w,null),h(w,hi),h(w,Yn),h(w,bi),h(w,Sn),h(w,gi),h(w,Dn),h(w,yi),h(w,R),p(Gn,R,null),h(R,$i),h(R,Kn),h(w,wi),h(w,I),p(jn,I,null),h(I,_i),h(I,On),h(w,Ti),h(w,N),p(Bn,N,null),h(N,Mi),h(N,eo),h(w,vi),h(w,P),p(Vn,P,null),h(P,Ci),h(P,to),o(e,Pl,t),p(Ln,e,t),o(e,El,t),o(e,Xn,t),o(e,Yl,t),o(e,no,t),Sl=!0},p(e,[t]){const W={};t&2&&(W.$$scope={dirty:t,ctx:e}),B.$set(W);const Hn={};t&2&&(Hn.$$scope={dirty:t,ctx:e}),H.$set(Hn);const v={};t&2&&(v.$$scope={dirty:t,ctx:e}),F.$set(v);const Fn={};t&2&&(Fn.$$scope={dirty:t,ctx:e}),A.$set(Fn)},i(e){Sl||(u(E.$$.fragment,e),u(Y.$$.fragment,e),u(K.$$.fragment,e),u(ne.$$.fragment,e),u(ae.$$.fragment,e),u(ie.$$.fragment,e),u(se.$$.fragment,e),u(de.$$.fragment,e),u(me.$$.fragment,e),u(ue.$$.fragment,e),u(fe.$$.fragment,e),u($e.$$.fragment,e),u(_e.$$.fragment,e),u(Te.$$.fragment,e),u(Me.$$.fragment,e),u(ve.$$.fragment,e),u(xe.$$.fragment,e),u(Ze.$$.fragment,e),u(Ge.$$.fragment,e),u(Be.$$.fragment,e),u(Le.$$.fragment,e),u(Xe.$$.fragment,e),u(Fe.$$.fragment,e),u(Ie.$$.fragment,e),u(B.$$.fragment,e),u(Pe.$$.fragment,e),u(Ye.$$.fragment,e),u(De.$$.fragment,e),u(Oe.$$.fragment,e),u(et.$$.fragment,e),u(nt.$$.fragment,e),u(at.$$.fragment,e),u(lt.$$.fragment,e),u(st.$$.fragment,e),u(dt.$$.fragment,e),u(ut.$$.fragment,e),u(ct.$$.fragment,e),u(bt.$$.fragment,e),u(gt.$$.fragment,e),u(yt.$$.fragment,e),u($t.$$.fragment,e),u(wt.$$.fragment,e),u(_t.$$.fragment,e),u(qt.$$.fragment,e),u(Jt.$$.fragment,e),u(Wt.$$.fragment,e),u(Zt.$$.fragment,e),u(Ut.$$.fragment,e),u(jt.$$.fragment,e),u(Vt.$$.fragment,e),u(Xt.$$.fragment,e),u(H.$$.fragment,e),u(Ht.$$.fragment,e),u(At.$$.fragment,e),u(Nt.$$.fragment,e),u(F.$$.fragment,e),u(Et.$$.fragment,e),u(St.$$.fragment,e),u(Kt.$$.fragment,e),u(Ot.$$.fragment,e),u(tn.$$.fragment,e),u(nn.$$.fragment,e),u(an.$$.fragment,e),u(ln.$$.fragment,e),u(rn.$$.fragment,e),u(A.$$.fragment,e),u(dn.$$.fragment,e),u(pn.$$.fragment,e),u(fn.$$.fragment,e),u(hn.$$.fragment,e),u(yn.$$.fragment,e),u(wn.$$.fragment,e),u(Tn.$$.fragment,e),u(vn.$$.fragment,e),u(kn.$$.fragment,e),u(qn.$$.fragment,e),u(Jn.$$.fragment,e),u(zn.$$.fragment,e),u(Un.$$.fragment,e),u(Qn.$$.fragment,e),u(Gn.$$.fragment,e),u(jn.$$.fragment,e),u(Bn.$$.fragment,e),u(Vn.$$.fragment,e),u(Ln.$$.fragment,e),Sl=!0)},o(e){f(E.$$.fragment,e),f(Y.$$.fragment,e),f(K.$$.fragment,e),f(ne.$$.fragment,e),f(ae.$$.fragment,e),f(ie.$$.fragment,e),f(se.$$.fragment,e),f(de.$$.fragment,e),f(me.$$.fragment,e),f(ue.$$.fragment,e),f(fe.$$.fragment,e),f($e.$$.fragment,e),f(_e.$$.fragment,e),f(Te.$$.fragment,e),f(Me.$$.fragment,e),f(ve.$$.fragment,e),f(xe.$$.fragment,e),f(Ze.$$.fragment,e),f(Ge.$$.fragment,e),f(Be.$$.fragment,e),f(Le.$$.fragment,e),f(Xe.$$.fragment,e),f(Fe.$$.fragment,e),f(Ie.$$.fragment,e),f(B.$$.fragment,e),f(Pe.$$.fragment,e),f(Ye.$$.fragment,e),f(De.$$.fragment,e),f(Oe.$$.fragment,e),f(et.$$.fragment,e),f(nt.$$.fragment,e),f(at.$$.fragment,e),f(lt.$$.fragment,e),f(st.$$.fragment,e),f(dt.$$.fragment,e),f(ut.$$.fragment,e),f(ct.$$.fragment,e),f(bt.$$.fragment,e),f(gt.$$.fragment,e),f(yt.$$.fragment,e),f($t.$$.fragment,e),f(wt.$$.fragment,e),f(_t.$$.fragment,e),f(qt.$$.fragment,e),f(Jt.$$.fragment,e),f(Wt.$$.fragment,e),f(Zt.$$.fragment,e),f(Ut.$$.fragment,e),f(jt.$$.fragment,e),f(Vt.$$.fragment,e),f(Xt.$$.fragment,e),f(H.$$.fragment,e),f(Ht.$$.fragment,e),f(At.$$.fragment,e),f(Nt.$$.fragment,e),f(F.$$.fragment,e),f(Et.$$.fragment,e),f(St.$$.fragment,e),f(Kt.$$.fragment,e),f(Ot.$$.fragment,e),f(tn.$$.fragment,e),f(nn.$$.fragment,e),f(an.$$.fragment,e),f(ln.$$.fragment,e),f(rn.$$.fragment,e),f(A.$$.fragment,e),f(dn.$$.fragment,e),f(pn.$$.fragment,e),f(fn.$$.fragment,e),f(hn.$$.fragment,e),f(yn.$$.fragment,e),f(wn.$$.fragment,e),f(Tn.$$.fragment,e),f(vn.$$.fragment,e),f(kn.$$.fragment,e),f(qn.$$.fragment,e),f(Jn.$$.fragment,e),f(zn.$$.fragment,e),f(Un.$$.fragment,e),f(Qn.$$.fragment,e),f(Gn.$$.fragment,e),f(jn.$$.fragment,e),f(Bn.$$.fragment,e),f(Vn.$$.fragment,e),f(Ln.$$.fragment,e),Sl=!1},d(e){e&&(n(_),n($),n(z),n(oo),n(ao),n(S),n(lo),n(D),n(io),n(so),n(O),n(ro),n(ee),n(mo),n(te),n(po),n(uo),n(oe),n(fo),n(co),n(le),n(ho),n(bo),n(go),n(re),n(yo),n($o),n(wo),n(pe),n(_o),n(To),n(Mo),n(ce),n(vo),n(he),n(Co),n(be),n(ko),n(Z),n(qo),n(U),n(xo),n(Q),n(Jo),n(G),n(zo),n(ge),n(Wo),n(ye),n(Zo),n(Uo),n(we),n(Qo),n(Go),n(q),n(jo),n(Bo),n(Ce),n(Vo),n(ke),n(Lo),n(qe),n(Xo),n(Ho),n(Je),n(Fo),n(ze),n(Ao),n(We),n(Ro),n(Io),n(Ue),n(No),n(Qe),n(Po),n(Eo),n(je),n(Yo),n(So),n(Ve),n(Do),n(Ko),n(Oo),n(He),n(ea),n(ta),n(Ae),n(na),n(Re),n(oa),n(aa),n(Ne),n(la),n(ia),n(sa),n(Ee),n(ra),n(da),n(Se),n(ma),n(pa),n(Ke),n(ua),n(fa),n(ca),n(tt),n(ha),n(ba),n(ot),n(ga),n(ya),n($a),n(it),n(wa),n(_a),n(rt),n(Ta),n(Ma),n(mt),n(va),n(pt),n(Ca),n(ka),n(ft),n(qa),n(xa),n(ht),n(Ja),n(za),n(M),n(Wa),n(Za),n(Tt),n(Ua),n(Mt),n(Qa),n(vt),n(Ga),n(Ct),n(ja),n(kt),n(Ba),n(Va),n(xt),n(La),n(Xa),n(zt),n(Ha),n(Fa),n(Aa),n(Ra),n(Qt),n(Ia),n(Gt),n(Na),n(Pa),n(Bt),n(Ea),n(Ya),n(Lt),n(Sa),n(Da),n(Ka),n(Oa),n(Ft),n(el),n(tl),n(Rt),n(nl),n(It),n(ol),n(al),n(Pt),n(ll),n(il),n(sl),n(Yt),n(rl),n(dl),n(Dt),n(ml),n(pl),n(ul),n(en),n(fl),n(cl),n(hl),n(on),n(bl),n(gl),n(yl),n(sn),n($l),n(wl),n(_l),n(Tl),n(mn),n(Ml),n(vl),n(un),n(Cl),n(kl),n(cn),n(ql),n(xl),n(bn),n(Jl),n(gn),n(zl),n(Wl),n($n),n(Zl),n(Ul),n(_n),n(Ql),n(Gl),n(Mn),n(jl),n(Bl),n(Cn),n(Vl),n(Ll),n(Xl),n(xn),n(Hl),n(Fl),n(Al),n(Wn),n(Rl),n(Zn),n(Il),n(Nl),n(w),n(Pl),n(El),n(Xn),n(Yl),n(no)),n(g),c(E,e),c(Y,e),c(K,e),c(ne,e),c(ae,e),c(ie,e),c(se,e),c(de,e),c(me,e),c(ue,e),c(fe,e),c($e,e),c(_e,e),c(Te),c(Me),c(ve,e),c(xe,e),c(Ze,e),c(Ge,e),c(Be,e),c(Le,e),c(Xe,e),c(Fe,e),c(Ie,e),c(B,e),c(Pe,e),c(Ye,e),c(De,e),c(Oe,e),c(et,e),c(nt,e),c(at,e),c(lt,e),c(st,e),c(dt,e),c(ut,e),c(ct,e),c(bt,e),c(gt),c(yt),c($t),c(wt),c(_t,e),c(qt,e),c(Jt,e),c(Wt,e),c(Zt,e),c(Ut,e),c(jt,e),c(Vt,e),c(Xt,e),c(H,e),c(Ht,e),c(At,e),c(Nt,e),c(F,e),c(Et,e),c(St,e),c(Kt,e),c(Ot,e),c(tn,e),c(nn,e),c(an,e),c(ln,e),c(rn,e),c(A,e),c(dn,e),c(pn,e),c(fn,e),c(hn,e),c(yn,e),c(wn,e),c(Tn,e),c(vn,e),c(kn,e),c(qn,e),c(Jn,e),c(zn,e),c(Un,e),c(Qn),c(Gn),c(jn),c(Bn),c(Vn),c(Ln,e)}}}const _r='{"title":"Quantize 🤗 Transformers models","local":"quantize--transformers-models","sections":[{"title":"AWQ integration","local":"awq-integration","sections":[{"title":"Quantizing a model","local":"quantizing-a-model","sections":[],"depth":3},{"title":"Load a quantized model","local":"load-a-quantized-model","sections":[],"depth":3}],"depth":2},{"title":"Example usage","local":"example-usage","sections":[{"title":"Combining AWQ and Flash Attention","local":"combining-awq-and-flash-attention","sections":[],"depth":3},{"title":"Benchmarks","local":"benchmarks","sections":[],"depth":3},{"title":"Google colab demo","local":"google-colab-demo","sections":[],"depth":3},{"title":"AwqConfig","local":"transformers.AwqConfig","sections":[],"depth":3}],"depth":2},{"title":"AutoGPTQ Integration","local":"autogptq-integration","sections":[{"title":"Requirements","local":"requirements","sections":[],"depth":3},{"title":"Load and quantize a model","local":"load-and-quantize-a-model","sections":[{"title":"GPTQ Configuration","local":"gptq-configuration","sections":[],"depth":4},{"title":"Quantization","local":"quantization","sections":[],"depth":4}],"depth":3},{"title":"Push quantized model to 🤗 Hub","local":"push-quantized-model-to--hub","sections":[],"depth":3},{"title":"Load a quantized model from the 🤗 Hub","local":"load-a-quantized-model-from-the--hub","sections":[],"depth":3},{"title":"Exllama kernels for faster inference","local":"exllama-kernels-for-faster-inference","sections":[{"title":"Fine-tune a quantized model","local":"fine-tune-a-quantized-model","sections":[],"depth":4}],"depth":3},{"title":"Example demo","local":"example-demo","sections":[],"depth":3},{"title":"GPTQConfig","local":"transformers.GPTQConfig","sections":[],"depth":3}],"depth":2},{"title":"bitsandbytes Integration","local":"bitsandbytes-integration","sections":[{"title":"General usage","local":"general-usage","sections":[],"depth":3},{"title":"FP4 quantization","local":"fp4-quantization","sections":[{"title":"Requirements","local":"requirements","sections":[],"depth":4},{"title":"Tips and best practices","local":"tips-and-best-practices","sections":[],"depth":4},{"title":"Load a large model in 4bit","local":"load-a-large-model-in-4bit","sections":[],"depth":4}],"depth":3},{"title":"Load a large model in 8bit","local":"load-a-large-model-in-8bit","sections":[{"title":"Advanced use cases","local":"advanced-use-cases","sections":[{"title":"Change the compute dtype","local":"change-the-compute-dtype","sections":[],"depth":5},{"title":"Using NF4 (Normal Float 4) data type","local":"using-nf4-normal-float-4-data-type","sections":[],"depth":5},{"title":"Use nested quantization for more memory efficient inference","local":"use-nested-quantization-for-more-memory-efficient-inference","sections":[],"depth":5}],"depth":4}],"depth":3},{"title":"Push quantized models on the 🤗 Hub","local":"push-quantized-models-on-the--hub","sections":[],"depth":3},{"title":"Load a quantized model from the 🤗 Hub","local":"load-a-quantized-model-from-the--hub","sections":[],"depth":3},{"title":"Advanced use cases","local":"advanced-use-cases","sections":[{"title":"Offload between cpu and gpu","local":"offload-between-cpu-and-gpu","sections":[],"depth":4},{"title":"Play with llm_int8_threshold","local":"play-with-llmint8threshold","sections":[],"depth":4},{"title":"Skip the conversion of some modules","local":"skip-the-conversion-of-some-modules","sections":[],"depth":4},{"title":"Fine-tune a model that has been loaded in 8-bit","local":"fine-tune-a-model-that-has-been-loaded-in-8-bit","sections":[],"depth":4}],"depth":3},{"title":"BitsAndBytesConfig","local":"transformers.BitsAndBytesConfig","sections":[],"depth":3}],"depth":2},{"title":"Quantization with 🤗 optimum","local":"quantization-with--optimum","sections":[],"depth":2}],"depth":1}';function Tr(J){return mr(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Jr extends pr{constructor(g){super(),ur(this,g,Tr,wr,dr,{})}}export{Jr as component};
