import{s as Pe,o as Ke,n as ae}from"../chunks/scheduler.8c3d61f6.js";import{S as Oe,i as et,g as m,s as i,r as g,A as tt,h as u,f as n,c as d,j as V,u as y,x as J,k as D,y as p,a as f,v as _,d as b,t as $,w}from"../chunks/index.589a98e8.js";import{T as st}from"../chunks/Tip.42aa8582.js";import{D as oe}from"../chunks/Docstring.27406313.js";import{C as me}from"../chunks/CodeBlock.36627b28.js";import{E as fe}from"../chunks/ExampleCodeBlock.3dc467a7.js";import{H as Ae,E as ot}from"../chunks/EditOnGithub.e5a8d9cb.js";function at(x){let s,h='To learn more about how to load LoRA weights, see the <a href="../../using-diffusers/loading_adapters#lora">LoRA</a> loading guide.';return{c(){s=m("p"),s.innerHTML=h},l(a){s=u(a,"P",{"data-svelte-h":!0}),J(s)!=="svelte-1fw6lx1"&&(s.innerHTML=h)},m(a,o){f(a,s,o)},p:ae,d(a){a&&n(s)}}}function nt(x){let s,h="Example:",a,o,r;return o=new me({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(){s=m("p"),s.textContent=h,a=i(),g(o.$$.fragment)},l(e){s=u(e,"P",{"data-svelte-h":!0}),J(s)!=="svelte-11lpom8"&&(s.textContent=h),a=d(e),y(o.$$.fragment,e)},m(e,c){f(e,s,c),f(e,a,c),_(o,e,c),r=!0},p:ae,i(e){r||(b(o.$$.fragment,e),r=!0)},o(e){$(o.$$.fragment,e),r=!1},d(e){e&&(n(s),n(a)),w(o,e)}}}function rt(x){let s,h="Example:",a,o,r;return o=new me({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(){s=m("p"),s.textContent=h,a=i(),g(o.$$.fragment)},l(e){s=u(e,"P",{"data-svelte-h":!0}),J(s)!=="svelte-11lpom8"&&(s.textContent=h),a=d(e),y(o.$$.fragment,e)},m(e,c){f(e,s,c),f(e,a,c),_(o,e,c),r=!0},p:ae,i(e){r||(b(o.$$.fragment,e),r=!0)},o(e){$(o.$$.fragment,e),r=!1},d(e){e&&(n(s),n(a)),w(o,e)}}}function lt(x){let s,h="Example:",a,o,r;return o=new me({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(){s=m("p"),s.textContent=h,a=i(),g(o.$$.fragment)},l(e){s=u(e,"P",{"data-svelte-h":!0}),J(s)!=="svelte-11lpom8"&&(s.textContent=h),a=d(e),y(o.$$.fragment,e)},m(e,c){f(e,s,c),f(e,a,c),_(o,e,c),r=!0},p:ae,i(e){r||(b(o.$$.fragment,e),r=!0)},o(e){$(o.$$.fragment,e),r=!1},d(e){e&&(n(s),n(a)),w(o,e)}}}function it(x){let s,h="Example:",a,o,r;return o=new me({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lLnVuZXQubG9hZF9hdHRuX3Byb2NzKCUwQSUyMCUyMCUyMCUyMCUyMmpiaWxja2UtaGYlMkZzZHhsLWNpbmVtYXRpYy0xJTIyJTJDJTIwd2VpZ2h0X25hbWUlM0QlMjJweXRvcmNoX2xvcmFfd2VpZ2h0cy5zYWZldGVuc29ycyUyMiUyQyUyMGFkYXB0ZXJfbmFtZSUzRCUyMmNpbmVtYXRpYyUyMiUwQSk=",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.unet.load_attn_procs(
    <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>
)`,wrap:!1}}),{c(){s=m("p"),s.textContent=h,a=i(),g(o.$$.fragment)},l(e){s=u(e,"P",{"data-svelte-h":!0}),J(s)!=="svelte-11lpom8"&&(s.textContent=h),a=d(e),y(o.$$.fragment,e)},m(e,c){f(e,s,c),f(e,a,c),_(o,e,c),r=!0},p:ae,i(e){r||(b(o.$$.fragment,e),r=!0)},o(e){$(o.$$.fragment,e),r=!1},d(e){e&&(n(s),n(a)),w(o,e)}}}function dt(x){let s,h="Example:",a,o,r;return o=new me({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJDb21wVmlzJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS00JTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTBBKS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lLnVuZXQubG9hZF9hdHRuX3Byb2NzKCUyMnBhdGgtdG8tc2F2ZS1tb2RlbCUyMiUyQyUyMHdlaWdodF9uYW1lJTNEJTIycHl0b3JjaF9jdXN0b21fZGlmZnVzaW9uX3dlaWdodHMuYmluJTIyKSUwQXBpcGVsaW5lLnVuZXQuc2F2ZV9hdHRuX3Byb2NzKCUyMnBhdGgtdG8tc2F2ZS1tb2RlbCUyMiUyQyUyMHdlaWdodF9uYW1lJTNEJTIycHl0b3JjaF9jdXN0b21fZGlmZnVzaW9uX3dlaWdodHMuYmluJTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

pipeline = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>,
    torch_dtype=torch.float16,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline.unet.load_attn_procs(<span class="hljs-string">&quot;path-to-save-model&quot;</span>, weight_name=<span class="hljs-string">&quot;pytorch_custom_diffusion_weights.bin&quot;</span>)
pipeline.unet.save_attn_procs(<span class="hljs-string">&quot;path-to-save-model&quot;</span>, weight_name=<span class="hljs-string">&quot;pytorch_custom_diffusion_weights.bin&quot;</span>)`,wrap:!1}}),{c(){s=m("p"),s.textContent=h,a=i(),g(o.$$.fragment)},l(e){s=u(e,"P",{"data-svelte-h":!0}),J(s)!=="svelte-11lpom8"&&(s.textContent=h),a=d(e),y(o.$$.fragment,e)},m(e,c){f(e,s,c),f(e,a,c),_(o,e,c),r=!0},p:ae,i(e){r||(b(o.$$.fragment,e),r=!0)},o(e){$(o.$$.fragment,e),r=!1},d(e){e&&(n(s),n(a)),w(o,e)}}}function pt(x){let s,h="Example:",a,o,r;return o=new me({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(){s=m("p"),s.textContent=h,a=i(),g(o.$$.fragment)},l(e){s=u(e,"P",{"data-svelte-h":!0}),J(s)!=="svelte-11lpom8"&&(s.textContent=h),a=d(e),y(o.$$.fragment,e)},m(e,c){f(e,s,c),f(e,a,c),_(o,e,c),r=!0},p:ae,i(e){r||(b(o.$$.fragment,e),r=!0)},o(e){$(o.$$.fragment,e),r=!1},d(e){e&&(n(s),n(a)),w(o,e)}}}function ct(x){let s,h,a,o,r,e,c,Be='Some training methods - like LoRA and Custom Diffusion - typically target the UNet’s attention layers, but these training methods can also target other non-attention layers. Instead of training all of a model’s parameters, only a subset of the parameters are trained, which is faster and more efficient. This class is useful if you’re <em>only</em> loading weights into a UNet. If you need to load weights into the text encoder or a text encoder and UNet, try using the <a href="/docs/diffusers/pr_8376/en/api/loaders/lora#diffusers.loaders.LoraLoaderMixin.load_lora_weights">load_lora_weights()</a> function instead.',he,E,qe="The <code>UNet2DConditionLoadersMixin</code> class provides functions for loading and saving weights, fusing and unfusing LoRAs, disabling and enabling LoRAs, and setting and deleting adapters.",ge,N,ye,z,_e,U,H,Ue,ne,Fe="Load LoRA layers into a <code>UNet2DCondtionModel</code>.",Me,v,A,xe,re,Ye="Delete an adapter’s LoRA layers from the UNet.",Je,B,ve,T,P,Te,le,Qe="Disable the UNet’s active LoRA layers.",Ce,q,Ze,C,K,Ge,ie,Se="Enable the UNet’s active LoRA layers.",je,F,We,Z,O,Xe,de,Ee=`Load pretrained attention processor layers into <a href="/docs/diffusers/pr_8376/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>. Attention processor layers have to be
defined in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow"><code>attention_processor.py</code></a>
and be a <code>torch.nn.Module</code> class. Currently supported: LoRA, Custom Diffusion. For LoRA, one must install
<code>peft</code>: <code>pip install -U peft</code>.`,Re,Y,Ie,G,ee,Le,pe,ze=`Save attention processor layers to a directory so that it can be reloaded with the
<a href="/docs/diffusers/pr_8376/en/api/loaders/unet#diffusers.loaders.UNet2DConditionLoadersMixin.load_attn_procs">load_attn_procs()</a> method.`,ke,Q,Ve,j,te,De,ce,He="Set the currently active adapters for use in the UNet.",Ne,S,be,se,$e,ue,we;return r=new Ae({props:{title:"UNet",local:"unet",headingTag:"h1"}}),N=new st({props:{$$slots:{default:[at]},$$scope:{ctx:x}}}),z=new Ae({props:{title:"UNet2DConditionLoadersMixin",local:"diffusers.loaders.UNet2DConditionLoadersMixin",headingTag:"h2"}}),H=new oe({props:{name:"class diffusers.loaders.UNet2DConditionLoadersMixin",anchor:"diffusers.loaders.UNet2DConditionLoadersMixin",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_8376/src/diffusers/loaders/unet.py#L66"}}),A=new oe({props:{name:"delete_adapters",anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.delete_adapters",parameters:[{name:"adapter_names",val:": Union"}],parametersDescription:[{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.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/vr_8376/src/diffusers/loaders/unet.py#L670"}}),B=new fe({props:{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.delete_adapters.example",$$slots:{default:[nt]},$$scope:{ctx:x}}}),P=new oe({props:{name:"disable_lora",anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.disable_lora",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_8376/src/diffusers/loaders/unet.py#L624"}}),q=new fe({props:{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.disable_lora.example",$$slots:{default:[rt]},$$scope:{ctx:x}}}),K=new oe({props:{name:"enable_lora",anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.enable_lora",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_8376/src/diffusers/loaders/unet.py#L647"}}),F=new fe({props:{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.enable_lora.example",$$slots:{default:[lt]},$$scope:{ctx:x}}}),O=new oe({props:{name:"load_attn_procs",anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.load_attn_procs",parameters:[{name:"pretrained_model_name_or_path_or_dict",val:": Union"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.load_attn_procs.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 model id (for example <code>google/ddpm-celebahq-256</code>) of a pretrained model hosted on
the Hub.</li>
<li>A path to a directory (for example <code>./my_model_directory</code>) containing the model weights saved
with <a href="/docs/diffusers/pr_8376/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.UNet2DConditionLoadersMixin.load_attn_procs.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.UNet2DConditionLoadersMixin.load_attn_procs.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.
resume_download &#x2014;
Deprecated and ignored. All downloads are now resumed by default when possible. Will be removed in v1
of Diffusers.`,name:"force_download"},{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.load_attn_procs.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.UNet2DConditionLoadersMixin.load_attn_procs.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.UNet2DConditionLoadersMixin.load_attn_procs.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.UNet2DConditionLoadersMixin.load_attn_procs.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.UNet2DConditionLoadersMixin.load_attn_procs.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.UNet2DConditionLoadersMixin.load_attn_procs.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.UNet2DConditionLoadersMixin.load_attn_procs.adapter_name",description:`<strong>adapter_name</strong> (<code>str</code>, <em>optional</em>, defaults to None) &#x2014;
Adapter name to be used for referencing the loaded adapter model. If not specified, it will use
<code>default_{i}</code> where i is the total number of adapters being loaded.`,name:"adapter_name"},{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.load_attn_procs.weight_name",description:`<strong>weight_name</strong> (<code>str</code>, <em>optional</em>, defaults to None) &#x2014;
Name of the serialized state dict file.`,name:"weight_name"}],source:"https://github.com/huggingface/diffusers/blob/vr_8376/src/diffusers/loaders/unet.py#L74"}}),Y=new fe({props:{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.load_attn_procs.example",$$slots:{default:[it]},$$scope:{ctx:x}}}),ee=new oe({props:{name:"save_attn_procs",anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.save_attn_procs",parameters:[{name:"save_directory",val:": Union"},{name:"is_main_process",val:": bool = True"},{name:"weight_name",val:": str = None"},{name:"save_function",val:": Callable = None"},{name:"safe_serialization",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.save_attn_procs.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Directory to save an attention processor to (will be created if it doesn&#x2019;t exist).`,name:"save_directory"},{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.save_attn_procs.is_main_process",description:`<strong>is_main_process</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether the process calling this is the main process or not. Useful during distributed training and you
need to call this function on all processes. In this case, set <code>is_main_process=True</code> only on the main
process to avoid race conditions.`,name:"is_main_process"},{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.save_attn_procs.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.UNet2DConditionLoadersMixin.save_attn_procs.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 with <code>pickle</code>.`,name:"safe_serialization"}],source:"https://github.com/huggingface/diffusers/blob/vr_8376/src/diffusers/loaders/unet.py#L400"}}),Q=new fe({props:{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.save_attn_procs.example",$$slots:{default:[dt]},$$scope:{ctx:x}}}),te=new oe({props:{name:"set_adapters",anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.set_adapters",parameters:[{name:"adapter_names",val:": Union"},{name:"weights",val:": Union = None"}],parametersDescription:[{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.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.UNet2DConditionLoadersMixin.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/vr_8376/src/diffusers/loaders/unet.py#L569"}}),S=new fe({props:{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.set_adapters.example",$$slots:{default:[pt]},$$scope:{ctx:x}}}),se=new ot({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/loaders/unet.md"}}),{c(){s=m("meta"),h=i(),a=m("p"),o=i(),g(r.$$.fragment),e=i(),c=m("p"),c.innerHTML=Be,he=i(),E=m("p"),E.innerHTML=qe,ge=i(),g(N.$$.fragment),ye=i(),g(z.$$.fragment),_e=i(),U=m("div"),g(H.$$.fragment),Ue=i(),ne=m("p"),ne.innerHTML=Fe,Me=i(),v=m("div"),g(A.$$.fragment),xe=i(),re=m("p"),re.textContent=Ye,Je=i(),g(B.$$.fragment),ve=i(),T=m("div"),g(P.$$.fragment),Te=i(),le=m("p"),le.textContent=Qe,Ce=i(),g(q.$$.fragment),Ze=i(),C=m("div"),g(K.$$.fragment),Ge=i(),ie=m("p"),ie.textContent=Se,je=i(),g(F.$$.fragment),We=i(),Z=m("div"),g(O.$$.fragment),Xe=i(),de=m("p"),de.innerHTML=Ee,Re=i(),g(Y.$$.fragment),Ie=i(),G=m("div"),g(ee.$$.fragment),Le=i(),pe=m("p"),pe.innerHTML=ze,ke=i(),g(Q.$$.fragment),Ve=i(),j=m("div"),g(te.$$.fragment),De=i(),ce=m("p"),ce.textContent=He,Ne=i(),g(S.$$.fragment),be=i(),g(se.$$.fragment),$e=i(),ue=m("p"),this.h()},l(t){const l=tt("svelte-u9bgzb",document.head);s=u(l,"META",{name:!0,content:!0}),l.forEach(n),h=d(t),a=u(t,"P",{}),V(a).forEach(n),o=d(t),y(r.$$.fragment,t),e=d(t),c=u(t,"P",{"data-svelte-h":!0}),J(c)!=="svelte-1czfrxr"&&(c.innerHTML=Be),he=d(t),E=u(t,"P",{"data-svelte-h":!0}),J(E)!=="svelte-1exfvvi"&&(E.innerHTML=qe),ge=d(t),y(N.$$.fragment,t),ye=d(t),y(z.$$.fragment,t),_e=d(t),U=u(t,"DIV",{class:!0});var M=V(U);y(H.$$.fragment,M),Ue=d(M),ne=u(M,"P",{"data-svelte-h":!0}),J(ne)!=="svelte-153rhof"&&(ne.innerHTML=Fe),Me=d(M),v=u(M,"DIV",{class:!0});var W=V(v);y(A.$$.fragment,W),xe=d(W),re=u(W,"P",{"data-svelte-h":!0}),J(re)!=="svelte-15bgn5q"&&(re.textContent=Ye),Je=d(W),y(B.$$.fragment,W),W.forEach(n),ve=d(M),T=u(M,"DIV",{class:!0});var X=V(T);y(P.$$.fragment,X),Te=d(X),le=u(X,"P",{"data-svelte-h":!0}),J(le)!=="svelte-nwmpi3"&&(le.textContent=Qe),Ce=d(X),y(q.$$.fragment,X),X.forEach(n),Ze=d(M),C=u(M,"DIV",{class:!0});var R=V(C);y(K.$$.fragment,R),Ge=d(R),ie=u(R,"P",{"data-svelte-h":!0}),J(ie)!=="svelte-inzqno"&&(ie.textContent=Se),je=d(R),y(F.$$.fragment,R),R.forEach(n),We=d(M),Z=u(M,"DIV",{class:!0});var I=V(Z);y(O.$$.fragment,I),Xe=d(I),de=u(I,"P",{"data-svelte-h":!0}),J(de)!=="svelte-60to01"&&(de.innerHTML=Ee),Re=d(I),y(Y.$$.fragment,I),I.forEach(n),Ie=d(M),G=u(M,"DIV",{class:!0});var L=V(G);y(ee.$$.fragment,L),Le=d(L),pe=u(L,"P",{"data-svelte-h":!0}),J(pe)!=="svelte-1qayywu"&&(pe.innerHTML=ze),ke=d(L),y(Q.$$.fragment,L),L.forEach(n),Ve=d(M),j=u(M,"DIV",{class:!0});var k=V(j);y(te.$$.fragment,k),De=d(k),ce=u(k,"P",{"data-svelte-h":!0}),J(ce)!=="svelte-38gdgn"&&(ce.textContent=He),Ne=d(k),y(S.$$.fragment,k),k.forEach(n),M.forEach(n),be=d(t),y(se.$$.fragment,t),$e=d(t),ue=u(t,"P",{}),V(ue).forEach(n),this.h()},h(){D(s,"name","hf:doc:metadata"),D(s,"content",ft),D(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),D(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),D(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),D(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),D(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),D(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),D(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,l){p(document.head,s),f(t,h,l),f(t,a,l),f(t,o,l),_(r,t,l),f(t,e,l),f(t,c,l),f(t,he,l),f(t,E,l),f(t,ge,l),_(N,t,l),f(t,ye,l),_(z,t,l),f(t,_e,l),f(t,U,l),_(H,U,null),p(U,Ue),p(U,ne),p(U,Me),p(U,v),_(A,v,null),p(v,xe),p(v,re),p(v,Je),_(B,v,null),p(U,ve),p(U,T),_(P,T,null),p(T,Te),p(T,le),p(T,Ce),_(q,T,null),p(U,Ze),p(U,C),_(K,C,null),p(C,Ge),p(C,ie),p(C,je),_(F,C,null),p(U,We),p(U,Z),_(O,Z,null),p(Z,Xe),p(Z,de),p(Z,Re),_(Y,Z,null),p(U,Ie),p(U,G),_(ee,G,null),p(G,Le),p(G,pe),p(G,ke),_(Q,G,null),p(U,Ve),p(U,j),_(te,j,null),p(j,De),p(j,ce),p(j,Ne),_(S,j,null),f(t,be,l),_(se,t,l),f(t,$e,l),f(t,ue,l),we=!0},p(t,[l]){const M={};l&2&&(M.$$scope={dirty:l,ctx:t}),N.$set(M);const W={};l&2&&(W.$$scope={dirty:l,ctx:t}),B.$set(W);const X={};l&2&&(X.$$scope={dirty:l,ctx:t}),q.$set(X);const R={};l&2&&(R.$$scope={dirty:l,ctx:t}),F.$set(R);const I={};l&2&&(I.$$scope={dirty:l,ctx:t}),Y.$set(I);const L={};l&2&&(L.$$scope={dirty:l,ctx:t}),Q.$set(L);const k={};l&2&&(k.$$scope={dirty:l,ctx:t}),S.$set(k)},i(t){we||(b(r.$$.fragment,t),b(N.$$.fragment,t),b(z.$$.fragment,t),b(H.$$.fragment,t),b(A.$$.fragment,t),b(B.$$.fragment,t),b(P.$$.fragment,t),b(q.$$.fragment,t),b(K.$$.fragment,t),b(F.$$.fragment,t),b(O.$$.fragment,t),b(Y.$$.fragment,t),b(ee.$$.fragment,t),b(Q.$$.fragment,t),b(te.$$.fragment,t),b(S.$$.fragment,t),b(se.$$.fragment,t),we=!0)},o(t){$(r.$$.fragment,t),$(N.$$.fragment,t),$(z.$$.fragment,t),$(H.$$.fragment,t),$(A.$$.fragment,t),$(B.$$.fragment,t),$(P.$$.fragment,t),$(q.$$.fragment,t),$(K.$$.fragment,t),$(F.$$.fragment,t),$(O.$$.fragment,t),$(Y.$$.fragment,t),$(ee.$$.fragment,t),$(Q.$$.fragment,t),$(te.$$.fragment,t),$(S.$$.fragment,t),$(se.$$.fragment,t),we=!1},d(t){t&&(n(h),n(a),n(o),n(e),n(c),n(he),n(E),n(ge),n(ye),n(_e),n(U),n(be),n($e),n(ue)),n(s),w(r,t),w(N,t),w(z,t),w(H),w(A),w(B),w(P),w(q),w(K),w(F),w(O),w(Y),w(ee),w(Q),w(te),w(S),w(se,t)}}}const ft='{"title":"UNet","local":"unet","sections":[{"title":"UNet2DConditionLoadersMixin","local":"diffusers.loaders.UNet2DConditionLoadersMixin","sections":[],"depth":2}],"depth":1}';function mt(x){return Ke(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class wt extends Oe{constructor(s){super(),et(this,s,mt,ct,Pe,{})}}export{wt as component};
