import{s as Nn,o as Zn,n as jn}from"../chunks/scheduler.8c3d61f6.js";import{S as Rn,i as Xn,g as s,s as n,r as c,A as Wn,h as r,f as i,c as o,j as v,u,x as h,k as y,y as t,a as _,v as f,d as m,t as p,w as g}from"../chunks/index.da70eac4.js";import{T as Sn}from"../chunks/Tip.1d9b8c37.js";import{D as w}from"../chunks/Docstring.6b390b9a.js";import{C as Yn}from"../chunks/CodeBlock.00a903b3.js";import{E as On}from"../chunks/ExampleCodeBlock.db12be95.js";import{H as Oe,E as Kn}from"../chunks/EditOnGithub.1e64e623.js";function eo(qe){let b,D='Learn how to quantize models in the <a href="../quantization/overview">Quantization</a> guide.';return{c(){b=s("p"),b.innerHTML=D},l(q){b=r(q,"P",{"data-svelte-h":!0}),h(b)!=="svelte-1dd515k"&&(b.innerHTML=D)},m(q,T){_(q,b,T)},p:jn,d(q){q&&i(b)}}}function to(qe){let b,D="Example:",q,T,C;return T=new Yn({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEZsdXhUcmFuc2Zvcm1lcjJETW9kZWwlMkMlMjBUb3JjaEFvQ29uZmlnJTBBJTBBcXVhbnRpemF0aW9uX2NvbmZpZyUyMCUzRCUyMFRvcmNoQW9Db25maWcoJTIyaW50OHdvJTIyKSUwQXRyYW5zZm9ybWVyJTIwJTNEJTIwRmx1eFRyYW5zZm9ybWVyMkRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyYmxhY2stZm9yZXN0LWxhYnMlMkZGbHV4LjEtRGV2JTIyJTJDJTBBJTIwJTIwJTIwJTIwc3ViZm9sZGVyJTNEJTIydHJhbnNmb3JtZXIlMjIlMkMlMEElMjAlMjAlMjAlMjBxdWFudGl6YXRpb25fY29uZmlnJTNEcXVhbnRpemF0aW9uX2NvbmZpZyUyQyUwQSUyMCUyMCUyMCUyMHRvcmNoX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYlMkMlMEEp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> FluxTransformer2DModel, TorchAoConfig

quantization_config = TorchAoConfig(<span class="hljs-string">&quot;int8wo&quot;</span>)
transformer = FluxTransformer2DModel.from_pretrained(
    <span class="hljs-string">&quot;black-forest-labs/Flux.1-Dev&quot;</span>,
    subfolder=<span class="hljs-string">&quot;transformer&quot;</span>,
    quantization_config=quantization_config,
    torch_dtype=torch.bfloat16,
)`,wrap:!1}}),{c(){b=s("p"),b.textContent=D,q=n(),c(T.$$.fragment)},l(z){b=r(z,"P",{"data-svelte-h":!0}),h(b)!=="svelte-11lpom8"&&(b.textContent=D),q=o(z),u(T.$$.fragment,z)},m(z,M){_(z,b,M),_(z,q,M),f(T,z,M),C=!0},p:jn,i(z){C||(m(T.$$.fragment,z),C=!0)},o(z){p(T.$$.fragment,z),C=!1},d(z){z&&(i(b),i(q)),g(T,z)}}}function no(qe){let b,D,q,T,C,z,M,bn='Quantization techniques reduce memory and computational costs by representing weights and activations with lower-precision data types like 8-bit integers (int8). This enables loading larger models you normally wouldn’t be able to fit into memory, and speeding up inference. Diffusers supports 8-bit and 4-bit quantization with <a href="https://huggingface.co/docs/bitsandbytes/en/index" rel="nofollow">bitsandbytes</a>.',Ke,Y,vn='Quantization techniques that aren’t supported in Transformers can be added with the <a href="/docs/diffusers/pr_10123/en/api/quantization#diffusers.DiffusersQuantizer">DiffusersQuantizer</a> class.',et,B,tt,O,nt,$,K,kt,Te,yn=`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>.`,Dt,Ce,$n="This replaces <code>load_in_8bit</code> or <code>load_in_4bit</code>therefore both options are mutually exclusive.",Lt,Me,wn=`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.`,Bt,A,ee,At,ke,zn="Returns <code>True</code> if the model is quantizable, <code>False</code> otherwise.",Qt,Q,te,Ft,De,xn="Safety checker that arguments are correct - also replaces some NoneType arguments with their default values.",It,F,ne,Et,Le,qn=`This method returns the quantization method used for the model. If the model is not quantizable, it returns
<code>None</code>.`,Pt,I,oe,Ht,Be,Tn=`Removes all attributes from config which correspond to the default config attributes for better readability and
serializes to a Python dictionary.`,ot,se,st,L,re,Jt,Ae,Cn="This is a config class for GGUF Quantization techniques.",rt,ie,it,k,ae,Vt,Qe,Mn="This is a config class for torchao quantization/sparsity techniques.",Ut,E,at,de,dt,d,le,Gt,Fe,kn=`Abstract class of the HuggingFace quantizer. Supports for now quantizing HF diffusers models for inference and/or
quantization. This class is used only for diffusers.models.modeling_utils.ModelMixin.from_pretrained and cannot be
easily used outside the scope of that method yet.`,jt,Ie,Dn=`Attributes
quantization_config (<code>diffusers.quantizers.quantization_config.QuantizationConfigMixin</code>):
The quantization config that defines the quantization parameters of your model that you want to quantize.
modules_to_not_convert (<code>List[str]</code>, <em>optional</em>):
The list of module names to not convert when quantizing the model.
required_packages (<code>List[str]</code>, <em>optional</em>):
The list of required pip packages to install prior to using the quantizer
requires_calibration (<code>bool</code>):
Whether the quantization method requires to calibrate the model before using it.`,Nt,P,ce,Zt,Ee,Ln="adjust max_memory argument for infer_auto_device_map() if extra memory is needed for quantization",Rt,H,ue,Xt,Pe,Bn=`Override this method if you want to adjust the <code>target_dtype</code> variable used in <code>from_pretrained</code> to compute the
device_map in case the device_map is a <code>str</code>. E.g. for bitsandbytes we force-set <code>target_dtype</code> to <code>torch.int8</code>
and for 4-bit we pass a custom enum <code>accelerate.CustomDtype.int4</code>.`,Wt,J,fe,St,He,An=`checks if a loaded state_dict component is part of quantized param + some validation; only defined for
quantization methods that require to create a new parameters for quantization.`,Yt,V,me,Ot,Je,Qn="checks if the quantized param has expected shape.",Kt,U,pe,en,Ve,Fn="takes needed components from state_dict and creates quantized param.",tn,G,ge,nn,Ue,In=`Potentially dequantize the model to retrive the original model, with some loss in accuracy / performance. Note
not all quantization schemes support this.`,on,j,he,sn,Ge,En=`returns dtypes for modules that are not quantized - used for the computation of the device_map in case one
passes a str as a device_map. The method will use the <code>modules_to_not_convert</code> that is modified in
<code>_process_model_before_weight_loading</code>. <code>diffusers</code> models don’t have any <code>modules_to_not_convert</code> attributes
yet but this can change soon in the future.`,rn,N,_e,an,je,Pn=`Post-process the model post weights loading. Make sure to override the abstract method
<code>_process_model_after_weight_loading</code>.`,dn,Z,be,ln,Ne,Hn=`Setting model attributes and/or converting model before weights loading. At this point the model should be
initialized on the meta device so you can freely manipulate the skeleton of the model in order to replace
modules in-place. Make sure to override the abstract method <code>_process_model_before_weight_loading</code>.`,cn,R,ve,un,Ze,Jn=`Override this method if you want to pass a override the existing device map with a new one. E.g. for
bitsandbytes, since <code>accelerate</code> is a hard requirement, if no device_map is passed, the device_map is set to
\`“auto”“`,fn,X,ye,mn,Re,Vn="Override this method if you want to adjust the <code>missing_keys</code>.",pn,W,$e,gn,Xe,Un=`Some quantization methods require to explicitly set the dtype of the model to a target dtype. You need to
override this method in case you want to make sure that behavior is preserved`,hn,S,we,_n,We,Gn=`This method is used to potentially check for potential conflicts with arguments that are passed in
<code>from_pretrained</code>. You need to define it for all future quantizers that are integrated with diffusers. If no
explicit check are needed, simply return nothing.`,lt,ze,ct,Ye,ut;return C=new Oe({props:{title:"Quantization",local:"quantization",headingTag:"h1"}}),B=new Sn({props:{$$slots:{default:[eo]},$$scope:{ctx:qe}}}),O=new Oe({props:{title:"BitsAndBytesConfig",local:"diffusers.BitsAndBytesConfig",headingTag:"h2"}}),K=new w({props:{name:"class diffusers.BitsAndBytesConfig",anchor:"diffusers.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:"bnb_4bit_quant_storage",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.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:"diffusers.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:"diffusers.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:"diffusers.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 typically kept in its original <code>dtype</code>.`,name:"llm_int8_skip_modules"},{anchor:"diffusers.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:"diffusers.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:"diffusers.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 type. For example, inputs might be
fp32, but computation can be set to bf16 for speedups.`,name:"bnb_4bit_compute_dtype"},{anchor:"diffusers.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:"diffusers.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:"diffusers.BitsAndBytesConfig.bnb_4bit_quant_storage",description:`<strong>bnb_4bit_quant_storage</strong> (<code>torch.dtype</code> or str, <em>optional</em>, defaults to <code>torch.uint8</code>) &#x2014;
This sets the storage type to pack the quanitzed 4-bit prarams.`,name:"bnb_4bit_quant_storage"},{anchor:"diffusers.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/diffusers/blob/vr_10123/src/diffusers/quantizers/quantization_config.py#L165"}}),ee=new w({props:{name:"is_quantizable",anchor:"diffusers.BitsAndBytesConfig.is_quantizable",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/quantizers/quantization_config.py#L338"}}),te=new w({props:{name:"post_init",anchor:"diffusers.BitsAndBytesConfig.post_init",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/quantizers/quantization_config.py#L301"}}),ne=new w({props:{name:"quantization_method",anchor:"diffusers.BitsAndBytesConfig.quantization_method",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/quantizers/quantization_config.py#L344"}}),oe=new w({props:{name:"to_diff_dict",anchor:"diffusers.BitsAndBytesConfig.to_diff_dict",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/quantizers/quantization_config.py#L375",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>
`}}),se=new Oe({props:{title:"GGUFQuantizationConfig",local:"diffusers.GGUFQuantizationConfig",headingTag:"h2"}}),re=new w({props:{name:"class diffusers.GGUFQuantizationConfig",anchor:"diffusers.GGUFQuantizationConfig",parameters:[{name:"compute_dtype",val:": typing.Optional[ForwardRef('torch.dtype')] = None"}],parametersDescription:[{anchor:"diffusers.GGUFQuantizationConfig.compute_dtype",description:`<strong>compute_dtype</strong> &#x2014; (<code>torch.dtype</code>, defaults to <code>torch.float32</code>):
This sets the computational type which might be different than the input type. For example, inputs might be
fp32, but computation can be set to bf16 for speedups.`,name:"compute_dtype"}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/quantizers/quantization_config.py#L398"}}),ie=new Oe({props:{title:"TorchAoConfig",local:"diffusers.TorchAoConfig",headingTag:"h2"}}),ae=new w({props:{name:"class diffusers.TorchAoConfig",anchor:"diffusers.TorchAoConfig",parameters:[{name:"quant_type",val:": str"},{name:"modules_to_not_convert",val:": typing.Optional[typing.List[str]] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.TorchAoConfig.quant_type",description:`<strong>quant_type</strong> (<code>str</code>) &#x2014;
The type of quantization we want to use, currently supporting:</p>
<ul>
<li>
<p><strong>Integer quantization:</strong></p>
<ul>
<li>Full function names: <code>int4_weight_only</code>, <code>int8_dynamic_activation_int4_weight</code>,
<code>int8_weight_only</code>, <code>int8_dynamic_activation_int8_weight</code></li>
<li>Shorthands: <code>int4wo</code>, <code>int4dq</code>, <code>int8wo</code>, <code>int8dq</code></li>
</ul>
</li>
<li>
<p><strong>Floating point 8-bit quantization:</strong></p>
<ul>
<li>Full function names: <code>float8_weight_only</code>, <code>float8_dynamic_activation_float8_weight</code>,
<code>float8_static_activation_float8_weight</code></li>
<li>Shorthands: <code>float8wo</code>, <code>float8wo_e5m2</code>, <code>float8wo_e4m3</code>, <code>float8dq</code>, <code>float8dq_e4m3</code>,
<code>float8_e4m3_tensor</code>, <code>float8_e4m3_row</code>,</li>
</ul>
</li>
<li>
<p><strong>Floating point X-bit quantization:</strong></p>
<ul>
<li>Full function names: <code>fpx_weight_only</code></li>
<li>Shorthands: <code>fpX_eAwB</code>, where <code>X</code> is the number of bits (between <code>1</code> to <code>7</code>), <code>A</code> is the number
of exponent bits and <code>B</code> is the number of mantissa bits. The constraint of <code>X == A + B + 1</code> must
be satisfied for a given shorthand notation.</li>
</ul>
</li>
<li>
<p><strong>Unsigned Integer quantization:</strong></p>
<ul>
<li>Full function names: <code>uintx_weight_only</code></li>
<li>Shorthands: <code>uint1wo</code>, <code>uint2wo</code>, <code>uint3wo</code>, <code>uint4wo</code>, <code>uint5wo</code>, <code>uint6wo</code>, <code>uint7wo</code></li>
</ul>
</li>
</ul>`,name:"quant_type"},{anchor:"diffusers.TorchAoConfig.modules_to_not_convert",description:`<strong>modules_to_not_convert</strong> (<code>List[str]</code>, <em>optional</em>, default to <code>None</code>) &#x2014;
The list of modules to not quantize, useful for quantizing models that explicitly require to have some
modules left in their original precision.`,name:"modules_to_not_convert"},{anchor:"diffusers.TorchAoConfig.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
The keyword arguments for the chosen type of quantization, for example, int4_weight_only quantization
supports two keyword arguments <code>group_size</code> and <code>inner_k_tiles</code> currently. More API examples and
documentation of arguments can be found in
<a href="https://github.com/pytorch/ao/tree/main/torchao/quantization#other-available-quantization-techniques" rel="nofollow">https://github.com/pytorch/ao/tree/main/torchao/quantization#other-available-quantization-techniques</a>`,name:"kwargs"}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/quantizers/quantization_config.py#L421"}}),E=new On({props:{anchor:"diffusers.TorchAoConfig.example",$$slots:{default:[to]},$$scope:{ctx:qe}}}),de=new Oe({props:{title:"DiffusersQuantizer",local:"diffusers.DiffusersQuantizer",headingTag:"h2"}}),le=new w({props:{name:"class diffusers.DiffusersQuantizer",anchor:"diffusers.DiffusersQuantizer",parameters:[{name:"quantization_config",val:": QuantizationConfigMixin"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/quantizers/base.py#L34"}}),ce=new w({props:{name:"adjust_max_memory",anchor:"diffusers.DiffusersQuantizer.adjust_max_memory",parameters:[{name:"max_memory",val:": typing.Dict[str, typing.Union[int, str]]"}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/quantizers/base.py#L133"}}),ue=new w({props:{name:"adjust_target_dtype",anchor:"diffusers.DiffusersQuantizer.adjust_target_dtype",parameters:[{name:"torch_dtype",val:": torch.dtype"}],parametersDescription:[{anchor:"diffusers.DiffusersQuantizer.adjust_target_dtype.torch_dtype",description:`<strong>torch_dtype</strong> (<code>torch.dtype</code>, <em>optional</em>) &#x2014;
The torch_dtype that is used to compute the device_map.`,name:"torch_dtype"}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/quantizers/base.py#L91"}}),fe=new w({props:{name:"check_if_quantized_param",anchor:"diffusers.DiffusersQuantizer.check_if_quantized_param",parameters:[{name:"model",val:": ModelMixin"},{name:"param_value",val:": torch.Tensor"},{name:"param_name",val:": str"},{name:"state_dict",val:": typing.Dict[str, typing.Any]"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/quantizers/base.py#L137"}}),me=new w({props:{name:"check_quantized_param_shape",anchor:"diffusers.DiffusersQuantizer.check_quantized_param_shape",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/quantizers/base.py#L157"}}),pe=new w({props:{name:"create_quantized_param",anchor:"diffusers.DiffusersQuantizer.create_quantized_param",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/quantizers/base.py#L151"}}),ge=new w({props:{name:"dequantize",anchor:"diffusers.DiffusersQuantizer.dequantize",parameters:[{name:"model",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/quantizers/base.py#L200"}}),he=new w({props:{name:"get_special_dtypes_update",anchor:"diffusers.DiffusersQuantizer.get_special_dtypes_update",parameters:[{name:"model",val:""},{name:"torch_dtype",val:": torch.dtype"}],parametersDescription:[{anchor:"diffusers.DiffusersQuantizer.get_special_dtypes_update.model",description:`<strong>model</strong> (<code>~diffusers.models.modeling_utils.ModelMixin</code>) &#x2014;
The model to quantize`,name:"model"},{anchor:"diffusers.DiffusersQuantizer.get_special_dtypes_update.torch_dtype",description:`<strong>torch_dtype</strong> (<code>torch.dtype</code>) &#x2014;
The dtype passed in <code>from_pretrained</code> method.`,name:"torch_dtype"}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/quantizers/base.py#L113"}}),_e=new w({props:{name:"postprocess_model",anchor:"diffusers.DiffusersQuantizer.postprocess_model",parameters:[{name:"model",val:": ModelMixin"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.DiffusersQuantizer.postprocess_model.model",description:`<strong>model</strong> (<code>~diffusers.models.modeling_utils.ModelMixin</code>) &#x2014;
The model to quantize`,name:"model"},{anchor:"diffusers.DiffusersQuantizer.postprocess_model.kwargs",description:`<strong>kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
The keyword arguments that are passed along <code>_process_model_after_weight_loading</code>.`,name:"kwargs"}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/quantizers/base.py#L187"}}),be=new w({props:{name:"preprocess_model",anchor:"diffusers.DiffusersQuantizer.preprocess_model",parameters:[{name:"model",val:": ModelMixin"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.DiffusersQuantizer.preprocess_model.model",description:`<strong>model</strong> (<code>~diffusers.models.modeling_utils.ModelMixin</code>) &#x2014;
The model to quantize`,name:"model"},{anchor:"diffusers.DiffusersQuantizer.preprocess_model.kwargs",description:`<strong>kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
The keyword arguments that are passed along <code>_process_model_before_weight_loading</code>.`,name:"kwargs"}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/quantizers/base.py#L171"}}),ve=new w({props:{name:"update_device_map",anchor:"diffusers.DiffusersQuantizer.update_device_map",parameters:[{name:"device_map",val:": typing.Optional[typing.Dict[str, typing.Any]]"}],parametersDescription:[{anchor:"diffusers.DiffusersQuantizer.update_device_map.device_map",description:`<strong>device_map</strong> (<code>Union[dict, str]</code>, <em>optional</em>) &#x2014;
The device_map that is passed through the <code>from_pretrained</code> method.`,name:"device_map"}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/quantizers/base.py#L79"}}),ye=new w({props:{name:"update_missing_keys",anchor:"diffusers.DiffusersQuantizer.update_missing_keys",parameters:[{name:"model",val:""},{name:"missing_keys",val:": typing.List[str]"},{name:"prefix",val:": str"}],parametersDescription:[{anchor:"diffusers.DiffusersQuantizer.update_missing_keys.missing_keys",description:`<strong>missing_keys</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
The list of missing keys in the checkpoint compared to the state dict of the model`,name:"missing_keys"}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/quantizers/base.py#L103"}}),$e=new w({props:{name:"update_torch_dtype",anchor:"diffusers.DiffusersQuantizer.update_torch_dtype",parameters:[{name:"torch_dtype",val:": torch.dtype"}],parametersDescription:[{anchor:"diffusers.DiffusersQuantizer.update_torch_dtype.torch_dtype",description:`<strong>torch_dtype</strong> (<code>torch.dtype</code>) &#x2014;
The input dtype that is passed in <code>from_pretrained</code>`,name:"torch_dtype"}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/quantizers/base.py#L68"}}),we=new w({props:{name:"validate_environment",anchor:"diffusers.DiffusersQuantizer.validate_environment",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_10123/src/diffusers/quantizers/base.py#L163"}}),ze=new Kn({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/quantization.md"}}),{c(){b=s("meta"),D=n(),q=s("p"),T=n(),c(C.$$.fragment),z=n(),M=s("p"),M.innerHTML=bn,Ke=n(),Y=s("p"),Y.innerHTML=vn,et=n(),c(B.$$.fragment),tt=n(),c(O.$$.fragment),nt=n(),$=s("div"),c(K.$$.fragment),kt=n(),Te=s("p"),Te.innerHTML=yn,Dt=n(),Ce=s("p"),Ce.innerHTML=$n,Lt=n(),Me=s("p"),Me.innerHTML=wn,Bt=n(),A=s("div"),c(ee.$$.fragment),At=n(),ke=s("p"),ke.innerHTML=zn,Qt=n(),Q=s("div"),c(te.$$.fragment),Ft=n(),De=s("p"),De.textContent=xn,It=n(),F=s("div"),c(ne.$$.fragment),Et=n(),Le=s("p"),Le.innerHTML=qn,Pt=n(),I=s("div"),c(oe.$$.fragment),Ht=n(),Be=s("p"),Be.textContent=Tn,ot=n(),c(se.$$.fragment),st=n(),L=s("div"),c(re.$$.fragment),Jt=n(),Ae=s("p"),Ae.textContent=Cn,rt=n(),c(ie.$$.fragment),it=n(),k=s("div"),c(ae.$$.fragment),Vt=n(),Qe=s("p"),Qe.textContent=Mn,Ut=n(),c(E.$$.fragment),at=n(),c(de.$$.fragment),dt=n(),d=s("div"),c(le.$$.fragment),Gt=n(),Fe=s("p"),Fe.textContent=kn,jt=n(),Ie=s("p"),Ie.innerHTML=Dn,Nt=n(),P=s("div"),c(ce.$$.fragment),Zt=n(),Ee=s("p"),Ee.textContent=Ln,Rt=n(),H=s("div"),c(ue.$$.fragment),Xt=n(),Pe=s("p"),Pe.innerHTML=Bn,Wt=n(),J=s("div"),c(fe.$$.fragment),St=n(),He=s("p"),He.textContent=An,Yt=n(),V=s("div"),c(me.$$.fragment),Ot=n(),Je=s("p"),Je.textContent=Qn,Kt=n(),U=s("div"),c(pe.$$.fragment),en=n(),Ve=s("p"),Ve.textContent=Fn,tn=n(),G=s("div"),c(ge.$$.fragment),nn=n(),Ue=s("p"),Ue.textContent=In,on=n(),j=s("div"),c(he.$$.fragment),sn=n(),Ge=s("p"),Ge.innerHTML=En,rn=n(),N=s("div"),c(_e.$$.fragment),an=n(),je=s("p"),je.innerHTML=Pn,dn=n(),Z=s("div"),c(be.$$.fragment),ln=n(),Ne=s("p"),Ne.innerHTML=Hn,cn=n(),R=s("div"),c(ve.$$.fragment),un=n(),Ze=s("p"),Ze.innerHTML=Jn,fn=n(),X=s("div"),c(ye.$$.fragment),mn=n(),Re=s("p"),Re.innerHTML=Vn,pn=n(),W=s("div"),c($e.$$.fragment),gn=n(),Xe=s("p"),Xe.textContent=Un,hn=n(),S=s("div"),c(we.$$.fragment),_n=n(),We=s("p"),We.innerHTML=Gn,lt=n(),c(ze.$$.fragment),ct=n(),Ye=s("p"),this.h()},l(e){const a=Wn("svelte-u9bgzb",document.head);b=r(a,"META",{name:!0,content:!0}),a.forEach(i),D=o(e),q=r(e,"P",{}),v(q).forEach(i),T=o(e),u(C.$$.fragment,e),z=o(e),M=r(e,"P",{"data-svelte-h":!0}),h(M)!=="svelte-gx66go"&&(M.innerHTML=bn),Ke=o(e),Y=r(e,"P",{"data-svelte-h":!0}),h(Y)!=="svelte-t7xxra"&&(Y.innerHTML=vn),et=o(e),u(B.$$.fragment,e),tt=o(e),u(O.$$.fragment,e),nt=o(e),$=r(e,"DIV",{class:!0});var x=v($);u(K.$$.fragment,x),kt=o(x),Te=r(x,"P",{"data-svelte-h":!0}),h(Te)!=="svelte-woamwr"&&(Te.innerHTML=yn),Dt=o(x),Ce=r(x,"P",{"data-svelte-h":!0}),h(Ce)!=="svelte-ki5gis"&&(Ce.innerHTML=$n),Lt=o(x),Me=r(x,"P",{"data-svelte-h":!0}),h(Me)!=="svelte-8qsk2q"&&(Me.innerHTML=wn),Bt=o(x),A=r(x,"DIV",{class:!0});var xe=v(A);u(ee.$$.fragment,xe),At=o(xe),ke=r(xe,"P",{"data-svelte-h":!0}),h(ke)!=="svelte-10tvzyv"&&(ke.innerHTML=zn),xe.forEach(i),Qt=o(x),Q=r(x,"DIV",{class:!0});var ft=v(Q);u(te.$$.fragment,ft),Ft=o(ft),De=r(ft,"P",{"data-svelte-h":!0}),h(De)!=="svelte-gy26u4"&&(De.textContent=xn),ft.forEach(i),It=o(x),F=r(x,"DIV",{class:!0});var mt=v(F);u(ne.$$.fragment,mt),Et=o(mt),Le=r(mt,"P",{"data-svelte-h":!0}),h(Le)!=="svelte-19bn0da"&&(Le.innerHTML=qn),mt.forEach(i),Pt=o(x),I=r(x,"DIV",{class:!0});var pt=v(I);u(oe.$$.fragment,pt),Ht=o(pt),Be=r(pt,"P",{"data-svelte-h":!0}),h(Be)!=="svelte-1p6bdas"&&(Be.textContent=Tn),pt.forEach(i),x.forEach(i),ot=o(e),u(se.$$.fragment,e),st=o(e),L=r(e,"DIV",{class:!0});var gt=v(L);u(re.$$.fragment,gt),Jt=o(gt),Ae=r(gt,"P",{"data-svelte-h":!0}),h(Ae)!=="svelte-1r606z3"&&(Ae.textContent=Cn),gt.forEach(i),rt=o(e),u(ie.$$.fragment,e),it=o(e),k=r(e,"DIV",{class:!0});var Se=v(k);u(ae.$$.fragment,Se),Vt=o(Se),Qe=r(Se,"P",{"data-svelte-h":!0}),h(Qe)!=="svelte-1pwo8e0"&&(Qe.textContent=Mn),Ut=o(Se),u(E.$$.fragment,Se),Se.forEach(i),at=o(e),u(de.$$.fragment,e),dt=o(e),d=r(e,"DIV",{class:!0});var l=v(d);u(le.$$.fragment,l),Gt=o(l),Fe=r(l,"P",{"data-svelte-h":!0}),h(Fe)!=="svelte-n1gm3c"&&(Fe.textContent=kn),jt=o(l),Ie=r(l,"P",{"data-svelte-h":!0}),h(Ie)!=="svelte-1fnduym"&&(Ie.innerHTML=Dn),Nt=o(l),P=r(l,"DIV",{class:!0});var ht=v(P);u(ce.$$.fragment,ht),Zt=o(ht),Ee=r(ht,"P",{"data-svelte-h":!0}),h(Ee)!=="svelte-1d4i4z7"&&(Ee.textContent=Ln),ht.forEach(i),Rt=o(l),H=r(l,"DIV",{class:!0});var _t=v(H);u(ue.$$.fragment,_t),Xt=o(_t),Pe=r(_t,"P",{"data-svelte-h":!0}),h(Pe)!=="svelte-eyxa3y"&&(Pe.innerHTML=Bn),_t.forEach(i),Wt=o(l),J=r(l,"DIV",{class:!0});var bt=v(J);u(fe.$$.fragment,bt),St=o(bt),He=r(bt,"P",{"data-svelte-h":!0}),h(He)!=="svelte-y0lxmf"&&(He.textContent=An),bt.forEach(i),Yt=o(l),V=r(l,"DIV",{class:!0});var vt=v(V);u(me.$$.fragment,vt),Ot=o(vt),Je=r(vt,"P",{"data-svelte-h":!0}),h(Je)!=="svelte-1170ss6"&&(Je.textContent=Qn),vt.forEach(i),Kt=o(l),U=r(l,"DIV",{class:!0});var yt=v(U);u(pe.$$.fragment,yt),en=o(yt),Ve=r(yt,"P",{"data-svelte-h":!0}),h(Ve)!=="svelte-odkanz"&&(Ve.textContent=Fn),yt.forEach(i),tn=o(l),G=r(l,"DIV",{class:!0});var $t=v(G);u(ge.$$.fragment,$t),nn=o($t),Ue=r($t,"P",{"data-svelte-h":!0}),h(Ue)!=="svelte-1wzx7fq"&&(Ue.textContent=In),$t.forEach(i),on=o(l),j=r(l,"DIV",{class:!0});var wt=v(j);u(he.$$.fragment,wt),sn=o(wt),Ge=r(wt,"P",{"data-svelte-h":!0}),h(Ge)!=="svelte-1cb2fzf"&&(Ge.innerHTML=En),wt.forEach(i),rn=o(l),N=r(l,"DIV",{class:!0});var zt=v(N);u(_e.$$.fragment,zt),an=o(zt),je=r(zt,"P",{"data-svelte-h":!0}),h(je)!=="svelte-6rgq61"&&(je.innerHTML=Pn),zt.forEach(i),dn=o(l),Z=r(l,"DIV",{class:!0});var xt=v(Z);u(be.$$.fragment,xt),ln=o(xt),Ne=r(xt,"P",{"data-svelte-h":!0}),h(Ne)!=="svelte-wiwxpv"&&(Ne.innerHTML=Hn),xt.forEach(i),cn=o(l),R=r(l,"DIV",{class:!0});var qt=v(R);u(ve.$$.fragment,qt),un=o(qt),Ze=r(qt,"P",{"data-svelte-h":!0}),h(Ze)!=="svelte-5g503h"&&(Ze.innerHTML=Jn),qt.forEach(i),fn=o(l),X=r(l,"DIV",{class:!0});var Tt=v(X);u(ye.$$.fragment,Tt),mn=o(Tt),Re=r(Tt,"P",{"data-svelte-h":!0}),h(Re)!=="svelte-13hqoy0"&&(Re.innerHTML=Vn),Tt.forEach(i),pn=o(l),W=r(l,"DIV",{class:!0});var Ct=v(W);u($e.$$.fragment,Ct),gn=o(Ct),Xe=r(Ct,"P",{"data-svelte-h":!0}),h(Xe)!=="svelte-udr2k7"&&(Xe.textContent=Un),Ct.forEach(i),hn=o(l),S=r(l,"DIV",{class:!0});var Mt=v(S);u(we.$$.fragment,Mt),_n=o(Mt),We=r(Mt,"P",{"data-svelte-h":!0}),h(We)!=="svelte-1ra2q1u"&&(We.innerHTML=Gn),Mt.forEach(i),l.forEach(i),lt=o(e),u(ze.$$.fragment,e),ct=o(e),Ye=r(e,"P",{}),v(Ye).forEach(i),this.h()},h(){y(b,"name","hf:doc:metadata"),y(b,"content",oo),y(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(d,"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,a){t(document.head,b),_(e,D,a),_(e,q,a),_(e,T,a),f(C,e,a),_(e,z,a),_(e,M,a),_(e,Ke,a),_(e,Y,a),_(e,et,a),f(B,e,a),_(e,tt,a),f(O,e,a),_(e,nt,a),_(e,$,a),f(K,$,null),t($,kt),t($,Te),t($,Dt),t($,Ce),t($,Lt),t($,Me),t($,Bt),t($,A),f(ee,A,null),t(A,At),t(A,ke),t($,Qt),t($,Q),f(te,Q,null),t(Q,Ft),t(Q,De),t($,It),t($,F),f(ne,F,null),t(F,Et),t(F,Le),t($,Pt),t($,I),f(oe,I,null),t(I,Ht),t(I,Be),_(e,ot,a),f(se,e,a),_(e,st,a),_(e,L,a),f(re,L,null),t(L,Jt),t(L,Ae),_(e,rt,a),f(ie,e,a),_(e,it,a),_(e,k,a),f(ae,k,null),t(k,Vt),t(k,Qe),t(k,Ut),f(E,k,null),_(e,at,a),f(de,e,a),_(e,dt,a),_(e,d,a),f(le,d,null),t(d,Gt),t(d,Fe),t(d,jt),t(d,Ie),t(d,Nt),t(d,P),f(ce,P,null),t(P,Zt),t(P,Ee),t(d,Rt),t(d,H),f(ue,H,null),t(H,Xt),t(H,Pe),t(d,Wt),t(d,J),f(fe,J,null),t(J,St),t(J,He),t(d,Yt),t(d,V),f(me,V,null),t(V,Ot),t(V,Je),t(d,Kt),t(d,U),f(pe,U,null),t(U,en),t(U,Ve),t(d,tn),t(d,G),f(ge,G,null),t(G,nn),t(G,Ue),t(d,on),t(d,j),f(he,j,null),t(j,sn),t(j,Ge),t(d,rn),t(d,N),f(_e,N,null),t(N,an),t(N,je),t(d,dn),t(d,Z),f(be,Z,null),t(Z,ln),t(Z,Ne),t(d,cn),t(d,R),f(ve,R,null),t(R,un),t(R,Ze),t(d,fn),t(d,X),f(ye,X,null),t(X,mn),t(X,Re),t(d,pn),t(d,W),f($e,W,null),t(W,gn),t(W,Xe),t(d,hn),t(d,S),f(we,S,null),t(S,_n),t(S,We),_(e,lt,a),f(ze,e,a),_(e,ct,a),_(e,Ye,a),ut=!0},p(e,[a]){const x={};a&2&&(x.$$scope={dirty:a,ctx:e}),B.$set(x);const xe={};a&2&&(xe.$$scope={dirty:a,ctx:e}),E.$set(xe)},i(e){ut||(m(C.$$.fragment,e),m(B.$$.fragment,e),m(O.$$.fragment,e),m(K.$$.fragment,e),m(ee.$$.fragment,e),m(te.$$.fragment,e),m(ne.$$.fragment,e),m(oe.$$.fragment,e),m(se.$$.fragment,e),m(re.$$.fragment,e),m(ie.$$.fragment,e),m(ae.$$.fragment,e),m(E.$$.fragment,e),m(de.$$.fragment,e),m(le.$$.fragment,e),m(ce.$$.fragment,e),m(ue.$$.fragment,e),m(fe.$$.fragment,e),m(me.$$.fragment,e),m(pe.$$.fragment,e),m(ge.$$.fragment,e),m(he.$$.fragment,e),m(_e.$$.fragment,e),m(be.$$.fragment,e),m(ve.$$.fragment,e),m(ye.$$.fragment,e),m($e.$$.fragment,e),m(we.$$.fragment,e),m(ze.$$.fragment,e),ut=!0)},o(e){p(C.$$.fragment,e),p(B.$$.fragment,e),p(O.$$.fragment,e),p(K.$$.fragment,e),p(ee.$$.fragment,e),p(te.$$.fragment,e),p(ne.$$.fragment,e),p(oe.$$.fragment,e),p(se.$$.fragment,e),p(re.$$.fragment,e),p(ie.$$.fragment,e),p(ae.$$.fragment,e),p(E.$$.fragment,e),p(de.$$.fragment,e),p(le.$$.fragment,e),p(ce.$$.fragment,e),p(ue.$$.fragment,e),p(fe.$$.fragment,e),p(me.$$.fragment,e),p(pe.$$.fragment,e),p(ge.$$.fragment,e),p(he.$$.fragment,e),p(_e.$$.fragment,e),p(be.$$.fragment,e),p(ve.$$.fragment,e),p(ye.$$.fragment,e),p($e.$$.fragment,e),p(we.$$.fragment,e),p(ze.$$.fragment,e),ut=!1},d(e){e&&(i(D),i(q),i(T),i(z),i(M),i(Ke),i(Y),i(et),i(tt),i(nt),i($),i(ot),i(st),i(L),i(rt),i(it),i(k),i(at),i(dt),i(d),i(lt),i(ct),i(Ye)),i(b),g(C,e),g(B,e),g(O,e),g(K),g(ee),g(te),g(ne),g(oe),g(se,e),g(re),g(ie,e),g(ae),g(E),g(de,e),g(le),g(ce),g(ue),g(fe),g(me),g(pe),g(ge),g(he),g(_e),g(be),g(ve),g(ye),g($e),g(we),g(ze,e)}}}const oo='{"title":"Quantization","local":"quantization","sections":[{"title":"BitsAndBytesConfig","local":"diffusers.BitsAndBytesConfig","sections":[],"depth":2},{"title":"GGUFQuantizationConfig","local":"diffusers.GGUFQuantizationConfig","sections":[],"depth":2},{"title":"TorchAoConfig","local":"diffusers.TorchAoConfig","sections":[],"depth":2},{"title":"DiffusersQuantizer","local":"diffusers.DiffusersQuantizer","sections":[],"depth":2}],"depth":1}';function so(qe){return Zn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class mo extends Rn{constructor(b){super(),Xn(this,b,so,no,Nn,{})}}export{mo as component};
