import{s as Dt,o as Yt,n as We}from"../chunks/scheduler.8c3d61f6.js";import{S as Qt,i as Ht,g as n,s,r as g,A as zt,h as i,f as d,c as o,j as T,u as _,x as u,k as U,y as t,a as v,v as y,d as b,t as $,w as x}from"../chunks/index.da70eac4.js";import{T as Nt}from"../chunks/Tip.1d9b8c37.js";import{D as C}from"../chunks/Docstring.6b390b9a.js";import{C as Be}from"../chunks/CodeBlock.00a903b3.js";import{E as qe}from"../chunks/ExampleCodeBlock.db12be95.js";import{H as St,E as Kt}from"../chunks/EditOnGithub.1e64e623.js";function Ot(J){let r,M='Refer to the <a href="../../tutorials/using_peft_for_inference.md">Inference with PEFT</a> tutorial for an overview of how to use PEFT in Diffusers for inference.';return{c(){r=n("p"),r.innerHTML=M},l(c){r=i(c,"P",{"data-svelte-h":!0}),u(r)!=="svelte-1yhqcl5"&&(r.innerHTML=M)},m(c,l){v(c,r,l)},p:We,d(c){c&&d(r)}}}function ea(J){let r,M="Example:",c,l,h;return l=new Be({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lLmxvYWRfbG9yYV93ZWlnaHRzKCUwQSUyMCUyMCUyMCUyMCUyMmpiaWxja2UtaGYlMkZzZHhsLWNpbmVtYXRpYy0xJTIyJTJDJTIwd2VpZ2h0X25hbWUlM0QlMjJweXRvcmNoX2xvcmFfd2VpZ2h0cy5zYWZldGVuc29ycyUyMiUyQyUyMGFkYXB0ZXJfbmFtZXMlM0QlMjJjaW5lbWF0aWMlMjIlMEEpJTBBcGlwZWxpbmUuZGVsZXRlX2FkYXB0ZXJzKCUyMmNpbmVtYXRpYyUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image
<span class="hljs-keyword">import</span> torch

pipeline = AutoPipelineForText2Image.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>, torch_dtype=torch.float16
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline.load_lora_weights(
    <span class="hljs-string">&quot;jbilcke-hf/sdxl-cinematic-1&quot;</span>, weight_name=<span class="hljs-string">&quot;pytorch_lora_weights.safetensors&quot;</span>, adapter_names=<span class="hljs-string">&quot;cinematic&quot;</span>
)
pipeline.delete_adapters(<span class="hljs-string">&quot;cinematic&quot;</span>)`,wrap:!1}}),{c(){r=n("p"),r.textContent=M,c=s(),g(l.$$.fragment)},l(a){r=i(a,"P",{"data-svelte-h":!0}),u(r)!=="svelte-11lpom8"&&(r.textContent=M),c=o(a),_(l.$$.fragment,a)},m(a,w){v(a,r,w),v(a,c,w),y(l,a,w),h=!0},p:We,i(a){h||(b(l.$$.fragment,a),h=!0)},o(a){$(l.$$.fragment,a),h=!1},d(a){a&&(d(r),d(c)),x(l,a)}}}function ta(J){let r,M="Example:",c,l,h;return l=new Be({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lLmxvYWRfbG9yYV93ZWlnaHRzKCUwQSUyMCUyMCUyMCUyMCUyMmpiaWxja2UtaGYlMkZzZHhsLWNpbmVtYXRpYy0xJTIyJTJDJTIwd2VpZ2h0X25hbWUlM0QlMjJweXRvcmNoX2xvcmFfd2VpZ2h0cy5zYWZldGVuc29ycyUyMiUyQyUyMGFkYXB0ZXJfbmFtZSUzRCUyMmNpbmVtYXRpYyUyMiUwQSklMEFwaXBlbGluZS5kaXNhYmxlX2xvcmEoKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image
<span class="hljs-keyword">import</span> torch

pipeline = AutoPipelineForText2Image.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>, torch_dtype=torch.float16
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline.load_lora_weights(
    <span class="hljs-string">&quot;jbilcke-hf/sdxl-cinematic-1&quot;</span>, weight_name=<span class="hljs-string">&quot;pytorch_lora_weights.safetensors&quot;</span>, adapter_name=<span class="hljs-string">&quot;cinematic&quot;</span>
)
pipeline.disable_lora()`,wrap:!1}}),{c(){r=n("p"),r.textContent=M,c=s(),g(l.$$.fragment)},l(a){r=i(a,"P",{"data-svelte-h":!0}),u(r)!=="svelte-11lpom8"&&(r.textContent=M),c=o(a),_(l.$$.fragment,a)},m(a,w){v(a,r,w),v(a,c,w),y(l,a,w),h=!0},p:We,i(a){h||(b(l.$$.fragment,a),h=!0)},o(a){$(l.$$.fragment,a),h=!1},d(a){a&&(d(r),d(c)),x(l,a)}}}function aa(J){let r,M="Example:",c,l,h;return l=new Be({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lLmxvYWRfbG9yYV93ZWlnaHRzKCUwQSUyMCUyMCUyMCUyMCUyMmpiaWxja2UtaGYlMkZzZHhsLWNpbmVtYXRpYy0xJTIyJTJDJTIwd2VpZ2h0X25hbWUlM0QlMjJweXRvcmNoX2xvcmFfd2VpZ2h0cy5zYWZldGVuc29ycyUyMiUyQyUyMGFkYXB0ZXJfbmFtZSUzRCUyMmNpbmVtYXRpYyUyMiUwQSklMEFwaXBlbGluZS5lbmFibGVfbG9yYSgp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image
<span class="hljs-keyword">import</span> torch

pipeline = AutoPipelineForText2Image.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>, torch_dtype=torch.float16
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline.load_lora_weights(
    <span class="hljs-string">&quot;jbilcke-hf/sdxl-cinematic-1&quot;</span>, weight_name=<span class="hljs-string">&quot;pytorch_lora_weights.safetensors&quot;</span>, adapter_name=<span class="hljs-string">&quot;cinematic&quot;</span>
)
pipeline.enable_lora()`,wrap:!1}}),{c(){r=n("p"),r.textContent=M,c=s(),g(l.$$.fragment)},l(a){r=i(a,"P",{"data-svelte-h":!0}),u(r)!=="svelte-11lpom8"&&(r.textContent=M),c=o(a),_(l.$$.fragment,a)},m(a,w){v(a,r,w),v(a,c,w),y(l,a,w),h=!0},p:We,i(a){h||(b(l.$$.fragment,a),h=!0)},o(a){$(l.$$.fragment,a),h=!1},d(a){a&&(d(r),d(c)),x(l,a)}}}function ra(J){let r,M="Example:",c,l,h;return l=new Be({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lLmxvYWRfbG9yYV93ZWlnaHRzKCUwQSUyMCUyMCUyMCUyMCUyMmpiaWxja2UtaGYlMkZzZHhsLWNpbmVtYXRpYy0xJTIyJTJDJTIwd2VpZ2h0X25hbWUlM0QlMjJweXRvcmNoX2xvcmFfd2VpZ2h0cy5zYWZldGVuc29ycyUyMiUyQyUyMGFkYXB0ZXJfbmFtZSUzRCUyMmNpbmVtYXRpYyUyMiUwQSklMEFwaXBlbGluZS5sb2FkX2xvcmFfd2VpZ2h0cyglMjJuZXJpanMlMkZwaXhlbC1hcnQteGwlMjIlMkMlMjB3ZWlnaHRfbmFtZSUzRCUyMnBpeGVsLWFydC14bC5zYWZldGVuc29ycyUyMiUyQyUyMGFkYXB0ZXJfbmFtZSUzRCUyMnBpeGVsJTIyKSUwQXBpcGVsaW5lLnNldF9hZGFwdGVycyglNUIlMjJjaW5lbWF0aWMlMjIlMkMlMjAlMjJwaXhlbCUyMiU1RCUyQyUyMGFkYXB0ZXJfd2VpZ2h0cyUzRCU1QjAuNSUyQyUyMDAuNSU1RCk=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image
<span class="hljs-keyword">import</span> torch

pipeline = AutoPipelineForText2Image.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>, torch_dtype=torch.float16
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline.load_lora_weights(
    <span class="hljs-string">&quot;jbilcke-hf/sdxl-cinematic-1&quot;</span>, weight_name=<span class="hljs-string">&quot;pytorch_lora_weights.safetensors&quot;</span>, adapter_name=<span class="hljs-string">&quot;cinematic&quot;</span>
)
pipeline.load_lora_weights(<span class="hljs-string">&quot;nerijs/pixel-art-xl&quot;</span>, weight_name=<span class="hljs-string">&quot;pixel-art-xl.safetensors&quot;</span>, adapter_name=<span class="hljs-string">&quot;pixel&quot;</span>)
pipeline.set_adapters([<span class="hljs-string">&quot;cinematic&quot;</span>, <span class="hljs-string">&quot;pixel&quot;</span>], adapter_weights=[<span class="hljs-number">0.5</span>, <span class="hljs-number">0.5</span>])`,wrap:!1}}),{c(){r=n("p"),r.textContent=M,c=s(),g(l.$$.fragment)},l(a){r=i(a,"P",{"data-svelte-h":!0}),u(r)!=="svelte-11lpom8"&&(r.textContent=M),c=o(a),_(l.$$.fragment,a)},m(a,w){v(a,r,w),v(a,c,w),y(l,a,w),h=!0},p:We,i(a){h||(b(l.$$.fragment,a),h=!0)},o(a){$(l.$$.fragment,a),h=!1},d(a){a&&(d(r),d(c)),x(l,a)}}}function sa(J){let r,M,c,l,h,a,w,Tt='Diffusers supports loading adapters such as <a href="../../using-diffusers/loading_adapters">LoRA</a> with the <a href="https://huggingface.co/docs/peft/index" rel="nofollow">PEFT</a> library with the <a href="/docs/diffusers/main/en/api/loaders/peft#diffusers.loaders.PeftAdapterMixin">PeftAdapterMixin</a> class. This allows modeling classes in Diffusers like <a href="/docs/diffusers/main/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>, <a href="/docs/diffusers/main/en/api/models/sd3_transformer2d#diffusers.SD3Transformer2DModel">SD3Transformer2DModel</a> to operate with an adapter.',ke,E,Xe,H,Re,p,z,Se,de,Ut=`A class containing all functions for loading and using adapters weights that are supported in PEFT library. For
more details about adapters and injecting them in a base model, check out the PEFT
<a href="https://huggingface.co/docs/peft/index" rel="nofollow">documentation</a>.`,De,pe,Jt="Install the latest version of PEFT, and use this mixin to:",Ye,fe,Ct="<li>Attach new adapters in the model.</li> <li>Attach multiple adapters and iteratively activate/deactivate them.</li> <li>Activate/deactivate all adapters from the model.</li> <li>Get a list of the active adapters.</li>",Qe,P,N,He,ce,Pt="Gets the current list of active adapters of the model.",ze,me,Zt=`If you are not familiar with adapters and PEFT methods, we invite you to read more about them on the PEFT
<a href="https://huggingface.co/docs/peft" rel="nofollow">documentation</a>.`,Ne,Z,K,Ke,he,jt=`Adds a new adapter to the current model for training. If no adapter name is passed, a default name is assigned
to the adapter to follow the convention of the PEFT library.`,Oe,ue,Gt=`If you are not familiar with adapters and PEFT methods, we invite you to read more about them in the PEFT
<a href="https://huggingface.co/docs/peft" rel="nofollow">documentation</a>.`,et,j,O,tt,ge,It="Delete an adapter’s LoRA layers from the underlying model.",at,q,rt,G,ee,st,_e,Wt="Disable all adapters attached to the model and fallback to inference with the base model only.",ot,ye,kt=`If you are not familiar with adapters and PEFT methods, we invite you to read more about them on the PEFT
<a href="https://huggingface.co/docs/peft" rel="nofollow">documentation</a>.`,nt,I,te,it,be,Xt="Disables the active LoRA layers of the underlying model.",lt,B,dt,W,ae,pt,$e,Rt=`Enable adapters that are attached to the model. The model uses <code>self.active_adapters()</code> to retrieve the list of
adapters to enable.`,ft,xe,At=`If you are not familiar with adapters and PEFT methods, we invite you to read more about them on the PEFT
<a href="https://huggingface.co/docs/peft" rel="nofollow">documentation</a>.`,ct,k,re,mt,we,Ft="Enables the active LoRA layers of the underlying model.",ht,S,ut,D,se,gt,ve,Vt="Loads a LoRA adapter into the underlying model.",_t,Y,oe,yt,Me,Lt="Save the LoRA parameters corresponding to the underlying model.",bt,X,ne,$t,Te,Et="Sets a specific adapter by forcing the model to only use that adapter and disables the other adapters.",xt,Ue,qt=`If you are not familiar with adapters and PEFT methods, we invite you to read more about them on the PEFT
<a href="https://huggingface.co/docs/peft" rel="nofollow">documentation</a>.`,wt,R,ie,vt,Je,Bt="Set the currently active adapters for use in the UNet.",Mt,Q,Ae,le,Fe,Ie,Ve;return h=new St({props:{title:"PEFT",local:"peft",headingTag:"h1"}}),E=new Nt({props:{$$slots:{default:[Ot]},$$scope:{ctx:J}}}),H=new St({props:{title:"PeftAdapterMixin",local:"diffusers.loaders.PeftAdapterMixin",headingTag:"h2"}}),z=new C({props:{name:"class diffusers.loaders.PeftAdapterMixin",anchor:"diffusers.loaders.PeftAdapterMixin",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/peft.py#L109"}}),N=new C({props:{name:"active_adapters",anchor:"diffusers.loaders.PeftAdapterMixin.active_adapters",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/peft.py#L601"}}),K=new C({props:{name:"add_adapter",anchor:"diffusers.loaders.PeftAdapterMixin.add_adapter",parameters:[{name:"adapter_config",val:""},{name:"adapter_name",val:": str = 'default'"}],parametersDescription:[{anchor:"diffusers.loaders.PeftAdapterMixin.add_adapter.adapter_config",description:`<strong>adapter_config</strong> (<code>[~peft.PeftConfig]</code>) &#x2014;
The configuration of the adapter to add; supported adapters are non-prefix tuning and adaption prompt
methods.`,name:"adapter_config"},{anchor:"diffusers.loaders.PeftAdapterMixin.add_adapter.adapter_name",description:`<strong>adapter_name</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;default&quot;</code>) &#x2014;
The name of the adapter to add. If no name is passed, a default name is assigned to the adapter.`,name:"adapter_name"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/peft.py#L469"}}),O=new C({props:{name:"delete_adapters",anchor:"diffusers.loaders.PeftAdapterMixin.delete_adapters",parameters:[{name:"adapter_names",val:": typing.Union[typing.List[str], str]"}],parametersDescription:[{anchor:"diffusers.loaders.PeftAdapterMixin.delete_adapters.adapter_names",description:`<strong>adapter_names</strong> (<code>Union[List[str], str]</code>) &#x2014;
The names (single string or list of strings) of the adapter to delete.`,name:"adapter_names"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/peft.py#L719"}}),q=new qe({props:{anchor:"diffusers.loaders.PeftAdapterMixin.delete_adapters.example",$$slots:{default:[ea]},$$scope:{ctx:J}}}),ee=new C({props:{name:"disable_adapters",anchor:"diffusers.loaders.PeftAdapterMixin.disable_adapters",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/peft.py#L556"}}),te=new C({props:{name:"disable_lora",anchor:"diffusers.loaders.PeftAdapterMixin.disable_lora",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/peft.py#L673"}}),B=new qe({props:{anchor:"diffusers.loaders.PeftAdapterMixin.disable_lora.example",$$slots:{default:[ta]},$$scope:{ctx:J}}}),ae=new C({props:{name:"enable_adapters",anchor:"diffusers.loaders.PeftAdapterMixin.enable_adapters",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/peft.py#L578"}}),re=new C({props:{name:"enable_lora",anchor:"diffusers.loaders.PeftAdapterMixin.enable_lora",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/peft.py#L696"}}),S=new qe({props:{anchor:"diffusers.loaders.PeftAdapterMixin.enable_lora.example",$$slots:{default:[aa]},$$scope:{ctx:J}}}),se=new C({props:{name:"load_lora_adapter",anchor:"diffusers.loaders.PeftAdapterMixin.load_lora_adapter",parameters:[{name:"pretrained_model_name_or_path_or_dict",val:""},{name:"prefix",val:" = 'transformer'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.loaders.PeftAdapterMixin.load_lora_adapter.pretrained_model_name_or_path_or_dict",description:`<strong>pretrained_model_name_or_path_or_dict</strong> (<code>str</code> or <code>os.PathLike</code> or <code>dict</code>) &#x2014;
Can be either:</p>
<ul>
<li>A string, the <em>model id</em> (for example <code>google/ddpm-celebahq-256</code>) of a pretrained model hosted on
the Hub.</li>
<li>A path to a <em>directory</em> (for example <code>./my_model_directory</code>) containing the model weights saved
with <a href="/docs/diffusers/main/en/api/models/overview#diffusers.ModelMixin.save_pretrained">ModelMixin.save_pretrained()</a>.</li>
<li>A <a href="https://pytorch.org/tutorials/beginner/saving_loading_models.html#what-is-a-state-dict" rel="nofollow">torch state
dict</a>.</li>
</ul>`,name:"pretrained_model_name_or_path_or_dict"},{anchor:"diffusers.loaders.PeftAdapterMixin.load_lora_adapter.prefix",description:"<strong>prefix</strong> (<code>str</code>, <em>optional</em>) &#x2014; Prefix to filter the state dict.",name:"prefix"},{anchor:"diffusers.loaders.PeftAdapterMixin.load_lora_adapter.cache_dir",description:`<strong>cache_dir</strong> (<code>Union[str, os.PathLike]</code>, <em>optional</em>) &#x2014;
Path to a directory where a downloaded pretrained model configuration is cached if the standard cache
is not used.`,name:"cache_dir"},{anchor:"diffusers.loaders.PeftAdapterMixin.load_lora_adapter.force_download",description:`<strong>force_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.`,name:"force_download"},{anchor:"diffusers.loaders.PeftAdapterMixin.load_lora_adapter.proxies",description:`<strong>proxies</strong> (<code>Dict[str, str]</code>, <em>optional</em>) &#x2014;
A dictionary of proxy servers to use by protocol or endpoint, for example, <code>{&apos;http&apos;: &apos;foo.bar:3128&apos;, &apos;http://hostname&apos;: &apos;foo.bar:4012&apos;}</code>. The proxies are used on each request.`,name:"proxies"},{anchor:"diffusers.loaders.PeftAdapterMixin.load_lora_adapter.local_files_only",description:`<strong>local_files_only</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to only load local model weights and configuration files or not. If set to <code>True</code>, the model
won&#x2019;t be downloaded from the Hub.`,name:"local_files_only"},{anchor:"diffusers.loaders.PeftAdapterMixin.load_lora_adapter.token",description:`<strong>token</strong> (<code>str</code> or <em>bool</em>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, the token generated from
<code>diffusers-cli login</code> (stored in <code>~/.huggingface</code>) is used.`,name:"token"},{anchor:"diffusers.loaders.PeftAdapterMixin.load_lora_adapter.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;main&quot;</code>) &#x2014;
The specific model version to use. It can be a branch name, a tag name, a commit id, or any identifier
allowed by Git.`,name:"revision"},{anchor:"diffusers.loaders.PeftAdapterMixin.load_lora_adapter.subfolder",description:`<strong>subfolder</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&quot;</code>) &#x2014;
The subfolder location of a model file within a larger model repository on the Hub or locally.`,name:"subfolder"},{anchor:"diffusers.loaders.PeftAdapterMixin.load_lora_adapter.network_alphas",description:`<strong>network_alphas</strong> (<code>Dict[str, float]</code>) &#x2014;
The value of the network alpha used for stable learning and preventing underflow. This value has the
same meaning as the <code>--network_alpha</code> option in the kohya-ss trainer script. Refer to <a href="https://github.com/darkstorm2150/sd-scripts/blob/main/docs/train_network_README-en.md#execute-learning" rel="nofollow">this
link</a>.`,name:"network_alphas"},{anchor:"diffusers.loaders.PeftAdapterMixin.load_lora_adapter.low_cpu_mem_usage",description:`<strong>low_cpu_mem_usage</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Speed up model loading by only loading the pretrained LoRA weights and not initializing the random
weights.`,name:"low_cpu_mem_usage"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/peft.py#L141"}}),oe=new C({props:{name:"save_lora_adapter",anchor:"diffusers.loaders.PeftAdapterMixin.save_lora_adapter",parameters:[{name:"save_directory",val:""},{name:"adapter_name",val:": str = 'default'"},{name:"upcast_before_saving",val:": bool = False"},{name:"safe_serialization",val:": bool = True"},{name:"weight_name",val:": typing.Optional[str] = None"}],parametersDescription:[{anchor:"diffusers.loaders.PeftAdapterMixin.save_lora_adapter.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Directory to save LoRA parameters to. Will be created if it doesn&#x2019;t exist.`,name:"save_directory"},{anchor:"diffusers.loaders.PeftAdapterMixin.save_lora_adapter.adapter_name",description:`<strong>adapter_name</strong> &#x2014; (<code>str</code>, defaults to &#x201C;default&#x201D;): The name of the adapter to serialize. Useful when the
underlying model has multiple adapters loaded.`,name:"adapter_name"},{anchor:"diffusers.loaders.PeftAdapterMixin.save_lora_adapter.upcast_before_saving",description:`<strong>upcast_before_saving</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
Whether to cast the underlying model to <code>torch.float32</code> before serialization.`,name:"upcast_before_saving"},{anchor:"diffusers.loaders.PeftAdapterMixin.save_lora_adapter.save_function",description:`<strong>save_function</strong> (<code>Callable</code>) &#x2014;
The function to use to save the state dictionary. Useful during distributed training when you need to
replace <code>torch.save</code> with another method. Can be configured with the environment variable
<code>DIFFUSERS_SAVE_MODE</code>.`,name:"save_function"},{anchor:"diffusers.loaders.PeftAdapterMixin.save_lora_adapter.safe_serialization",description:`<strong>safe_serialization</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to save the model using <code>safetensors</code> or the traditional PyTorch way with <code>pickle</code>.`,name:"safe_serialization"},{anchor:"diffusers.loaders.PeftAdapterMixin.save_lora_adapter.weight_name",description:"<strong>weight_name</strong> &#x2014; (<code>str</code>, <em>optional</em>, defaults to <code>None</code>): Name of the file to serialize the state dict with.",name:"weight_name"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/peft.py#L350"}}),ne=new C({props:{name:"set_adapter",anchor:"diffusers.loaders.PeftAdapterMixin.set_adapter",parameters:[{name:"adapter_name",val:": typing.Union[str, typing.List[str]]"}],parametersDescription:[{anchor:"diffusers.loaders.PeftAdapterMixin.set_adapter.adapter_name",description:`<strong>adapter_name</strong> (Union[str, List[str]])) &#x2014;
The list of adapters to set or the adapter name in the case of a single adapter.`,name:"adapter_name"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/peft.py#L507"}}),ie=new C({props:{name:"set_adapters",anchor:"diffusers.loaders.PeftAdapterMixin.set_adapters",parameters:[{name:"adapter_names",val:": typing.Union[typing.List[str], str]"},{name:"weights",val:": typing.Union[float, typing.Dict, typing.List[float], typing.List[typing.Dict], typing.List[NoneType], NoneType] = None"}],parametersDescription:[{anchor:"diffusers.loaders.PeftAdapterMixin.set_adapters.adapter_names",description:`<strong>adapter_names</strong> (<code>List[str]</code> or <code>str</code>) &#x2014;
The names of the adapters to use.`,name:"adapter_names"},{anchor:"diffusers.loaders.PeftAdapterMixin.set_adapters.adapter_weights",description:`<strong>adapter_weights</strong> (<code>Union[List[float], float]</code>, <em>optional</em>) &#x2014;
The adapter(s) weights to use with the UNet. If <code>None</code>, the weights are set to <code>1.0</code> for all the
adapters.`,name:"adapter_weights"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/peft.py#L413"}}),Q=new qe({props:{anchor:"diffusers.loaders.PeftAdapterMixin.set_adapters.example",$$slots:{default:[ra]},$$scope:{ctx:J}}}),le=new Kt({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/loaders/peft.md"}}),{c(){r=n("meta"),M=s(),c=n("p"),l=s(),g(h.$$.fragment),a=s(),w=n("p"),w.innerHTML=Tt,ke=s(),g(E.$$.fragment),Xe=s(),g(H.$$.fragment),Re=s(),p=n("div"),g(z.$$.fragment),Se=s(),de=n("p"),de.innerHTML=Ut,De=s(),pe=n("p"),pe.textContent=Jt,Ye=s(),fe=n("ul"),fe.innerHTML=Ct,Qe=s(),P=n("div"),g(N.$$.fragment),He=s(),ce=n("p"),ce.textContent=Pt,ze=s(),me=n("p"),me.innerHTML=Zt,Ne=s(),Z=n("div"),g(K.$$.fragment),Ke=s(),he=n("p"),he.textContent=jt,Oe=s(),ue=n("p"),ue.innerHTML=Gt,et=s(),j=n("div"),g(O.$$.fragment),tt=s(),ge=n("p"),ge.textContent=It,at=s(),g(q.$$.fragment),rt=s(),G=n("div"),g(ee.$$.fragment),st=s(),_e=n("p"),_e.textContent=Wt,ot=s(),ye=n("p"),ye.innerHTML=kt,nt=s(),I=n("div"),g(te.$$.fragment),it=s(),be=n("p"),be.textContent=Xt,lt=s(),g(B.$$.fragment),dt=s(),W=n("div"),g(ae.$$.fragment),pt=s(),$e=n("p"),$e.innerHTML=Rt,ft=s(),xe=n("p"),xe.innerHTML=At,ct=s(),k=n("div"),g(re.$$.fragment),mt=s(),we=n("p"),we.textContent=Ft,ht=s(),g(S.$$.fragment),ut=s(),D=n("div"),g(se.$$.fragment),gt=s(),ve=n("p"),ve.textContent=Vt,_t=s(),Y=n("div"),g(oe.$$.fragment),yt=s(),Me=n("p"),Me.textContent=Lt,bt=s(),X=n("div"),g(ne.$$.fragment),$t=s(),Te=n("p"),Te.textContent=Et,xt=s(),Ue=n("p"),Ue.innerHTML=qt,wt=s(),R=n("div"),g(ie.$$.fragment),vt=s(),Je=n("p"),Je.textContent=Bt,Mt=s(),g(Q.$$.fragment),Ae=s(),g(le.$$.fragment),Fe=s(),Ie=n("p"),this.h()},l(e){const m=zt("svelte-u9bgzb",document.head);r=i(m,"META",{name:!0,content:!0}),m.forEach(d),M=o(e),c=i(e,"P",{}),T(c).forEach(d),l=o(e),_(h.$$.fragment,e),a=o(e),w=i(e,"P",{"data-svelte-h":!0}),u(w)!=="svelte-19ge5s3"&&(w.innerHTML=Tt),ke=o(e),_(E.$$.fragment,e),Xe=o(e),_(H.$$.fragment,e),Re=o(e),p=i(e,"DIV",{class:!0});var f=T(p);_(z.$$.fragment,f),Se=o(f),de=i(f,"P",{"data-svelte-h":!0}),u(de)!=="svelte-16jad6u"&&(de.innerHTML=Ut),De=o(f),pe=i(f,"P",{"data-svelte-h":!0}),u(pe)!=="svelte-jgx411"&&(pe.textContent=Jt),Ye=o(f),fe=i(f,"UL",{"data-svelte-h":!0}),u(fe)!=="svelte-70o87y"&&(fe.innerHTML=Ct),Qe=o(f),P=i(f,"DIV",{class:!0});var A=T(P);_(N.$$.fragment,A),He=o(A),ce=i(A,"P",{"data-svelte-h":!0}),u(ce)!=="svelte-1i9yvzx"&&(ce.textContent=Pt),ze=o(A),me=i(A,"P",{"data-svelte-h":!0}),u(me)!=="svelte-pm6rj0"&&(me.innerHTML=Zt),A.forEach(d),Ne=o(f),Z=i(f,"DIV",{class:!0});var F=T(Z);_(K.$$.fragment,F),Ke=o(F),he=i(F,"P",{"data-svelte-h":!0}),u(he)!=="svelte-ayg1h"&&(he.textContent=jt),Oe=o(F),ue=i(F,"P",{"data-svelte-h":!0}),u(ue)!=="svelte-m719pe"&&(ue.innerHTML=Gt),F.forEach(d),et=o(f),j=i(f,"DIV",{class:!0});var V=T(j);_(O.$$.fragment,V),tt=o(V),ge=i(V,"P",{"data-svelte-h":!0}),u(ge)!=="svelte-1oumhy2"&&(ge.textContent=It),at=o(V),_(q.$$.fragment,V),V.forEach(d),rt=o(f),G=i(f,"DIV",{class:!0});var L=T(G);_(ee.$$.fragment,L),st=o(L),_e=i(L,"P",{"data-svelte-h":!0}),u(_e)!=="svelte-stjif2"&&(_e.textContent=Wt),ot=o(L),ye=i(L,"P",{"data-svelte-h":!0}),u(ye)!=="svelte-pm6rj0"&&(ye.innerHTML=kt),L.forEach(d),nt=o(f),I=i(f,"DIV",{class:!0});var Ce=T(I);_(te.$$.fragment,Ce),it=o(Ce),be=i(Ce,"P",{"data-svelte-h":!0}),u(be)!=="svelte-1w71mps"&&(be.textContent=Xt),lt=o(Ce),_(B.$$.fragment,Ce),Ce.forEach(d),dt=o(f),W=i(f,"DIV",{class:!0});var Pe=T(W);_(ae.$$.fragment,Pe),pt=o(Pe),$e=i(Pe,"P",{"data-svelte-h":!0}),u($e)!=="svelte-hmbjwp"&&($e.innerHTML=Rt),ft=o(Pe),xe=i(Pe,"P",{"data-svelte-h":!0}),u(xe)!=="svelte-pm6rj0"&&(xe.innerHTML=At),Pe.forEach(d),ct=o(f),k=i(f,"DIV",{class:!0});var Ze=T(k);_(re.$$.fragment,Ze),mt=o(Ze),we=i(Ze,"P",{"data-svelte-h":!0}),u(we)!=="svelte-9erqj1"&&(we.textContent=Ft),ht=o(Ze),_(S.$$.fragment,Ze),Ze.forEach(d),ut=o(f),D=i(f,"DIV",{class:!0});var Le=T(D);_(se.$$.fragment,Le),gt=o(Le),ve=i(Le,"P",{"data-svelte-h":!0}),u(ve)!=="svelte-mffm0u"&&(ve.textContent=Vt),Le.forEach(d),_t=o(f),Y=i(f,"DIV",{class:!0});var Ee=T(Y);_(oe.$$.fragment,Ee),yt=o(Ee),Me=i(Ee,"P",{"data-svelte-h":!0}),u(Me)!=="svelte-1wrxd29"&&(Me.textContent=Lt),Ee.forEach(d),bt=o(f),X=i(f,"DIV",{class:!0});var je=T(X);_(ne.$$.fragment,je),$t=o(je),Te=i(je,"P",{"data-svelte-h":!0}),u(Te)!=="svelte-1kp30gn"&&(Te.textContent=Et),xt=o(je),Ue=i(je,"P",{"data-svelte-h":!0}),u(Ue)!=="svelte-pm6rj0"&&(Ue.innerHTML=qt),je.forEach(d),wt=o(f),R=i(f,"DIV",{class:!0});var Ge=T(R);_(ie.$$.fragment,Ge),vt=o(Ge),Je=i(Ge,"P",{"data-svelte-h":!0}),u(Je)!=="svelte-38gdgn"&&(Je.textContent=Bt),Mt=o(Ge),_(Q.$$.fragment,Ge),Ge.forEach(d),f.forEach(d),Ae=o(e),_(le.$$.fragment,e),Fe=o(e),Ie=i(e,"P",{}),T(Ie).forEach(d),this.h()},h(){U(r,"name","hf:doc:metadata"),U(r,"content",oa),U(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(p,"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,m){t(document.head,r),v(e,M,m),v(e,c,m),v(e,l,m),y(h,e,m),v(e,a,m),v(e,w,m),v(e,ke,m),y(E,e,m),v(e,Xe,m),y(H,e,m),v(e,Re,m),v(e,p,m),y(z,p,null),t(p,Se),t(p,de),t(p,De),t(p,pe),t(p,Ye),t(p,fe),t(p,Qe),t(p,P),y(N,P,null),t(P,He),t(P,ce),t(P,ze),t(P,me),t(p,Ne),t(p,Z),y(K,Z,null),t(Z,Ke),t(Z,he),t(Z,Oe),t(Z,ue),t(p,et),t(p,j),y(O,j,null),t(j,tt),t(j,ge),t(j,at),y(q,j,null),t(p,rt),t(p,G),y(ee,G,null),t(G,st),t(G,_e),t(G,ot),t(G,ye),t(p,nt),t(p,I),y(te,I,null),t(I,it),t(I,be),t(I,lt),y(B,I,null),t(p,dt),t(p,W),y(ae,W,null),t(W,pt),t(W,$e),t(W,ft),t(W,xe),t(p,ct),t(p,k),y(re,k,null),t(k,mt),t(k,we),t(k,ht),y(S,k,null),t(p,ut),t(p,D),y(se,D,null),t(D,gt),t(D,ve),t(p,_t),t(p,Y),y(oe,Y,null),t(Y,yt),t(Y,Me),t(p,bt),t(p,X),y(ne,X,null),t(X,$t),t(X,Te),t(X,xt),t(X,Ue),t(p,wt),t(p,R),y(ie,R,null),t(R,vt),t(R,Je),t(R,Mt),y(Q,R,null),v(e,Ae,m),y(le,e,m),v(e,Fe,m),v(e,Ie,m),Ve=!0},p(e,[m]){const f={};m&2&&(f.$$scope={dirty:m,ctx:e}),E.$set(f);const A={};m&2&&(A.$$scope={dirty:m,ctx:e}),q.$set(A);const F={};m&2&&(F.$$scope={dirty:m,ctx:e}),B.$set(F);const V={};m&2&&(V.$$scope={dirty:m,ctx:e}),S.$set(V);const L={};m&2&&(L.$$scope={dirty:m,ctx:e}),Q.$set(L)},i(e){Ve||(b(h.$$.fragment,e),b(E.$$.fragment,e),b(H.$$.fragment,e),b(z.$$.fragment,e),b(N.$$.fragment,e),b(K.$$.fragment,e),b(O.$$.fragment,e),b(q.$$.fragment,e),b(ee.$$.fragment,e),b(te.$$.fragment,e),b(B.$$.fragment,e),b(ae.$$.fragment,e),b(re.$$.fragment,e),b(S.$$.fragment,e),b(se.$$.fragment,e),b(oe.$$.fragment,e),b(ne.$$.fragment,e),b(ie.$$.fragment,e),b(Q.$$.fragment,e),b(le.$$.fragment,e),Ve=!0)},o(e){$(h.$$.fragment,e),$(E.$$.fragment,e),$(H.$$.fragment,e),$(z.$$.fragment,e),$(N.$$.fragment,e),$(K.$$.fragment,e),$(O.$$.fragment,e),$(q.$$.fragment,e),$(ee.$$.fragment,e),$(te.$$.fragment,e),$(B.$$.fragment,e),$(ae.$$.fragment,e),$(re.$$.fragment,e),$(S.$$.fragment,e),$(se.$$.fragment,e),$(oe.$$.fragment,e),$(ne.$$.fragment,e),$(ie.$$.fragment,e),$(Q.$$.fragment,e),$(le.$$.fragment,e),Ve=!1},d(e){e&&(d(M),d(c),d(l),d(a),d(w),d(ke),d(Xe),d(Re),d(p),d(Ae),d(Fe),d(Ie)),d(r),x(h,e),x(E,e),x(H,e),x(z),x(N),x(K),x(O),x(q),x(ee),x(te),x(B),x(ae),x(re),x(S),x(se),x(oe),x(ne),x(ie),x(Q),x(le,e)}}}const oa='{"title":"PEFT","local":"peft","sections":[{"title":"PeftAdapterMixin","local":"diffusers.loaders.PeftAdapterMixin","sections":[],"depth":2}],"depth":1}';function na(J){return Yt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ha extends Qt{constructor(r){super(),Ht(this,r,na,sa,Dt,{})}}export{ha as component};
