import{s as Ae,o as Ke,n as ae}from"../chunks/scheduler.182ea377.js";import{S as Oe,i as et,g as f,s as l,r as g,A as tt,h as u,f as n,c as d,j as k,u as y,x as J,k as D,y as c,a as m,v as _,d as b,t as $,w}from"../chunks/index.abf12888.js";import{T as st}from"../chunks/Tip.230e2334.js";import{D as oe}from"../chunks/Docstring.b0ac41bc.js";import{C as fe}from"../chunks/CodeBlock.57fe6e13.js";import{E as me}from"../chunks/ExampleCodeBlock.cf625607.js";import{H as Pe,E as ot}from"../chunks/EditOnGithub.9b8e78e4.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=f("p"),s.innerHTML=h},l(a){s=u(a,"P",{"data-svelte-h":!0}),J(s)!=="svelte-1fw6lx1"&&(s.innerHTML=h)},m(a,o){m(a,s,o)},p:ae,d(a){a&&n(s)}}}function nt(x){let s,h="Example:",a,o,r;return o=new fe({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=f("p"),s.textContent=h,a=l(),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,p){m(e,s,p),m(e,a,p),_(o,e,p),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 fe({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=f("p"),s.textContent=h,a=l(),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,p){m(e,s,p),m(e,a,p),_(o,e,p),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 fe({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=f("p"),s.textContent=h,a=l(),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,p){m(e,s,p),m(e,a,p),_(o,e,p),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 fe({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=f("p"),s.textContent=h,a=l(),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,p){m(e,s,p),m(e,a,p),_(o,e,p),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 fe({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=f("p"),s.textContent=h,a=l(),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,p){m(e,s,p),m(e,a,p),_(o,e,p),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="Example:",a,o,r;return o=new fe({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=f("p"),s.textContent=h,a=l(),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,p){m(e,s,p),m(e,a,p),_(o,e,p),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,a,o,r,e,p,Ne='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/v0.28.1/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,B,ye,z,_e,U,H,Ue,ne,Fe="Load LoRA layers into a <code>UNet2DCondtionModel</code>.",Me,v,P,xe,re,Ye="Delete an adapter’s LoRA layers from the UNet.",Je,N,ve,T,A,Te,ie,Qe="Disable the UNet’s active LoRA layers.",Ce,q,Ze,C,K,Ge,le,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/v0.28.1/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.`,Ie,Y,Re,G,ee,Le,ce,ze=`Save attention processor layers to a directory so that it can be reloaded with the
<a href="/docs/diffusers/v0.28.1/en/api/loaders/unet#diffusers.loaders.UNet2DConditionLoadersMixin.load_attn_procs">load_attn_procs()</a> method.`,Ve,Q,ke,j,te,De,pe,He="Set the currently active adapters for use in the UNet.",Be,S,be,se,$e,ue,we;return r=new Pe({props:{title:"UNet",local:"unet",headingTag:"h1"}}),B=new st({props:{$$slots:{default:[at]},$$scope:{ctx:x}}}),z=new Pe({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/v0.28.1/src/diffusers/loaders/unet.py#L68"}}),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/v0.28.1/src/diffusers/loaders/unet.py#L667"}}),N=new me({props:{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.delete_adapters.example",$$slots:{default:[nt]},$$scope:{ctx:x}}}),A=new oe({props:{name:"disable_lora",anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.disable_lora",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.28.1/src/diffusers/loaders/unet.py#L621"}}),q=new me({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/v0.28.1/src/diffusers/loaders/unet.py#L644"}}),F=new me({props:{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.enable_lora.example",$$slots:{default:[it]},$$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/v0.28.1/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.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/v0.28.1/src/diffusers/loaders/unet.py#L76"}}),Y=new me({props:{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.load_attn_procs.example",$$slots:{default:[lt]},$$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/v0.28.1/src/diffusers/loaders/unet.py#L412"}}),Q=new me({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/v0.28.1/src/diffusers/loaders/unet.py#L566"}}),S=new me({props:{anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.set_adapters.example",$$slots:{default:[ct]},$$scope:{ctx:x}}}),se=new ot({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/loaders/unet.md"}}),{c(){s=f("meta"),h=l(),a=f("p"),o=l(),g(r.$$.fragment),e=l(),p=f("p"),p.innerHTML=Ne,he=l(),E=f("p"),E.innerHTML=qe,ge=l(),g(B.$$.fragment),ye=l(),g(z.$$.fragment),_e=l(),U=f("div"),g(H.$$.fragment),Ue=l(),ne=f("p"),ne.innerHTML=Fe,Me=l(),v=f("div"),g(P.$$.fragment),xe=l(),re=f("p"),re.textContent=Ye,Je=l(),g(N.$$.fragment),ve=l(),T=f("div"),g(A.$$.fragment),Te=l(),ie=f("p"),ie.textContent=Qe,Ce=l(),g(q.$$.fragment),Ze=l(),C=f("div"),g(K.$$.fragment),Ge=l(),le=f("p"),le.textContent=Se,je=l(),g(F.$$.fragment),We=l(),Z=f("div"),g(O.$$.fragment),Xe=l(),de=f("p"),de.innerHTML=Ee,Ie=l(),g(Y.$$.fragment),Re=l(),G=f("div"),g(ee.$$.fragment),Le=l(),ce=f("p"),ce.innerHTML=ze,Ve=l(),g(Q.$$.fragment),ke=l(),j=f("div"),g(te.$$.fragment),De=l(),pe=f("p"),pe.textContent=He,Be=l(),g(S.$$.fragment),be=l(),g(se.$$.fragment),$e=l(),ue=f("p"),this.h()},l(t){const i=tt("svelte-u9bgzb",document.head);s=u(i,"META",{name:!0,content:!0}),i.forEach(n),h=d(t),a=u(t,"P",{}),k(a).forEach(n),o=d(t),y(r.$$.fragment,t),e=d(t),p=u(t,"P",{"data-svelte-h":!0}),J(p)!=="svelte-h4hjhn"&&(p.innerHTML=Ne),he=d(t),E=u(t,"P",{"data-svelte-h":!0}),J(E)!=="svelte-1exfvvi"&&(E.innerHTML=qe),ge=d(t),y(B.$$.fragment,t),ye=d(t),y(z.$$.fragment,t),_e=d(t),U=u(t,"DIV",{class:!0});var M=k(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=k(v);y(P.$$.fragment,W),xe=d(W),re=u(W,"P",{"data-svelte-h":!0}),J(re)!=="svelte-15bgn5q"&&(re.textContent=Ye),Je=d(W),y(N.$$.fragment,W),W.forEach(n),ve=d(M),T=u(M,"DIV",{class:!0});var X=k(T);y(A.$$.fragment,X),Te=d(X),ie=u(X,"P",{"data-svelte-h":!0}),J(ie)!=="svelte-nwmpi3"&&(ie.textContent=Qe),Ce=d(X),y(q.$$.fragment,X),X.forEach(n),Ze=d(M),C=u(M,"DIV",{class:!0});var I=k(C);y(K.$$.fragment,I),Ge=d(I),le=u(I,"P",{"data-svelte-h":!0}),J(le)!=="svelte-inzqno"&&(le.textContent=Se),je=d(I),y(F.$$.fragment,I),I.forEach(n),We=d(M),Z=u(M,"DIV",{class:!0});var R=k(Z);y(O.$$.fragment,R),Xe=d(R),de=u(R,"P",{"data-svelte-h":!0}),J(de)!=="svelte-1e8krmk"&&(de.innerHTML=Ee),Ie=d(R),y(Y.$$.fragment,R),R.forEach(n),Re=d(M),G=u(M,"DIV",{class:!0});var L=k(G);y(ee.$$.fragment,L),Le=d(L),ce=u(L,"P",{"data-svelte-h":!0}),J(ce)!=="svelte-1gpp7se"&&(ce.innerHTML=ze),Ve=d(L),y(Q.$$.fragment,L),L.forEach(n),ke=d(M),j=u(M,"DIV",{class:!0});var V=k(j);y(te.$$.fragment,V),De=d(V),pe=u(V,"P",{"data-svelte-h":!0}),J(pe)!=="svelte-38gdgn"&&(pe.textContent=He),Be=d(V),y(S.$$.fragment,V),V.forEach(n),M.forEach(n),be=d(t),y(se.$$.fragment,t),$e=d(t),ue=u(t,"P",{}),k(ue).forEach(n),this.h()},h(){D(s,"name","hf:doc:metadata"),D(s,"content",mt),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,i){c(document.head,s),m(t,h,i),m(t,a,i),m(t,o,i),_(r,t,i),m(t,e,i),m(t,p,i),m(t,he,i),m(t,E,i),m(t,ge,i),_(B,t,i),m(t,ye,i),_(z,t,i),m(t,_e,i),m(t,U,i),_(H,U,null),c(U,Ue),c(U,ne),c(U,Me),c(U,v),_(P,v,null),c(v,xe),c(v,re),c(v,Je),_(N,v,null),c(U,ve),c(U,T),_(A,T,null),c(T,Te),c(T,ie),c(T,Ce),_(q,T,null),c(U,Ze),c(U,C),_(K,C,null),c(C,Ge),c(C,le),c(C,je),_(F,C,null),c(U,We),c(U,Z),_(O,Z,null),c(Z,Xe),c(Z,de),c(Z,Ie),_(Y,Z,null),c(U,Re),c(U,G),_(ee,G,null),c(G,Le),c(G,ce),c(G,Ve),_(Q,G,null),c(U,ke),c(U,j),_(te,j,null),c(j,De),c(j,pe),c(j,Be),_(S,j,null),m(t,be,i),_(se,t,i),m(t,$e,i),m(t,ue,i),we=!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 R={};i&2&&(R.$$scope={dirty:i,ctx:t}),Y.$set(R);const L={};i&2&&(L.$$scope={dirty:i,ctx:t}),Q.$set(L);const V={};i&2&&(V.$$scope={dirty:i,ctx:t}),S.$set(V)},i(t){we||(b(r.$$.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),b(se.$$.fragment,t),we=!0)},o(t){$(r.$$.fragment,t),$(B.$$.fragment,t),$(z.$$.fragment,t),$(H.$$.fragment,t),$(P.$$.fragment,t),$(N.$$.fragment,t),$(A.$$.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(p),n(he),n(E),n(ge),n(ye),n(_e),n(U),n(be),n($e),n(ue)),n(s),w(r,t),w(B,t),w(z,t),w(H),w(P),w(N),w(A),w(q),w(K),w(F),w(O),w(Y),w(ee),w(Q),w(te),w(S),w(se,t)}}}const mt='{"title":"UNet","local":"unet","sections":[{"title":"UNet2DConditionLoadersMixin","local":"diffusers.loaders.UNet2DConditionLoadersMixin","sections":[],"depth":2}],"depth":1}';function ft(x){return Ke(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class wt extends Oe{constructor(s){super(),et(this,s,ft,pt,Ae,{})}}export{wt as component};
