import{S as Yr,i as Vr,s as zr,e as r,k as f,w as y,t as i,M as Hr,c as n,d as t,m as p,a as s,x,h as l,b as d,G as e,g as _,y as b,q as w,o as M,B as $,v as Xr,L as dr}from"../../chunks/vendor-hf-doc-builder.js";import{T as Qr}from"../../chunks/Tip-hf-doc-builder.js";import{D as S}from"../../chunks/Docstring-hf-doc-builder.js";import{C as cr}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as bo}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as lr}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Or(Z){let c,T,u,m,v,a,g,j,P,H,E;return{c(){c=r("p"),T=i("\u{1F9EA} The "),u=r("code"),m=i("LoaderMixins"),v=i(" are highly experimental and prone to future changes. To use private or "),a=r("a"),g=i("gated"),j=i(" models, log-in with "),P=r("code"),H=i("huggingface-cli login"),E=i("."),this.h()},l(A){c=n(A,"P",{});var L=s(c);T=l(L,"\u{1F9EA} The "),u=n(L,"CODE",{});var Ze=s(u);m=l(Ze,"LoaderMixins"),Ze.forEach(t),v=l(L," are highly experimental and prone to future changes. To use private or "),a=n(L,"A",{href:!0,rel:!0});var We=s(a);g=l(We,"gated"),We.forEach(t),j=l(L," models, log-in with "),P=n(L,"CODE",{});var me=s(P);H=l(me,"huggingface-cli login"),me.forEach(t),E=l(L,"."),L.forEach(t),this.h()},h(){d(a,"href","https://huggingface.co/docs/hub/models-gated#gated-models"),d(a,"rel","nofollow")},m(A,L){_(A,c,L),e(c,T),e(c,u),e(u,m),e(c,v),e(c,a),e(a,g),e(c,j),e(c,P),e(P,H),e(c,E)},d(A){A&&t(c)}}}function Kr(Z){let c,T,u,m,v;return m=new cr({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFtb2RlbF9pZCUyMCUzRCUyMCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMiklMEElMEFwaXBlLmxvYWRfdGV4dHVhbF9pbnZlcnNpb24oJTIyc2QtY29uY2VwdHMtbGlicmFyeSUyRmNhdC10b3klMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyQSUyMCUzQ2NhdC10b3klM0UlMjBiYWNrcGFjayUyMiUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZShwcm9tcHQlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENTApLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMmNhdC1iYWNrcGFjay5wbmclMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline
<span class="hljs-keyword">import</span> torch

model_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)

pipe.load_textual_inversion(<span class="hljs-string">&quot;sd-concepts-library/cat-toy&quot;</span>)

prompt = <span class="hljs-string">&quot;A &lt;cat-toy&gt; backpack&quot;</span>

image = pipe(prompt, num_inference_steps=<span class="hljs-number">50</span>).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;cat-backpack.png&quot;</span>)`}}),{c(){c=r("p"),T=i("To load a textual inversion embedding vector in \u{1F917} Diffusers format:"),u=f(),y(m.$$.fragment)},l(a){c=n(a,"P",{});var g=s(c);T=l(g,"To load a textual inversion embedding vector in \u{1F917} Diffusers format:"),g.forEach(t),u=p(a),x(m.$$.fragment,a)},m(a,g){_(a,c,g),e(c,T),_(a,u,g),b(m,a,g),v=!0},p:dr,i(a){v||(w(m.$$.fragment,a),v=!0)},o(a){M(m.$$.fragment,a),v=!1},d(a){a&&t(c),a&&t(u),$(m,a)}}}function en(Z){let c,T,u,m,v;return m=new cr({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFtb2RlbF9pZCUyMCUzRCUyMCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMiklMEElMEFwaXBlLmxvYWRfdGV4dHVhbF9pbnZlcnNpb24oJTIyLiUyRmNoYXJ0dXJuZXJ2Mi5wdCUyMiUyQyUyMHRva2VuJTNEJTIyY2hhcnR1cm5lcnYyJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMmNoYXJ0dXJuZXJ2MiUyQyUyMG11bHRpcGxlJTIwdmlld3MlMjBvZiUyMHRoZSUyMHNhbWUlMjBjaGFyYWN0ZXIlMjBpbiUyMHRoZSUyMHNhbWUlMjBvdXRmaXQlMkMlMjBhJTIwY2hhcmFjdGVyJTIwdHVybmFyb3VuZCUyMG9mJTIwYSUyMHdvbWFuJTIwd2VhcmluZyUyMGElMjBibGFjayUyMGphY2tldCUyMGFuZCUyMHJlZCUyMHNoaXJ0JTJDJTIwYmVzdCUyMHF1YWxpdHklMkMlMjBpbnRyaWNhdGUlMjBkZXRhaWxzLiUyMiUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZShwcm9tcHQlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENTApLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMmNoYXJhY3Rlci5wbmclMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline
<span class="hljs-keyword">import</span> torch

model_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)

pipe.load_textual_inversion(<span class="hljs-string">&quot;./charturnerv2.pt&quot;</span>, token=<span class="hljs-string">&quot;charturnerv2&quot;</span>)

prompt = <span class="hljs-string">&quot;charturnerv2, multiple views of the same character in the same outfit, a character turnaround of a woman wearing a black jacket and red shirt, best quality, intricate details.&quot;</span>

image = pipe(prompt, num_inference_steps=<span class="hljs-number">50</span>).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;character.png&quot;</span>)`}}),{c(){c=r("p"),T=i("locally:"),u=f(),y(m.$$.fragment)},l(a){c=n(a,"P",{});var g=s(c);T=l(g,"locally:"),g.forEach(t),u=p(a),x(m.$$.fragment,a)},m(a,g){_(a,c,g),e(c,T),_(a,u,g),b(m,a,g),v=!0},p:dr,i(a){v||(w(m.$$.fragment,a),v=!0)},o(a){M(m.$$.fragment,a),v=!1},d(a){a&&t(c),a&&t(u),$(m,a)}}}function on(Z){let c,T,u,m,v;return m=new cr({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBJTBBJTIzJTIwRG93bmxvYWQlMjBwaXBlbGluZSUyMGZyb20lMjBodWdnaW5nZmFjZS5jbyUyMGFuZCUyMGNhY2hlLiUwQXBpcGVsaW5lJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9zaW5nbGVfZmlsZSglMEElMjAlMjAlMjAlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGV2Fycmlvck1hbWE3NzclMkZPcmFuZ2VNaXhzJTJGYmxvYiUyRm1haW4lMkZNb2RlbHMlMkZBYnlzc09yYW5nZU1peCUyRkFieXNzT3JhbmdlTWl4LnNhZmV0ZW5zb3JzJTIyJTBBKSUwQSUwQSUyMyUyMERvd25sb2FkJTIwcGlwZWxpbmUlMjBmcm9tJTIwbG9jYWwlMjBmaWxlJTBBJTIzJTIwZmlsZSUyMGlzJTIwZG93bmxvYWRlZCUyMHVuZGVyJTIwLiUyRnYxLTUtcHJ1bmVkLWVtYW9ubHkuY2twdCUwQXBpcGVsaW5lJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9zaW5nbGVfZmlsZSglMjIuJTJGdjEtNS1wcnVuZWQtZW1hb25seSUyMiklMEElMEElMjMlMjBFbmFibGUlMjBmbG9hdDE2JTIwYW5kJTIwbW92ZSUyMHRvJTIwR1BVJTBBcGlwZWxpbmUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25QaXBlbGluZS5mcm9tX3NpbmdsZV9maWxlKCUwQSUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyRmJsb2IlMkZtYWluJTJGdjEtNS1wcnVuZWQtZW1hb25seS5ja3B0JTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTBBKSUwQXBpcGVsaW5lLnRvKCUyMmN1ZGElMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Download pipeline from huggingface.co and cache.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline = StableDiffusionPipeline.from_single_file(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/WarriorMama777/OrangeMixs/blob/main/Models/AbyssOrangeMix/AbyssOrangeMix.safetensors&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Download pipeline from local file</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># file is downloaded under ./v1-5-pruned-emaonly.ckpt</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline = StableDiffusionPipeline.from_single_file(<span class="hljs-string">&quot;./v1-5-pruned-emaonly&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Enable float16 and move to GPU</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline = StableDiffusionPipeline.from_single_file(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/runwayml/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.ckpt&quot;</span>,
<span class="hljs-meta">... </span>    torch_dtype=torch.float16,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline.to(<span class="hljs-string">&quot;cuda&quot;</span>)`}}),{c(){c=r("p"),T=i("Examples:"),u=f(),y(m.$$.fragment)},l(a){c=n(a,"P",{});var g=s(c);T=l(g,"Examples:"),g.forEach(t),u=p(a),x(m.$$.fragment,a)},m(a,g){_(a,c,g),e(c,T),_(a,u,g),b(m,a,g),v=!0},p:dr,i(a){v||(w(m.$$.fragment,a),v=!0)},o(a){M(m.$$.fragment,a),v=!1},d(a){a&&t(c),a&&t(u),$(m,a)}}}function tn(Z){let c,T,u,m,v,a,g,j,P,H,E,A,L,Ze,We,me,X,wo,G,Q,Oe,he,Ro,Ke,Bo,Mo,N,ue,Yo,O,ge,Vo,F,zo,je,Ho,Xo,_e,eo,Qo,Oo,oo,Ko,et,ot,K,ve,tt,ye,rt,Pe,nt,st,$o,q,ee,to,xe,at,ro,it,To,k,be,lt,no,dt,ct,U,we,ft,Me,pt,Ae,mt,ht,ut,so,gt,_t,oe,vt,$e,yt,Te,xt,bt,wt,te,Mt,re,Le,$t,ao,Tt,Lo,R,ne,io,Ue,Lt,lo,Ut,Uo,I,ke,kt,B,It,Ge,Et,Jt,Ie,co,Nt,Ft,Ct,se,Ee,Dt,Y,St,qe,Zt,Wt,Je,fo,jt,Pt,At,ae,Ne,Gt,po,qt,ko,V,ie,mo,Fe,Rt,ho,Bt,Io,C,Ce,Yt,z,Vt,uo,zt,Ht,Re,Xt,Qt,Ot,W,De,Kt,D,er,Be,or,tr,go,rr,nr,_o,sr,ar,ir,le,Eo;return a=new bo({}),X=new Qr({props:{warning:!0,$$slots:{default:[Or]},$$scope:{ctx:Z}}}),he=new bo({}),ue=new S({props:{name:"class diffusers.loaders.UNet2DConditionLoadersMixin",anchor:"diffusers.loaders.UNet2DConditionLoadersMixin",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/loaders.py#L112"}}),ge=new S({props:{name:"load_attn_procs",anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.load_attn_procs",parameters:[{name:"pretrained_model_name_or_path_or_dict",val:": typing.Union[str, typing.Dict[str, torch.Tensor]]"},{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.18.2/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.use_auth_token",description:`<strong>use_auth_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:"use_auth_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.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.18.2/src/diffusers/loaders.py#L116"}}),ve=new S({props:{name:"save_attn_procs",anchor:"diffusers.loaders.UNet2DConditionLoadersMixin.save_attn_procs",parameters:[{name:"save_directory",val:": typing.Union[str, os.PathLike]"},{name:"is_main_process",val:": bool = True"},{name:"weight_name",val:": str = None"},{name:"save_function",val:": typing.Callable = None"},{name:"safe_serialization",val:": bool = False"},{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"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/loaders.py#L329"}}),xe=new bo({}),be=new S({props:{name:"class diffusers.loaders.TextualInversionLoaderMixin",anchor:"diffusers.loaders.TextualInversionLoaderMixin",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/loaders.py#L407"}}),we=new S({props:{name:"load_textual_inversion",anchor:"diffusers.loaders.TextualInversionLoaderMixin.load_textual_inversion",parameters:[{name:"pretrained_model_name_or_path",val:": typing.Union[str, typing.List[str], typing.Dict[str, torch.Tensor], typing.List[typing.Dict[str, torch.Tensor]]]"},{name:"token",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.loaders.TextualInversionLoaderMixin.load_textual_inversion.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code> or <code>os.PathLike</code> or <code>List[str or os.PathLike]</code> or <code>Dict</code> or <code>List[Dict]</code>) &#x2014;
Can be either one of the following or a list of them:</p>
<ul>
<li>A string, the <em>model id</em> (for example <code>sd-concepts-library/low-poly-hd-logos-icons</code>) of a
pretrained model hosted on the Hub.</li>
<li>A path to a <em>directory</em> (for example <code>./my_text_inversion_directory/</code>) containing the textual
inversion weights.</li>
<li>A path to a <em>file</em> (for example <code>./my_text_inversions.pt</code>) containing textual inversion weights.</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"},{anchor:"diffusers.loaders.TextualInversionLoaderMixin.load_textual_inversion.token",description:`<strong>token</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
Override the token to use for the textual inversion weights. If <code>pretrained_model_name_or_path</code> is a
list, then <code>token</code> must also be a list of equal length.`,name:"token"},{anchor:"diffusers.loaders.TextualInversionLoaderMixin.load_textual_inversion.weight_name",description:`<strong>weight_name</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Name of a custom weight file. This should be used when:</p>
<ul>
<li>The saved textual inversion file is in &#x1F917; Diffusers format, but was saved under a specific weight
name such as <code>text_inv.bin</code>.</li>
<li>The saved textual inversion file is in the Automatic1111 format.</li>
</ul>`,name:"weight_name"},{anchor:"diffusers.loaders.TextualInversionLoaderMixin.load_textual_inversion.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.TextualInversionLoaderMixin.load_textual_inversion.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.TextualInversionLoaderMixin.load_textual_inversion.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.TextualInversionLoaderMixin.load_textual_inversion.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.TextualInversionLoaderMixin.load_textual_inversion.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.TextualInversionLoaderMixin.load_textual_inversion.use_auth_token",description:`<strong>use_auth_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:"use_auth_token"},{anchor:"diffusers.loaders.TextualInversionLoaderMixin.load_textual_inversion.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.TextualInversionLoaderMixin.load_textual_inversion.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.TextualInversionLoaderMixin.load_textual_inversion.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.18.2/src/diffusers/loaders.py#L469"}}),oe=new lr({props:{anchor:"diffusers.loaders.TextualInversionLoaderMixin.load_textual_inversion.example",$$slots:{default:[Kr]},$$scope:{ctx:Z}}}),te=new lr({props:{anchor:"diffusers.loaders.TextualInversionLoaderMixin.load_textual_inversion.example-2",$$slots:{default:[en]},$$scope:{ctx:Z}}}),Le=new S({props:{name:"maybe_convert_prompt",anchor:"diffusers.loaders.TextualInversionLoaderMixin.maybe_convert_prompt",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"tokenizer",val:": PreTrainedTokenizer"}],parametersDescription:[{anchor:"diffusers.loaders.TextualInversionLoaderMixin.maybe_convert_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or list of <code>str</code>) &#x2014;
The prompt or prompts to guide the image generation.`,name:"prompt"},{anchor:"diffusers.loaders.TextualInversionLoaderMixin.maybe_convert_prompt.tokenizer",description:`<strong>tokenizer</strong> (<code>PreTrainedTokenizer</code>) &#x2014;
The tokenizer responsible for encoding the prompt into input tokens.`,name:"tokenizer"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/loaders.py#L412",returnDescription:`
<p>The converted prompt</p>
`,returnType:`
<p><code>str</code> or list of <code>str</code></p>
`}}),Ue=new bo({}),ke=new S({props:{name:"class diffusers.loaders.LoraLoaderMixin",anchor:"diffusers.loaders.LoraLoaderMixin",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/loaders.py#L738"}}),Ee=new S({props:{name:"load_lora_weights",anchor:"diffusers.loaders.LoraLoaderMixin.load_lora_weights",parameters:[{name:"pretrained_model_name_or_path_or_dict",val:": typing.Union[str, typing.Dict[str, torch.Tensor]]"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.loaders.LoraLoaderMixin.load_lora_weights.pretrained_model_name_or_path_or_dict",description:`<strong>pretrained_model_name_or_path_or_dict</strong> (<code>str</code> or <code>os.PathLike</code> or <code>dict</code>) &#x2014;
Can be either:</p>
<ul>
<li>A string, the <em>model id</em> (for example <code>google/ddpm-celebahq-256</code>) of a pretrained model hosted on
the Hub.</li>
<li>A path to a <em>directory</em> (for example <code>./my_model_directory</code>) containing the model weights saved
with <a href="/docs/diffusers/v0.18.2/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.LoraLoaderMixin.load_lora_weights.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.LoraLoaderMixin.load_lora_weights.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.LoraLoaderMixin.load_lora_weights.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.LoraLoaderMixin.load_lora_weights.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.LoraLoaderMixin.load_lora_weights.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.LoraLoaderMixin.load_lora_weights.use_auth_token",description:`<strong>use_auth_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:"use_auth_token"},{anchor:"diffusers.loaders.LoraLoaderMixin.load_lora_weights.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.LoraLoaderMixin.load_lora_weights.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.LoraLoaderMixin.load_lora_weights.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.18.2/src/diffusers/loaders.py#L746"}}),Ne=new S({props:{name:"save_lora_weights",anchor:"diffusers.loaders.LoraLoaderMixin.save_lora_weights",parameters:[{name:"save_directory",val:": typing.Union[str, os.PathLike]"},{name:"unet_lora_layers",val:": typing.Dict[str, typing.Union[torch.nn.modules.module.Module, torch.Tensor]] = None"},{name:"text_encoder_lora_layers",val:": typing.Dict[str, torch.nn.modules.module.Module] = None"},{name:"is_main_process",val:": bool = True"},{name:"weight_name",val:": str = None"},{name:"save_function",val:": typing.Callable = None"},{name:"safe_serialization",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.loaders.LoraLoaderMixin.save_lora_weights.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Directory to save LoRA parameters to. Will be created if it doesn&#x2019;t exist.`,name:"save_directory"},{anchor:"diffusers.loaders.LoraLoaderMixin.save_lora_weights.unet_lora_layers",description:`<strong>unet_lora_layers</strong> (<code>Dict[str, torch.nn.Module]</code> or <code>Dict[str, torch.Tensor]</code>) &#x2014;
State dict of the LoRA layers corresponding to the UNet.`,name:"unet_lora_layers"},{anchor:"diffusers.loaders.LoraLoaderMixin.save_lora_weights.text_encoder_lora_layers",description:"<strong>text_encoder_lora_layers</strong> (<code>Dict[str, torch.nn.Module] or </code>Dict[str, torch.Tensor]<code>) -- State dict of the LoRA layers corresponding to the </code>text_encoder`. Must explicitly pass the text\nencoder LoRA state dict because it comes &#x1F917; Transformers.",name:"text_encoder_lora_layers"},{anchor:"diffusers.loaders.LoraLoaderMixin.save_lora_weights.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.LoraLoaderMixin.save_lora_weights.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"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/loaders.py#L1150"}}),Fe=new bo({}),Ce=new S({props:{name:"class diffusers.loaders.FromSingleFileMixin",anchor:"diffusers.loaders.FromSingleFileMixin",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/loaders.py#L1279"}}),De=new S({props:{name:"from_single_file",anchor:"diffusers.loaders.FromSingleFileMixin.from_single_file",parameters:[{name:"pretrained_model_link_or_path",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.loaders.FromSingleFileMixin.from_single_file.pretrained_model_link_or_path",description:`<strong>pretrained_model_link_or_path</strong> (<code>str</code> or <code>os.PathLike</code>, <em>optional</em>) &#x2014;
Can be either:<ul>
<li>A link to the <code>.ckpt</code> file (for example
<code>&quot;https://huggingface.co/&lt;repo_id&gt;/blob/main/&lt;path_to_file&gt;.ckpt&quot;</code>) on the Hub.</li>
<li>A path to a <em>file</em> containing all pipeline weights.</li>
</ul>`,name:"pretrained_model_link_or_path"},{anchor:"diffusers.loaders.FromSingleFileMixin.from_single_file.torch_dtype",description:`<strong>torch_dtype</strong> (<code>str</code> or <code>torch.dtype</code>, <em>optional</em>) &#x2014;
Override the default <code>torch.dtype</code> and load the model with another dtype. If <code>&quot;auto&quot;</code> is passed, the
dtype is automatically derived from the model&#x2019;s weights.`,name:"torch_dtype"},{anchor:"diffusers.loaders.FromSingleFileMixin.from_single_file.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.FromSingleFileMixin.from_single_file.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.FromSingleFileMixin.from_single_file.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.FromSingleFileMixin.from_single_file.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.FromSingleFileMixin.from_single_file.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 True, the model
won&#x2019;t be downloaded from the Hub.`,name:"local_files_only"},{anchor:"diffusers.loaders.FromSingleFileMixin.from_single_file.use_auth_token",description:`<strong>use_auth_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:"use_auth_token"},{anchor:"diffusers.loaders.FromSingleFileMixin.from_single_file.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.FromSingleFileMixin.from_single_file.use_safetensors",description:`<strong>use_safetensors</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
If set to <code>None</code>, the safetensors weights are downloaded if they&#x2019;re available <strong>and</strong> if the
safetensors library is installed. If set to <code>True</code>, the model is forcibly loaded from safetensors
weights. If set to <code>False</code>, safetensors weights are not loaded.`,name:"use_safetensors"},{anchor:"diffusers.loaders.FromSingleFileMixin.from_single_file.extract_ema",description:`<strong>extract_ema</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to extract the EMA weights or not. Pass <code>True</code> to extract the EMA weights which usually yield
higher quality images for inference. Non-EMA weights are usually better to continue finetuning.`,name:"extract_ema"},{anchor:"diffusers.loaders.FromSingleFileMixin.from_single_file.upcast_attention",description:`<strong>upcast_attention</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Whether the attention computation should always be upcasted.`,name:"upcast_attention"},{anchor:"diffusers.loaders.FromSingleFileMixin.from_single_file.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The image size the model was trained on. Use 512 for all Stable Diffusion v1 models and the Stable
Diffusion v2 base model. Use 768 for Stable Diffusion v2.`,name:"image_size"},{anchor:"diffusers.loaders.FromSingleFileMixin.from_single_file.prediction_type",description:`<strong>prediction_type</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The prediction type the model was trained on. Use <code>&apos;epsilon&apos;</code> for all Stable Diffusion v1 models and
the Stable Diffusion v2 base model. Use <code>&apos;v_prediction&apos;</code> for Stable Diffusion v2.`,name:"prediction_type"},{anchor:"diffusers.loaders.FromSingleFileMixin.from_single_file.num_in_channels",description:`<strong>num_in_channels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
The number of input channels. If <code>None</code>, it will be automatically inferred.`,name:"num_in_channels"},{anchor:"diffusers.loaders.FromSingleFileMixin.from_single_file.scheduler_type",description:`<strong>scheduler_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pndm&quot;</code>) &#x2014;
Type of scheduler to use. Should be one of <code>[&quot;pndm&quot;, &quot;lms&quot;, &quot;heun&quot;, &quot;euler&quot;, &quot;euler-ancestral&quot;, &quot;dpm&quot;, &quot;ddim&quot;]</code>.`,name:"scheduler_type"},{anchor:"diffusers.loaders.FromSingleFileMixin.from_single_file.load_safety_checker",description:`<strong>load_safety_checker</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to load the safety checker or not.`,name:"load_safety_checker"},{anchor:"diffusers.loaders.FromSingleFileMixin.from_single_file.text_encoder",description:`<strong>text_encoder</strong> (<code>CLIPTextModel</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
An instance of
<a href="https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModel" rel="nofollow">CLIP</a> to use,
specifically the <a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a>
variant. If this parameter is <code>None</code>, the function will load a new instance of [CLIP] by itself, if
needed.`,name:"text_encoder"},{anchor:"diffusers.loaders.FromSingleFileMixin.from_single_file.tokenizer",description:`<strong>tokenizer</strong> (<code>CLIPTokenizer</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
An instance of
<a href="https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>
to use. If this parameter is <code>None</code>, the function will load a new instance of [CLIPTokenizer] by
itself, if needed.`,name:"tokenizer"},{anchor:"diffusers.loaders.FromSingleFileMixin.from_single_file.kwargs",description:`<strong>kwargs</strong> (remaining dictionary of keyword arguments, <em>optional</em>) &#x2014;
Can be used to overwrite load and saveable variables (for example the pipeline components of the
specific pipeline class). The overwritten components are directly passed to the pipelines <code>__init__</code>
method. See example below for more information.`,name:"kwargs"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/loaders.py#L1290"}}),le=new lr({props:{anchor:"diffusers.loaders.FromSingleFileMixin.from_single_file.example",$$slots:{default:[on]},$$scope:{ctx:Z}}}),{c(){c=r("meta"),T=f(),u=r("h1"),m=r("a"),v=r("span"),y(a.$$.fragment),g=f(),j=r("span"),P=i("Loaders"),H=f(),E=r("p"),A=i("Adapters (textual inversion, LoRA, hypernetworks) allow you to modify a diffusion model to generate images in a specific style without training or finetuning the entire model. The adapter weights are typically only a tiny fraction of the pretrained model\u2019s which making them very portable. \u{1F917} Diffusers provides an easy-to-use "),L=r("code"),Ze=i("LoaderMixin"),We=i(" API to load adapter weights."),me=f(),y(X.$$.fragment),wo=f(),G=r("h2"),Q=r("a"),Oe=r("span"),y(he.$$.fragment),Ro=f(),Ke=r("span"),Bo=i("UNet2DConditionLoadersMixin"),Mo=f(),N=r("div"),y(ue.$$.fragment),Yo=f(),O=r("div"),y(ge.$$.fragment),Vo=f(),F=r("p"),zo=i("Load pretrained attention processor layers into "),je=r("a"),Ho=i("UNet2DConditionModel"),Xo=i(`. Attention processor layers have to be
defined in
`),_e=r("a"),eo=r("code"),Qo=i("cross_attention.py"),Oo=i(`
and be a `),oo=r("code"),Ko=i("torch.nn.Module"),et=i(" class."),ot=f(),K=r("div"),y(ve.$$.fragment),tt=f(),ye=r("p"),rt=i(`Save an attention processor to a directory so that it can be reloaded using the
`),Pe=r("a"),nt=i("load_attn_procs()"),st=i(" method."),$o=f(),q=r("h2"),ee=r("a"),to=r("span"),y(xe.$$.fragment),at=f(),ro=r("span"),it=i("TextualInversionLoaderMixin"),To=f(),k=r("div"),y(be.$$.fragment),lt=f(),no=r("p"),dt=i("Load textual inversion tokens and embeddings to the tokenizer and text encoder."),ct=f(),U=r("div"),y(we.$$.fragment),ft=f(),Me=r("p"),pt=i("Load textual inversion embeddings into the text encoder of "),Ae=r("a"),mt=i("StableDiffusionPipeline"),ht=i(` (both \u{1F917} Diffusers and
Automatic1111 formats are supported).`),ut=f(),so=r("p"),gt=i("Example:"),_t=f(),y(oe.$$.fragment),vt=f(),$e=r("p"),yt=i(`To load a textual inversion embedding vector in Automatic1111 format, make sure to download the vector first
(for example from `),Te=r("a"),xt=i("civitAI"),bt=i(") and then load the vector"),wt=f(),y(te.$$.fragment),Mt=f(),re=r("div"),y(Le.$$.fragment),$t=f(),ao=r("p"),Tt=i(`Processes prompts that include a special token corresponding to a multi-vector textual inversion embedding to
be replaced with multiple special tokens each corresponding to one of the vectors. If the prompt has no textual
inversion token or if the textual inversion token is a single vector, the input prompt is returned.`),Lo=f(),R=r("h2"),ne=r("a"),io=r("span"),y(Ue.$$.fragment),Lt=f(),lo=r("span"),Ut=i("LoraLoaderMixin"),Uo=f(),I=r("div"),y(ke.$$.fragment),kt=f(),B=r("p"),It=i("Load LoRA layers into "),Ge=r("a"),Et=i("UNet2DConditionModel"),Jt=i(` and
`),Ie=r("a"),co=r("code"),Nt=i("CLIPTextModel"),Ft=i("."),Ct=f(),se=r("div"),y(Ee.$$.fragment),Dt=f(),Y=r("p"),St=i("Load pretrained LoRA attention processor layers into "),qe=r("a"),Zt=i("UNet2DConditionModel"),Wt=i(` and
`),Je=r("a"),fo=r("code"),jt=i("CLIPTextModel"),Pt=i("."),At=f(),ae=r("div"),y(Ne.$$.fragment),Gt=f(),po=r("p"),qt=i("Save the LoRA parameters corresponding to the UNet and text encoder."),ko=f(),V=r("h2"),ie=r("a"),mo=r("span"),y(Fe.$$.fragment),Rt=f(),ho=r("span"),Bt=i("FromSingleFileMixin"),Io=f(),C=r("div"),y(Ce.$$.fragment),Yt=f(),z=r("p"),Vt=i("Load model weights saved in the "),uo=r("code"),zt=i(".ckpt"),Ht=i(" format into a "),Re=r("a"),Xt=i("DiffusionPipeline"),Qt=i("."),Ot=f(),W=r("div"),y(De.$$.fragment),Kt=f(),D=r("p"),er=i("Instantiate a "),Be=r("a"),or=i("DiffusionPipeline"),tr=i(" from pretrained pipeline weights saved in the "),go=r("code"),rr=i(".ckpt"),nr=i(` format. The pipeline
is set in evaluation mode (`),_o=r("code"),sr=i("model.eval()"),ar=i(") by default."),ir=f(),y(le.$$.fragment),this.h()},l(o){const h=Hr('[data-svelte="svelte-1phssyn"]',document.head);c=n(h,"META",{name:!0,content:!0}),h.forEach(t),T=p(o),u=n(o,"H1",{class:!0});var Se=s(u);m=n(Se,"A",{id:!0,class:!0,href:!0});var vo=s(m);v=n(vo,"SPAN",{});var yo=s(v);x(a.$$.fragment,yo),yo.forEach(t),vo.forEach(t),g=p(Se),j=n(Se,"SPAN",{});var xo=s(j);P=l(xo,"Loaders"),xo.forEach(t),Se.forEach(t),H=p(o),E=n(o,"P",{});var Jo=s(E);A=l(Jo,"Adapters (textual inversion, LoRA, hypernetworks) allow you to modify a diffusion model to generate images in a specific style without training or finetuning the entire model. The adapter weights are typically only a tiny fraction of the pretrained model\u2019s which making them very portable. \u{1F917} Diffusers provides an easy-to-use "),L=n(Jo,"CODE",{});var fr=s(L);Ze=l(fr,"LoaderMixin"),fr.forEach(t),We=l(Jo," API to load adapter weights."),Jo.forEach(t),me=p(o),x(X.$$.fragment,o),wo=p(o),G=n(o,"H2",{class:!0});var No=s(G);Q=n(No,"A",{id:!0,class:!0,href:!0});var pr=s(Q);Oe=n(pr,"SPAN",{});var mr=s(Oe);x(he.$$.fragment,mr),mr.forEach(t),pr.forEach(t),Ro=p(No),Ke=n(No,"SPAN",{});var hr=s(Ke);Bo=l(hr,"UNet2DConditionLoadersMixin"),hr.forEach(t),No.forEach(t),Mo=p(o),N=n(o,"DIV",{class:!0});var Ye=s(N);x(ue.$$.fragment,Ye),Yo=p(Ye),O=n(Ye,"DIV",{class:!0});var Fo=s(O);x(ge.$$.fragment,Fo),Vo=p(Fo),F=n(Fo,"P",{});var de=s(F);zo=l(de,"Load pretrained attention processor layers into "),je=n(de,"A",{href:!0});var ur=s(je);Ho=l(ur,"UNet2DConditionModel"),ur.forEach(t),Xo=l(de,`. Attention processor layers have to be
defined in
`),_e=n(de,"A",{href:!0,rel:!0});var gr=s(_e);eo=n(gr,"CODE",{});var _r=s(eo);Qo=l(_r,"cross_attention.py"),_r.forEach(t),gr.forEach(t),Oo=l(de,`
and be a `),oo=n(de,"CODE",{});var vr=s(oo);Ko=l(vr,"torch.nn.Module"),vr.forEach(t),et=l(de," class."),de.forEach(t),Fo.forEach(t),ot=p(Ye),K=n(Ye,"DIV",{class:!0});var Co=s(K);x(ve.$$.fragment,Co),tt=p(Co),ye=n(Co,"P",{});var Do=s(ye);rt=l(Do,`Save an attention processor to a directory so that it can be reloaded using the
`),Pe=n(Do,"A",{href:!0});var yr=s(Pe);nt=l(yr,"load_attn_procs()"),yr.forEach(t),st=l(Do," method."),Do.forEach(t),Co.forEach(t),Ye.forEach(t),$o=p(o),q=n(o,"H2",{class:!0});var So=s(q);ee=n(So,"A",{id:!0,class:!0,href:!0});var xr=s(ee);to=n(xr,"SPAN",{});var br=s(to);x(xe.$$.fragment,br),br.forEach(t),xr.forEach(t),at=p(So),ro=n(So,"SPAN",{});var wr=s(ro);it=l(wr,"TextualInversionLoaderMixin"),wr.forEach(t),So.forEach(t),To=p(o),k=n(o,"DIV",{class:!0});var ce=s(k);x(be.$$.fragment,ce),lt=p(ce),no=n(ce,"P",{});var Mr=s(no);dt=l(Mr,"Load textual inversion tokens and embeddings to the tokenizer and text encoder."),Mr.forEach(t),ct=p(ce),U=n(ce,"DIV",{class:!0});var J=s(U);x(we.$$.fragment,J),ft=p(J),Me=n(J,"P",{});var Zo=s(Me);pt=l(Zo,"Load textual inversion embeddings into the text encoder of "),Ae=n(Zo,"A",{href:!0});var $r=s(Ae);mt=l($r,"StableDiffusionPipeline"),$r.forEach(t),ht=l(Zo,` (both \u{1F917} Diffusers and
Automatic1111 formats are supported).`),Zo.forEach(t),ut=p(J),so=n(J,"P",{});var Tr=s(so);gt=l(Tr,"Example:"),Tr.forEach(t),_t=p(J),x(oe.$$.fragment,J),vt=p(J),$e=n(J,"P",{});var Wo=s($e);yt=l(Wo,`To load a textual inversion embedding vector in Automatic1111 format, make sure to download the vector first
(for example from `),Te=n(Wo,"A",{href:!0,rel:!0});var Lr=s(Te);xt=l(Lr,"civitAI"),Lr.forEach(t),bt=l(Wo,") and then load the vector"),Wo.forEach(t),wt=p(J),x(te.$$.fragment,J),J.forEach(t),Mt=p(ce),re=n(ce,"DIV",{class:!0});var jo=s(re);x(Le.$$.fragment,jo),$t=p(jo),ao=n(jo,"P",{});var Ur=s(ao);Tt=l(Ur,`Processes prompts that include a special token corresponding to a multi-vector textual inversion embedding to
be replaced with multiple special tokens each corresponding to one of the vectors. If the prompt has no textual
inversion token or if the textual inversion token is a single vector, the input prompt is returned.`),Ur.forEach(t),jo.forEach(t),ce.forEach(t),Lo=p(o),R=n(o,"H2",{class:!0});var Po=s(R);ne=n(Po,"A",{id:!0,class:!0,href:!0});var kr=s(ne);io=n(kr,"SPAN",{});var Ir=s(io);x(Ue.$$.fragment,Ir),Ir.forEach(t),kr.forEach(t),Lt=p(Po),lo=n(Po,"SPAN",{});var Er=s(lo);Ut=l(Er,"LoraLoaderMixin"),Er.forEach(t),Po.forEach(t),Uo=p(o),I=n(o,"DIV",{class:!0});var fe=s(I);x(ke.$$.fragment,fe),kt=p(fe),B=n(fe,"P",{});var Ve=s(B);It=l(Ve,"Load LoRA layers into "),Ge=n(Ve,"A",{href:!0});var Jr=s(Ge);Et=l(Jr,"UNet2DConditionModel"),Jr.forEach(t),Jt=l(Ve,` and
`),Ie=n(Ve,"A",{href:!0,rel:!0});var Nr=s(Ie);co=n(Nr,"CODE",{});var Fr=s(co);Nt=l(Fr,"CLIPTextModel"),Fr.forEach(t),Nr.forEach(t),Ft=l(Ve,"."),Ve.forEach(t),Ct=p(fe),se=n(fe,"DIV",{class:!0});var Ao=s(se);x(Ee.$$.fragment,Ao),Dt=p(Ao),Y=n(Ao,"P",{});var ze=s(Y);St=l(ze,"Load pretrained LoRA attention processor layers into "),qe=n(ze,"A",{href:!0});var Cr=s(qe);Zt=l(Cr,"UNet2DConditionModel"),Cr.forEach(t),Wt=l(ze,` and
`),Je=n(ze,"A",{href:!0,rel:!0});var Dr=s(Je);fo=n(Dr,"CODE",{});var Sr=s(fo);jt=l(Sr,"CLIPTextModel"),Sr.forEach(t),Dr.forEach(t),Pt=l(ze,"."),ze.forEach(t),Ao.forEach(t),At=p(fe),ae=n(fe,"DIV",{class:!0});var Go=s(ae);x(Ne.$$.fragment,Go),Gt=p(Go),po=n(Go,"P",{});var Zr=s(po);qt=l(Zr,"Save the LoRA parameters corresponding to the UNet and text encoder."),Zr.forEach(t),Go.forEach(t),fe.forEach(t),ko=p(o),V=n(o,"H2",{class:!0});var qo=s(V);ie=n(qo,"A",{id:!0,class:!0,href:!0});var Wr=s(ie);mo=n(Wr,"SPAN",{});var jr=s(mo);x(Fe.$$.fragment,jr),jr.forEach(t),Wr.forEach(t),Rt=p(qo),ho=n(qo,"SPAN",{});var Pr=s(ho);Bt=l(Pr,"FromSingleFileMixin"),Pr.forEach(t),qo.forEach(t),Io=p(o),C=n(o,"DIV",{class:!0});var He=s(C);x(Ce.$$.fragment,He),Yt=p(He),z=n(He,"P",{});var Xe=s(z);Vt=l(Xe,"Load model weights saved in the "),uo=n(Xe,"CODE",{});var Ar=s(uo);zt=l(Ar,".ckpt"),Ar.forEach(t),Ht=l(Xe," format into a "),Re=n(Xe,"A",{href:!0});var Gr=s(Re);Xt=l(Gr,"DiffusionPipeline"),Gr.forEach(t),Qt=l(Xe,"."),Xe.forEach(t),Ot=p(He),W=n(He,"DIV",{class:!0});var Qe=s(W);x(De.$$.fragment,Qe),Kt=p(Qe),D=n(Qe,"P",{});var pe=s(D);er=l(pe,"Instantiate a "),Be=n(pe,"A",{href:!0});var qr=s(Be);or=l(qr,"DiffusionPipeline"),qr.forEach(t),tr=l(pe," from pretrained pipeline weights saved in the "),go=n(pe,"CODE",{});var Rr=s(go);rr=l(Rr,".ckpt"),Rr.forEach(t),nr=l(pe,` format. The pipeline
is set in evaluation mode (`),_o=n(pe,"CODE",{});var Br=s(_o);sr=l(Br,"model.eval()"),Br.forEach(t),ar=l(pe,") by default."),pe.forEach(t),ir=p(Qe),x(le.$$.fragment,Qe),Qe.forEach(t),He.forEach(t),this.h()},h(){d(c,"name","hf:doc:metadata"),d(c,"content",JSON.stringify(rn)),d(m,"id","loaders"),d(m,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(m,"href","#loaders"),d(u,"class","relative group"),d(Q,"id","diffusers.loaders.UNet2DConditionLoadersMixin"),d(Q,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Q,"href","#diffusers.loaders.UNet2DConditionLoadersMixin"),d(G,"class","relative group"),d(je,"href","/docs/diffusers/v0.18.2/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel"),d(_e,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/cross_attention.py"),d(_e,"rel","nofollow"),d(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Pe,"href","/docs/diffusers/v0.18.2/en/api/loaders#diffusers.loaders.UNet2DConditionLoadersMixin.load_attn_procs"),d(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ee,"id","diffusers.loaders.TextualInversionLoaderMixin"),d(ee,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ee,"href","#diffusers.loaders.TextualInversionLoaderMixin"),d(q,"class","relative group"),d(Ae,"href","/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),d(Te,"href","https://civitai.com/models/3036?modelVersionId=9857"),d(Te,"rel","nofollow"),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"),d(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ne,"id","diffusers.loaders.LoraLoaderMixin"),d(ne,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ne,"href","#diffusers.loaders.LoraLoaderMixin"),d(R,"class","relative group"),d(Ge,"href","/docs/diffusers/v0.18.2/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel"),d(Ie,"href","https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModel"),d(Ie,"rel","nofollow"),d(qe,"href","/docs/diffusers/v0.18.2/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel"),d(Je,"href","https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModel"),d(Je,"rel","nofollow"),d(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ie,"id","diffusers.loaders.FromSingleFileMixin"),d(ie,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ie,"href","#diffusers.loaders.FromSingleFileMixin"),d(V,"class","relative group"),d(Re,"href","/docs/diffusers/v0.18.2/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),d(Be,"href","/docs/diffusers/v0.18.2/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),d(W,"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")},m(o,h){e(document.head,c),_(o,T,h),_(o,u,h),e(u,m),e(m,v),b(a,v,null),e(u,g),e(u,j),e(j,P),_(o,H,h),_(o,E,h),e(E,A),e(E,L),e(L,Ze),e(E,We),_(o,me,h),b(X,o,h),_(o,wo,h),_(o,G,h),e(G,Q),e(Q,Oe),b(he,Oe,null),e(G,Ro),e(G,Ke),e(Ke,Bo),_(o,Mo,h),_(o,N,h),b(ue,N,null),e(N,Yo),e(N,O),b(ge,O,null),e(O,Vo),e(O,F),e(F,zo),e(F,je),e(je,Ho),e(F,Xo),e(F,_e),e(_e,eo),e(eo,Qo),e(F,Oo),e(F,oo),e(oo,Ko),e(F,et),e(N,ot),e(N,K),b(ve,K,null),e(K,tt),e(K,ye),e(ye,rt),e(ye,Pe),e(Pe,nt),e(ye,st),_(o,$o,h),_(o,q,h),e(q,ee),e(ee,to),b(xe,to,null),e(q,at),e(q,ro),e(ro,it),_(o,To,h),_(o,k,h),b(be,k,null),e(k,lt),e(k,no),e(no,dt),e(k,ct),e(k,U),b(we,U,null),e(U,ft),e(U,Me),e(Me,pt),e(Me,Ae),e(Ae,mt),e(Me,ht),e(U,ut),e(U,so),e(so,gt),e(U,_t),b(oe,U,null),e(U,vt),e(U,$e),e($e,yt),e($e,Te),e(Te,xt),e($e,bt),e(U,wt),b(te,U,null),e(k,Mt),e(k,re),b(Le,re,null),e(re,$t),e(re,ao),e(ao,Tt),_(o,Lo,h),_(o,R,h),e(R,ne),e(ne,io),b(Ue,io,null),e(R,Lt),e(R,lo),e(lo,Ut),_(o,Uo,h),_(o,I,h),b(ke,I,null),e(I,kt),e(I,B),e(B,It),e(B,Ge),e(Ge,Et),e(B,Jt),e(B,Ie),e(Ie,co),e(co,Nt),e(B,Ft),e(I,Ct),e(I,se),b(Ee,se,null),e(se,Dt),e(se,Y),e(Y,St),e(Y,qe),e(qe,Zt),e(Y,Wt),e(Y,Je),e(Je,fo),e(fo,jt),e(Y,Pt),e(I,At),e(I,ae),b(Ne,ae,null),e(ae,Gt),e(ae,po),e(po,qt),_(o,ko,h),_(o,V,h),e(V,ie),e(ie,mo),b(Fe,mo,null),e(V,Rt),e(V,ho),e(ho,Bt),_(o,Io,h),_(o,C,h),b(Ce,C,null),e(C,Yt),e(C,z),e(z,Vt),e(z,uo),e(uo,zt),e(z,Ht),e(z,Re),e(Re,Xt),e(z,Qt),e(C,Ot),e(C,W),b(De,W,null),e(W,Kt),e(W,D),e(D,er),e(D,Be),e(Be,or),e(D,tr),e(D,go),e(go,rr),e(D,nr),e(D,_o),e(_o,sr),e(D,ar),e(W,ir),b(le,W,null),Eo=!0},p(o,[h]){const Se={};h&2&&(Se.$$scope={dirty:h,ctx:o}),X.$set(Se);const vo={};h&2&&(vo.$$scope={dirty:h,ctx:o}),oe.$set(vo);const yo={};h&2&&(yo.$$scope={dirty:h,ctx:o}),te.$set(yo);const xo={};h&2&&(xo.$$scope={dirty:h,ctx:o}),le.$set(xo)},i(o){Eo||(w(a.$$.fragment,o),w(X.$$.fragment,o),w(he.$$.fragment,o),w(ue.$$.fragment,o),w(ge.$$.fragment,o),w(ve.$$.fragment,o),w(xe.$$.fragment,o),w(be.$$.fragment,o),w(we.$$.fragment,o),w(oe.$$.fragment,o),w(te.$$.fragment,o),w(Le.$$.fragment,o),w(Ue.$$.fragment,o),w(ke.$$.fragment,o),w(Ee.$$.fragment,o),w(Ne.$$.fragment,o),w(Fe.$$.fragment,o),w(Ce.$$.fragment,o),w(De.$$.fragment,o),w(le.$$.fragment,o),Eo=!0)},o(o){M(a.$$.fragment,o),M(X.$$.fragment,o),M(he.$$.fragment,o),M(ue.$$.fragment,o),M(ge.$$.fragment,o),M(ve.$$.fragment,o),M(xe.$$.fragment,o),M(be.$$.fragment,o),M(we.$$.fragment,o),M(oe.$$.fragment,o),M(te.$$.fragment,o),M(Le.$$.fragment,o),M(Ue.$$.fragment,o),M(ke.$$.fragment,o),M(Ee.$$.fragment,o),M(Ne.$$.fragment,o),M(Fe.$$.fragment,o),M(Ce.$$.fragment,o),M(De.$$.fragment,o),M(le.$$.fragment,o),Eo=!1},d(o){t(c),o&&t(T),o&&t(u),$(a),o&&t(H),o&&t(E),o&&t(me),$(X,o),o&&t(wo),o&&t(G),$(he),o&&t(Mo),o&&t(N),$(ue),$(ge),$(ve),o&&t($o),o&&t(q),$(xe),o&&t(To),o&&t(k),$(be),$(we),$(oe),$(te),$(Le),o&&t(Lo),o&&t(R),$(Ue),o&&t(Uo),o&&t(I),$(ke),$(Ee),$(Ne),o&&t(ko),o&&t(V),$(Fe),o&&t(Io),o&&t(C),$(Ce),$(De),$(le)}}}const rn={local:"loaders",sections:[{local:"diffusers.loaders.UNet2DConditionLoadersMixin",title:"UNet2DConditionLoadersMixin"},{local:"diffusers.loaders.TextualInversionLoaderMixin",title:"TextualInversionLoaderMixin"},{local:"diffusers.loaders.LoraLoaderMixin",title:"LoraLoaderMixin"},{local:"diffusers.loaders.FromSingleFileMixin",title:"FromSingleFileMixin"}],title:"Loaders"};function nn(Z){return Xr(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class pn extends Yr{constructor(c){super();Vr(this,c,nn,tn,zr,{})}}export{pn as default,rn as metadata};
