import{s as Cl,o as xl,n as Ve}from"../chunks/scheduler.182ea377.js";import{S as Xl,i as kl,g as r,s as i,r as c,A as Ll,h as m,f as l,c as n,j as vl,u as M,x as u,k as S,y as Rl,a as s,v as y,d as g,t as b,w}from"../chunks/index.abf12888.js";import{T as Fe}from"../chunks/Tip.230e2334.js";import{C as $}from"../chunks/CodeBlock.57fe6e13.js";import{D as Hl}from"../chunks/DocNotebookDropdown.5fa27ace.js";import{H as Y}from"../chunks/Heading.16916d63.js";import{H as Vl,a as Il}from"../chunks/HfOption.fc88c804.js";function Ql(T){let a,j='Feel free to browse the <a href="https://huggingface.co/spaces/sd-concepts-library/stable-diffusion-conceptualizer" rel="nofollow">Stable Diffusion Conceptualizer</a>, <a href="https://huggingface.co/spaces/multimodalart/LoraTheExplorer" rel="nofollow">LoRA the Explorer</a>, and the <a href="https://huggingface.co/spaces/huggingface-projects/diffusers-gallery" rel="nofollow">Diffusers Models Gallery</a> for checkpoints and embeddings to use.';return{c(){a=r("p"),a.innerHTML=j},l(o){a=m(o,"P",{"data-svelte-h":!0}),u(a)!=="svelte-unc393"&&(a.innerHTML=j)},m(o,h){s(o,a,h)},p:Ve,d(o){o&&l(a)}}}function Al(T){let a,j='LoRA is a very general training technique that can be used with other training methods. For example, it is common to train a model with DreamBooth and LoRA. It is also increasingly common to load and merge multiple LoRAs to create new and unique images. You can learn more about it in the in-depth <a href="merge_loras">Merge LoRAs</a> guide since merging is outside the scope of this loading guide.';return{c(){a=r("p"),a.innerHTML=j},l(o){a=m(o,"P",{"data-svelte-h":!0}),u(a)!=="svelte-bp0omm"&&(a.innerHTML=j)},m(o,h){s(o,a,h)},p:Ve,d(o){o&&l(a)}}}function Fl(T){let a,j="Currently, <code>set_adapters()</code> only supports scaling attention weights. If a LoRA has other parts (e.g., resnets or down-/upsamplers), they will keep a scale of 1.0.";return{c(){a=r("p"),a.innerHTML=j},l(o){a=m(o,"P",{"data-svelte-h":!0}),u(a)!=="svelte-1aq2a67"&&(a.innerHTML=j)},m(o,h){s(o,a,h)},p:Ve,d(o){o&&l(a)}}}function Sl(T){let a,j="Some limitations of using Kohya LoRAs with 🤗 Diffusers include:",o,h,f='<li>Images may not look like those generated by UIs - like ComfyUI - for multiple reasons, which are explained <a href="https://github.com/huggingface/diffusers/pull/4287/#issuecomment-1655110736" rel="nofollow">here</a>.</li> <li><a href="https://github.com/KohakuBlueleaf/LyCORIS" rel="nofollow">LyCORIS checkpoints</a> aren’t fully supported. The <a href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline.load_lora_weights">load_lora_weights()</a> method loads LyCORIS checkpoints with LoRA and LoCon modules, but Hada and LoKR are not supported.</li>';return{c(){a=r("p"),a.textContent=j,o=i(),h=r("ul"),h.innerHTML=f},l(d){a=m(d,"P",{"data-svelte-h":!0}),u(a)!=="svelte-1aa8at7"&&(a.textContent=j),o=n(d),h=m(d,"UL",{"data-svelte-h":!0}),u(h)!=="svelte-51yoff"&&(h.innerHTML=f)},m(d,J){s(d,a,J),s(d,o,J),s(d,h,J)},p:Ve,d(d){d&&(l(a),l(o),l(h))}}}function Yl(T){let a,j='To load a Kohya LoRA, let’s download the <a href="https://civitai.com/models/150986/blueprintify-sd-xl-10" rel="nofollow">Blueprintify SD XL 1.0</a> checkpoint from <a href="https://civitai.com/" rel="nofollow">Civitai</a> as an example:',o,h,f,d,J='Load the LoRA checkpoint with the <a href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline.load_lora_weights">load_lora_weights()</a> method, and specify the filename in the <code>weight_name</code> parameter:',B,Z,q,_,C="Generate an image:",N,v,G,W,I;return h=new $({props:{code:"IXdnZXQlMjBodHRwcyUzQSUyRiUyRmNpdml0YWkuY29tJTJGYXBpJTJGZG93bmxvYWQlMkZtb2RlbHMlMkYxNjg3NzYlMjAtTyUyMGJsdWVwcmludGlmeS1zZC14bC0xMC5zYWZldGVuc29ycw==",highlighted:"!wget https://civitai.com/api/download/models/168776 -O blueprintify-sd-xl-10.safetensors",wrap:!1}}),Z=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lLmxvYWRfbG9yYV93ZWlnaHRzKCUyMnBhdGglMkZ0byUyRndlaWdodHMlMjIlMkMlMjB3ZWlnaHRfbmFtZSUzRCUyMmJsdWVwcmludGlmeS1zZC14bC0xMC5zYWZldGVuc29ycyUyMik=",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;path/to/weights&quot;</span>, weight_name=<span class="hljs-string">&quot;blueprintify-sd-xl-10.safetensors&quot;</span>)`,wrap:!1}}),v=new $({props:{code:"JTIzJTIwdXNlJTIwYmwzdXByaW50JTIwaW4lMjB0aGUlMjBwcm9tcHQlMjB0byUyMHRyaWdnZXIlMjB0aGUlMjBMb1JBJTBBcHJvbXB0JTIwJTNEJTIwJTIyYmwzdXByaW50JTJDJTIwYSUyMGhpZ2hseSUyMGRldGFpbGVkJTIwYmx1ZXByaW50JTIwb2YlMjB0aGUlMjBlaWZmZWwlMjB0b3dlciUyQyUyMGV4cGxhaW5pbmclMjBob3clMjB0byUyMGJ1aWxkJTIwYWxsJTIwcGFydHMlMkMlMjBtYW55JTIwdHh0JTJDJTIwYmx1ZXByaW50JTIwZ3JpZCUyMGJhY2tkcm9wJTIyJTBBaW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQpLmltYWdlcyU1QjAlNUQlMEFpbWFnZQ==",highlighted:`<span class="hljs-comment"># use bl3uprint in the prompt to trigger the LoRA</span>
prompt = <span class="hljs-string">&quot;bl3uprint, a highly detailed blueprint of the eiffel tower, explaining how to build all parts, many txt, blueprint grid backdrop&quot;</span>
image = pipeline(prompt).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),W=new Fe({props:{warning:!0,$$slots:{default:[Sl]},$$scope:{ctx:T}}}),{c(){a=r("p"),a.innerHTML=j,o=i(),c(h.$$.fragment),f=i(),d=r("p"),d.innerHTML=J,B=i(),c(Z.$$.fragment),q=i(),_=r("p"),_.textContent=C,N=i(),c(v.$$.fragment),G=i(),c(W.$$.fragment)},l(p){a=m(p,"P",{"data-svelte-h":!0}),u(a)!=="svelte-1xg7vsu"&&(a.innerHTML=j),o=n(p),M(h.$$.fragment,p),f=n(p),d=m(p,"P",{"data-svelte-h":!0}),u(d)!=="svelte-czbvsl"&&(d.innerHTML=J),B=n(p),M(Z.$$.fragment,p),q=n(p),_=m(p,"P",{"data-svelte-h":!0}),u(_)!=="svelte-1un5bjt"&&(_.textContent=C),N=n(p),M(v.$$.fragment,p),G=n(p),M(W.$$.fragment,p)},m(p,U){s(p,a,U),s(p,o,U),y(h,p,U),s(p,f,U),s(p,d,U),s(p,B,U),y(Z,p,U),s(p,q,U),s(p,_,U),s(p,N,U),y(v,p,U),s(p,G,U),y(W,p,U),I=!0},p(p,U){const Qe={};U&2&&(Qe.$$scope={dirty:U,ctx:p}),W.$set(Qe)},i(p){I||(g(h.$$.fragment,p),g(Z.$$.fragment,p),g(v.$$.fragment,p),g(W.$$.fragment,p),I=!0)},o(p){b(h.$$.fragment,p),b(Z.$$.fragment,p),b(v.$$.fragment,p),b(W.$$.fragment,p),I=!1},d(p){p&&(l(a),l(o),l(f),l(d),l(B),l(q),l(_),l(N),l(G)),w(h,p),w(Z,p),w(v,p),w(W,p)}}}function ql(T){let a,j='Loading a checkpoint from TheLastBen is very similar. For example, to load the <a href="https://huggingface.co/TheLastBen/William_Eggleston_Style_SDXL" rel="nofollow">TheLastBen/William_Eggleston_Style_SDXL</a> checkpoint:',o,h,f;return h=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lLmxvYWRfbG9yYV93ZWlnaHRzKCUyMlRoZUxhc3RCZW4lMkZXaWxsaWFtX0VnZ2xlc3Rvbl9TdHlsZV9TRFhMJTIyJTJDJTIwd2VpZ2h0X25hbWUlM0QlMjJ3ZWdnLnNhZmV0ZW5zb3JzJTIyKSUwQSUwQSUyMyUyMHVzZSUyMGJ5JTIwd2lsbGlhbSUyMGVnZ2xlc3RvbiUyMGluJTIwdGhlJTIwcHJvbXB0JTIwdG8lMjB0cmlnZ2VyJTIwdGhlJTIwTG9SQSUwQXByb21wdCUyMCUzRCUyMCUyMmElMjBob3VzZSUyMGJ5JTIwd2lsbGlhbSUyMGVnZ2xlc3RvbiUyQyUyMHN1bnJheXMlMkMlMjBiZWF1dGlmdWwlMkMlMjBzdW5saWdodCUyQyUyMHN1bnJheXMlMkMlMjBiZWF1dGlmdWwlMjIlMEFpbWFnZSUyMCUzRCUyMHBpcGVsaW5lKHByb21wdCUzRHByb21wdCkuaW1hZ2VzJTVCMCU1RCUwQWltYWdl",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;TheLastBen/William_Eggleston_Style_SDXL&quot;</span>, weight_name=<span class="hljs-string">&quot;wegg.safetensors&quot;</span>)

<span class="hljs-comment"># use by william eggleston in the prompt to trigger the LoRA</span>
prompt = <span class="hljs-string">&quot;a house by william eggleston, sunrays, beautiful, sunlight, sunrays, beautiful&quot;</span>
image = pipeline(prompt=prompt).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),{c(){a=r("p"),a.innerHTML=j,o=i(),c(h.$$.fragment)},l(d){a=m(d,"P",{"data-svelte-h":!0}),u(a)!=="svelte-qdt5l0"&&(a.innerHTML=j),o=n(d),M(h.$$.fragment,d)},m(d,J){s(d,a,J),s(d,o,J),y(h,d,J),f=!0},p:Ve,i(d){f||(g(h.$$.fragment,d),f=!0)},o(d){b(h.$$.fragment,d),f=!1},d(d){d&&(l(a),l(o)),w(h,d)}}}function Nl(T){let a,j,o,h;return a=new Il({props:{id:"other-trainers",option:"Kohya",$$slots:{default:[Yl]},$$scope:{ctx:T}}}),o=new Il({props:{id:"other-trainers",option:"TheLastBen",$$slots:{default:[ql]},$$scope:{ctx:T}}}),{c(){c(a.$$.fragment),j=i(),c(o.$$.fragment)},l(f){M(a.$$.fragment,f),j=n(f),M(o.$$.fragment,f)},m(f,d){y(a,f,d),s(f,j,d),y(o,f,d),h=!0},p(f,d){const J={};d&2&&(J.$$scope={dirty:d,ctx:f}),a.$set(J);const B={};d&2&&(B.$$scope={dirty:d,ctx:f}),o.$set(B)},i(f){h||(g(a.$$.fragment,f),g(o.$$.fragment,f),h=!0)},o(f){b(a.$$.fragment,f),b(o.$$.fragment,f),h=!1},d(f){f&&l(j),w(a,f),w(o,f)}}}function zl(T){let a,j=`Diffusers currently only supports IP-Adapter for some of the most popular pipelines. Feel free to open a feature request if you have a cool use case and want to integrate IP-Adapter with an unsupported pipeline!
Official IP-Adapter checkpoints are available from <a href="https://huggingface.co/h94/IP-Adapter" rel="nofollow">h94/IP-Adapter</a>.`;return{c(){a=r("p"),a.innerHTML=j},l(o){a=m(o,"P",{"data-svelte-h":!0}),u(a)!=="svelte-13d91fo"&&(a.innerHTML=j)},m(o,h){s(o,a,h)},p:Ve,d(o){o&&l(a)}}}function El(T){let a,j,o,h,f,d,J,B,Z,q='There are several <a href="../training/overview">training</a> techniques for personalizing diffusion models to generate images of a specific subject or images in certain styles. Each of these training methods produces a different type of adapter. Some of the adapters generate an entirely new model, while other adapters only modify a smaller set of embeddings or weights. This means the loading process for each adapter is also different.',_,C,N="This guide will show you how to load DreamBooth, textual inversion, and LoRA weights.",v,G,W,I,p,U,Qe='<a href="https://dreambooth.github.io/" rel="nofollow">DreamBooth</a> finetunes an <em>entire diffusion model</em> on just several images of a subject to generate images of that subject in new styles and settings. This method works by using a special word in the prompt that the model learns to associate with the subject image. Of all the training methods, DreamBooth produces the largest file size (usually a few GBs) because it is a full checkpoint model.',Se,z,zt='Let’s load the <a href="https://huggingface.co/sd-dreambooth-library/herge-style" rel="nofollow">herge_style</a> checkpoint, which is trained on just 10 images drawn by Hergé, to generate images in that style. For it to work, you need to include the special word <code>herge_style</code> in your prompt to trigger the checkpoint:',Ye,E,qe,x,Et='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/load_dreambooth.png"/>',Ne,P,ze,D,Pt='<a href="https://textual-inversion.github.io/" rel="nofollow">Textual inversion</a> is very similar to DreamBooth and it can also personalize a diffusion model to generate certain concepts (styles, objects) from just a few images. This method works by training and finding new embeddings that represent the images you provide with a special word in the prompt. As a result, the diffusion model weights stay the same and the training process produces a relatively tiny (a few KBs) file.',Ee,K,Dt="Because textual inversion creates embeddings, it cannot be used on its own like DreamBooth and requires another model.",Pe,O,De,ee,Kt='Now you can load the textual inversion embeddings with the <a href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline.load_textual_inversion">load_textual_inversion()</a> method and generate some images. Let’s load the <a href="https://huggingface.co/sd-concepts-library/gta5-artwork" rel="nofollow">sd-concepts-library/gta5-artwork</a> embeddings and you’ll need to include the special word <code>&lt;gta5-artwork&gt;</code> in your prompt to trigger it:',Ke,te,Oe,X,Ot='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/load_txt_embed.png"/>',et,le,el='Textual inversion can also be trained on undesirable things to create <em>negative embeddings</em> to discourage a model from generating images with those undesirable things like blurry images or extra fingers on a hand. This can be an easy way to quickly improve your prompt. You’ll also load the embeddings with <a href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline.load_textual_inversion">load_textual_inversion()</a>, but this time, you’ll need two more parameters:',tt,se,tl="<li><code>weight_name</code>: specifies the weight file to load if the file was saved in the 🤗 Diffusers format with a specific name or if the file is stored in the A1111 format</li> <li><code>token</code>: specifies the special word to use in the prompt to trigger the embeddings</li>",lt,ae,ll='Let’s load the <a href="https://huggingface.co/sayakpaul/EasyNegative-test" rel="nofollow">sayakpaul/EasyNegative-test</a> embeddings:',st,ie,at,ne,sl="Now you can use the <code>token</code> to generate an image with the negative embeddings:",it,oe,nt,k,al='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/load_neg_embed.png"/>',ot,pe,pt,re,il='<a href="https://huggingface.co/papers/2106.09685" rel="nofollow">Low-Rank Adaptation (LoRA)</a> is a popular training technique because it is fast and generates smaller file sizes (a couple hundred MBs). Like the other methods in this guide, LoRA can train a model to learn new styles from just a few images. It works by inserting new weights into the diffusion model and then only the new weights are trained instead of the entire model. This makes LoRAs faster to train and easier to store.',rt,L,mt,me,nl="LoRAs also need to be used with another model:",dt,de,ut,ue,ol='Then use the <a href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline.load_lora_weights">load_lora_weights()</a> method to load the <a href="https://huggingface.co/ostris/super-cereal-sdxl-lora" rel="nofollow">ostris/super-cereal-sdxl-lora</a> weights and specify the weights filename from the repository:',ht,he,ft,R,pl='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/load_lora.png"/>',ct,fe,rl='The <a href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline.load_lora_weights">load_lora_weights()</a> method loads LoRA weights into both the UNet and text encoder. It is the preferred way for loading LoRAs because it can handle cases where:',Mt,ce,ml="<li>the LoRA weights don’t have separate identifiers for the UNet and text encoder</li> <li>the LoRA weights have separate identifiers for the UNet and text encoder</li>",yt,Me,dl='But if you only need to load LoRA weights into the UNet, then you can use the <a href="/docs/diffusers/main/en/api/loaders/unet#diffusers.loaders.UNet2DConditionLoadersMixin.load_attn_procs">load_attn_procs()</a> method. Let’s load the <a href="https://huggingface.co/jbilcke-hf/sdxl-cinematic-1" rel="nofollow">jbilcke-hf/sdxl-cinematic-1</a> LoRA:',gt,ye,bt,H,ul='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/load_attn_proc.png"/>',wt,ge,hl='To unload the LoRA weights, use the <a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.LoraLoaderMixin.unload_lora_weights">unload_lora_weights()</a> method to discard the LoRA weights and restore the model to its original weights:',jt,be,Ut,we,Jt,je,fl='For both <a href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline.load_lora_weights">load_lora_weights()</a> and <a href="/docs/diffusers/main/en/api/loaders/unet#diffusers.loaders.UNet2DConditionLoadersMixin.load_attn_procs">load_attn_procs()</a>, you can pass the <code>cross_attention_kwargs={&quot;scale&quot;: 0.5}</code> parameter to adjust how much of the LoRA weights to use. A value of <code>0</code> is the same as only using the base model weights, and a value of <code>1</code> is equivalent to using the fully finetuned LoRA.',Tt,Ue,cl="For more granular control on the amount of LoRA weights used per layer, you can use <code>set_adapters()</code> and pass a dictionary specifying by how much to scale the weights in each layer by.",$t,Je,Zt,Te,Ml='This also works with multiple adapters - see <a href="https://huggingface.co/docs/diffusers/tutorials/using_peft_for_inference#customize-adapters-strength" rel="nofollow">this guide</a> for how to do it.',Gt,V,Wt,$e,Bt,Ze,yl='Other popular LoRA trainers from the community include those by <a href="https://github.com/kohya-ss/sd-scripts/" rel="nofollow">Kohya</a> and <a href="https://github.com/TheLastBen/fast-stable-diffusion" rel="nofollow">TheLastBen</a>. These trainers create different LoRA checkpoints than those trained by 🤗 Diffusers, but they can still be loaded in the same way.',_t,Q,vt,Ge,It,We,gl='<a href="https://ip-adapter.github.io/" rel="nofollow">IP-Adapter</a> is a lightweight adapter that enables image prompting for any diffusion model. This adapter works by decoupling the cross-attention layers of the image and text features. All the other model components are frozen and only the embedded image features in the UNet are trained. As a result, IP-Adapter files are typically only ~100MBs.',Ct,Be,bl='You can learn more about how to use IP-Adapter for different tasks and specific use cases in the <a href="../using-diffusers/ip_adapter">IP-Adapter</a> guide.',xt,A,Xt,_e,wl="To start, load a Stable Diffusion checkpoint.",kt,ve,Lt,Ie,jl='Then load the IP-Adapter weights and add it to the pipeline with the <a href="/docs/diffusers/main/en/api/loaders/ip_adapter#diffusers.loaders.IPAdapterMixin.load_ip_adapter">load_ip_adapter()</a> method.',Rt,Ce,Ht,xe,Ul="Once loaded, you can use the pipeline with an image and text prompt to guide the image generation process.",Vt,Xe,Qt,F,Jl='    <img src="https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/ip-bear.png"/>',At,ke,Ft,Le,Tl='IP-Adapter relies on an image encoder to generate image features. If the IP-Adapter repository contains an <code>image_encoder</code> subfolder, the image encoder is automatically loaded and registered to the pipeline. Otherwise, you’ll need to explicitly load the image encoder with a <a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPVisionModelWithProjection" rel="nofollow">CLIPVisionModelWithProjection</a> model and pass it to the pipeline.',St,Re,$l="This is the case for <em>IP-Adapter Plus</em> checkpoints which use the ViT-H image encoder.",Yt,He,qt,Ae,Nt;return f=new Y({props:{title:"Load adapters",local:"load-adapters",headingTag:"h1"}}),J=new Hl({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/loading_adapters.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/pytorch/loading_adapters.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/tensorflow/loading_adapters.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/loading_adapters.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/pytorch/loading_adapters.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/tensorflow/loading_adapters.ipynb"}]}}),G=new Fe({props:{$$slots:{default:[Ql]},$$scope:{ctx:T}}}),I=new Y({props:{title:"DreamBooth",local:"dreambooth",headingTag:"h2"}}),E=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTIyc2QtZHJlYW1ib290aC1saWJyYXJ5JTJGaGVyZ2Utc3R5bGUlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpLnRvKCUyMmN1ZGElMjIpJTBBcHJvbXB0JTIwJTNEJTIwJTIyQSUyMGN1dGUlMjBoZXJnZV9zdHlsZSUyMGJyb3duJTIwYmVhciUyMGVhdGluZyUyMGElMjBzbGljZSUyMG9mJTIwcGl6emElMkMlMjBzdHVubmluZyUyMGNvbG9yJTIwc2NoZW1lJTJDJTIwbWFzdGVycGllY2UlMkMlMjBpbGx1c3RyYXRpb24lMjIlMEFpbWFnZSUyMCUzRCUyMHBpcGVsaW5lKHByb21wdCkuaW1hZ2VzJTVCMCU1RCUwQWltYWdl",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;sd-dreambooth-library/herge-style&quot;</span>, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)
prompt = <span class="hljs-string">&quot;A cute herge_style brown bear eating a slice of pizza, stunning color scheme, masterpiece, illustration&quot;</span>
image = pipeline(prompt).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),P=new Y({props:{title:"Textual inversion",local:"textual-inversion",headingTag:"h2"}}),O=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpLnRvKCUyMmN1ZGElMjIp",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;runwayml/stable-diffusion-v1-5&quot;</span>, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),te=new $({props:{code:"cGlwZWxpbmUubG9hZF90ZXh0dWFsX2ludmVyc2lvbiglMjJzZC1jb25jZXB0cy1saWJyYXJ5JTJGZ3RhNS1hcnR3b3JrJTIyKSUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBjdXRlJTIwYnJvd24lMjBiZWFyJTIwZWF0aW5nJTIwYSUyMHNsaWNlJTIwb2YlMjBwaXp6YSUyQyUyMHN0dW5uaW5nJTIwY29sb3IlMjBzY2hlbWUlMkMlMjBtYXN0ZXJwaWVjZSUyQyUyMGlsbHVzdHJhdGlvbiUyQyUyMCUzQ2d0YTUtYXJ0d29yayUzRSUyMHN0eWxlJTIyJTBBaW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQpLmltYWdlcyU1QjAlNUQlMEFpbWFnZQ==",highlighted:`pipeline.load_textual_inversion(<span class="hljs-string">&quot;sd-concepts-library/gta5-artwork&quot;</span>)
prompt = <span class="hljs-string">&quot;A cute brown bear eating a slice of pizza, stunning color scheme, masterpiece, illustration, &lt;gta5-artwork&gt; style&quot;</span>
image = pipeline(prompt).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),ie=new $({props:{code:"cGlwZWxpbmUubG9hZF90ZXh0dWFsX2ludmVyc2lvbiglMEElMjAlMjAlMjAlMjAlMjJzYXlha3BhdWwlMkZFYXN5TmVnYXRpdmUtdGVzdCUyMiUyQyUyMHdlaWdodF9uYW1lJTNEJTIyRWFzeU5lZ2F0aXZlLnNhZmV0ZW5zb3JzJTIyJTJDJTIwdG9rZW4lM0QlMjJFYXN5TmVnYXRpdmUlMjIlMEEp",highlighted:`pipeline.load_textual_inversion(
    <span class="hljs-string">&quot;sayakpaul/EasyNegative-test&quot;</span>, weight_name=<span class="hljs-string">&quot;EasyNegative.safetensors&quot;</span>, token=<span class="hljs-string">&quot;EasyNegative&quot;</span>
)`,wrap:!1}}),oe=new $({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQSUyMGN1dGUlMjBicm93biUyMGJlYXIlMjBlYXRpbmclMjBhJTIwc2xpY2UlMjBvZiUyMHBpenphJTJDJTIwc3R1bm5pbmclMjBjb2xvciUyMHNjaGVtZSUyQyUyMG1hc3RlcnBpZWNlJTJDJTIwaWxsdXN0cmF0aW9uJTJDJTIwRWFzeU5lZ2F0aXZlJTIyJTBBbmVnYXRpdmVfcHJvbXB0JTIwJTNEJTIwJTIyRWFzeU5lZ2F0aXZlJTIyJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlMkMlMjBuZWdhdGl2ZV9wcm9tcHQlM0RuZWdhdGl2ZV9wcm9tcHQlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENTApLmltYWdlcyU1QjAlNUQlMEFpbWFnZQ==",highlighted:`prompt = <span class="hljs-string">&quot;A cute brown bear eating a slice of pizza, stunning color scheme, masterpiece, illustration, EasyNegative&quot;</span>
negative_prompt = <span class="hljs-string">&quot;EasyNegative&quot;</span>

image = pipeline(prompt, negative_prompt=negative_prompt, num_inference_steps=<span class="hljs-number">50</span>).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),pe=new Y({props:{title:"LoRA",local:"lora",headingTag:"h2"}}),L=new Fe({props:{$$slots:{default:[Al]},$$scope:{ctx:T}}}),de=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KS50byglMjJjdWRhJTIyKQ==",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>)`,wrap:!1}}),he=new $({props:{code:"cGlwZWxpbmUubG9hZF9sb3JhX3dlaWdodHMoJTIyb3N0cmlzJTJGc3VwZXItY2VyZWFsLXNkeGwtbG9yYSUyMiUyQyUyMHdlaWdodF9uYW1lJTNEJTIyY2VyZWFsX2JveF9zZHhsX3YxLnNhZmV0ZW5zb3JzJTIyKSUwQXByb21wdCUyMCUzRCUyMCUyMmJlYXJzJTJDJTIwcGl6emElMjBiaXRlcyUyMiUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0KS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2U=",highlighted:`pipeline.load_lora_weights(<span class="hljs-string">&quot;ostris/super-cereal-sdxl-lora&quot;</span>, weight_name=<span class="hljs-string">&quot;cereal_box_sdxl_v1.safetensors&quot;</span>)
prompt = <span class="hljs-string">&quot;bears, pizza bites&quot;</span>
image = pipeline(prompt).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),ye=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lLnVuZXQubG9hZF9hdHRuX3Byb2NzKCUyMmpiaWxja2UtaGYlMkZzZHhsLWNpbmVtYXRpYy0xJTIyJTJDJTIwd2VpZ2h0X25hbWUlM0QlMjJweXRvcmNoX2xvcmFfd2VpZ2h0cy5zYWZldGVuc29ycyUyMiklMEElMEElMjMlMjB1c2UlMjBjbm10JTIwaW4lMjB0aGUlMjBwcm9tcHQlMjB0byUyMHRyaWdnZXIlMjB0aGUlMjBMb1JBJTBBcHJvbXB0JTIwJTNEJTIwJTIyQSUyMGN1dGUlMjBjbm10JTIwZWF0aW5nJTIwYSUyMHNsaWNlJTIwb2YlMjBwaXp6YSUyQyUyMHN0dW5uaW5nJTIwY29sb3IlMjBzY2hlbWUlMkMlMjBtYXN0ZXJwaWVjZSUyQyUyMGlsbHVzdHJhdGlvbiUyMiUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0KS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2U=",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>)

<span class="hljs-comment"># use cnmt in the prompt to trigger the LoRA</span>
prompt = <span class="hljs-string">&quot;A cute cnmt eating a slice of pizza, stunning color scheme, masterpiece, illustration&quot;</span>
image = pipeline(prompt).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),be=new $({props:{code:"cGlwZWxpbmUudW5sb2FkX2xvcmFfd2VpZ2h0cygp",highlighted:"pipeline.unload_lora_weights()",wrap:!1}}),we=new Y({props:{title:"Adjust LoRA weight scale",local:"adjust-lora-weight-scale",headingTag:"h3"}}),Je=new $({props:{code:"cGlwZSUyMCUzRCUyMC4uLiUyMCUyMyUyMGNyZWF0ZSUyMHBpcGVsaW5lJTBBcGlwZS5sb2FkX2xvcmFfd2VpZ2h0cyguLi4lMkMlMjBhZGFwdGVyX25hbWUlM0QlMjJteV9hZGFwdGVyJTIyKSUyMCUwQXNjYWxlcyUyMCUzRCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMnRleHRfZW5jb2RlciUyMiUzQSUyMDAuNSUyQyUwQSUyMCUyMCUyMCUyMCUyMnRleHRfZW5jb2Rlcl8yJTIyJTNBJTIwMC41JTJDJTIwJTIwJTIzJTIwb25seSUyMHVzYWJsZSUyMGlmJTIwcGlwZSUyMGhhcyUyMGElMjAybmQlMjB0ZXh0JTIwZW5jb2RlciUwQSUyMCUyMCUyMCUyMCUyMnVuZXQlMjIlM0ElMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJkb3duJTIyJTNBJTIwMC45JTJDJTIwJTIwJTIzJTIwYWxsJTIwdHJhbnNmb3JtZXJzJTIwaW4lMjB0aGUlMjBkb3duLXBhcnQlMjB3aWxsJTIwdXNlJTIwc2NhbGUlMjAwLjklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjAlMjJtaWQlMjIlMjAlMjAlMjMlMjBpbiUyMHRoaXMlMjBleGFtcGxlJTIwJTIybWlkJTIyJTIwaXMlMjBub3QlMjBnaXZlbiUyQyUyMHRoZXJlZm9yZSUyMGFsbCUyMHRyYW5zZm9ybWVycyUyMGluJTIwdGhlJTIwbWlkJTIwcGFydCUyMHdpbGwlMjB1c2UlMjB0aGUlMjBkZWZhdWx0JTIwc2NhbGUlMjAxLjAlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJ1cCUyMiUzQSUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMmJsb2NrXzAlMjIlM0ElMjAwLjYlMkMlMjAlMjAlMjMlMjBhbGwlMjAzJTIwdHJhbnNmb3JtZXJzJTIwaW4lMjB0aGUlMjAwdGglMjBibG9jayUyMGluJTIwdGhlJTIwdXAtcGFydCUyMHdpbGwlMjB1c2UlMjBzY2FsZSUyMDAuNiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMmJsb2NrXzElMjIlM0ElMjAlNUIwLjQlMkMlMjAwLjglMkMlMjAxLjAlNUQlMkMlMjAlMjAlMjMlMjB0aGUlMjAzJTIwdHJhbnNmb3JtZXJzJTIwaW4lMjB0aGUlMjAxc3QlMjBibG9jayUyMGluJTIwdGhlJTIwdXAtcGFydCUyMHdpbGwlMjB1c2UlMjBzY2FsZXMlMjAwLjQlMkMlMjAwLjglMjBhbmQlMjAxLjAlMjByZXNwZWN0aXZlbHklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0QlMEElMjAlMjAlMjAlMjAlN0QlMEElN0QlMEFwaXBlLnNldF9hZGFwdGVycyglMjJteV9hZGFwdGVyJTIyJTJDJTIwc2NhbGVzKQ==",highlighted:`pipe = ... <span class="hljs-comment"># create pipeline</span>
pipe.load_lora_weights(..., adapter_name=<span class="hljs-string">&quot;my_adapter&quot;</span>) 
scales = {
    <span class="hljs-string">&quot;text_encoder&quot;</span>: <span class="hljs-number">0.5</span>,
    <span class="hljs-string">&quot;text_encoder_2&quot;</span>: <span class="hljs-number">0.5</span>,  <span class="hljs-comment"># only usable if pipe has a 2nd text encoder</span>
    <span class="hljs-string">&quot;unet&quot;</span>: {
        <span class="hljs-string">&quot;down&quot;</span>: <span class="hljs-number">0.9</span>,  <span class="hljs-comment"># all transformers in the down-part will use scale 0.9</span>
        <span class="hljs-comment"># &quot;mid&quot;  # in this example &quot;mid&quot; is not given, therefore all transformers in the mid part will use the default scale 1.0</span>
        <span class="hljs-string">&quot;up&quot;</span>: {
            <span class="hljs-string">&quot;block_0&quot;</span>: <span class="hljs-number">0.6</span>,  <span class="hljs-comment"># all 3 transformers in the 0th block in the up-part will use scale 0.6</span>
            <span class="hljs-string">&quot;block_1&quot;</span>: [<span class="hljs-number">0.4</span>, <span class="hljs-number">0.8</span>, <span class="hljs-number">1.0</span>],  <span class="hljs-comment"># the 3 transformers in the 1st block in the up-part will use scales 0.4, 0.8 and 1.0 respectively</span>
        }
    }
}
pipe.set_adapters(<span class="hljs-string">&quot;my_adapter&quot;</span>, scales)`,wrap:!1}}),V=new Fe({props:{warning:!0,$$slots:{default:[Fl]},$$scope:{ctx:T}}}),$e=new Y({props:{title:"Kohya and TheLastBen",local:"kohya-and-thelastben",headingTag:"h3"}}),Q=new Vl({props:{id:"other-trainers",options:["Kohya","TheLastBen"],$$slots:{default:[Nl]},$$scope:{ctx:T}}}),Ge=new Y({props:{title:"IP-Adapter",local:"ip-adapter",headingTag:"h2"}}),A=new Fe({props:{warning:!1,$$slots:{default:[zl]},$$scope:{ctx:T}}}),ve=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBsb2FkX2ltYWdlJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBBdXRvUGlwZWxpbmVGb3JUZXh0MkltYWdlLmZyb21fcHJldHJhaW5lZCglMjJydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image

pipeline = AutoPipelineForText2Image.from_pretrained(<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),Ce=new $({props:{code:"cGlwZWxpbmUubG9hZF9pcF9hZGFwdGVyKCUyMmg5NCUyRklQLUFkYXB0ZXIlMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJtb2RlbHMlMjIlMkMlMjB3ZWlnaHRfbmFtZSUzRCUyMmlwLWFkYXB0ZXJfc2QxNS5iaW4lMjIp",highlighted:'pipeline.load_ip_adapter(<span class="hljs-string">&quot;h94/IP-Adapter&quot;</span>, subfolder=<span class="hljs-string">&quot;models&quot;</span>, weight_name=<span class="hljs-string">&quot;ip-adapter_sd15.bin&quot;</span>)',wrap:!1}}),Xe=new $({props:{code:"aW1hZ2UlMjAlM0QlMjBsb2FkX2ltYWdlKCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmh1Z2dpbmdmYWNlJTJGZG9jdW1lbnRhdGlvbi1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRmRpZmZ1c2VycyUyRmxvYWRfbmVnX2VtYmVkLnBuZyUyMiklMEFnZW5lcmF0b3IlMjAlM0QlMjB0b3JjaC5HZW5lcmF0b3IoZGV2aWNlJTNEJTIyY3B1JTIyKS5tYW51YWxfc2VlZCgzMyklMEFpbWFnZXMlMjAlM0QlMjBwaXBlbGluZSglMEElQzIlQTAlMjAlQzIlQTAlMjBwcm9tcHQlM0QnYmVzdCUyMHF1YWxpdHklMkMlMjBoaWdoJTIwcXVhbGl0eSUyQyUyMHdlYXJpbmclMjBzdW5nbGFzc2VzJyUyQyUwQSVDMiVBMCUyMCVDMiVBMCUyMGlwX2FkYXB0ZXJfaW1hZ2UlM0RpbWFnZSUyQyUwQSVDMiVBMCUyMCVDMiVBMCUyMG5lZ2F0aXZlX3Byb21wdCUzRCUyMm1vbm9jaHJvbWUlMkMlMjBsb3dyZXMlMkMlMjBiYWQlMjBhbmF0b215JTJDJTIwd29yc3QlMjBxdWFsaXR5JTJDJTIwbG93JTIwcXVhbGl0eSUyMiUyQyUwQSVDMiVBMCUyMCVDMiVBMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0Q1MCUyQyUwQSVDMiVBMCUyMCVDMiVBMCUyMGdlbmVyYXRvciUzRGdlbmVyYXRvciUyQyUwQSkuaW1hZ2VzJTVCMCU1RCUwQWltYWdlcw==",highlighted:`image = load_image(<span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/load_neg_embed.png&quot;</span>)
generator = torch.Generator(device=<span class="hljs-string">&quot;cpu&quot;</span>).manual_seed(<span class="hljs-number">33</span>)
images = pipeline(
    prompt=<span class="hljs-string">&#x27;best quality, high quality, wearing sunglasses&#x27;</span>,
    ip_adapter_image=image,
    negative_prompt=<span class="hljs-string">&quot;monochrome, lowres, bad anatomy, worst quality, low quality&quot;</span>,
    num_inference_steps=<span class="hljs-number">50</span>,
    generator=generator,
).images[<span class="hljs-number">0</span>]
images`,wrap:!1}}),ke=new Y({props:{title:"IP-Adapter Plus",local:"ip-adapter-plus",headingTag:"h3"}}),He=new $({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENMSVBWaXNpb25Nb2RlbFdpdGhQcm9qZWN0aW9uJTBBJTBBaW1hZ2VfZW5jb2RlciUyMCUzRCUyMENMSVBWaXNpb25Nb2RlbFdpdGhQcm9qZWN0aW9uLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJoOTQlMkZJUC1BZGFwdGVyJTIyJTJDJTBBJTIwJTIwJTIwJTIwc3ViZm9sZGVyJTNEJTIybW9kZWxzJTJGaW1hZ2VfZW5jb2RlciUyMiUyQyUwQSUyMCUyMCUyMCUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEElMEFwaXBlbGluZSUyMCUzRCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi14bC1iYXNlLTEuMCUyMiUyQyUwQSUyMCUyMCUyMCUyMGltYWdlX2VuY29kZXIlM0RpbWFnZV9lbmNvZGVyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKS50byglMjJjdWRhJTIyKSUwQSUwQXBpcGVsaW5lLmxvYWRfaXBfYWRhcHRlciglMjJoOTQlMkZJUC1BZGFwdGVyJTIyJTJDJTIwc3ViZm9sZGVyJTNEJTIyc2R4bF9tb2RlbHMlMjIlMkMlMjB3ZWlnaHRfbmFtZSUzRCUyMmlwLWFkYXB0ZXItcGx1c19zZHhsX3ZpdC1oLnNhZmV0ZW5zb3JzJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPVisionModelWithProjection

image_encoder = CLIPVisionModelWithProjection.from_pretrained(
    <span class="hljs-string">&quot;h94/IP-Adapter&quot;</span>,
    subfolder=<span class="hljs-string">&quot;models/image_encoder&quot;</span>,
    torch_dtype=torch.float16
)

pipeline = AutoPipelineForText2Image.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>,
    image_encoder=image_encoder,
    torch_dtype=torch.float16
).to(<span class="hljs-string">&quot;cuda&quot;</span>)

pipeline.load_ip_adapter(<span class="hljs-string">&quot;h94/IP-Adapter&quot;</span>, subfolder=<span class="hljs-string">&quot;sdxl_models&quot;</span>, weight_name=<span class="hljs-string">&quot;ip-adapter-plus_sdxl_vit-h.safetensors&quot;</span>)`,wrap:!1}}),{c(){a=r("meta"),j=i(),o=r("p"),h=i(),c(f.$$.fragment),d=i(),c(J.$$.fragment),B=i(),Z=r("p"),Z.innerHTML=q,_=i(),C=r("p"),C.textContent=N,v=i(),c(G.$$.fragment),W=i(),c(I.$$.fragment),p=i(),U=r("p"),U.innerHTML=Qe,Se=i(),z=r("p"),z.innerHTML=zt,Ye=i(),c(E.$$.fragment),qe=i(),x=r("div"),x.innerHTML=Et,Ne=i(),c(P.$$.fragment),ze=i(),D=r("p"),D.innerHTML=Pt,Ee=i(),K=r("p"),K.textContent=Dt,Pe=i(),c(O.$$.fragment),De=i(),ee=r("p"),ee.innerHTML=Kt,Ke=i(),c(te.$$.fragment),Oe=i(),X=r("div"),X.innerHTML=Ot,et=i(),le=r("p"),le.innerHTML=el,tt=i(),se=r("ul"),se.innerHTML=tl,lt=i(),ae=r("p"),ae.innerHTML=ll,st=i(),c(ie.$$.fragment),at=i(),ne=r("p"),ne.innerHTML=sl,it=i(),c(oe.$$.fragment),nt=i(),k=r("div"),k.innerHTML=al,ot=i(),c(pe.$$.fragment),pt=i(),re=r("p"),re.innerHTML=il,rt=i(),c(L.$$.fragment),mt=i(),me=r("p"),me.textContent=nl,dt=i(),c(de.$$.fragment),ut=i(),ue=r("p"),ue.innerHTML=ol,ht=i(),c(he.$$.fragment),ft=i(),R=r("div"),R.innerHTML=pl,ct=i(),fe=r("p"),fe.innerHTML=rl,Mt=i(),ce=r("ul"),ce.innerHTML=ml,yt=i(),Me=r("p"),Me.innerHTML=dl,gt=i(),c(ye.$$.fragment),bt=i(),H=r("div"),H.innerHTML=ul,wt=i(),ge=r("p"),ge.innerHTML=hl,jt=i(),c(be.$$.fragment),Ut=i(),c(we.$$.fragment),Jt=i(),je=r("p"),je.innerHTML=fl,Tt=i(),Ue=r("p"),Ue.innerHTML=cl,$t=i(),c(Je.$$.fragment),Zt=i(),Te=r("p"),Te.innerHTML=Ml,Gt=i(),c(V.$$.fragment),Wt=i(),c($e.$$.fragment),Bt=i(),Ze=r("p"),Ze.innerHTML=yl,_t=i(),c(Q.$$.fragment),vt=i(),c(Ge.$$.fragment),It=i(),We=r("p"),We.innerHTML=gl,Ct=i(),Be=r("p"),Be.innerHTML=bl,xt=i(),c(A.$$.fragment),Xt=i(),_e=r("p"),_e.textContent=wl,kt=i(),c(ve.$$.fragment),Lt=i(),Ie=r("p"),Ie.innerHTML=jl,Rt=i(),c(Ce.$$.fragment),Ht=i(),xe=r("p"),xe.textContent=Ul,Vt=i(),c(Xe.$$.fragment),Qt=i(),F=r("div"),F.innerHTML=Jl,At=i(),c(ke.$$.fragment),Ft=i(),Le=r("p"),Le.innerHTML=Tl,St=i(),Re=r("p"),Re.innerHTML=$l,Yt=i(),c(He.$$.fragment),qt=i(),Ae=r("p"),this.h()},l(e){const t=Ll("svelte-u9bgzb",document.head);a=m(t,"META",{name:!0,content:!0}),t.forEach(l),j=n(e),o=m(e,"P",{}),vl(o).forEach(l),h=n(e),M(f.$$.fragment,e),d=n(e),M(J.$$.fragment,e),B=n(e),Z=m(e,"P",{"data-svelte-h":!0}),u(Z)!=="svelte-ax3rwx"&&(Z.innerHTML=q),_=n(e),C=m(e,"P",{"data-svelte-h":!0}),u(C)!=="svelte-h4deay"&&(C.textContent=N),v=n(e),M(G.$$.fragment,e),W=n(e),M(I.$$.fragment,e),p=n(e),U=m(e,"P",{"data-svelte-h":!0}),u(U)!=="svelte-yncm6r"&&(U.innerHTML=Qe),Se=n(e),z=m(e,"P",{"data-svelte-h":!0}),u(z)!=="svelte-1ngpipq"&&(z.innerHTML=zt),Ye=n(e),M(E.$$.fragment,e),qe=n(e),x=m(e,"DIV",{class:!0,"data-svelte-h":!0}),u(x)!=="svelte-1qqjocv"&&(x.innerHTML=Et),Ne=n(e),M(P.$$.fragment,e),ze=n(e),D=m(e,"P",{"data-svelte-h":!0}),u(D)!=="svelte-z0bjzf"&&(D.innerHTML=Pt),Ee=n(e),K=m(e,"P",{"data-svelte-h":!0}),u(K)!=="svelte-1bhtcph"&&(K.textContent=Dt),Pe=n(e),M(O.$$.fragment,e),De=n(e),ee=m(e,"P",{"data-svelte-h":!0}),u(ee)!=="svelte-vc3s5l"&&(ee.innerHTML=Kt),Ke=n(e),M(te.$$.fragment,e),Oe=n(e),X=m(e,"DIV",{class:!0,"data-svelte-h":!0}),u(X)!=="svelte-vwb4li"&&(X.innerHTML=Ot),et=n(e),le=m(e,"P",{"data-svelte-h":!0}),u(le)!=="svelte-ogra4"&&(le.innerHTML=el),tt=n(e),se=m(e,"UL",{"data-svelte-h":!0}),u(se)!=="svelte-1v8nqu6"&&(se.innerHTML=tl),lt=n(e),ae=m(e,"P",{"data-svelte-h":!0}),u(ae)!=="svelte-1eujnzn"&&(ae.innerHTML=ll),st=n(e),M(ie.$$.fragment,e),at=n(e),ne=m(e,"P",{"data-svelte-h":!0}),u(ne)!=="svelte-5s5bn9"&&(ne.innerHTML=sl),it=n(e),M(oe.$$.fragment,e),nt=n(e),k=m(e,"DIV",{class:!0,"data-svelte-h":!0}),u(k)!=="svelte-j6euo"&&(k.innerHTML=al),ot=n(e),M(pe.$$.fragment,e),pt=n(e),re=m(e,"P",{"data-svelte-h":!0}),u(re)!=="svelte-10sp1c2"&&(re.innerHTML=il),rt=n(e),M(L.$$.fragment,e),mt=n(e),me=m(e,"P",{"data-svelte-h":!0}),u(me)!=="svelte-l2hd9l"&&(me.textContent=nl),dt=n(e),M(de.$$.fragment,e),ut=n(e),ue=m(e,"P",{"data-svelte-h":!0}),u(ue)!=="svelte-g1fouw"&&(ue.innerHTML=ol),ht=n(e),M(he.$$.fragment,e),ft=n(e),R=m(e,"DIV",{class:!0,"data-svelte-h":!0}),u(R)!=="svelte-848z5s"&&(R.innerHTML=pl),ct=n(e),fe=m(e,"P",{"data-svelte-h":!0}),u(fe)!=="svelte-6yhpjz"&&(fe.innerHTML=rl),Mt=n(e),ce=m(e,"UL",{"data-svelte-h":!0}),u(ce)!=="svelte-ddcy8o"&&(ce.innerHTML=ml),yt=n(e),Me=m(e,"P",{"data-svelte-h":!0}),u(Me)!=="svelte-im0lkb"&&(Me.innerHTML=dl),gt=n(e),M(ye.$$.fragment,e),bt=n(e),H=m(e,"DIV",{class:!0,"data-svelte-h":!0}),u(H)!=="svelte-1etahws"&&(H.innerHTML=ul),wt=n(e),ge=m(e,"P",{"data-svelte-h":!0}),u(ge)!=="svelte-wf4vgp"&&(ge.innerHTML=hl),jt=n(e),M(be.$$.fragment,e),Ut=n(e),M(we.$$.fragment,e),Jt=n(e),je=m(e,"P",{"data-svelte-h":!0}),u(je)!=="svelte-1yl8r5n"&&(je.innerHTML=fl),Tt=n(e),Ue=m(e,"P",{"data-svelte-h":!0}),u(Ue)!=="svelte-u1an6c"&&(Ue.innerHTML=cl),$t=n(e),M(Je.$$.fragment,e),Zt=n(e),Te=m(e,"P",{"data-svelte-h":!0}),u(Te)!=="svelte-y7bfbz"&&(Te.innerHTML=Ml),Gt=n(e),M(V.$$.fragment,e),Wt=n(e),M($e.$$.fragment,e),Bt=n(e),Ze=m(e,"P",{"data-svelte-h":!0}),u(Ze)!=="svelte-6zj1or"&&(Ze.innerHTML=yl),_t=n(e),M(Q.$$.fragment,e),vt=n(e),M(Ge.$$.fragment,e),It=n(e),We=m(e,"P",{"data-svelte-h":!0}),u(We)!=="svelte-1pu4ft1"&&(We.innerHTML=gl),Ct=n(e),Be=m(e,"P",{"data-svelte-h":!0}),u(Be)!=="svelte-18j3qom"&&(Be.innerHTML=bl),xt=n(e),M(A.$$.fragment,e),Xt=n(e),_e=m(e,"P",{"data-svelte-h":!0}),u(_e)!=="svelte-w9hhyu"&&(_e.textContent=wl),kt=n(e),M(ve.$$.fragment,e),Lt=n(e),Ie=m(e,"P",{"data-svelte-h":!0}),u(Ie)!=="svelte-lmam2w"&&(Ie.innerHTML=jl),Rt=n(e),M(Ce.$$.fragment,e),Ht=n(e),xe=m(e,"P",{"data-svelte-h":!0}),u(xe)!=="svelte-7abk5j"&&(xe.textContent=Ul),Vt=n(e),M(Xe.$$.fragment,e),Qt=n(e),F=m(e,"DIV",{class:!0,"data-svelte-h":!0}),u(F)!=="svelte-1vum0wo"&&(F.innerHTML=Jl),At=n(e),M(ke.$$.fragment,e),Ft=n(e),Le=m(e,"P",{"data-svelte-h":!0}),u(Le)!=="svelte-85ru9q"&&(Le.innerHTML=Tl),St=n(e),Re=m(e,"P",{"data-svelte-h":!0}),u(Re)!=="svelte-zfljo5"&&(Re.innerHTML=$l),Yt=n(e),M(He.$$.fragment,e),qt=n(e),Ae=m(e,"P",{}),vl(Ae).forEach(l),this.h()},h(){S(a,"name","hf:doc:metadata"),S(a,"content",Pl),S(x,"class","flex justify-center"),S(X,"class","flex justify-center"),S(k,"class","flex justify-center"),S(R,"class","flex justify-center"),S(H,"class","flex justify-center"),S(F,"class","flex justify-center")},m(e,t){Rl(document.head,a),s(e,j,t),s(e,o,t),s(e,h,t),y(f,e,t),s(e,d,t),y(J,e,t),s(e,B,t),s(e,Z,t),s(e,_,t),s(e,C,t),s(e,v,t),y(G,e,t),s(e,W,t),y(I,e,t),s(e,p,t),s(e,U,t),s(e,Se,t),s(e,z,t),s(e,Ye,t),y(E,e,t),s(e,qe,t),s(e,x,t),s(e,Ne,t),y(P,e,t),s(e,ze,t),s(e,D,t),s(e,Ee,t),s(e,K,t),s(e,Pe,t),y(O,e,t),s(e,De,t),s(e,ee,t),s(e,Ke,t),y(te,e,t),s(e,Oe,t),s(e,X,t),s(e,et,t),s(e,le,t),s(e,tt,t),s(e,se,t),s(e,lt,t),s(e,ae,t),s(e,st,t),y(ie,e,t),s(e,at,t),s(e,ne,t),s(e,it,t),y(oe,e,t),s(e,nt,t),s(e,k,t),s(e,ot,t),y(pe,e,t),s(e,pt,t),s(e,re,t),s(e,rt,t),y(L,e,t),s(e,mt,t),s(e,me,t),s(e,dt,t),y(de,e,t),s(e,ut,t),s(e,ue,t),s(e,ht,t),y(he,e,t),s(e,ft,t),s(e,R,t),s(e,ct,t),s(e,fe,t),s(e,Mt,t),s(e,ce,t),s(e,yt,t),s(e,Me,t),s(e,gt,t),y(ye,e,t),s(e,bt,t),s(e,H,t),s(e,wt,t),s(e,ge,t),s(e,jt,t),y(be,e,t),s(e,Ut,t),y(we,e,t),s(e,Jt,t),s(e,je,t),s(e,Tt,t),s(e,Ue,t),s(e,$t,t),y(Je,e,t),s(e,Zt,t),s(e,Te,t),s(e,Gt,t),y(V,e,t),s(e,Wt,t),y($e,e,t),s(e,Bt,t),s(e,Ze,t),s(e,_t,t),y(Q,e,t),s(e,vt,t),y(Ge,e,t),s(e,It,t),s(e,We,t),s(e,Ct,t),s(e,Be,t),s(e,xt,t),y(A,e,t),s(e,Xt,t),s(e,_e,t),s(e,kt,t),y(ve,e,t),s(e,Lt,t),s(e,Ie,t),s(e,Rt,t),y(Ce,e,t),s(e,Ht,t),s(e,xe,t),s(e,Vt,t),y(Xe,e,t),s(e,Qt,t),s(e,F,t),s(e,At,t),y(ke,e,t),s(e,Ft,t),s(e,Le,t),s(e,St,t),s(e,Re,t),s(e,Yt,t),y(He,e,t),s(e,qt,t),s(e,Ae,t),Nt=!0},p(e,[t]){const Zl={};t&2&&(Zl.$$scope={dirty:t,ctx:e}),G.$set(Zl);const Gl={};t&2&&(Gl.$$scope={dirty:t,ctx:e}),L.$set(Gl);const Wl={};t&2&&(Wl.$$scope={dirty:t,ctx:e}),V.$set(Wl);const Bl={};t&2&&(Bl.$$scope={dirty:t,ctx:e}),Q.$set(Bl);const _l={};t&2&&(_l.$$scope={dirty:t,ctx:e}),A.$set(_l)},i(e){Nt||(g(f.$$.fragment,e),g(J.$$.fragment,e),g(G.$$.fragment,e),g(I.$$.fragment,e),g(E.$$.fragment,e),g(P.$$.fragment,e),g(O.$$.fragment,e),g(te.$$.fragment,e),g(ie.$$.fragment,e),g(oe.$$.fragment,e),g(pe.$$.fragment,e),g(L.$$.fragment,e),g(de.$$.fragment,e),g(he.$$.fragment,e),g(ye.$$.fragment,e),g(be.$$.fragment,e),g(we.$$.fragment,e),g(Je.$$.fragment,e),g(V.$$.fragment,e),g($e.$$.fragment,e),g(Q.$$.fragment,e),g(Ge.$$.fragment,e),g(A.$$.fragment,e),g(ve.$$.fragment,e),g(Ce.$$.fragment,e),g(Xe.$$.fragment,e),g(ke.$$.fragment,e),g(He.$$.fragment,e),Nt=!0)},o(e){b(f.$$.fragment,e),b(J.$$.fragment,e),b(G.$$.fragment,e),b(I.$$.fragment,e),b(E.$$.fragment,e),b(P.$$.fragment,e),b(O.$$.fragment,e),b(te.$$.fragment,e),b(ie.$$.fragment,e),b(oe.$$.fragment,e),b(pe.$$.fragment,e),b(L.$$.fragment,e),b(de.$$.fragment,e),b(he.$$.fragment,e),b(ye.$$.fragment,e),b(be.$$.fragment,e),b(we.$$.fragment,e),b(Je.$$.fragment,e),b(V.$$.fragment,e),b($e.$$.fragment,e),b(Q.$$.fragment,e),b(Ge.$$.fragment,e),b(A.$$.fragment,e),b(ve.$$.fragment,e),b(Ce.$$.fragment,e),b(Xe.$$.fragment,e),b(ke.$$.fragment,e),b(He.$$.fragment,e),Nt=!1},d(e){e&&(l(j),l(o),l(h),l(d),l(B),l(Z),l(_),l(C),l(v),l(W),l(p),l(U),l(Se),l(z),l(Ye),l(qe),l(x),l(Ne),l(ze),l(D),l(Ee),l(K),l(Pe),l(De),l(ee),l(Ke),l(Oe),l(X),l(et),l(le),l(tt),l(se),l(lt),l(ae),l(st),l(at),l(ne),l(it),l(nt),l(k),l(ot),l(pt),l(re),l(rt),l(mt),l(me),l(dt),l(ut),l(ue),l(ht),l(ft),l(R),l(ct),l(fe),l(Mt),l(ce),l(yt),l(Me),l(gt),l(bt),l(H),l(wt),l(ge),l(jt),l(Ut),l(Jt),l(je),l(Tt),l(Ue),l($t),l(Zt),l(Te),l(Gt),l(Wt),l(Bt),l(Ze),l(_t),l(vt),l(It),l(We),l(Ct),l(Be),l(xt),l(Xt),l(_e),l(kt),l(Lt),l(Ie),l(Rt),l(Ht),l(xe),l(Vt),l(Qt),l(F),l(At),l(Ft),l(Le),l(St),l(Re),l(Yt),l(qt),l(Ae)),l(a),w(f,e),w(J,e),w(G,e),w(I,e),w(E,e),w(P,e),w(O,e),w(te,e),w(ie,e),w(oe,e),w(pe,e),w(L,e),w(de,e),w(he,e),w(ye,e),w(be,e),w(we,e),w(Je,e),w(V,e),w($e,e),w(Q,e),w(Ge,e),w(A,e),w(ve,e),w(Ce,e),w(Xe,e),w(ke,e),w(He,e)}}}const Pl='{"title":"Load adapters","local":"load-adapters","sections":[{"title":"DreamBooth","local":"dreambooth","sections":[],"depth":2},{"title":"Textual inversion","local":"textual-inversion","sections":[],"depth":2},{"title":"LoRA","local":"lora","sections":[{"title":"Adjust LoRA weight scale","local":"adjust-lora-weight-scale","sections":[],"depth":3},{"title":"Kohya and TheLastBen","local":"kohya-and-thelastben","sections":[],"depth":3}],"depth":2},{"title":"IP-Adapter","local":"ip-adapter","sections":[{"title":"IP-Adapter Plus","local":"ip-adapter-plus","sections":[],"depth":3}],"depth":2}],"depth":1}';function Dl(T){return xl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class is extends Xl{constructor(a){super(),kl(this,a,Dl,El,Cl,{})}}export{is as component};
