import{s as He,o as Pe,n as se}from"../chunks/scheduler.182ea377.js";import{S as Ae,i as Ke,g as m,s as d,r as g,A as Oe,h as f,f as r,c,j as k,u as y,x as J,k as D,y as l,a as u,v as _,d as b,t as w,w as U}from"../chunks/index.abf12888.js";import{T as et}from"../chunks/Tip.230e2334.js";import{D as oe}from"../chunks/Docstring.93f6f462.js";import{C as me}from"../chunks/CodeBlock.57fe6e13.js";import{E as pe}from"../chunks/ExampleCodeBlock.658f5cd6.js";import{H as ze}from"../chunks/Heading.16916d63.js";function tt(x){let o,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(){o=m("p"),o.innerHTML=h},l(a){o=f(a,"P",{"data-svelte-h":!0}),J(o)!=="svelte-1fw6lx1"&&(o.innerHTML=h)},m(a,s){u(a,o,s)},p:se,d(a){a&&r(o)}}}function ot(x){let o,h="Example:",a,s,n;return s=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(){o=m("p"),o.textContent=h,a=d(),g(s.$$.fragment)},l(e){o=f(e,"P",{"data-svelte-h":!0}),J(o)!=="svelte-11lpom8"&&(o.textContent=h),a=c(e),y(s.$$.fragment,e)},m(e,p){u(e,o,p),u(e,a,p),_(s,e,p),n=!0},p:se,i(e){n||(b(s.$$.fragment,e),n=!0)},o(e){w(s.$$.fragment,e),n=!1},d(e){e&&(r(o),r(a)),U(s,e)}}}function st(x){let o,h="Example:",a,s,n;return s=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(){o=m("p"),o.textContent=h,a=d(),g(s.$$.fragment)},l(e){o=f(e,"P",{"data-svelte-h":!0}),J(o)!=="svelte-11lpom8"&&(o.textContent=h),a=c(e),y(s.$$.fragment,e)},m(e,p){u(e,o,p),u(e,a,p),_(s,e,p),n=!0},p:se,i(e){n||(b(s.$$.fragment,e),n=!0)},o(e){w(s.$$.fragment,e),n=!1},d(e){e&&(r(o),r(a)),U(s,e)}}}function at(x){let o,h="Example:",a,s,n;return s=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(){o=m("p"),o.textContent=h,a=d(),g(s.$$.fragment)},l(e){o=f(e,"P",{"data-svelte-h":!0}),J(o)!=="svelte-11lpom8"&&(o.textContent=h),a=c(e),y(s.$$.fragment,e)},m(e,p){u(e,o,p),u(e,a,p),_(s,e,p),n=!0},p:se,i(e){n||(b(s.$$.fragment,e),n=!0)},o(e){w(s.$$.fragment,e),n=!1},d(e){e&&(r(o),r(a)),U(s,e)}}}function nt(x){let o,h="Example:",a,s,n;return s=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(){o=m("p"),o.textContent=h,a=d(),g(s.$$.fragment)},l(e){o=f(e,"P",{"data-svelte-h":!0}),J(o)!=="svelte-11lpom8"&&(o.textContent=h),a=c(e),y(s.$$.fragment,e)},m(e,p){u(e,o,p),u(e,a,p),_(s,e,p),n=!0},p:se,i(e){n||(b(s.$$.fragment,e),n=!0)},o(e){w(s.$$.fragment,e),n=!1},d(e){e&&(r(o),r(a)),U(s,e)}}}function rt(x){let o,h="Example:",a,s,n;return s=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(){o=m("p"),o.textContent=h,a=d(),g(s.$$.fragment)},l(e){o=f(e,"P",{"data-svelte-h":!0}),J(o)!=="svelte-11lpom8"&&(o.textContent=h),a=c(e),y(s.$$.fragment,e)},m(e,p){u(e,o,p),u(e,a,p),_(s,e,p),n=!0},p:se,i(e){n||(b(s.$$.fragment,e),n=!0)},o(e){w(s.$$.fragment,e),n=!1},d(e){e&&(r(o),r(a)),U(s,e)}}}function it(x){let o,h="Example:",a,s,n;return s=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(){o=m("p"),o.textContent=h,a=d(),g(s.$$.fragment)},l(e){o=f(e,"P",{"data-svelte-h":!0}),J(o)!=="svelte-11lpom8"&&(o.textContent=h),a=c(e),y(s.$$.fragment,e)},m(e,p){u(e,o,p),u(e,a,p),_(s,e,p),n=!0},p:se,i(e){n||(b(s.$$.fragment,e),n=!0)},o(e){w(s.$$.fragment,e),n=!1},d(e){e&&(r(o),r(a)),U(s,e)}}}function lt(x){let o,h,a,s,n,e,p,De='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/main/en/api/loaders/lora#diffusers.loaders.LoraLoaderMixin.load_lora_weights">load_lora_weights()</a> function instead.',ue,E,Be="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.",he,B,ge,z,ye,$,H,we,ae,Ne="Load LoRA layers into a <code>UNet2DCondtionModel</code>.",Ue,T,P,$e,ne,qe="Delete an adapter’s LoRA layers from the UNet.",Me,N,xe,v,A,Je,re,Fe="Disable the UNet’s active LoRA layers.",Te,q,ve,C,K,Ce,ie,Ye="Enable the UNet’s active LoRA layers.",Ze,F,Ge,Z,O,je,le,Qe=`Load pretrained attention processor layers into <a href="/docs/diffusers/main/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.`,We,Y,Xe,G,ee,Ie,de,Se=`Save attention processor layers to a directory so that it can be reloaded with the
<a href="/docs/diffusers/main/en/api/loaders/unet#diffusers.loaders.UNet2DConditionLoadersMixin.load_attn_procs">load_attn_procs()</a> method.`,Le,Q,Re,j,te,Ve,ce,Ee="Set the currently active adapters for use in the UNet.",ke,S,_e,fe,be;return n=new ze({props:{title:"UNet",local:"unet",headingTag:"h1"}}),B=new et({props:{$$slots:{default:[tt]},$$scope:{ctx:x}}}),z=new ze({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/main/src/diffusers/loaders/unet.py#L64"}}),P=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/main/src/diffusers/loaders/unet.py#L661"}}),N=new pe({props:{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.delete_adapters.example",$$slots:{default:[ot]},$$scope:{ctx:x}}}),A=new oe({props:{name:"disable_lora",anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.disable_lora",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/unet.py#L615"}}),q=new pe({props:{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.disable_lora.example",$$slots:{default:[st]},$$scope:{ctx:x}}}),K=new oe({props:{name:"enable_lora",anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.enable_lora",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/unet.py#L638"}}),F=new pe({props:{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.enable_lora.example",$$slots:{default:[at]},$$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/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.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.`,name:"force_download"},{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.load_attn_procs.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to resume downloading the model weights and configuration files. If set to <code>False</code>, any
incompletely downloaded files are deleted.`,name:"resume_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.low_cpu_mem_usage",description:`<strong>low_cpu_mem_usage</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code> if torch version &gt;= 1.9.0 else <code>False</code>) &#x2014;
Speed up model loading only loading the pretrained weights and not initializing the weights. This also
tries to not use more than 1x model size in CPU memory (including peak memory) while loading the model.
Only supported for PyTorch &gt;= 1.9.0. If you are using an older version of PyTorch, setting this
argument to <code>True</code> will raise an error.`,name:"low_cpu_mem_usage"},{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.mirror",description:`<strong>mirror</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Mirror source to resolve accessibility issues if you&#x2019;re downloading a model in China. We do not
guarantee the timeliness or safety of the source, and you should refer to the mirror site for more
information.`,name:"mirror"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/unet.py#L72"}}),Y=new pe({props:{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.load_attn_procs.example",$$slots:{default:[nt]},$$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/main/src/diffusers/loaders/unet.py#L413"}}),Q=new pe({props:{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.save_attn_procs.example",$$slots:{default:[rt]},$$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/main/src/diffusers/loaders/unet.py#L567"}}),S=new pe({props:{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.set_adapters.example",$$slots:{default:[it]},$$scope:{ctx:x}}}),{c(){o=m("meta"),h=d(),a=m("p"),s=d(),g(n.$$.fragment),e=d(),p=m("p"),p.innerHTML=De,ue=d(),E=m("p"),E.innerHTML=Be,he=d(),g(B.$$.fragment),ge=d(),g(z.$$.fragment),ye=d(),$=m("div"),g(H.$$.fragment),we=d(),ae=m("p"),ae.innerHTML=Ne,Ue=d(),T=m("div"),g(P.$$.fragment),$e=d(),ne=m("p"),ne.textContent=qe,Me=d(),g(N.$$.fragment),xe=d(),v=m("div"),g(A.$$.fragment),Je=d(),re=m("p"),re.textContent=Fe,Te=d(),g(q.$$.fragment),ve=d(),C=m("div"),g(K.$$.fragment),Ce=d(),ie=m("p"),ie.textContent=Ye,Ze=d(),g(F.$$.fragment),Ge=d(),Z=m("div"),g(O.$$.fragment),je=d(),le=m("p"),le.innerHTML=Qe,We=d(),g(Y.$$.fragment),Xe=d(),G=m("div"),g(ee.$$.fragment),Ie=d(),de=m("p"),de.innerHTML=Se,Le=d(),g(Q.$$.fragment),Re=d(),j=m("div"),g(te.$$.fragment),Ve=d(),ce=m("p"),ce.textContent=Ee,ke=d(),g(S.$$.fragment),_e=d(),fe=m("p"),this.h()},l(t){const i=Oe("svelte-u9bgzb",document.head);o=f(i,"META",{name:!0,content:!0}),i.forEach(r),h=c(t),a=f(t,"P",{}),k(a).forEach(r),s=c(t),y(n.$$.fragment,t),e=c(t),p=f(t,"P",{"data-svelte-h":!0}),J(p)!=="svelte-hkb21b"&&(p.innerHTML=De),ue=c(t),E=f(t,"P",{"data-svelte-h":!0}),J(E)!=="svelte-1exfvvi"&&(E.innerHTML=Be),he=c(t),y(B.$$.fragment,t),ge=c(t),y(z.$$.fragment,t),ye=c(t),$=f(t,"DIV",{class:!0});var M=k($);y(H.$$.fragment,M),we=c(M),ae=f(M,"P",{"data-svelte-h":!0}),J(ae)!=="svelte-153rhof"&&(ae.innerHTML=Ne),Ue=c(M),T=f(M,"DIV",{class:!0});var W=k(T);y(P.$$.fragment,W),$e=c(W),ne=f(W,"P",{"data-svelte-h":!0}),J(ne)!=="svelte-15bgn5q"&&(ne.textContent=qe),Me=c(W),y(N.$$.fragment,W),W.forEach(r),xe=c(M),v=f(M,"DIV",{class:!0});var X=k(v);y(A.$$.fragment,X),Je=c(X),re=f(X,"P",{"data-svelte-h":!0}),J(re)!=="svelte-nwmpi3"&&(re.textContent=Fe),Te=c(X),y(q.$$.fragment,X),X.forEach(r),ve=c(M),C=f(M,"DIV",{class:!0});var I=k(C);y(K.$$.fragment,I),Ce=c(I),ie=f(I,"P",{"data-svelte-h":!0}),J(ie)!=="svelte-inzqno"&&(ie.textContent=Ye),Ze=c(I),y(F.$$.fragment,I),I.forEach(r),Ge=c(M),Z=f(M,"DIV",{class:!0});var L=k(Z);y(O.$$.fragment,L),je=c(L),le=f(L,"P",{"data-svelte-h":!0}),J(le)!=="svelte-u9tliy"&&(le.innerHTML=Qe),We=c(L),y(Y.$$.fragment,L),L.forEach(r),Xe=c(M),G=f(M,"DIV",{class:!0});var R=k(G);y(ee.$$.fragment,R),Ie=c(R),de=f(R,"P",{"data-svelte-h":!0}),J(de)!=="svelte-17c800g"&&(de.innerHTML=Se),Le=c(R),y(Q.$$.fragment,R),R.forEach(r),Re=c(M),j=f(M,"DIV",{class:!0});var V=k(j);y(te.$$.fragment,V),Ve=c(V),ce=f(V,"P",{"data-svelte-h":!0}),J(ce)!=="svelte-38gdgn"&&(ce.textContent=Ee),ke=c(V),y(S.$$.fragment,V),V.forEach(r),M.forEach(r),_e=c(t),fe=f(t,"P",{}),k(fe).forEach(r),this.h()},h(){D(o,"name","hf:doc:metadata"),D(o,"content",dt),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(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(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($,"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,i){l(document.head,o),u(t,h,i),u(t,a,i),u(t,s,i),_(n,t,i),u(t,e,i),u(t,p,i),u(t,ue,i),u(t,E,i),u(t,he,i),_(B,t,i),u(t,ge,i),_(z,t,i),u(t,ye,i),u(t,$,i),_(H,$,null),l($,we),l($,ae),l($,Ue),l($,T),_(P,T,null),l(T,$e),l(T,ne),l(T,Me),_(N,T,null),l($,xe),l($,v),_(A,v,null),l(v,Je),l(v,re),l(v,Te),_(q,v,null),l($,ve),l($,C),_(K,C,null),l(C,Ce),l(C,ie),l(C,Ze),_(F,C,null),l($,Ge),l($,Z),_(O,Z,null),l(Z,je),l(Z,le),l(Z,We),_(Y,Z,null),l($,Xe),l($,G),_(ee,G,null),l(G,Ie),l(G,de),l(G,Le),_(Q,G,null),l($,Re),l($,j),_(te,j,null),l(j,Ve),l(j,ce),l(j,ke),_(S,j,null),u(t,_e,i),u(t,fe,i),be=!0},p(t,[i]){const M={};i&2&&(M.$$scope={dirty:i,ctx:t}),B.$set(M);const W={};i&2&&(W.$$scope={dirty:i,ctx:t}),N.$set(W);const X={};i&2&&(X.$$scope={dirty:i,ctx:t}),q.$set(X);const I={};i&2&&(I.$$scope={dirty:i,ctx:t}),F.$set(I);const L={};i&2&&(L.$$scope={dirty:i,ctx:t}),Y.$set(L);const R={};i&2&&(R.$$scope={dirty:i,ctx:t}),Q.$set(R);const V={};i&2&&(V.$$scope={dirty:i,ctx:t}),S.$set(V)},i(t){be||(b(n.$$.fragment,t),b(B.$$.fragment,t),b(z.$$.fragment,t),b(H.$$.fragment,t),b(P.$$.fragment,t),b(N.$$.fragment,t),b(A.$$.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),be=!0)},o(t){w(n.$$.fragment,t),w(B.$$.fragment,t),w(z.$$.fragment,t),w(H.$$.fragment,t),w(P.$$.fragment,t),w(N.$$.fragment,t),w(A.$$.fragment,t),w(q.$$.fragment,t),w(K.$$.fragment,t),w(F.$$.fragment,t),w(O.$$.fragment,t),w(Y.$$.fragment,t),w(ee.$$.fragment,t),w(Q.$$.fragment,t),w(te.$$.fragment,t),w(S.$$.fragment,t),be=!1},d(t){t&&(r(h),r(a),r(s),r(e),r(p),r(ue),r(E),r(he),r(ge),r(ye),r($),r(_e),r(fe)),r(o),U(n,t),U(B,t),U(z,t),U(H),U(P),U(N),U(A),U(q),U(K),U(F),U(O),U(Y),U(ee),U(Q),U(te),U(S)}}}const dt='{"title":"UNet","local":"unet","sections":[{"title":"UNet2DConditionLoadersMixin","local":"diffusers.loaders.UNet2DConditionLoadersMixin","sections":[],"depth":2}],"depth":1}';function ct(x){return Pe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class _t extends Ae{constructor(o){super(),Ke(this,o,ct,lt,He,{})}}export{_t as component};
