import{s as Hn,o as Pn,n as En}from"../chunks/scheduler.8c3d61f6.js";import{S as In,i as Fn,g as s,s as n,r as u,A as jn,h as o,f as a,c as r,j as v,u as f,x as g,k as y,y as t,a as b,v as c,d as m,t as p,w as h}from"../chunks/index.da70eac4.js";import{T as Vn}from"../chunks/Tip.1d9b8c37.js";import{D as x}from"../chunks/Docstring.6b390b9a.js";import{C as Jn}from"../chunks/CodeBlock.00a903b3.js";import{E as Un}from"../chunks/ExampleCodeBlock.db12be95.js";import{H as $t,E as Nn}from"../chunks/EditOnGithub.1e64e623.js";function Rn(xe){let _,D='Learn how to quantize models in the <a href="../quantization/overview">Quantization</a> guide.';return{c(){_=s("p"),_.innerHTML=D},l(q){_=o(q,"P",{"data-svelte-h":!0}),g(_)!=="svelte-1dd515k"&&(_.innerHTML=D)},m(q,T){b(q,_,T)},p:En,d(q){q&&a(_)}}}function Gn(xe){let _,D="Example:",q,T,C;return T=new Jn({props:{code:"VE9ETyhhcnlhbiklM0ElMjB1cGRhdGUlMEFxdWFudGl6YXRpb25fY29uZmlnJTIwJTNEJTIwVG9yY2hBb0NvbmZpZyglMjJpbnQ0X3dlaWdodF9vbmx5JTIyJTJDJTIwZ3JvdXBfc2l6ZSUzRDMyKSUwQSUyMyUyMGludDRfd2VpZ2h0X29ubHklMjBxdWFudCUyMGlzJTIwb25seSUyMHdvcmtpbmclMjB3aXRoJTIwKnRvcmNoLmJmbG9hdDE2KiUyMGR0eXBlJTIwcmlnaHQlMjBub3clMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjBtb2RlbF9pZCUyQyUyMGRldmljZV9tYXAlM0QlMjJjdWRhJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiUyQyUyMHF1YW50aXphdGlvbl9jb25maWclM0RxdWFudGl6YXRpb25fY29uZmlnJTBBKQ==",highlighted:`TODO(aryan): update
quantization_config = TorchAoConfig(<span class="hljs-string">&quot;int4_weight_only&quot;</span>, group_size=<span class="hljs-number">32</span>)
<span class="hljs-comment"># int4_weight_only quant is only working with *torch.bfloat16* dtype right now</span>
model = AutoModelForCausalLM.from_pretrained(
    model_id, device_map=<span class="hljs-string">&quot;cuda&quot;</span>, torch_dtype=torch.bfloat16, quantization_config=quantization_config
)`,wrap:!1}}),{c(){_=s("p"),_.textContent=D,q=n(),u(T.$$.fragment)},l(z){_=o(z,"P",{"data-svelte-h":!0}),g(_)!=="svelte-11lpom8"&&(_.textContent=D),q=r(z),f(T.$$.fragment,z)},m(z,M){b(z,_,M),b(z,q,M),c(T,z,M),C=!0},p:En,i(z){C||(m(T.$$.fragment,z),C=!0)},o(z){p(T.$$.fragment,z),C=!1},d(z){z&&(a(_),a(q)),h(T,z)}}}function Zn(xe){let _,D,q,T,C,z,M,un='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>.',Se,Y,fn='Quantization techniques that aren’t supported in Transformers can be added with the <a href="/docs/diffusers/pr_10009/en/api/quantization#diffusers.DiffusersQuantizer">DiffusersQuantizer</a> class.',Xe,L,Ye,O,Oe,$,W,xt,ze,cn=`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>.`,zt,we,mn="This replaces <code>load_in_8bit</code> or <code>load_in_4bit</code>therefore both options are mutually exclusive.",wt,qe,pn=`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.`,qt,B,K,Tt,Te,hn="Returns <code>True</code> if the model is quantizable, <code>False</code> otherwise.",Ct,A,ee,Mt,Ce,gn="Safety checker that arguments are correct - also replaces some NoneType arguments with their default values.",kt,Q,te,Dt,Me,_n=`This method returns the quantization method used for the model. If the model is not quantizable, it returns
<code>None</code>.`,Lt,E,ne,Bt,ke,bn=`Removes all attributes from config which correspond to the default config attributes for better readability and
serializes to a Python dictionary.`,We,re,Ke,k,se,At,De,vn="This is a config class for torchao quantization/sparsity techniques.",Qt,H,et,oe,tt,i,ae,Et,Le,yn=`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.`,Ht,Be,$n=`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.`,Pt,P,ie,It,Ae,xn="adjust max_memory argument for infer_auto_device_map() if extra memory is needed for quantization",Ft,I,de,jt,Qe,zn=`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>.`,Vt,F,le,Jt,Ee,wn=`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.`,Ut,j,ue,Nt,He,qn="checks if the quantized param has expected shape.",Rt,V,fe,Gt,Pe,Tn="takes needed components from state_dict and creates quantized param.",Zt,J,ce,St,Ie,Cn=`Potentially dequantize the model to retrive the original model, with some loss in accuracy / performance. Note
not all quantization schemes support this.`,Xt,U,me,Yt,Fe,Mn=`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.`,Ot,N,pe,Wt,je,kn=`Post-process the model post weights loading. Make sure to override the abstract method
<code>_process_model_after_weight_loading</code>.`,Kt,R,he,en,Ve,Dn=`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>.`,tn,G,ge,nn,Je,Ln=`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”“`,rn,Z,_e,sn,Ue,Bn="Override this method if you want to adjust the <code>missing_keys</code>.",on,S,be,an,Ne,An=`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`,dn,X,ve,ln,Re,Qn=`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.`,nt,ye,rt,Ze,st;return C=new $t({props:{title:"Quantization",local:"quantization",headingTag:"h1"}}),L=new Vn({props:{$$slots:{default:[Rn]},$$scope:{ctx:xe}}}),O=new $t({props:{title:"BitsAndBytesConfig",local:"diffusers.BitsAndBytesConfig",headingTag:"h2"}}),W=new x({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_10009/src/diffusers/quantizers/quantization_config.py#L164"}}),K=new x({props:{name:"is_quantizable",anchor:"diffusers.BitsAndBytesConfig.is_quantizable",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10009/src/diffusers/quantizers/quantization_config.py#L337"}}),ee=new x({props:{name:"post_init",anchor:"diffusers.BitsAndBytesConfig.post_init",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10009/src/diffusers/quantizers/quantization_config.py#L300"}}),te=new x({props:{name:"quantization_method",anchor:"diffusers.BitsAndBytesConfig.quantization_method",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10009/src/diffusers/quantizers/quantization_config.py#L343"}}),ne=new x({props:{name:"to_diff_dict",anchor:"diffusers.BitsAndBytesConfig.to_diff_dict",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10009/src/diffusers/quantizers/quantization_config.py#L374",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>
`}}),re=new $t({props:{title:"TorchAoConfig",local:"diffusers.TorchAoConfig",headingTag:"h2"}}),se=new x({props:{name:"class diffusers.TorchAoConfig",anchor:"diffusers.TorchAoConfig",parameters:[{name:"quant_type",val:": str"},{name:"modules_to_not_convert",val:": typing.Optional[typing.List] = 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: <code>int4_weight_only</code>, <code>int8_weight_only</code> and
<code>int8_dynamic_activation_int8_weight</code>.`,name:"quant_type"},{anchor:"diffusers.TorchAoConfig.modules_to_not_convert",description:`<strong>modules_to_not_convert</strong> (<code>list</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_10009/src/diffusers/quantizers/quantization_config.py#L397"}}),H=new Un({props:{anchor:"diffusers.TorchAoConfig.example",$$slots:{default:[Gn]},$$scope:{ctx:xe}}}),oe=new $t({props:{title:"DiffusersQuantizer",local:"diffusers.DiffusersQuantizer",headingTag:"h2"}}),ae=new x({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_10009/src/diffusers/quantizers/base.py#L34"}}),ie=new x({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_10009/src/diffusers/quantizers/base.py#L133"}}),de=new x({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_10009/src/diffusers/quantizers/base.py#L91"}}),le=new x({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_10009/src/diffusers/quantizers/base.py#L137"}}),ue=new x({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_10009/src/diffusers/quantizers/base.py#L157"}}),fe=new x({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_10009/src/diffusers/quantizers/base.py#L151"}}),ce=new x({props:{name:"dequantize",anchor:"diffusers.DiffusersQuantizer.dequantize",parameters:[{name:"model",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_10009/src/diffusers/quantizers/base.py#L200"}}),me=new x({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_10009/src/diffusers/quantizers/base.py#L113"}}),pe=new x({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_10009/src/diffusers/quantizers/base.py#L187"}}),he=new x({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_10009/src/diffusers/quantizers/base.py#L171"}}),ge=new x({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_10009/src/diffusers/quantizers/base.py#L79"}}),_e=new x({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_10009/src/diffusers/quantizers/base.py#L103"}}),be=new x({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_10009/src/diffusers/quantizers/base.py#L68"}}),ve=new x({props:{name:"validate_environment",anchor:"diffusers.DiffusersQuantizer.validate_environment",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_10009/src/diffusers/quantizers/base.py#L163"}}),ye=new Nn({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/quantization.md"}}),{c(){_=s("meta"),D=n(),q=s("p"),T=n(),u(C.$$.fragment),z=n(),M=s("p"),M.innerHTML=un,Se=n(),Y=s("p"),Y.innerHTML=fn,Xe=n(),u(L.$$.fragment),Ye=n(),u(O.$$.fragment),Oe=n(),$=s("div"),u(W.$$.fragment),xt=n(),ze=s("p"),ze.innerHTML=cn,zt=n(),we=s("p"),we.innerHTML=mn,wt=n(),qe=s("p"),qe.innerHTML=pn,qt=n(),B=s("div"),u(K.$$.fragment),Tt=n(),Te=s("p"),Te.innerHTML=hn,Ct=n(),A=s("div"),u(ee.$$.fragment),Mt=n(),Ce=s("p"),Ce.textContent=gn,kt=n(),Q=s("div"),u(te.$$.fragment),Dt=n(),Me=s("p"),Me.innerHTML=_n,Lt=n(),E=s("div"),u(ne.$$.fragment),Bt=n(),ke=s("p"),ke.textContent=bn,We=n(),u(re.$$.fragment),Ke=n(),k=s("div"),u(se.$$.fragment),At=n(),De=s("p"),De.textContent=vn,Qt=n(),u(H.$$.fragment),et=n(),u(oe.$$.fragment),tt=n(),i=s("div"),u(ae.$$.fragment),Et=n(),Le=s("p"),Le.textContent=yn,Ht=n(),Be=s("p"),Be.innerHTML=$n,Pt=n(),P=s("div"),u(ie.$$.fragment),It=n(),Ae=s("p"),Ae.textContent=xn,Ft=n(),I=s("div"),u(de.$$.fragment),jt=n(),Qe=s("p"),Qe.innerHTML=zn,Vt=n(),F=s("div"),u(le.$$.fragment),Jt=n(),Ee=s("p"),Ee.textContent=wn,Ut=n(),j=s("div"),u(ue.$$.fragment),Nt=n(),He=s("p"),He.textContent=qn,Rt=n(),V=s("div"),u(fe.$$.fragment),Gt=n(),Pe=s("p"),Pe.textContent=Tn,Zt=n(),J=s("div"),u(ce.$$.fragment),St=n(),Ie=s("p"),Ie.textContent=Cn,Xt=n(),U=s("div"),u(me.$$.fragment),Yt=n(),Fe=s("p"),Fe.innerHTML=Mn,Ot=n(),N=s("div"),u(pe.$$.fragment),Wt=n(),je=s("p"),je.innerHTML=kn,Kt=n(),R=s("div"),u(he.$$.fragment),en=n(),Ve=s("p"),Ve.innerHTML=Dn,tn=n(),G=s("div"),u(ge.$$.fragment),nn=n(),Je=s("p"),Je.innerHTML=Ln,rn=n(),Z=s("div"),u(_e.$$.fragment),sn=n(),Ue=s("p"),Ue.innerHTML=Bn,on=n(),S=s("div"),u(be.$$.fragment),an=n(),Ne=s("p"),Ne.textContent=An,dn=n(),X=s("div"),u(ve.$$.fragment),ln=n(),Re=s("p"),Re.innerHTML=Qn,nt=n(),u(ye.$$.fragment),rt=n(),Ze=s("p"),this.h()},l(e){const d=jn("svelte-u9bgzb",document.head);_=o(d,"META",{name:!0,content:!0}),d.forEach(a),D=r(e),q=o(e,"P",{}),v(q).forEach(a),T=r(e),f(C.$$.fragment,e),z=r(e),M=o(e,"P",{"data-svelte-h":!0}),g(M)!=="svelte-gx66go"&&(M.innerHTML=un),Se=r(e),Y=o(e,"P",{"data-svelte-h":!0}),g(Y)!=="svelte-pnzeyd"&&(Y.innerHTML=fn),Xe=r(e),f(L.$$.fragment,e),Ye=r(e),f(O.$$.fragment,e),Oe=r(e),$=o(e,"DIV",{class:!0});var w=v($);f(W.$$.fragment,w),xt=r(w),ze=o(w,"P",{"data-svelte-h":!0}),g(ze)!=="svelte-woamwr"&&(ze.innerHTML=cn),zt=r(w),we=o(w,"P",{"data-svelte-h":!0}),g(we)!=="svelte-ki5gis"&&(we.innerHTML=mn),wt=r(w),qe=o(w,"P",{"data-svelte-h":!0}),g(qe)!=="svelte-8qsk2q"&&(qe.innerHTML=pn),qt=r(w),B=o(w,"DIV",{class:!0});var $e=v(B);f(K.$$.fragment,$e),Tt=r($e),Te=o($e,"P",{"data-svelte-h":!0}),g(Te)!=="svelte-10tvzyv"&&(Te.innerHTML=hn),$e.forEach(a),Ct=r(w),A=o(w,"DIV",{class:!0});var ot=v(A);f(ee.$$.fragment,ot),Mt=r(ot),Ce=o(ot,"P",{"data-svelte-h":!0}),g(Ce)!=="svelte-gy26u4"&&(Ce.textContent=gn),ot.forEach(a),kt=r(w),Q=o(w,"DIV",{class:!0});var at=v(Q);f(te.$$.fragment,at),Dt=r(at),Me=o(at,"P",{"data-svelte-h":!0}),g(Me)!=="svelte-19bn0da"&&(Me.innerHTML=_n),at.forEach(a),Lt=r(w),E=o(w,"DIV",{class:!0});var it=v(E);f(ne.$$.fragment,it),Bt=r(it),ke=o(it,"P",{"data-svelte-h":!0}),g(ke)!=="svelte-1p6bdas"&&(ke.textContent=bn),it.forEach(a),w.forEach(a),We=r(e),f(re.$$.fragment,e),Ke=r(e),k=o(e,"DIV",{class:!0});var Ge=v(k);f(se.$$.fragment,Ge),At=r(Ge),De=o(Ge,"P",{"data-svelte-h":!0}),g(De)!=="svelte-1pwo8e0"&&(De.textContent=vn),Qt=r(Ge),f(H.$$.fragment,Ge),Ge.forEach(a),et=r(e),f(oe.$$.fragment,e),tt=r(e),i=o(e,"DIV",{class:!0});var l=v(i);f(ae.$$.fragment,l),Et=r(l),Le=o(l,"P",{"data-svelte-h":!0}),g(Le)!=="svelte-n1gm3c"&&(Le.textContent=yn),Ht=r(l),Be=o(l,"P",{"data-svelte-h":!0}),g(Be)!=="svelte-1fnduym"&&(Be.innerHTML=$n),Pt=r(l),P=o(l,"DIV",{class:!0});var dt=v(P);f(ie.$$.fragment,dt),It=r(dt),Ae=o(dt,"P",{"data-svelte-h":!0}),g(Ae)!=="svelte-1d4i4z7"&&(Ae.textContent=xn),dt.forEach(a),Ft=r(l),I=o(l,"DIV",{class:!0});var lt=v(I);f(de.$$.fragment,lt),jt=r(lt),Qe=o(lt,"P",{"data-svelte-h":!0}),g(Qe)!=="svelte-eyxa3y"&&(Qe.innerHTML=zn),lt.forEach(a),Vt=r(l),F=o(l,"DIV",{class:!0});var ut=v(F);f(le.$$.fragment,ut),Jt=r(ut),Ee=o(ut,"P",{"data-svelte-h":!0}),g(Ee)!=="svelte-y0lxmf"&&(Ee.textContent=wn),ut.forEach(a),Ut=r(l),j=o(l,"DIV",{class:!0});var ft=v(j);f(ue.$$.fragment,ft),Nt=r(ft),He=o(ft,"P",{"data-svelte-h":!0}),g(He)!=="svelte-1170ss6"&&(He.textContent=qn),ft.forEach(a),Rt=r(l),V=o(l,"DIV",{class:!0});var ct=v(V);f(fe.$$.fragment,ct),Gt=r(ct),Pe=o(ct,"P",{"data-svelte-h":!0}),g(Pe)!=="svelte-odkanz"&&(Pe.textContent=Tn),ct.forEach(a),Zt=r(l),J=o(l,"DIV",{class:!0});var mt=v(J);f(ce.$$.fragment,mt),St=r(mt),Ie=o(mt,"P",{"data-svelte-h":!0}),g(Ie)!=="svelte-1wzx7fq"&&(Ie.textContent=Cn),mt.forEach(a),Xt=r(l),U=o(l,"DIV",{class:!0});var pt=v(U);f(me.$$.fragment,pt),Yt=r(pt),Fe=o(pt,"P",{"data-svelte-h":!0}),g(Fe)!=="svelte-1cb2fzf"&&(Fe.innerHTML=Mn),pt.forEach(a),Ot=r(l),N=o(l,"DIV",{class:!0});var ht=v(N);f(pe.$$.fragment,ht),Wt=r(ht),je=o(ht,"P",{"data-svelte-h":!0}),g(je)!=="svelte-6rgq61"&&(je.innerHTML=kn),ht.forEach(a),Kt=r(l),R=o(l,"DIV",{class:!0});var gt=v(R);f(he.$$.fragment,gt),en=r(gt),Ve=o(gt,"P",{"data-svelte-h":!0}),g(Ve)!=="svelte-wiwxpv"&&(Ve.innerHTML=Dn),gt.forEach(a),tn=r(l),G=o(l,"DIV",{class:!0});var _t=v(G);f(ge.$$.fragment,_t),nn=r(_t),Je=o(_t,"P",{"data-svelte-h":!0}),g(Je)!=="svelte-5g503h"&&(Je.innerHTML=Ln),_t.forEach(a),rn=r(l),Z=o(l,"DIV",{class:!0});var bt=v(Z);f(_e.$$.fragment,bt),sn=r(bt),Ue=o(bt,"P",{"data-svelte-h":!0}),g(Ue)!=="svelte-13hqoy0"&&(Ue.innerHTML=Bn),bt.forEach(a),on=r(l),S=o(l,"DIV",{class:!0});var vt=v(S);f(be.$$.fragment,vt),an=r(vt),Ne=o(vt,"P",{"data-svelte-h":!0}),g(Ne)!=="svelte-udr2k7"&&(Ne.textContent=An),vt.forEach(a),dn=r(l),X=o(l,"DIV",{class:!0});var yt=v(X);f(ve.$$.fragment,yt),ln=r(yt),Re=o(yt,"P",{"data-svelte-h":!0}),g(Re)!=="svelte-1ra2q1u"&&(Re.innerHTML=Qn),yt.forEach(a),l.forEach(a),nt=r(e),f(ye.$$.fragment,e),rt=r(e),Ze=o(e,"P",{}),v(Ze).forEach(a),this.h()},h(){y(_,"name","hf:doc:metadata"),y(_,"content",Sn),y(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(E,"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(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(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(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(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(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(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(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(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(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(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(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(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(i,"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,d){t(document.head,_),b(e,D,d),b(e,q,d),b(e,T,d),c(C,e,d),b(e,z,d),b(e,M,d),b(e,Se,d),b(e,Y,d),b(e,Xe,d),c(L,e,d),b(e,Ye,d),c(O,e,d),b(e,Oe,d),b(e,$,d),c(W,$,null),t($,xt),t($,ze),t($,zt),t($,we),t($,wt),t($,qe),t($,qt),t($,B),c(K,B,null),t(B,Tt),t(B,Te),t($,Ct),t($,A),c(ee,A,null),t(A,Mt),t(A,Ce),t($,kt),t($,Q),c(te,Q,null),t(Q,Dt),t(Q,Me),t($,Lt),t($,E),c(ne,E,null),t(E,Bt),t(E,ke),b(e,We,d),c(re,e,d),b(e,Ke,d),b(e,k,d),c(se,k,null),t(k,At),t(k,De),t(k,Qt),c(H,k,null),b(e,et,d),c(oe,e,d),b(e,tt,d),b(e,i,d),c(ae,i,null),t(i,Et),t(i,Le),t(i,Ht),t(i,Be),t(i,Pt),t(i,P),c(ie,P,null),t(P,It),t(P,Ae),t(i,Ft),t(i,I),c(de,I,null),t(I,jt),t(I,Qe),t(i,Vt),t(i,F),c(le,F,null),t(F,Jt),t(F,Ee),t(i,Ut),t(i,j),c(ue,j,null),t(j,Nt),t(j,He),t(i,Rt),t(i,V),c(fe,V,null),t(V,Gt),t(V,Pe),t(i,Zt),t(i,J),c(ce,J,null),t(J,St),t(J,Ie),t(i,Xt),t(i,U),c(me,U,null),t(U,Yt),t(U,Fe),t(i,Ot),t(i,N),c(pe,N,null),t(N,Wt),t(N,je),t(i,Kt),t(i,R),c(he,R,null),t(R,en),t(R,Ve),t(i,tn),t(i,G),c(ge,G,null),t(G,nn),t(G,Je),t(i,rn),t(i,Z),c(_e,Z,null),t(Z,sn),t(Z,Ue),t(i,on),t(i,S),c(be,S,null),t(S,an),t(S,Ne),t(i,dn),t(i,X),c(ve,X,null),t(X,ln),t(X,Re),b(e,nt,d),c(ye,e,d),b(e,rt,d),b(e,Ze,d),st=!0},p(e,[d]){const w={};d&2&&(w.$$scope={dirty:d,ctx:e}),L.$set(w);const $e={};d&2&&($e.$$scope={dirty:d,ctx:e}),H.$set($e)},i(e){st||(m(C.$$.fragment,e),m(L.$$.fragment,e),m(O.$$.fragment,e),m(W.$$.fragment,e),m(K.$$.fragment,e),m(ee.$$.fragment,e),m(te.$$.fragment,e),m(ne.$$.fragment,e),m(re.$$.fragment,e),m(se.$$.fragment,e),m(H.$$.fragment,e),m(oe.$$.fragment,e),m(ae.$$.fragment,e),m(ie.$$.fragment,e),m(de.$$.fragment,e),m(le.$$.fragment,e),m(ue.$$.fragment,e),m(fe.$$.fragment,e),m(ce.$$.fragment,e),m(me.$$.fragment,e),m(pe.$$.fragment,e),m(he.$$.fragment,e),m(ge.$$.fragment,e),m(_e.$$.fragment,e),m(be.$$.fragment,e),m(ve.$$.fragment,e),m(ye.$$.fragment,e),st=!0)},o(e){p(C.$$.fragment,e),p(L.$$.fragment,e),p(O.$$.fragment,e),p(W.$$.fragment,e),p(K.$$.fragment,e),p(ee.$$.fragment,e),p(te.$$.fragment,e),p(ne.$$.fragment,e),p(re.$$.fragment,e),p(se.$$.fragment,e),p(H.$$.fragment,e),p(oe.$$.fragment,e),p(ae.$$.fragment,e),p(ie.$$.fragment,e),p(de.$$.fragment,e),p(le.$$.fragment,e),p(ue.$$.fragment,e),p(fe.$$.fragment,e),p(ce.$$.fragment,e),p(me.$$.fragment,e),p(pe.$$.fragment,e),p(he.$$.fragment,e),p(ge.$$.fragment,e),p(_e.$$.fragment,e),p(be.$$.fragment,e),p(ve.$$.fragment,e),p(ye.$$.fragment,e),st=!1},d(e){e&&(a(D),a(q),a(T),a(z),a(M),a(Se),a(Y),a(Xe),a(Ye),a(Oe),a($),a(We),a(Ke),a(k),a(et),a(tt),a(i),a(nt),a(rt),a(Ze)),a(_),h(C,e),h(L,e),h(O,e),h(W),h(K),h(ee),h(te),h(ne),h(re,e),h(se),h(H),h(oe,e),h(ae),h(ie),h(de),h(le),h(ue),h(fe),h(ce),h(me),h(pe),h(he),h(ge),h(_e),h(be),h(ve),h(ye,e)}}}const Sn='{"title":"Quantization","local":"quantization","sections":[{"title":"BitsAndBytesConfig","local":"diffusers.BitsAndBytesConfig","sections":[],"depth":2},{"title":"TorchAoConfig","local":"diffusers.TorchAoConfig","sections":[],"depth":2},{"title":"DiffusersQuantizer","local":"diffusers.DiffusersQuantizer","sections":[],"depth":2}],"depth":1}';function Xn(xe){return Pn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class rr extends In{constructor(_){super(),Fn(this,_,Xn,Zn,Hn,{})}}export{rr as component};
