import{s as Cl,o as xl,n as Ve}from"../chunks/scheduler.182ea377.js";import{S as Ll,i as kl,g as p,s as n,r as c,A as Xl,h as d,f as l,c as i,j as _l,u as M,x as h,k as Y,y as Rl,a as s,v as y,d as g,t as w,w as b}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 q}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=p("p"),a.innerHTML=j},l(o){a=d(o,"P",{"data-svelte-h":!0}),h(a)!=="svelte-unc393"&&(a.innerHTML=j)},m(o,u){s(o,a,u)},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=p("p"),a.innerHTML=j},l(o){a=d(o,"P",{"data-svelte-h":!0}),h(a)!=="svelte-bp0omm"&&(a.innerHTML=j)},m(o,u){s(o,a,u)},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=p("p"),a.innerHTML=j},l(o){a=d(o,"P",{"data-svelte-h":!0}),h(a)!=="svelte-1aq2a67"&&(a.innerHTML=j)},m(o,u){s(o,a,u)},p:Ve,d(o){o&&l(a)}}}function Yl(T){let a,j="Some limitations of using Kohya LoRAs with 🤗 Diffusers include:",o,u,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/loaders/lora#diffusers.loaders.LoraLoaderMixin.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=p("p"),a.textContent=j,o=n(),u=p("ul"),u.innerHTML=f},l(m){a=d(m,"P",{"data-svelte-h":!0}),h(a)!=="svelte-1aa8at7"&&(a.textContent=j),o=i(m),u=d(m,"UL",{"data-svelte-h":!0}),h(u)!=="svelte-witmc2"&&(u.innerHTML=f)},m(m,J){s(m,a,J),s(m,o,J),s(m,u,J)},p:Ve,d(m){m&&(l(a),l(o),l(u))}}}function ql(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,u,f,m,J='Load the LoRA checkpoint with the <a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.LoraLoaderMixin.load_lora_weights">load_lora_weights()</a> method, and specify the filename in the <code>weight_name</code> parameter:',B,Z,S,v,C="Generate an image:",N,_,G,W,I;return u=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}}),_=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:[Yl]},$$scope:{ctx:T}}}),{c(){a=p("p"),a.innerHTML=j,o=n(),c(u.$$.fragment),f=n(),m=p("p"),m.innerHTML=J,B=n(),c(Z.$$.fragment),S=n(),v=p("p"),v.textContent=C,N=n(),c(_.$$.fragment),G=n(),c(W.$$.fragment)},l(r){a=d(r,"P",{"data-svelte-h":!0}),h(a)!=="svelte-1xg7vsu"&&(a.innerHTML=j),o=i(r),M(u.$$.fragment,r),f=i(r),m=d(r,"P",{"data-svelte-h":!0}),h(m)!=="svelte-34k3vo"&&(m.innerHTML=J),B=i(r),M(Z.$$.fragment,r),S=i(r),v=d(r,"P",{"data-svelte-h":!0}),h(v)!=="svelte-1un5bjt"&&(v.textContent=C),N=i(r),M(_.$$.fragment,r),G=i(r),M(W.$$.fragment,r)},m(r,U){s(r,a,U),s(r,o,U),y(u,r,U),s(r,f,U),s(r,m,U),s(r,B,U),y(Z,r,U),s(r,S,U),s(r,v,U),s(r,N,U),y(_,r,U),s(r,G,U),y(W,r,U),I=!0},p(r,U){const Qe={};U&2&&(Qe.$$scope={dirty:U,ctx:r}),W.$set(Qe)},i(r){I||(g(u.$$.fragment,r),g(Z.$$.fragment,r),g(_.$$.fragment,r),g(W.$$.fragment,r),I=!0)},o(r){w(u.$$.fragment,r),w(Z.$$.fragment,r),w(_.$$.fragment,r),w(W.$$.fragment,r),I=!1},d(r){r&&(l(a),l(o),l(f),l(m),l(B),l(S),l(v),l(N),l(G)),b(u,r),b(Z,r),b(_,r),b(W,r)}}}function Sl(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,u,f;return u=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=p("p"),a.innerHTML=j,o=n(),c(u.$$.fragment)},l(m){a=d(m,"P",{"data-svelte-h":!0}),h(a)!=="svelte-qdt5l0"&&(a.innerHTML=j),o=i(m),M(u.$$.fragment,m)},m(m,J){s(m,a,J),s(m,o,J),y(u,m,J),f=!0},p:Ve,i(m){f||(g(u.$$.fragment,m),f=!0)},o(m){w(u.$$.fragment,m),f=!1},d(m){m&&(l(a),l(o)),b(u,m)}}}function Nl(T){let a,j,o,u;return a=new Il({props:{id:"other-trainers",option:"Kohya",$$slots:{default:[ql]},$$scope:{ctx:T}}}),o=new Il({props:{id:"other-trainers",option:"TheLastBen",$$slots:{default:[Sl]},$$scope:{ctx:T}}}),{c(){c(a.$$.fragment),j=n(),c(o.$$.fragment)},l(f){M(a.$$.fragment,f),j=i(f),M(o.$$.fragment,f)},m(f,m){y(a,f,m),s(f,j,m),y(o,f,m),u=!0},p(f,m){const J={};m&2&&(J.$$scope={dirty:m,ctx:f}),a.$set(J);const B={};m&2&&(B.$$scope={dirty:m,ctx:f}),o.$set(B)},i(f){u||(g(a.$$.fragment,f),g(o.$$.fragment,f),u=!0)},o(f){w(a.$$.fragment,f),w(o.$$.fragment,f),u=!1},d(f){f&&l(j),b(a,f),b(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=p("p"),a.innerHTML=j},l(o){a=d(o,"P",{"data-svelte-h":!0}),h(a)!=="svelte-13d91fo"&&(a.innerHTML=j)},m(o,u){s(o,a,u)},p:Ve,d(o){o&&l(a)}}}function El(T){let a,j,o,u,f,m,J,B,Z,S='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.',v,C,N="This guide will show you how to load DreamBooth, textual inversion, and LoRA weights.",_,G,W,I,r,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.',Ye,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:',qe,E,Se,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/loaders/textual_inversion#diffusers.loaders.TextualInversionLoaderMixin.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,L,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/loaders/textual_inversion#diffusers.loaders.TextualInversionLoaderMixin.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,ne,at,ie,sl="Now you can use the <code>token</code> to generate an image with the negative embeddings:",nt,oe,it,k,al='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/load_neg_embed.png"/>',ot,re,rt,pe,nl='<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.',pt,X,dt,de,il="LoRAs also need to be used with another model:",mt,me,ht,he,ol='Then use the <a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.LoraLoaderMixin.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:',ut,ue,ft,R,rl='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/load_lora.png"/>',ct,fe,pl='The <a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.LoraLoaderMixin.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,dl="<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,ml='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,wt,H,hl='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/load_attn_proc.png"/>',bt,ge,ul='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,we,Ut,be,Jt,je,fl='For both <a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.LoraLoaderMixin.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.',vt,Q,_t,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,wl='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,Lt,ve,bl="To start, load a Stable Diffusion checkpoint.",kt,_e,Xt,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,Le,Qt,F,Jl='    <img src="https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/ip-bear.png"/>',At,ke,Ft,Xe,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.',Yt,Re,$l="This is the case for <em>IP-Adapter Plus</em> checkpoints which use the ViT-H image encoder.",qt,He,St,Ae,Nt;return f=new q({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 q({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 q({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}}),ne=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}}),re=new q({props:{title:"LoRA",local:"lora",headingTag:"h2"}}),X=new Fe({props:{$$slots:{default:[Al]},$$scope:{ctx:T}}}),me=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}}),ue=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}}),we=new $({props:{code:"cGlwZWxpbmUudW5sb2FkX2xvcmFfd2VpZ2h0cygp",highlighted:"pipeline.unload_lora_weights()",wrap:!1}}),be=new q({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 q({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 q({props:{title:"IP-Adapter",local:"ip-adapter",headingTag:"h2"}}),A=new Fe({props:{warning:!1,$$slots:{default:[zl]},$$scope:{ctx:T}}}),_e=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}}),Le=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 q({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=p("meta"),j=n(),o=p("p"),u=n(),c(f.$$.fragment),m=n(),c(J.$$.fragment),B=n(),Z=p("p"),Z.innerHTML=S,v=n(),C=p("p"),C.textContent=N,_=n(),c(G.$$.fragment),W=n(),c(I.$$.fragment),r=n(),U=p("p"),U.innerHTML=Qe,Ye=n(),z=p("p"),z.innerHTML=zt,qe=n(),c(E.$$.fragment),Se=n(),x=p("div"),x.innerHTML=Et,Ne=n(),c(P.$$.fragment),ze=n(),D=p("p"),D.innerHTML=Pt,Ee=n(),K=p("p"),K.textContent=Dt,Pe=n(),c(O.$$.fragment),De=n(),ee=p("p"),ee.innerHTML=Kt,Ke=n(),c(te.$$.fragment),Oe=n(),L=p("div"),L.innerHTML=Ot,et=n(),le=p("p"),le.innerHTML=el,tt=n(),se=p("ul"),se.innerHTML=tl,lt=n(),ae=p("p"),ae.innerHTML=ll,st=n(),c(ne.$$.fragment),at=n(),ie=p("p"),ie.innerHTML=sl,nt=n(),c(oe.$$.fragment),it=n(),k=p("div"),k.innerHTML=al,ot=n(),c(re.$$.fragment),rt=n(),pe=p("p"),pe.innerHTML=nl,pt=n(),c(X.$$.fragment),dt=n(),de=p("p"),de.textContent=il,mt=n(),c(me.$$.fragment),ht=n(),he=p("p"),he.innerHTML=ol,ut=n(),c(ue.$$.fragment),ft=n(),R=p("div"),R.innerHTML=rl,ct=n(),fe=p("p"),fe.innerHTML=pl,Mt=n(),ce=p("ul"),ce.innerHTML=dl,yt=n(),Me=p("p"),Me.innerHTML=ml,gt=n(),c(ye.$$.fragment),wt=n(),H=p("div"),H.innerHTML=hl,bt=n(),ge=p("p"),ge.innerHTML=ul,jt=n(),c(we.$$.fragment),Ut=n(),c(be.$$.fragment),Jt=n(),je=p("p"),je.innerHTML=fl,Tt=n(),Ue=p("p"),Ue.innerHTML=cl,$t=n(),c(Je.$$.fragment),Zt=n(),Te=p("p"),Te.innerHTML=Ml,Gt=n(),c(V.$$.fragment),Wt=n(),c($e.$$.fragment),Bt=n(),Ze=p("p"),Ze.innerHTML=yl,vt=n(),c(Q.$$.fragment),_t=n(),c(Ge.$$.fragment),It=n(),We=p("p"),We.innerHTML=gl,Ct=n(),Be=p("p"),Be.innerHTML=wl,xt=n(),c(A.$$.fragment),Lt=n(),ve=p("p"),ve.textContent=bl,kt=n(),c(_e.$$.fragment),Xt=n(),Ie=p("p"),Ie.innerHTML=jl,Rt=n(),c(Ce.$$.fragment),Ht=n(),xe=p("p"),xe.textContent=Ul,Vt=n(),c(Le.$$.fragment),Qt=n(),F=p("div"),F.innerHTML=Jl,At=n(),c(ke.$$.fragment),Ft=n(),Xe=p("p"),Xe.innerHTML=Tl,Yt=n(),Re=p("p"),Re.innerHTML=$l,qt=n(),c(He.$$.fragment),St=n(),Ae=p("p"),this.h()},l(e){const t=Xl("svelte-u9bgzb",document.head);a=d(t,"META",{name:!0,content:!0}),t.forEach(l),j=i(e),o=d(e,"P",{}),_l(o).forEach(l),u=i(e),M(f.$$.fragment,e),m=i(e),M(J.$$.fragment,e),B=i(e),Z=d(e,"P",{"data-svelte-h":!0}),h(Z)!=="svelte-ax3rwx"&&(Z.innerHTML=S),v=i(e),C=d(e,"P",{"data-svelte-h":!0}),h(C)!=="svelte-h4deay"&&(C.textContent=N),_=i(e),M(G.$$.fragment,e),W=i(e),M(I.$$.fragment,e),r=i(e),U=d(e,"P",{"data-svelte-h":!0}),h(U)!=="svelte-yncm6r"&&(U.innerHTML=Qe),Ye=i(e),z=d(e,"P",{"data-svelte-h":!0}),h(z)!=="svelte-1ngpipq"&&(z.innerHTML=zt),qe=i(e),M(E.$$.fragment,e),Se=i(e),x=d(e,"DIV",{class:!0,"data-svelte-h":!0}),h(x)!=="svelte-1qqjocv"&&(x.innerHTML=Et),Ne=i(e),M(P.$$.fragment,e),ze=i(e),D=d(e,"P",{"data-svelte-h":!0}),h(D)!=="svelte-z0bjzf"&&(D.innerHTML=Pt),Ee=i(e),K=d(e,"P",{"data-svelte-h":!0}),h(K)!=="svelte-1bhtcph"&&(K.textContent=Dt),Pe=i(e),M(O.$$.fragment,e),De=i(e),ee=d(e,"P",{"data-svelte-h":!0}),h(ee)!=="svelte-1s1y71b"&&(ee.innerHTML=Kt),Ke=i(e),M(te.$$.fragment,e),Oe=i(e),L=d(e,"DIV",{class:!0,"data-svelte-h":!0}),h(L)!=="svelte-vwb4li"&&(L.innerHTML=Ot),et=i(e),le=d(e,"P",{"data-svelte-h":!0}),h(le)!=="svelte-h6sd1m"&&(le.innerHTML=el),tt=i(e),se=d(e,"UL",{"data-svelte-h":!0}),h(se)!=="svelte-1v8nqu6"&&(se.innerHTML=tl),lt=i(e),ae=d(e,"P",{"data-svelte-h":!0}),h(ae)!=="svelte-1eujnzn"&&(ae.innerHTML=ll),st=i(e),M(ne.$$.fragment,e),at=i(e),ie=d(e,"P",{"data-svelte-h":!0}),h(ie)!=="svelte-5s5bn9"&&(ie.innerHTML=sl),nt=i(e),M(oe.$$.fragment,e),it=i(e),k=d(e,"DIV",{class:!0,"data-svelte-h":!0}),h(k)!=="svelte-j6euo"&&(k.innerHTML=al),ot=i(e),M(re.$$.fragment,e),rt=i(e),pe=d(e,"P",{"data-svelte-h":!0}),h(pe)!=="svelte-10sp1c2"&&(pe.innerHTML=nl),pt=i(e),M(X.$$.fragment,e),dt=i(e),de=d(e,"P",{"data-svelte-h":!0}),h(de)!=="svelte-l2hd9l"&&(de.textContent=il),mt=i(e),M(me.$$.fragment,e),ht=i(e),he=d(e,"P",{"data-svelte-h":!0}),h(he)!=="svelte-1ud9e4b"&&(he.innerHTML=ol),ut=i(e),M(ue.$$.fragment,e),ft=i(e),R=d(e,"DIV",{class:!0,"data-svelte-h":!0}),h(R)!=="svelte-848z5s"&&(R.innerHTML=rl),ct=i(e),fe=d(e,"P",{"data-svelte-h":!0}),h(fe)!=="svelte-j3sxhc"&&(fe.innerHTML=pl),Mt=i(e),ce=d(e,"UL",{"data-svelte-h":!0}),h(ce)!=="svelte-ddcy8o"&&(ce.innerHTML=dl),yt=i(e),Me=d(e,"P",{"data-svelte-h":!0}),h(Me)!=="svelte-im0lkb"&&(Me.innerHTML=ml),gt=i(e),M(ye.$$.fragment,e),wt=i(e),H=d(e,"DIV",{class:!0,"data-svelte-h":!0}),h(H)!=="svelte-1etahws"&&(H.innerHTML=hl),bt=i(e),ge=d(e,"P",{"data-svelte-h":!0}),h(ge)!=="svelte-wf4vgp"&&(ge.innerHTML=ul),jt=i(e),M(we.$$.fragment,e),Ut=i(e),M(be.$$.fragment,e),Jt=i(e),je=d(e,"P",{"data-svelte-h":!0}),h(je)!=="svelte-nj309k"&&(je.innerHTML=fl),Tt=i(e),Ue=d(e,"P",{"data-svelte-h":!0}),h(Ue)!=="svelte-u1an6c"&&(Ue.innerHTML=cl),$t=i(e),M(Je.$$.fragment,e),Zt=i(e),Te=d(e,"P",{"data-svelte-h":!0}),h(Te)!=="svelte-y7bfbz"&&(Te.innerHTML=Ml),Gt=i(e),M(V.$$.fragment,e),Wt=i(e),M($e.$$.fragment,e),Bt=i(e),Ze=d(e,"P",{"data-svelte-h":!0}),h(Ze)!=="svelte-6zj1or"&&(Ze.innerHTML=yl),vt=i(e),M(Q.$$.fragment,e),_t=i(e),M(Ge.$$.fragment,e),It=i(e),We=d(e,"P",{"data-svelte-h":!0}),h(We)!=="svelte-1pu4ft1"&&(We.innerHTML=gl),Ct=i(e),Be=d(e,"P",{"data-svelte-h":!0}),h(Be)!=="svelte-18j3qom"&&(Be.innerHTML=wl),xt=i(e),M(A.$$.fragment,e),Lt=i(e),ve=d(e,"P",{"data-svelte-h":!0}),h(ve)!=="svelte-w9hhyu"&&(ve.textContent=bl),kt=i(e),M(_e.$$.fragment,e),Xt=i(e),Ie=d(e,"P",{"data-svelte-h":!0}),h(Ie)!=="svelte-lmam2w"&&(Ie.innerHTML=jl),Rt=i(e),M(Ce.$$.fragment,e),Ht=i(e),xe=d(e,"P",{"data-svelte-h":!0}),h(xe)!=="svelte-7abk5j"&&(xe.textContent=Ul),Vt=i(e),M(Le.$$.fragment,e),Qt=i(e),F=d(e,"DIV",{class:!0,"data-svelte-h":!0}),h(F)!=="svelte-1vum0wo"&&(F.innerHTML=Jl),At=i(e),M(ke.$$.fragment,e),Ft=i(e),Xe=d(e,"P",{"data-svelte-h":!0}),h(Xe)!=="svelte-85ru9q"&&(Xe.innerHTML=Tl),Yt=i(e),Re=d(e,"P",{"data-svelte-h":!0}),h(Re)!=="svelte-zfljo5"&&(Re.innerHTML=$l),qt=i(e),M(He.$$.fragment,e),St=i(e),Ae=d(e,"P",{}),_l(Ae).forEach(l),this.h()},h(){Y(a,"name","hf:doc:metadata"),Y(a,"content",Pl),Y(x,"class","flex justify-center"),Y(L,"class","flex justify-center"),Y(k,"class","flex justify-center"),Y(R,"class","flex justify-center"),Y(H,"class","flex justify-center"),Y(F,"class","flex justify-center")},m(e,t){Rl(document.head,a),s(e,j,t),s(e,o,t),s(e,u,t),y(f,e,t),s(e,m,t),y(J,e,t),s(e,B,t),s(e,Z,t),s(e,v,t),s(e,C,t),s(e,_,t),y(G,e,t),s(e,W,t),y(I,e,t),s(e,r,t),s(e,U,t),s(e,Ye,t),s(e,z,t),s(e,qe,t),y(E,e,t),s(e,Se,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,L,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(ne,e,t),s(e,at,t),s(e,ie,t),s(e,nt,t),y(oe,e,t),s(e,it,t),s(e,k,t),s(e,ot,t),y(re,e,t),s(e,rt,t),s(e,pe,t),s(e,pt,t),y(X,e,t),s(e,dt,t),s(e,de,t),s(e,mt,t),y(me,e,t),s(e,ht,t),s(e,he,t),s(e,ut,t),y(ue,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,wt,t),s(e,H,t),s(e,bt,t),s(e,ge,t),s(e,jt,t),y(we,e,t),s(e,Ut,t),y(be,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,vt,t),y(Q,e,t),s(e,_t,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,Lt,t),s(e,ve,t),s(e,kt,t),y(_e,e,t),s(e,Xt,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(Le,e,t),s(e,Qt,t),s(e,F,t),s(e,At,t),y(ke,e,t),s(e,Ft,t),s(e,Xe,t),s(e,Yt,t),s(e,Re,t),s(e,qt,t),y(He,e,t),s(e,St,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}),X.$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 vl={};t&2&&(vl.$$scope={dirty:t,ctx:e}),A.$set(vl)},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(ne.$$.fragment,e),g(oe.$$.fragment,e),g(re.$$.fragment,e),g(X.$$.fragment,e),g(me.$$.fragment,e),g(ue.$$.fragment,e),g(ye.$$.fragment,e),g(we.$$.fragment,e),g(be.$$.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(_e.$$.fragment,e),g(Ce.$$.fragment,e),g(Le.$$.fragment,e),g(ke.$$.fragment,e),g(He.$$.fragment,e),Nt=!0)},o(e){w(f.$$.fragment,e),w(J.$$.fragment,e),w(G.$$.fragment,e),w(I.$$.fragment,e),w(E.$$.fragment,e),w(P.$$.fragment,e),w(O.$$.fragment,e),w(te.$$.fragment,e),w(ne.$$.fragment,e),w(oe.$$.fragment,e),w(re.$$.fragment,e),w(X.$$.fragment,e),w(me.$$.fragment,e),w(ue.$$.fragment,e),w(ye.$$.fragment,e),w(we.$$.fragment,e),w(be.$$.fragment,e),w(Je.$$.fragment,e),w(V.$$.fragment,e),w($e.$$.fragment,e),w(Q.$$.fragment,e),w(Ge.$$.fragment,e),w(A.$$.fragment,e),w(_e.$$.fragment,e),w(Ce.$$.fragment,e),w(Le.$$.fragment,e),w(ke.$$.fragment,e),w(He.$$.fragment,e),Nt=!1},d(e){e&&(l(j),l(o),l(u),l(m),l(B),l(Z),l(v),l(C),l(_),l(W),l(r),l(U),l(Ye),l(z),l(qe),l(Se),l(x),l(Ne),l(ze),l(D),l(Ee),l(K),l(Pe),l(De),l(ee),l(Ke),l(Oe),l(L),l(et),l(le),l(tt),l(se),l(lt),l(ae),l(st),l(at),l(ie),l(nt),l(it),l(k),l(ot),l(rt),l(pe),l(pt),l(dt),l(de),l(mt),l(ht),l(he),l(ut),l(ft),l(R),l(ct),l(fe),l(Mt),l(ce),l(yt),l(Me),l(gt),l(wt),l(H),l(bt),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(vt),l(_t),l(It),l(We),l(Ct),l(Be),l(xt),l(Lt),l(ve),l(kt),l(Xt),l(Ie),l(Rt),l(Ht),l(xe),l(Vt),l(Qt),l(F),l(At),l(Ft),l(Xe),l(Yt),l(Re),l(qt),l(St),l(Ae)),l(a),b(f,e),b(J,e),b(G,e),b(I,e),b(E,e),b(P,e),b(O,e),b(te,e),b(ne,e),b(oe,e),b(re,e),b(X,e),b(me,e),b(ue,e),b(ye,e),b(we,e),b(be,e),b(Je,e),b(V,e),b($e,e),b(Q,e),b(Ge,e),b(A,e),b(_e,e),b(Ce,e),b(Le,e),b(ke,e),b(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 ns extends Ll{constructor(a){super(),kl(this,a,Dl,El,Cl,{})}}export{ns as component};
