Buckets:
| import{s as Ft,o as At,n as je}from"../chunks/scheduler.8c3d61f6.js";import{S as Et,i as Lt,g as l,s,r as _,A as qt,h as i,f as d,c as o,j as T,u as b,x as u,k as U,y as a,a as M,v as y,d as $,t as x,w}from"../chunks/index.da70eac4.js";import{T as Bt}from"../chunks/Tip.1d9b8c37.js";import{D as C}from"../chunks/Docstring.6b390b9a.js";import{C as Ae}from"../chunks/CodeBlock.00a903b3.js";import{E as Fe}from"../chunks/ExampleCodeBlock.db12be95.js";import{H as Vt,E as Yt}from"../chunks/EditOnGithub.1e64e623.js";function Qt(J){let r,v='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=l("p"),r.innerHTML=v},l(f){r=i(f,"P",{"data-svelte-h":!0}),u(r)!=="svelte-1yhqcl5"&&(r.innerHTML=v)},m(f,n){M(f,r,n)},p:je,d(f){f&&d(r)}}}function St(J){let r,v="Example:",f,n,h;return n=new Ae({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">"stabilityai/stable-diffusion-xl-base-1.0"</span>, torch_dtype=torch.float16 | |
| ).to(<span class="hljs-string">"cuda"</span>) | |
| pipeline.load_lora_weights( | |
| <span class="hljs-string">"jbilcke-hf/sdxl-cinematic-1"</span>, weight_name=<span class="hljs-string">"pytorch_lora_weights.safetensors"</span>, adapter_names=<span class="hljs-string">"cinematic"</span> | |
| ) | |
| pipeline.delete_adapters(<span class="hljs-string">"cinematic"</span>)`,wrap:!1}}),{c(){r=l("p"),r.textContent=v,f=s(),_(n.$$.fragment)},l(t){r=i(t,"P",{"data-svelte-h":!0}),u(r)!=="svelte-11lpom8"&&(r.textContent=v),f=o(t),b(n.$$.fragment,t)},m(t,g){M(t,r,g),M(t,f,g),y(n,t,g),h=!0},p:je,i(t){h||($(n.$$.fragment,t),h=!0)},o(t){x(n.$$.fragment,t),h=!1},d(t){t&&(d(r),d(f)),w(n,t)}}}function Dt(J){let r,v="Example:",f,n,h;return n=new Ae({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">"stabilityai/stable-diffusion-xl-base-1.0"</span>, torch_dtype=torch.float16 | |
| ).to(<span class="hljs-string">"cuda"</span>) | |
| pipeline.load_lora_weights( | |
| <span class="hljs-string">"jbilcke-hf/sdxl-cinematic-1"</span>, weight_name=<span class="hljs-string">"pytorch_lora_weights.safetensors"</span>, adapter_name=<span class="hljs-string">"cinematic"</span> | |
| ) | |
| pipeline.disable_lora()`,wrap:!1}}),{c(){r=l("p"),r.textContent=v,f=s(),_(n.$$.fragment)},l(t){r=i(t,"P",{"data-svelte-h":!0}),u(r)!=="svelte-11lpom8"&&(r.textContent=v),f=o(t),b(n.$$.fragment,t)},m(t,g){M(t,r,g),M(t,f,g),y(n,t,g),h=!0},p:je,i(t){h||($(n.$$.fragment,t),h=!0)},o(t){x(n.$$.fragment,t),h=!1},d(t){t&&(d(r),d(f)),w(n,t)}}}function Ht(J){let r,v="Example:",f,n,h;return n=new Ae({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">"stabilityai/stable-diffusion-xl-base-1.0"</span>, torch_dtype=torch.float16 | |
| ).to(<span class="hljs-string">"cuda"</span>) | |
| pipeline.load_lora_weights( | |
| <span class="hljs-string">"jbilcke-hf/sdxl-cinematic-1"</span>, weight_name=<span class="hljs-string">"pytorch_lora_weights.safetensors"</span>, adapter_name=<span class="hljs-string">"cinematic"</span> | |
| ) | |
| pipeline.enable_lora()`,wrap:!1}}),{c(){r=l("p"),r.textContent=v,f=s(),_(n.$$.fragment)},l(t){r=i(t,"P",{"data-svelte-h":!0}),u(r)!=="svelte-11lpom8"&&(r.textContent=v),f=o(t),b(n.$$.fragment,t)},m(t,g){M(t,r,g),M(t,f,g),y(n,t,g),h=!0},p:je,i(t){h||($(n.$$.fragment,t),h=!0)},o(t){x(n.$$.fragment,t),h=!1},d(t){t&&(d(r),d(f)),w(n,t)}}}function zt(J){let r,v="Example:",f,n,h;return n=new Ae({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">"stabilityai/stable-diffusion-xl-base-1.0"</span>, torch_dtype=torch.float16 | |
| ).to(<span class="hljs-string">"cuda"</span>) | |
| pipeline.load_lora_weights( | |
| <span class="hljs-string">"jbilcke-hf/sdxl-cinematic-1"</span>, weight_name=<span class="hljs-string">"pytorch_lora_weights.safetensors"</span>, adapter_name=<span class="hljs-string">"cinematic"</span> | |
| ) | |
| pipeline.load_lora_weights(<span class="hljs-string">"nerijs/pixel-art-xl"</span>, weight_name=<span class="hljs-string">"pixel-art-xl.safetensors"</span>, adapter_name=<span class="hljs-string">"pixel"</span>) | |
| pipeline.set_adapters([<span class="hljs-string">"cinematic"</span>, <span class="hljs-string">"pixel"</span>], adapter_weights=[<span class="hljs-number">0.5</span>, <span class="hljs-number">0.5</span>])`,wrap:!1}}),{c(){r=l("p"),r.textContent=v,f=s(),_(n.$$.fragment)},l(t){r=i(t,"P",{"data-svelte-h":!0}),u(r)!=="svelte-11lpom8"&&(r.textContent=v),f=o(t),b(n.$$.fragment,t)},m(t,g){M(t,r,g),M(t,f,g),y(n,t,g),h=!0},p:je,i(t){h||($(n.$$.fragment,t),h=!0)},o(t){x(n.$$.fragment,t),h=!1},d(t){t&&(d(r),d(f)),w(n,t)}}}function Nt(J){let r,v,f,n,h,t,g,yt='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/pr_9875/en/api/loaders/peft#diffusers.loaders.PeftAdapterMixin">PeftAdapterMixin</a> class. This allows modeling classes in Diffusers like <a href="/docs/diffusers/pr_9875/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>, <a href="/docs/diffusers/pr_9875/en/api/models/sd3_transformer2d#diffusers.SD3Transformer2DModel">SD3Transformer2DModel</a> to operate with an adapter.',Ge,L,Ie,D,Xe,p,H,Ee,le,$t=`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>.`,Le,ie,xt="Install the latest version of PEFT, and use this mixin to:",qe,de,wt="<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>",Be,Z,z,Ye,pe,Mt="Gets the current list of active adapters of the model.",Qe,fe,vt=`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>.`,Se,P,N,De,ce,Tt=`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.`,He,me,Ut=`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>.`,ze,j,K,Ne,he,Jt="Delete an adapter’s LoRA layers from the underlying model.",Ke,q,Oe,G,O,et,ue,Ct="Disable all adapters attached to the model and fallback to inference with the base model only.",tt,ge,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>.`,at,I,ee,rt,_e,Pt="Disables the active LoRA layers of the underlying model.",st,B,ot,X,te,nt,be,jt=`Enable adapters that are attached to the model. The model uses <code>self.active_adapters()</code> to retrieve the list of | |
| adapters to enable.`,lt,ye,Gt=`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>.`,it,k,ae,dt,$e,It="Enables the active LoRA layers of the underlying model.",pt,Y,ft,Q,re,ct,xe,Xt="Loads a LoRA adapter into the underlying model.",mt,W,se,ht,we,kt="Sets a specific adapter by forcing the model to only use that adapter and disables the other adapters.",ut,Me,Wt=`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>.`,gt,R,oe,_t,ve,Rt="Set the currently active adapters for use in the UNet.",bt,S,ke,ne,We,Pe,Re;return h=new Vt({props:{title:"PEFT",local:"peft",headingTag:"h1"}}),L=new Bt({props:{$$slots:{default:[Qt]},$$scope:{ctx:J}}}),D=new Vt({props:{title:"PeftAdapterMixin",local:"diffusers.loaders.PeftAdapterMixin",headingTag:"h2"}}),H=new C({props:{name:"class diffusers.loaders.PeftAdapterMixin",anchor:"diffusers.loaders.PeftAdapterMixin",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_9875/src/diffusers/loaders/peft.py#L54"}}),z=new C({props:{name:"active_adapters",anchor:"diffusers.loaders.PeftAdapterMixin.active_adapters",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_9875/src/diffusers/loaders/peft.py#L467"}}),N=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>) — | |
| 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>"default"</code>) — | |
| 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/vr_9875/src/diffusers/loaders/peft.py#L335"}}),K=new C({props:{name:"delete_adapters",anchor:"diffusers.loaders.PeftAdapterMixin.delete_adapters",parameters:[{name:"adapter_names",val:": Union"}],parametersDescription:[{anchor:"diffusers.loaders.PeftAdapterMixin.delete_adapters.adapter_names",description:`<strong>adapter_names</strong> (<code>Union[List[str], str]</code>) — | |
| The names (single string or list of strings) of the adapter to delete.`,name:"adapter_names"}],source:"https://github.com/huggingface/diffusers/blob/vr_9875/src/diffusers/loaders/peft.py#L585"}}),q=new Fe({props:{anchor:"diffusers.loaders.PeftAdapterMixin.delete_adapters.example",$$slots:{default:[St]},$$scope:{ctx:J}}}),O=new C({props:{name:"disable_adapters",anchor:"diffusers.loaders.PeftAdapterMixin.disable_adapters",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_9875/src/diffusers/loaders/peft.py#L422"}}),ee=new C({props:{name:"disable_lora",anchor:"diffusers.loaders.PeftAdapterMixin.disable_lora",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_9875/src/diffusers/loaders/peft.py#L539"}}),B=new Fe({props:{anchor:"diffusers.loaders.PeftAdapterMixin.disable_lora.example",$$slots:{default:[Dt]},$$scope:{ctx:J}}}),te=new C({props:{name:"enable_adapters",anchor:"diffusers.loaders.PeftAdapterMixin.enable_adapters",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_9875/src/diffusers/loaders/peft.py#L444"}}),ae=new C({props:{name:"enable_lora",anchor:"diffusers.loaders.PeftAdapterMixin.enable_lora",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_9875/src/diffusers/loaders/peft.py#L562"}}),Y=new Fe({props:{anchor:"diffusers.loaders.PeftAdapterMixin.enable_lora.example",$$slots:{default:[Ht]},$$scope:{ctx:J}}}),re=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>) — | |
| 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/pr_9875/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>) — 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>) — | |
| 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>) — | |
| 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>) — | |
| A dictionary of proxy servers to use by protocol or endpoint, for example, <code>{'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}</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>) — | |
| Whether to only load local model weights and configuration files or not. If set to <code>True</code>, the model | |
| won’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>) — | |
| 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>"main"</code>) — | |
| 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>""</code>) — | |
| 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>) — | |
| 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>) — | |
| 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/vr_9875/src/diffusers/loaders/peft.py#L106"}}),se=new C({props:{name:"set_adapter",anchor:"diffusers.loaders.PeftAdapterMixin.set_adapter",parameters:[{name:"adapter_name",val:": Union"}],parametersDescription:[{anchor:"diffusers.loaders.PeftAdapterMixin.set_adapter.adapter_name",description:`<strong>adapter_name</strong> (Union[str, List[str]])) — | |
| 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/vr_9875/src/diffusers/loaders/peft.py#L373"}}),oe=new C({props:{name:"set_adapters",anchor:"diffusers.loaders.PeftAdapterMixin.set_adapters",parameters:[{name:"adapter_names",val:": Union"},{name:"weights",val:": Union = None"}],parametersDescription:[{anchor:"diffusers.loaders.PeftAdapterMixin.set_adapters.adapter_names",description:`<strong>adapter_names</strong> (<code>List[str]</code> or <code>str</code>) — | |
| 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>) — | |
| 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_9875/src/diffusers/loaders/peft.py#L279"}}),S=new Fe({props:{anchor:"diffusers.loaders.PeftAdapterMixin.set_adapters.example",$$slots:{default:[zt]},$$scope:{ctx:J}}}),ne=new Yt({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/loaders/peft.md"}}),{c(){r=l("meta"),v=s(),f=l("p"),n=s(),_(h.$$.fragment),t=s(),g=l("p"),g.innerHTML=yt,Ge=s(),_(L.$$.fragment),Ie=s(),_(D.$$.fragment),Xe=s(),p=l("div"),_(H.$$.fragment),Ee=s(),le=l("p"),le.innerHTML=$t,Le=s(),ie=l("p"),ie.textContent=xt,qe=s(),de=l("ul"),de.innerHTML=wt,Be=s(),Z=l("div"),_(z.$$.fragment),Ye=s(),pe=l("p"),pe.textContent=Mt,Qe=s(),fe=l("p"),fe.innerHTML=vt,Se=s(),P=l("div"),_(N.$$.fragment),De=s(),ce=l("p"),ce.textContent=Tt,He=s(),me=l("p"),me.innerHTML=Ut,ze=s(),j=l("div"),_(K.$$.fragment),Ne=s(),he=l("p"),he.textContent=Jt,Ke=s(),_(q.$$.fragment),Oe=s(),G=l("div"),_(O.$$.fragment),et=s(),ue=l("p"),ue.textContent=Ct,tt=s(),ge=l("p"),ge.innerHTML=Zt,at=s(),I=l("div"),_(ee.$$.fragment),rt=s(),_e=l("p"),_e.textContent=Pt,st=s(),_(B.$$.fragment),ot=s(),X=l("div"),_(te.$$.fragment),nt=s(),be=l("p"),be.innerHTML=jt,lt=s(),ye=l("p"),ye.innerHTML=Gt,it=s(),k=l("div"),_(ae.$$.fragment),dt=s(),$e=l("p"),$e.textContent=It,pt=s(),_(Y.$$.fragment),ft=s(),Q=l("div"),_(re.$$.fragment),ct=s(),xe=l("p"),xe.textContent=Xt,mt=s(),W=l("div"),_(se.$$.fragment),ht=s(),we=l("p"),we.textContent=kt,ut=s(),Me=l("p"),Me.innerHTML=Wt,gt=s(),R=l("div"),_(oe.$$.fragment),_t=s(),ve=l("p"),ve.textContent=Rt,bt=s(),_(S.$$.fragment),ke=s(),_(ne.$$.fragment),We=s(),Pe=l("p"),this.h()},l(e){const m=qt("svelte-u9bgzb",document.head);r=i(m,"META",{name:!0,content:!0}),m.forEach(d),v=o(e),f=i(e,"P",{}),T(f).forEach(d),n=o(e),b(h.$$.fragment,e),t=o(e),g=i(e,"P",{"data-svelte-h":!0}),u(g)!=="svelte-rafglu"&&(g.innerHTML=yt),Ge=o(e),b(L.$$.fragment,e),Ie=o(e),b(D.$$.fragment,e),Xe=o(e),p=i(e,"DIV",{class:!0});var c=T(p);b(H.$$.fragment,c),Ee=o(c),le=i(c,"P",{"data-svelte-h":!0}),u(le)!=="svelte-16jad6u"&&(le.innerHTML=$t),Le=o(c),ie=i(c,"P",{"data-svelte-h":!0}),u(ie)!=="svelte-jgx411"&&(ie.textContent=xt),qe=o(c),de=i(c,"UL",{"data-svelte-h":!0}),u(de)!=="svelte-70o87y"&&(de.innerHTML=wt),Be=o(c),Z=i(c,"DIV",{class:!0});var V=T(Z);b(z.$$.fragment,V),Ye=o(V),pe=i(V,"P",{"data-svelte-h":!0}),u(pe)!=="svelte-1i9yvzx"&&(pe.textContent=Mt),Qe=o(V),fe=i(V,"P",{"data-svelte-h":!0}),u(fe)!=="svelte-pm6rj0"&&(fe.innerHTML=vt),V.forEach(d),Se=o(c),P=i(c,"DIV",{class:!0});var F=T(P);b(N.$$.fragment,F),De=o(F),ce=i(F,"P",{"data-svelte-h":!0}),u(ce)!=="svelte-ayg1h"&&(ce.textContent=Tt),He=o(F),me=i(F,"P",{"data-svelte-h":!0}),u(me)!=="svelte-m719pe"&&(me.innerHTML=Ut),F.forEach(d),ze=o(c),j=i(c,"DIV",{class:!0});var A=T(j);b(K.$$.fragment,A),Ne=o(A),he=i(A,"P",{"data-svelte-h":!0}),u(he)!=="svelte-1oumhy2"&&(he.textContent=Jt),Ke=o(A),b(q.$$.fragment,A),A.forEach(d),Oe=o(c),G=i(c,"DIV",{class:!0});var E=T(G);b(O.$$.fragment,E),et=o(E),ue=i(E,"P",{"data-svelte-h":!0}),u(ue)!=="svelte-stjif2"&&(ue.textContent=Ct),tt=o(E),ge=i(E,"P",{"data-svelte-h":!0}),u(ge)!=="svelte-pm6rj0"&&(ge.innerHTML=Zt),E.forEach(d),at=o(c),I=i(c,"DIV",{class:!0});var Te=T(I);b(ee.$$.fragment,Te),rt=o(Te),_e=i(Te,"P",{"data-svelte-h":!0}),u(_e)!=="svelte-1w71mps"&&(_e.textContent=Pt),st=o(Te),b(B.$$.fragment,Te),Te.forEach(d),ot=o(c),X=i(c,"DIV",{class:!0});var Ue=T(X);b(te.$$.fragment,Ue),nt=o(Ue),be=i(Ue,"P",{"data-svelte-h":!0}),u(be)!=="svelte-hmbjwp"&&(be.innerHTML=jt),lt=o(Ue),ye=i(Ue,"P",{"data-svelte-h":!0}),u(ye)!=="svelte-pm6rj0"&&(ye.innerHTML=Gt),Ue.forEach(d),it=o(c),k=i(c,"DIV",{class:!0});var Je=T(k);b(ae.$$.fragment,Je),dt=o(Je),$e=i(Je,"P",{"data-svelte-h":!0}),u($e)!=="svelte-9erqj1"&&($e.textContent=It),pt=o(Je),b(Y.$$.fragment,Je),Je.forEach(d),ft=o(c),Q=i(c,"DIV",{class:!0});var Ve=T(Q);b(re.$$.fragment,Ve),ct=o(Ve),xe=i(Ve,"P",{"data-svelte-h":!0}),u(xe)!=="svelte-mffm0u"&&(xe.textContent=Xt),Ve.forEach(d),mt=o(c),W=i(c,"DIV",{class:!0});var Ce=T(W);b(se.$$.fragment,Ce),ht=o(Ce),we=i(Ce,"P",{"data-svelte-h":!0}),u(we)!=="svelte-1kp30gn"&&(we.textContent=kt),ut=o(Ce),Me=i(Ce,"P",{"data-svelte-h":!0}),u(Me)!=="svelte-pm6rj0"&&(Me.innerHTML=Wt),Ce.forEach(d),gt=o(c),R=i(c,"DIV",{class:!0});var Ze=T(R);b(oe.$$.fragment,Ze),_t=o(Ze),ve=i(Ze,"P",{"data-svelte-h":!0}),u(ve)!=="svelte-38gdgn"&&(ve.textContent=Rt),bt=o(Ze),b(S.$$.fragment,Ze),Ze.forEach(d),c.forEach(d),ke=o(e),b(ne.$$.fragment,e),We=o(e),Pe=i(e,"P",{}),T(Pe).forEach(d),this.h()},h(){U(r,"name","hf:doc:metadata"),U(r,"content",Kt),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(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(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(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(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(Q,"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(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){a(document.head,r),M(e,v,m),M(e,f,m),M(e,n,m),y(h,e,m),M(e,t,m),M(e,g,m),M(e,Ge,m),y(L,e,m),M(e,Ie,m),y(D,e,m),M(e,Xe,m),M(e,p,m),y(H,p,null),a(p,Ee),a(p,le),a(p,Le),a(p,ie),a(p,qe),a(p,de),a(p,Be),a(p,Z),y(z,Z,null),a(Z,Ye),a(Z,pe),a(Z,Qe),a(Z,fe),a(p,Se),a(p,P),y(N,P,null),a(P,De),a(P,ce),a(P,He),a(P,me),a(p,ze),a(p,j),y(K,j,null),a(j,Ne),a(j,he),a(j,Ke),y(q,j,null),a(p,Oe),a(p,G),y(O,G,null),a(G,et),a(G,ue),a(G,tt),a(G,ge),a(p,at),a(p,I),y(ee,I,null),a(I,rt),a(I,_e),a(I,st),y(B,I,null),a(p,ot),a(p,X),y(te,X,null),a(X,nt),a(X,be),a(X,lt),a(X,ye),a(p,it),a(p,k),y(ae,k,null),a(k,dt),a(k,$e),a(k,pt),y(Y,k,null),a(p,ft),a(p,Q),y(re,Q,null),a(Q,ct),a(Q,xe),a(p,mt),a(p,W),y(se,W,null),a(W,ht),a(W,we),a(W,ut),a(W,Me),a(p,gt),a(p,R),y(oe,R,null),a(R,_t),a(R,ve),a(R,bt),y(S,R,null),M(e,ke,m),y(ne,e,m),M(e,We,m),M(e,Pe,m),Re=!0},p(e,[m]){const c={};m&2&&(c.$$scope={dirty:m,ctx:e}),L.$set(c);const V={};m&2&&(V.$$scope={dirty:m,ctx:e}),q.$set(V);const F={};m&2&&(F.$$scope={dirty:m,ctx:e}),B.$set(F);const A={};m&2&&(A.$$scope={dirty:m,ctx:e}),Y.$set(A);const E={};m&2&&(E.$$scope={dirty:m,ctx:e}),S.$set(E)},i(e){Re||($(h.$$.fragment,e),$(L.$$.fragment,e),$(D.$$.fragment,e),$(H.$$.fragment,e),$(z.$$.fragment,e),$(N.$$.fragment,e),$(K.$$.fragment,e),$(q.$$.fragment,e),$(O.$$.fragment,e),$(ee.$$.fragment,e),$(B.$$.fragment,e),$(te.$$.fragment,e),$(ae.$$.fragment,e),$(Y.$$.fragment,e),$(re.$$.fragment,e),$(se.$$.fragment,e),$(oe.$$.fragment,e),$(S.$$.fragment,e),$(ne.$$.fragment,e),Re=!0)},o(e){x(h.$$.fragment,e),x(L.$$.fragment,e),x(D.$$.fragment,e),x(H.$$.fragment,e),x(z.$$.fragment,e),x(N.$$.fragment,e),x(K.$$.fragment,e),x(q.$$.fragment,e),x(O.$$.fragment,e),x(ee.$$.fragment,e),x(B.$$.fragment,e),x(te.$$.fragment,e),x(ae.$$.fragment,e),x(Y.$$.fragment,e),x(re.$$.fragment,e),x(se.$$.fragment,e),x(oe.$$.fragment,e),x(S.$$.fragment,e),x(ne.$$.fragment,e),Re=!1},d(e){e&&(d(v),d(f),d(n),d(t),d(g),d(Ge),d(Ie),d(Xe),d(p),d(ke),d(We),d(Pe)),d(r),w(h,e),w(L,e),w(D,e),w(H),w(z),w(N),w(K),w(q),w(O),w(ee),w(B),w(te),w(ae),w(Y),w(re),w(se),w(oe),w(S),w(ne,e)}}}const Kt='{"title":"PEFT","local":"peft","sections":[{"title":"PeftAdapterMixin","local":"diffusers.loaders.PeftAdapterMixin","sections":[],"depth":2}],"depth":1}';function Ot(J){return At(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class la extends Et{constructor(r){super(),Lt(this,r,Ot,Nt,Ft,{})}}export{la as component}; | |
Xet Storage Details
- Size:
- 29.2 kB
- Xet hash:
- 813d23a25cfb5d2c380f9452e93469d9e66133e0cb40094e6b96f8932fdf0128
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.