import{s as mn,o as un,n as j}from"../chunks/scheduler.182ea377.js";import{S as hn,i as dn,g as o,s as a,r as m,A as cn,h as p,f as l,c as n,j as Hs,u,x as f,k as fn,y as Ct,a as s,v as h,d,t as c,w as M}from"../chunks/index.abf12888.js";import{T as Z}from"../chunks/Tip.230e2334.js";import{C as T}from"../chunks/CodeBlock.57fe6e13.js";import{H as J}from"../chunks/Heading.16916d63.js";function Mn(g){let i,w="This is an experimental feature. Its APIs can change in future.";return{c(){i=o("p"),i.textContent=w},l(r){i=p(r,"P",{"data-svelte-h":!0}),f(i)!=="svelte-zcd81y"&&(i.textContent=w)},m(r,y){s(r,i,y)},p:j,d(r){r&&l(i)}}}function wn(g){let i,w=`💡 LoRA is not only limited to attention layers. The authors found that amending
the attention layers of a language model is sufficient to obtain good downstream performance with great efficiency. This is why it’s common to just add the LoRA weights to the attention layers of a model. Check out the <a href="https://huggingface.co/blog/lora" rel="nofollow">Using LoRA for efficient Stable Diffusion fine-tuning</a> blog for more information about how LoRA works!`;return{c(){i=o("p"),i.innerHTML=w},l(r){i=p(r,"P",{"data-svelte-h":!0}),f(i)!=="svelte-1eow968"&&(i.innerHTML=w)},m(r,y){s(r,i,y)},p:j,d(r){r&&l(i)}}}function yn(g){let i,w="💡 A <code>scale</code> value of <code>0</code> is the same as not using your LoRA weights and you’re only using the base model weights, and a <code>scale</code> value of <code>1</code> means you’re only using the fully finetuned LoRA weights. Values between <code>0</code> and <code>1</code> interpolates between the two weights.";return{c(){i=o("p"),i.innerHTML=w},l(r){i=p(r,"P",{"data-svelte-h":!0}),f(i)!=="svelte-17q39x7"&&(i.innerHTML=w)},m(r,y){s(r,i,y)},p:j,d(r){r&&l(i)}}}function bn(g){let i,w=`If you are loading the LoRA parameters from the Hub and if the Hub repository has
a <code>base_model</code> tag (such as <a href="https://huggingface.co/sayakpaul/sd-model-finetuned-lora-t4/blob/main/README.md?code=true#L4" rel="nofollow">this</a>), then
you can do:`,r,y,_;return y=new T({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1Yi5yZXBvY2FyZCUyMGltcG9ydCUyMFJlcG9DYXJkJTBBJTBBbG9yYV9tb2RlbF9pZCUyMCUzRCUyMCUyMnNheWFrcGF1bCUyRnNkLW1vZGVsLWZpbmV0dW5lZC1sb3JhLXQ0JTIyJTBBY2FyZCUyMCUzRCUyMFJlcG9DYXJkLmxvYWQobG9yYV9tb2RlbF9pZCklMEFiYXNlX21vZGVsX2lkJTIwJTNEJTIwY2FyZC5kYXRhLnRvX2RpY3QoKSU1QiUyMmJhc2VfbW9kZWwlMjIlNUQlMEElMEFwaXBlJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKGJhc2VfbW9kZWxfaWQlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlKSUwQS4uLg==",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub.repocard <span class="hljs-keyword">import</span> RepoCard

lora_model_id = <span class="hljs-string">&quot;sayakpaul/sd-model-finetuned-lora-t4&quot;</span>
card = RepoCard.load(lora_model_id)
base_model_id = card.data.to_dict()[<span class="hljs-string">&quot;base_model&quot;</span>]

pipe = StableDiffusionPipeline.from_pretrained(base_model_id, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>)
...`,wrap:!1}}),{c(){i=o("p"),i.innerHTML=w,r=a(),m(y.$$.fragment)},l(b){i=p(b,"P",{"data-svelte-h":!0}),f(i)!=="svelte-1108nls"&&(i.innerHTML=w),r=n(b),u(y.$$.fragment,b)},m(b,U){s(b,i,U),s(b,r,U),h(y,b,U),_=!0},p:j,i(b){_||(d(y.$$.fragment,b),_=!0)},o(b){c(y.$$.fragment,b),_=!1},d(b){b&&(l(i),l(r)),M(y,b)}}}function gn(g){let i,w='💡 Take a look at the <a href="https://huggingface.co/blog/dreambooth" rel="nofollow">Training Stable Diffusion with DreamBooth using 🧨 Diffusers</a> blog for an in-depth analysis of DreamBooth experiments and recommended settings.';return{c(){i=o("p"),i.innerHTML=w},l(r){i=p(r,"P",{"data-svelte-h":!0}),f(i)!=="svelte-9rn216"&&(i.innerHTML=w)},m(r,y){s(r,i,y)},p:j,d(r){r&&l(i)}}}function Tn(g){let i,w="💡 A <code>scale</code> value of <code>0</code> is the same as not using your LoRA weights and you’re only using the base model weights, and a <code>scale</code> value of <code>1</code> means you’re only using the fully finetuned LoRA weights. Values between <code>0</code> and <code>1</code> interpolates between the two weights.";return{c(){i=o("p"),i.innerHTML=w},l(r){i=p(r,"P",{"data-svelte-h":!0}),f(i)!=="svelte-17q39x7"&&(i.innerHTML=w)},m(r,y){s(r,i,y)},p:j,d(r){r&&l(i)}}}function Jn(g){let i,w=`If your LoRA parameters involve the UNet as well as the Text Encoder, then passing
<code>cross_attention_kwargs={&quot;scale&quot;: 0.5}</code> will apply the <code>scale</code> value to both the UNet
and the Text Encoder.`;return{c(){i=o("p"),i.innerHTML=w},l(r){i=p(r,"P",{"data-svelte-h":!0}),f(i)!=="svelte-r01i5t"&&(i.innerHTML=w)},m(r,y){s(r,i,y)},p:j,d(r){r&&l(i)}}}function Un(g){let i,w='You can also provide a local directory path to <a href="/docs/diffusers/v0.23.0/en/api/pipelines/stable_diffusion/inpaint#diffusers.StableDiffusionInpaintPipeline.load_lora_weights">load_lora_weights()</a> as well as <a href="/docs/diffusers/v0.23.0/en/api/loaders#diffusers.loaders.UNet2DConditionLoadersMixin.load_attn_procs">load_attn_procs()</a>.';return{c(){i=o("p"),i.innerHTML=w},l(r){i=p(r,"P",{"data-svelte-h":!0}),f(i)!=="svelte-1ovazu4"&&(i.innerHTML=w)},m(r,y){s(r,i,y)},p:j,d(r){r&&l(i)}}}function _n(g){let i,w="Play with the <code>lora_scale</code> parameter when working with multiple LoRAs to control the amount of their influence on the final outputs.";return{c(){i=o("p"),i.innerHTML=w},l(r){i=p(r,"P",{"data-svelte-h":!0}),f(i)!=="svelte-ldu6p"&&(i.innerHTML=w)},m(r,y){s(r,i,y)},p:j,d(r){r&&l(i)}}}function Zn(g){let i,w="Currently, unfusing multiple LoRA checkpoints is not possible.";return{c(){i=o("p"),i.textContent=w},l(r){i=p(r,"P",{"data-svelte-h":!0}),f(i)!=="svelte-nyydsa"&&(i.textContent=w)},m(r,y){s(r,i,y)},p:j,d(r){r&&l(i)}}}function jn(g){let i,w="If you’re loading a checkpoint in the <code>safetensors</code> format, please ensure you have <code>safetensors</code> installed.";return{c(){i=o("p"),i.innerHTML=w},l(r){i=p(r,"P",{"data-svelte-h":!0}),f(i)!=="svelte-gba3ir"&&(i.innerHTML=w)},m(r,y){s(r,i,y)},p:j,d(r){r&&l(i)}}}function $n(g){let i,w="<strong>Known limitations specific to the Kohya LoRAs</strong>:",r,y,_='<li>When images don’t looks similar to other UIs, such as ComfyUI, it can be because of multiple reasons, as explained <a href="https://github.com/huggingface/diffusers/pull/4287/#issuecomment-1655110736" rel="nofollow">here</a>.</li> <li>We don’t fully support <a href="https://github.com/KohakuBlueleaf/LyCORIS" rel="nofollow">LyCORIS checkpoints</a>. To the best of our knowledge, our current <code>load_lora_weights()</code> should support LyCORIS checkpoints that have LoRA and LoCon modules but not the other ones, such as Hada, LoKR, etc.</li>';return{c(){i=o("p"),i.innerHTML=w,r=a(),y=o("ul"),y.innerHTML=_},l(b){i=p(b,"P",{"data-svelte-h":!0}),f(i)!=="svelte-8p7pue"&&(i.innerHTML=w),r=n(b),y=p(b,"UL",{"data-svelte-h":!0}),f(y)!=="svelte-au0p3i"&&(y.innerHTML=_)},m(b,U){s(b,i,U),s(b,r,U),s(b,y,U)},p:j,d(b){b&&(l(i),l(r),l(y))}}}function vn(g){let i,w,r,y,_,b,U,Xt,x,As='<a href="https://arxiv.org/abs/2106.09685" rel="nofollow">Low-Rank Adaptation of Large Language Models (LoRA)</a> is a training method that accelerates the training of large models while consuming less memory. It adds pairs of rank-decomposition weight matrices (called <strong>update matrices</strong>) to existing weights, and <strong>only</strong> trains those newly added weights. This has a couple of advantages:',xt,N,Qs='<li>Previous pretrained weights are kept frozen so the model is not as prone to <a href="https://www.pnas.org/doi/10.1073/pnas.1611835114" rel="nofollow">catastrophic forgetting</a>.</li> <li>Rank-decomposition matrices have significantly fewer parameters than the original model, which means that trained LoRA weights are easily portable.</li> <li>LoRA matrices are generally added to the attention layers of the original model. 🧨 Diffusers provides the <a href="/docs/diffusers/v0.23.0/en/api/loaders#diffusers.loaders.UNet2DConditionLoadersMixin.load_attn_procs">load_attn_procs()</a> method to load the LoRA weights into a model’s attention layers. You can control the extent to which the model is adapted toward new training images via a <code>scale</code> parameter.</li> <li>The greater memory-efficiency allows you to run fine-tuning on consumer GPUs like the Tesla T4, RTX 3080 or even the RTX 2080 Ti! GPUs like the T4 are free and readily accessible in Kaggle or Google Colab notebooks.</li>',Nt,$,Yt,Y,zs='<a href="https://github.com/cloneofsimo" rel="nofollow">cloneofsimo</a> was the first to try out LoRA training for Stable Diffusion in the popular <a href="https://github.com/cloneofsimo/lora" rel="nofollow">lora</a> GitHub repository. 🧨 Diffusers now supports finetuning with LoRA for <a href="https://github.com/huggingface/diffusers/tree/main/examples/text_to_image#training-with-lora" rel="nofollow">text-to-image generation</a> and <a href="https://github.com/huggingface/diffusers/tree/main/examples/dreambooth#training-with-low-rank-adaptation-of-large-language-models-lora" rel="nofollow">DreamBooth</a>. This guide will show you how to do both.',Et,E,qs='If you’d like to store or share your model with the community, login to your Hugging Face account (create <a href="https://hf.co/join" rel="nofollow">one</a> if you don’t have one already):',Ht,H,Ft,F,St,S,Ds="Finetuning a model like Stable Diffusion, which has billions of parameters, can be slow and difficult. With LoRA, it is much easier and faster to finetune a diffusion model. It can run on hardware with as little as 11GB of GPU RAM without resorting to tricks such as 8-bit optimizers.",At,A,Qt,Q,Ps='Let’s finetune <a href="https://huggingface.co/runwayml/stable-diffusion-v1-5" rel="nofollow"><code>stable-diffusion-v1-5</code></a> on the <a href="https://huggingface.co/datasets/lambdalabs/pokemon-blip-captions" rel="nofollow">Pokémon BLIP captions</a> dataset to generate your own Pokémon.',zt,z,Ks='Specify the <code>MODEL_NAME</code> environment variable (either a Hub model repository id or a path to the directory containing the model weights) and pass it to the <a href="https://huggingface.co/docs/diffusers/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained.pretrained_model_name_or_path" rel="nofollow"><code>pretrained_model_name_or_path</code></a> argument. You’ll also need to set the <code>DATASET_NAME</code> environment variable to the name of the dataset you want to train on. To use your own dataset, take a look at the <a href="create_dataset">Create a dataset for training</a> guide.',qt,q,Os="The <code>OUTPUT_DIR</code> and <code>HUB_MODEL_ID</code> variables are optional and specify where to save the model to on the Hub:",Dt,D,Pt,P,ea="There are some flags to be aware of before you start training:",Kt,K,ta='<li><code>--push_to_hub</code> stores the trained LoRA embeddings on the Hub.</li> <li><code>--report_to=wandb</code> reports and logs the training results to your Weights &amp; Biases dashboard (as an example, take a look at this <a href="https://wandb.ai/pcuenq/text2image-fine-tune/runs/b4k1w0tn?workspace=user-pcuenq" rel="nofollow">report</a>).</li> <li><code>--learning_rate=1e-04</code>, you can afford to use a higher learning rate than you normally would with LoRA.</li>',Ot,O,la='Now you’re ready to launch the training (you can find the full training script <a href="https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image_lora.py" rel="nofollow">here</a>). Training takes about 5 hours on a 2080 Ti GPU with 11GB of RAM, and it’ll create and save model checkpoints and the <code>pytorch_lora_weights</code> in your repository.',el,ee,tl,te,ll,le,sa='Now you can use the model for inference by loading the base model in the <a href="/docs/diffusers/v0.23.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline">StableDiffusionPipeline</a> and then the <a href="/docs/diffusers/v0.23.0/en/api/schedulers/multistep_dpm_solver#diffusers.DPMSolverMultistepScheduler">DPMSolverMultistepScheduler</a>:',sl,se,al,ae,aa="Load the LoRA weights from your finetuned model <em>on top of the base model weights</em>, and then move the pipeline to a GPU for faster inference. When you merge the LoRA weights with the frozen pretrained model weights, you can optionally adjust how much of the weights to merge with the <code>scale</code> parameter:",nl,v,il,ne,ol,W,pl,ie,rl,oe,na='<a href="https://arxiv.org/abs/2208.12242" rel="nofollow">DreamBooth</a> is a finetuning technique for personalizing a text-to-image model like Stable Diffusion to generate photorealistic images of a subject in different contexts, given a few images of the subject. However, DreamBooth is very sensitive to hyperparameters and it is easy to overfit. Some important hyperparameters to consider include those that affect the training time (learning rate, number of training steps), and inference time (number of steps, scheduler type).',fl,G,ml,pe,ul,re,ia='Let’s finetune <a href="https://huggingface.co/runwayml/stable-diffusion-v1-5" rel="nofollow"><code>stable-diffusion-v1-5</code></a> with DreamBooth and LoRA with some 🐶 <a href="https://drive.google.com/drive/folders/1BO_dyz-p65qhBRRMRA4TbZ8qW4rB99JZ" rel="nofollow">dog images</a>. Download and save these images to a directory. To use your own dataset, take a look at the <a href="create_dataset">Create a dataset for training</a> guide.',hl,fe,oa='To start, specify the <code>MODEL_NAME</code> environment variable (either a Hub model repository id or a path to the directory containing the model weights) and pass it to the <a href="https://huggingface.co/docs/diffusers/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained.pretrained_model_name_or_path" rel="nofollow"><code>pretrained_model_name_or_path</code></a> argument. You’ll also need to set <code>INSTANCE_DIR</code> to the path of the directory containing the images.',dl,me,pa="The <code>OUTPUT_DIR</code> variables is optional and specifies where to save the model to on the Hub:",cl,ue,Ml,he,ra="There are some flags to be aware of before you start training:",wl,de,fa='<li><code>--push_to_hub</code> stores the trained LoRA embeddings on the Hub.</li> <li><code>--report_to=wandb</code> reports and logs the training results to your Weights &amp; Biases dashboard (as an example, take a look at this <a href="https://wandb.ai/pcuenq/text2image-fine-tune/runs/b4k1w0tn?workspace=user-pcuenq" rel="nofollow">report</a>).</li> <li><code>--learning_rate=1e-04</code>, you can afford to use a higher learning rate than you normally would with LoRA.</li>',yl,ce,ma='Now you’re ready to launch the training (you can find the full training script <a href="https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth_lora.py" rel="nofollow">here</a>). The script creates and saves model checkpoints and the <code>pytorch_lora_weights.bin</code> file in your repository.',bl,Me,ua=`It’s also possible to additionally fine-tune the text encoder with LoRA. This, in most cases, leads
to better results with a slight increase in the compute. To allow fine-tuning the text encoder with LoRA,
specify the <code>--train_text_encoder</code> while launching the <code>train_dreambooth_lora.py</code> script.`,gl,we,Tl,ye,Jl,be,ha='Now you can use the model for inference by loading the base model in the <a href="/docs/diffusers/v0.23.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline">StableDiffusionPipeline</a>:',Ul,ge,_l,Te,da="Load the LoRA weights from your finetuned DreamBooth model <em>on top of the base model weights</em>, and then move the pipeline to a GPU for faster inference. When you merge the LoRA weights with the frozen pretrained model weights, you can optionally adjust how much of the weights to merge with the <code>scale</code> parameter:",Zl,R,jl,Je,$l,Ue,ca=`If you used <code>--train_text_encoder</code> during training, then use <code>pipe.load_lora_weights()</code> to load the LoRA
weights. For example:`,vl,_e,Wl,B,Gl,Ze,Ma=`Note that the use of <a href="/docs/diffusers/v0.23.0/en/api/pipelines/stable_diffusion/inpaint#diffusers.StableDiffusionInpaintPipeline.load_lora_weights">load_lora_weights()</a> is preferred to <a href="/docs/diffusers/v0.23.0/en/api/loaders#diffusers.loaders.UNet2DConditionLoadersMixin.load_attn_procs">load_attn_procs()</a> for loading LoRA parameters. This is because
<a href="/docs/diffusers/v0.23.0/en/api/pipelines/stable_diffusion/inpaint#diffusers.StableDiffusionInpaintPipeline.load_lora_weights">load_lora_weights()</a> can handle the following situations:`,Rl,I,je,kt,wa='LoRA parameters that don’t have separate identifiers for the UNet and the text encoder (such as <a href="https://huggingface.co/patrickvonplaten/lora_dreambooth_dog_example" rel="nofollow"><code>&quot;patrickvonplaten/lora_dreambooth_dog_example&quot;</code></a>). So, you can just do:',Fs,$e,Ss,Lt,ya='<p>LoRA parameters that have separate identifiers for the UNet and the text encoder such as: <a href="https://huggingface.co/sayakpaul/dreambooth" rel="nofollow"><code>&quot;sayakpaul/dreambooth&quot;</code></a>.</p>',Bl,k,Il,ve,kl,We,ba='We support fine-tuning with <a href="https://huggingface.co/papers/2307.01952" rel="nofollow">Stable Diffusion XL</a>. Please refer to the following docs:',Ll,Ge,ga='<li><a href="https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/README_sdxl.md" rel="nofollow">text_to_image/README_sdxl.md</a></li> <li><a href="https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/README_sdxl.md" rel="nofollow">dreambooth/README_sdxl.md</a></li>',Cl,Re,Vl,Be,Ta='You can call <a href="/docs/diffusers/v0.23.0/en/api/loaders#diffusers.loaders.LoraLoaderMixin.unload_lora_weights">unload_lora_weights()</a> on a pipeline to unload the LoRA parameters.',Xl,Ie,xl,ke,Ja='You can call <a href="/docs/diffusers/v0.23.0/en/api/loaders#diffusers.loaders.LoraLoaderMixin.fuse_lora">fuse_lora()</a> on a pipeline to merge the LoRA parameters with the original parameters of the underlying model(s). This can lead to a potential speedup in the inference latency.',Nl,Le,Yl,Ce,Ua='To undo <code>fuse_lora</code>, call <a href="/docs/diffusers/v0.23.0/en/api/loaders#diffusers.loaders.LoraLoaderMixin.unfuse_lora">unfuse_lora()</a> on a pipeline.',El,Ve,Hl,Xe,_a="If you need to use <code>scale</code> when working with <code>fuse_lora()</code> to control the influence of the LoRA parameters on the outputs, you should specify <code>lora_scale</code> within <code>fuse_lora()</code>. Passing the <code>scale</code> parameter to <code>cross_attention_kwargs</code> when you call the pipeline won’t work.",Fl,xe,Za="To use a different <code>lora_scale</code> with <code>fuse_lora()</code>, you should first call <code>unfuse_lora()</code> on the corresponding pipeline and call <code>fuse_lora()</code> again with the expected <code>lora_scale</code>.",Sl,Ne,Al,Ye,Ql,Ee,ja="Let’s say you want to load the pipeline above that has its UNet fused with the LoRA parameters. You can easily do so by simply calling the <code>save_pretrained()</code> method on <code>pipe</code>.",zl,He,$a="After loading the LoRA parameters into a pipeline, if you want to serialize the pipeline such that the affected model components are already fused with the LoRA parameters, you should:",ql,Fe,va="<li>call <code>fuse_lora()</code> on the pipeline with the desired <code>lora_scale</code>, given you’ve already loaded the LoRA parameters into it.</li> <li>call <code>save_pretrained()</code> on the pipeline.</li>",Dl,Se,Wa="Here is a complete example:",Pl,Ae,Kl,Qe,Ga="Now, you can load the pipeline and directly perform inference without having to load the LoRA parameters again:",Ol,ze,es,qe,ts,De,Ra="With the <code>fuse_lora()</code> method as described above, it’s possible to load multiple LoRA checkpoints. Let’s work through a complete example. First we load the base pipeline:",ls,Pe,ss,Ke,Ba="Then let’s two LoRA checkpoints and fuse them with specific <code>lora_scale</code> values:",as,Oe,ns,L,is,et,Ia="Let’s see them in action:",os,tt,ps,lt,ka='<img src="https://huggingface.co/datasets/diffusers/docs-images/resolve/main/cyborg_pikachu.png" alt="cyborg_pikachu"/>',rs,C,fs,st,ms,at,La='🤗 Diffusers supports loading checkpoints from popular LoRA trainers such as <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>. In this section, we outline the current API’s details and limitations.',us,nt,hs,it,Ca='This support was made possible because of the amazing contributors: <a href="https://github.com/takuma104" rel="nofollow">@takuma104</a> and <a href="https://github.com/isidentical" rel="nofollow">@isidentical</a>.',ds,ot,Va=`We support loading Kohya LoRA checkpoints using <a href="/docs/diffusers/v0.23.0/en/api/pipelines/stable_diffusion/inpaint#diffusers.StableDiffusionInpaintPipeline.load_lora_weights">load_lora_weights()</a>. In this section, we explain how to load such a checkpoint from <a href="https://civitai.com/" rel="nofollow">CivitAI</a>
in Diffusers and perform inference with it.`,cs,pt,Xa=`First, download a checkpoint. We’ll use
<a href="https://civitai.com/models/13239/light-and-shadow" rel="nofollow">this one</a> for demonstration purposes.`,Ms,rt,ws,ft,xa='Next, we initialize a <a href="/docs/diffusers/v0.23.0/en/api/pipelines/overview#diffusers.DiffusionPipeline">~DiffusionPipeline</a>:',ys,mt,bs,ut,Na="We then load the checkpoint downloaded from CivitAI:",gs,ht,Ts,V,Js,dt,Ya="And then it’s time for running inference:",Us,ct,_s,Mt,Ea="Below is a comparison between the LoRA and the non-LoRA results:",Zs,wt,Ha='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/lora_non_lora_comparison.png" alt="lora_non_lora"/>',js,yt,Fa=`You have a similar checkpoint stored on the Hugging Face Hub, you can load it
directly with <a href="/docs/diffusers/v0.23.0/en/api/pipelines/stable_diffusion/inpaint#diffusers.StableDiffusionInpaintPipeline.load_lora_weights">load_lora_weights()</a> like so:`,$s,bt,vs,gt,Ws,Tt,Sa='After the release of <a href="https://huggingface.co/papers/2307.01952" rel="nofollow">Stable Diffusion XL</a>, the community contributed some amazing LoRA checkpoints trained on top of it with the Kohya trainer.',Gs,Jt,Aa="Here are some example checkpoints we tried out:",Rs,Ut,Qa='<li>SDXL 0.9:<ul><li><a href="https://civitai.com/models/22279?modelVersionId=118556" rel="nofollow">https://civitai.com/models/22279?modelVersionId=118556</a></li> <li><a href="https://civitai.com/models/104515/sdxlor30costumesrevue-starlight-saijoclaudine-lora" rel="nofollow">https://civitai.com/models/104515/sdxlor30costumesrevue-starlight-saijoclaudine-lora</a></li> <li><a href="https://civitai.com/models/108448/daiton-sdxl-test" rel="nofollow">https://civitai.com/models/108448/daiton-sdxl-test</a></li> <li><a href="https://filebin.net/2ntfqqnapiu9q3zx/pixelbuildings128-v1.safetensors" rel="nofollow">https://filebin.net/2ntfqqnapiu9q3zx/pixelbuildings128-v1.safetensors</a></li></ul></li> <li>SDXL 1.0:<ul><li><a href="https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_offset_example-lora_1.0.safetensors" rel="nofollow">https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_offset_example-lora_1.0.safetensors</a></li></ul></li>',Bs,_t,za="Here is an example of how to perform inference with these checkpoints in <code>diffusers</code>:",Is,Zt,ks,jt,qa='<code>Kamepan.safetensors</code> comes from <a href="https://civitai.com/models/22279?modelVersionId=118556" rel="nofollow">https://civitai.com/models/22279?modelVersionId=118556</a> .',Ls,$t,Da="If you notice carefully, the inference UX is exactly identical to what we presented in the sections above.",Cs,vt,Pa='Thanks to <a href="https://github.com/isidentical" rel="nofollow">@isidentical</a> for helping us on integrating this feature.',Vs,X,Xs,Wt,xs,Gt,Ka="Here is an example:",Ns,Rt,Ys,Vt,Es;return _=new J({props:{title:"Low-Rank Adaptation of Large Language Models (LoRA)",local:"low-rank-adaptation-of-large-language-models-lora",headingTag:"h1"}}),U=new Z({props:{warning:!0,$$slots:{default:[Mn]},$$scope:{ctx:g}}}),$=new Z({props:{$$slots:{default:[wn]},$$scope:{ctx:g}}}),H=new T({props:{code:"aHVnZ2luZ2ZhY2UtY2xpJTIwbG9naW4=",highlighted:"huggingface-cli login",wrap:!1}}),F=new J({props:{title:"Text-to-image",local:"text-to-image",headingTag:"h2"}}),A=new J({props:{title:"Training",local:"text-to-image-training",headingTag:"h3"}}),D=new T({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBZXhwb3J0JTIwT1VUUFVUX0RJUiUzRCUyMiUyRnNkZGF0YSUyRmZpbmV0dW5lJTJGbG9yYSUyRnBva2Vtb24lMjIlMEFleHBvcnQlMjBIVUJfTU9ERUxfSUQlM0QlMjJwb2tlbW9uLWxvcmElMjIlMEFleHBvcnQlMjBEQVRBU0VUX05BTUUlM0QlMjJsYW1iZGFsYWJzJTJGcG9rZW1vbi1ibGlwLWNhcHRpb25zJTIy",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;/sddata/finetune/lora/pokemon&quot;</span>
<span class="hljs-built_in">export</span> HUB_MODEL_ID=<span class="hljs-string">&quot;pokemon-lora&quot;</span>
<span class="hljs-built_in">export</span> DATASET_NAME=<span class="hljs-string">&quot;lambdalabs/pokemon-blip-captions&quot;</span>`,wrap:!1}}),ee=new T({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMC0tbWl4ZWRfcHJlY2lzaW9uJTNEJTIyZnAxNiUyMiUyMCUyMHRyYWluX3RleHRfdG9faW1hZ2VfbG9yYS5weSUyMCU1QyUwQSUyMCUyMC0tcHJldHJhaW5lZF9tb2RlbF9uYW1lX29yX3BhdGglM0QlMjRNT0RFTF9OQU1FJTIwJTVDJTBBJTIwJTIwLS1kYXRhc2V0X25hbWUlM0QlMjREQVRBU0VUX05BTUUlMjAlNUMlMEElMjAlMjAtLWRhdGFsb2FkZXJfbnVtX3dvcmtlcnMlM0Q4JTIwJTVDJTBBJTIwJTIwLS1yZXNvbHV0aW9uJTNENTEyJTIwLS1jZW50ZXJfY3JvcCUyMC0tcmFuZG9tX2ZsaXAlMjAlNUMlMEElMjAlMjAtLXRyYWluX2JhdGNoX3NpemUlM0QxJTIwJTVDJTBBJTIwJTIwLS1ncmFkaWVudF9hY2N1bXVsYXRpb25fc3RlcHMlM0Q0JTIwJTVDJTBBJTIwJTIwLS1tYXhfdHJhaW5fc3RlcHMlM0QxNTAwMCUyMCU1QyUwQSUyMCUyMC0tbGVhcm5pbmdfcmF0ZSUzRDFlLTA0JTIwJTVDJTBBJTIwJTIwLS1tYXhfZ3JhZF9ub3JtJTNEMSUyMCU1QyUwQSUyMCUyMC0tbHJfc2NoZWR1bGVyJTNEJTIyY29zaW5lJTIyJTIwLS1scl93YXJtdXBfc3RlcHMlM0QwJTIwJTVDJTBBJTIwJTIwLS1vdXRwdXRfZGlyJTNEJTI0JTdCT1VUUFVUX0RJUiU3RCUyMCU1QyUwQSUyMCUyMC0tcHVzaF90b19odWIlMjAlNUMlMEElMjAlMjAtLWh1Yl9tb2RlbF9pZCUzRCUyNCU3QkhVQl9NT0RFTF9JRCU3RCUyMCU1QyUwQSUyMCUyMC0tcmVwb3J0X3RvJTNEd2FuZGIlMjAlNUMlMEElMjAlMjAtLWNoZWNrcG9pbnRpbmdfc3RlcHMlM0Q1MDAlMjAlNUMlMEElMjAlMjAtLXZhbGlkYXRpb25fcHJvbXB0JTNEJTIyQSUyMHBva2Vtb24lMjB3aXRoJTIwYmx1ZSUyMGV5ZXMuJTIyJTIwJTVDJTBBJTIwJTIwLS1zZWVkJTNEMTMzNw==",highlighted:`accelerate launch --mixed_precision=<span class="hljs-string">&quot;fp16&quot;</span>  train_text_to_image_lora.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span> \\
  --dataset_name=<span class="hljs-variable">$DATASET_NAME</span> \\
  --dataloader_num_workers=8 \\
  --resolution=512 --center_crop --random_flip \\
  --train_batch_size=1 \\
  --gradient_accumulation_steps=4 \\
  --max_train_steps=15000 \\
  --learning_rate=1e-04 \\
  --max_grad_norm=1 \\
  --lr_scheduler=<span class="hljs-string">&quot;cosine&quot;</span> --lr_warmup_steps=0 \\
  --output_dir=<span class="hljs-variable">\${OUTPUT_DIR}</span> \\
  --push_to_hub \\
  --hub_model_id=<span class="hljs-variable">\${HUB_MODEL_ID}</span> \\
  --report_to=wandb \\
  --checkpointing_steps=500 \\
  --validation_prompt=<span class="hljs-string">&quot;A pokemon with blue eyes.&quot;</span> \\
  --seed=1337`,wrap:!1}}),te=new J({props:{title:"Inference",local:"text-to-image-inference",headingTag:"h3"}}),se=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUlMkMlMjBEUE1Tb2x2ZXJNdWx0aXN0ZXBTY2hlZHVsZXIlMEElMEFtb2RlbF9iYXNlJTIwJTNEJTIwJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMEElMEFwaXBlJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2Jhc2UlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlKSUwQXBpcGUuc2NoZWR1bGVyJTIwJTNEJTIwRFBNU29sdmVyTXVsdGlzdGVwU2NoZWR1bGVyLmZyb21fY29uZmlnKHBpcGUuc2NoZWR1bGVyLmNvbmZpZyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline, DPMSolverMultistepScheduler

<span class="hljs-meta">&gt;&gt;&gt; </span>model_base = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = StableDiffusionPipeline.from_pretrained(model_base, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)`,wrap:!1}}),v=new Z({props:{$$slots:{default:[yn]},$$scope:{ctx:g}}}),ne=new T({props:{code:"cGlwZS51bmV0LmxvYWRfYXR0bl9wcm9jcyhsb3JhX21vZGVsX3BhdGgpJTBBcGlwZS50byglMjJjdWRhJTIyKSUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZSglMEElMjAlMjAlMjAlMjAlMjJBJTIwcG9rZW1vbiUyMHdpdGglMjBibHVlJTIwZXllcy4lMjIlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMjUlMkMlMjBndWlkYW5jZV9zY2FsZSUzRDcuNSUyQyUyMGNyb3NzX2F0dGVudGlvbl9rd2FyZ3MlM0QlN0IlMjJzY2FsZSUyMiUzQSUyMDAuNSU3RCUwQSkuaW1hZ2VzJTVCMCU1RCUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZSglMjJBJTIwcG9rZW1vbiUyMHdpdGglMjBibHVlJTIwZXllcy4lMjIlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMjUlMkMlMjBndWlkYW5jZV9zY2FsZSUzRDcuNSkuaW1hZ2VzJTVCMCU1RCUwQWltYWdlLnNhdmUoJTIyYmx1ZV9wb2tlbW9uLnBuZyUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.unet.load_attn_procs(lora_model_path)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-comment"># use half the weights from the LoRA finetuned model and half the weights from the base model</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;A pokemon with blue eyes.&quot;</span>, num_inference_steps=<span class="hljs-number">25</span>, guidance_scale=<span class="hljs-number">7.5</span>, cross_attention_kwargs={<span class="hljs-string">&quot;scale&quot;</span>: <span class="hljs-number">0.5</span>}
<span class="hljs-meta">... </span>).images[<span class="hljs-number">0</span>]
<span class="hljs-comment"># use the weights from the fully finetuned LoRA model</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(<span class="hljs-string">&quot;A pokemon with blue eyes.&quot;</span>, num_inference_steps=<span class="hljs-number">25</span>, guidance_scale=<span class="hljs-number">7.5</span>).images[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image.save(<span class="hljs-string">&quot;blue_pokemon.png&quot;</span>)`,wrap:!1}}),W=new Z({props:{$$slots:{default:[bn]},$$scope:{ctx:g}}}),ie=new J({props:{title:"DreamBooth",local:"dreambooth",headingTag:"h2"}}),G=new Z({props:{$$slots:{default:[gn]},$$scope:{ctx:g}}}),pe=new J({props:{title:"Training",local:"dreambooth-training",headingTag:"h3"}}),ue=new T({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBZXhwb3J0JTIwSU5TVEFOQ0VfRElSJTNEJTIycGF0aC10by1pbnN0YW5jZS1pbWFnZXMlMjIlMEFleHBvcnQlMjBPVVRQVVRfRElSJTNEJTIycGF0aC10by1zYXZlLW1vZGVsJTIy",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
<span class="hljs-built_in">export</span> INSTANCE_DIR=<span class="hljs-string">&quot;path-to-instance-images&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path-to-save-model&quot;</span>`,wrap:!1}}),we=new T({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2RyZWFtYm9vdGhfbG9yYS5weSUyMCU1QyUwQSUyMCUyMC0tcHJldHJhaW5lZF9tb2RlbF9uYW1lX29yX3BhdGglM0QlMjRNT0RFTF9OQU1FJTIwJTIwJTVDJTBBJTIwJTIwLS1pbnN0YW5jZV9kYXRhX2RpciUzRCUyNElOU1RBTkNFX0RJUiUyMCU1QyUwQSUyMCUyMC0tb3V0cHV0X2RpciUzRCUyNE9VVFBVVF9ESVIlMjAlNUMlMEElMjAlMjAtLWluc3RhbmNlX3Byb21wdCUzRCUyMmElMjBwaG90byUyMG9mJTIwc2tzJTIwZG9nJTIyJTIwJTVDJTBBJTIwJTIwLS1yZXNvbHV0aW9uJTNENTEyJTIwJTVDJTBBJTIwJTIwLS10cmFpbl9iYXRjaF9zaXplJTNEMSUyMCU1QyUwQSUyMCUyMC0tZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNEMSUyMCU1QyUwQSUyMCUyMC0tY2hlY2twb2ludGluZ19zdGVwcyUzRDEwMCUyMCU1QyUwQSUyMCUyMC0tbGVhcm5pbmdfcmF0ZSUzRDFlLTQlMjAlNUMlMEElMjAlMjAtLXJlcG9ydF90byUzRCUyMndhbmRiJTIyJTIwJTVDJTBBJTIwJTIwLS1scl9zY2hlZHVsZXIlM0QlMjJjb25zdGFudCUyMiUyMCU1QyUwQSUyMCUyMC0tbHJfd2FybXVwX3N0ZXBzJTNEMCUyMCU1QyUwQSUyMCUyMC0tbWF4X3RyYWluX3N0ZXBzJTNENTAwJTIwJTVDJTBBJTIwJTIwLS12YWxpZGF0aW9uX3Byb21wdCUzRCUyMkElMjBwaG90byUyMG9mJTIwc2tzJTIwZG9nJTIwaW4lMjBhJTIwYnVja2V0JTIyJTIwJTVDJTBBJTIwJTIwLS12YWxpZGF0aW9uX2Vwb2NocyUzRDUwJTIwJTVDJTBBJTIwJTIwLS1zZWVkJTNEJTIyMCUyMiUyMCU1QyUwQSUyMCUyMC0tcHVzaF90b19odWI=",highlighted:`accelerate launch train_dreambooth_lora.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span>  \\
  --instance_data_dir=<span class="hljs-variable">$INSTANCE_DIR</span> \\
  --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
  --instance_prompt=<span class="hljs-string">&quot;a photo of sks dog&quot;</span> \\
  --resolution=512 \\
  --train_batch_size=1 \\
  --gradient_accumulation_steps=1 \\
  --checkpointing_steps=100 \\
  --learning_rate=1e-4 \\
  --report_to=<span class="hljs-string">&quot;wandb&quot;</span> \\
  --lr_scheduler=<span class="hljs-string">&quot;constant&quot;</span> \\
  --lr_warmup_steps=0 \\
  --max_train_steps=500 \\
  --validation_prompt=<span class="hljs-string">&quot;A photo of sks dog in a bucket&quot;</span> \\
  --validation_epochs=50 \\
  --seed=<span class="hljs-string">&quot;0&quot;</span> \\
  --push_to_hub`,wrap:!1}}),ye=new J({props:{title:"Inference",local:"dreambooth-inference",headingTag:"h3"}}),ge=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFtb2RlbF9iYXNlJTIwJTNEJTIwJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMEElMEFwaXBlJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2Jhc2UlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>model_base = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = StableDiffusionPipeline.from_pretrained(model_base, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>)`,wrap:!1}}),R=new Z({props:{$$slots:{default:[Tn]},$$scope:{ctx:g}}}),Je=new T({props:{code:"cGlwZS51bmV0LmxvYWRfYXR0bl9wcm9jcyhsb3JhX21vZGVsX3BhdGgpJTBBcGlwZS50byglMjJjdWRhJTIyKSUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZSglMEElMjAlMjAlMjAlMjAlMjJBJTIwcGljdHVyZSUyMG9mJTIwYSUyMHNrcyUyMGRvZyUyMGluJTIwYSUyMGJ1Y2tldC4lMjIlMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMjUlMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDcuNSUyQyUwQSUyMCUyMCUyMCUyMGNyb3NzX2F0dGVudGlvbl9rd2FyZ3MlM0QlN0IlMjJzY2FsZSUyMiUzQSUyMDAuNSU3RCUyQyUwQSkuaW1hZ2VzJTVCMCU1RCUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZSglMjJBJTIwcGljdHVyZSUyMG9mJTIwYSUyMHNrcyUyMGRvZyUyMGluJTIwYSUyMGJ1Y2tldC4lMjIlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMjUlMkMlMjBndWlkYW5jZV9zY2FsZSUzRDcuNSkuaW1hZ2VzJTVCMCU1RCUwQWltYWdlLnNhdmUoJTIyYnVja2V0LWRvZy5wbmclMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.unet.load_attn_procs(lora_model_path)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-comment"># use half the weights from the LoRA finetuned model and half the weights from the base model</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;A picture of a sks dog in a bucket.&quot;</span>,
<span class="hljs-meta">... </span>    num_inference_steps=<span class="hljs-number">25</span>,
<span class="hljs-meta">... </span>    guidance_scale=<span class="hljs-number">7.5</span>,
<span class="hljs-meta">... </span>    cross_attention_kwargs={<span class="hljs-string">&quot;scale&quot;</span>: <span class="hljs-number">0.5</span>},
<span class="hljs-meta">... </span>).images[<span class="hljs-number">0</span>]
<span class="hljs-comment"># use the weights from the fully finetuned LoRA model</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(<span class="hljs-string">&quot;A picture of a sks dog in a bucket.&quot;</span>, num_inference_steps=<span class="hljs-number">25</span>, guidance_scale=<span class="hljs-number">7.5</span>).images[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image.save(<span class="hljs-string">&quot;bucket-dog.png&quot;</span>)`,wrap:!1}}),_e=new T({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1Yi5yZXBvY2FyZCUyMGltcG9ydCUyMFJlcG9DYXJkJTBBZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFsb3JhX21vZGVsX2lkJTIwJTNEJTIwJTIyc2F5YWtwYXVsJTJGZHJlYW1ib290aC10ZXh0LWVuY29kZXItdGVzdCUyMiUwQWNhcmQlMjAlM0QlMjBSZXBvQ2FyZC5sb2FkKGxvcmFfbW9kZWxfaWQpJTBBYmFzZV9tb2RlbF9pZCUyMCUzRCUyMGNhcmQuZGF0YS50b19kaWN0KCklNUIlMjJiYXNlX21vZGVsJTIyJTVEJTBBJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChiYXNlX21vZGVsX2lkJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSklMEFwaXBlJTIwJTNEJTIwcGlwZS50byglMjJjdWRhJTIyKSUwQXBpcGUubG9hZF9sb3JhX3dlaWdodHMobG9yYV9tb2RlbF9pZCklMEFpbWFnZSUyMCUzRCUyMHBpcGUoJTIyQSUyMHBpY3R1cmUlMjBvZiUyMGElMjBza3MlMjBkb2clMjBpbiUyMGElMjBidWNrZXQlMjIlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMjUpLmltYWdlcyU1QjAlNUQ=",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub.repocard <span class="hljs-keyword">import</span> RepoCard
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline
<span class="hljs-keyword">import</span> torch

lora_model_id = <span class="hljs-string">&quot;sayakpaul/dreambooth-text-encoder-test&quot;</span>
card = RepoCard.load(lora_model_id)
base_model_id = card.data.to_dict()[<span class="hljs-string">&quot;base_model&quot;</span>]

pipe = StableDiffusionPipeline.from_pretrained(base_model_id, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>)
pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipe.load_lora_weights(lora_model_id)
image = pipe(<span class="hljs-string">&quot;A picture of a sks dog in a bucket&quot;</span>, num_inference_steps=<span class="hljs-number">25</span>).images[<span class="hljs-number">0</span>]`,wrap:!1}}),B=new Z({props:{$$slots:{default:[Jn]},$$scope:{ctx:g}}}),$e=new T({props:{code:"cGlwZS5sb2FkX2xvcmFfd2VpZ2h0cyhsb3JhX21vZGVsX3BhdGgp",highlighted:"pipe.load_lora_weights(lora_model_path)",wrap:!1}}),k=new Z({props:{$$slots:{default:[Un]},$$scope:{ctx:g}}}),ve=new J({props:{title:"Stable Diffusion XL",local:"stable-diffusion-xl",headingTag:"h2"}}),Re=new J({props:{title:"Unloading LoRA parameters",local:"unloading-lora-parameters",headingTag:"h2"}}),Ie=new J({props:{title:"Fusing LoRA parameters",local:"fusing-lora-parameters",headingTag:"h2"}}),Le=new J({props:{title:"Unfusing LoRA parameters",local:"unfusing-lora-parameters",headingTag:"h2"}}),Ve=new J({props:{title:"Working with different LoRA scales when using LoRA fusion",local:"working-with-different-lora-scales-when-using-lora-fusion",headingTag:"h2"}}),Ne=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMjAlMEElMEFwaXBlJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi14bC1iYXNlLTEuMCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMiklMEFsb3JhX21vZGVsX2lkJTIwJTNEJTIwJTIyaGYtaW50ZXJuYWwtdGVzdGluZyUyRnNkeGwtMS4wLWxvcmElMjIlMEFsb3JhX2ZpbGVuYW1lJTIwJTNEJTIwJTIyc2RfeGxfb2Zmc2V0X2V4YW1wbGUtbG9yYV8xLjAuc2FmZXRlbnNvcnMlMjIlMEFwaXBlLmxvYWRfbG9yYV93ZWlnaHRzKGxvcmFfbW9kZWxfaWQlMkMlMjB3ZWlnaHRfbmFtZSUzRGxvcmFfZmlsZW5hbWUpJTBBJTBBJTIzJTIwVGhpcyUyMHVzZXMlMjBhJTIwZGVmYXVsdCUyMCU2MGxvcmFfc2NhbGUlNjAlMjBvZiUyMDEuMC4lMEFwaXBlLmZ1c2VfbG9yYSgpJTBBJTBBZ2VuZXJhdG9yJTIwJTNEJTIwdG9yY2gubWFudWFsX3NlZWQoMCklMEFpbWFnZXNfZnVzaW9uJTIwJTNEJTIwcGlwZSglMEElMjAlMjAlMjAlMjAlMjJtYXN0ZXJwaWVjZSUyQyUyMGJlc3QlMjBxdWFsaXR5JTJDJTIwbW91bnRhaW4lMjIlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMiUwQSkuaW1hZ2VzJTBBJTBBJTIzJTIwVG8lMjB3b3JrJTIwd2l0aCUyMGElMjBkaWZmZXJlbnQlMjAlNjBsb3JhX3NjYWxlJTYwJTJDJTIwZmlyc3QlMjByZXZlcnNlJTIwdGhlJTIwZWZmZWN0cyUyMG9mJTIwJTYwZnVzZV9sb3JhKCklNjAuJTBBcGlwZS51bmZ1c2VfbG9yYSgpJTBBJTBBJTIzJTIwVGhlbiUyMHByb2NlZWQlMjBhcyUyMGZvbGxvd3MuJTBBcGlwZS5sb2FkX2xvcmFfd2VpZ2h0cyhsb3JhX21vZGVsX2lkJTJDJTIwd2VpZ2h0X25hbWUlM0Rsb3JhX2ZpbGVuYW1lKSUwQXBpcGUuZnVzZV9sb3JhKGxvcmFfc2NhbGUlM0QwLjUpJTBBJTBBZ2VuZXJhdG9yJTIwJTNEJTIwdG9yY2gubWFudWFsX3NlZWQoMCklMEFpbWFnZXNfZnVzaW9uJTIwJTNEJTIwcGlwZSglMEElMjAlMjAlMjAlMjAlMjJtYXN0ZXJwaWVjZSUyQyUyMGJlc3QlMjBxdWFsaXR5JTJDJTIwbW91bnRhaW4lMjIlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMiUwQSkuaW1hZ2Vz",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">import</span> torch 

pipe = DiffusionPipeline.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>)
lora_model_id = <span class="hljs-string">&quot;hf-internal-testing/sdxl-1.0-lora&quot;</span>
lora_filename = <span class="hljs-string">&quot;sd_xl_offset_example-lora_1.0.safetensors&quot;</span>
pipe.load_lora_weights(lora_model_id, weight_name=lora_filename)

<span class="hljs-comment"># This uses a default \`lora_scale\` of 1.0.</span>
pipe.fuse_lora()

generator = torch.manual_seed(<span class="hljs-number">0</span>)
images_fusion = pipe(
    <span class="hljs-string">&quot;masterpiece, best quality, mountain&quot;</span>, generator=generator, num_inference_steps=<span class="hljs-number">2</span>
).images

<span class="hljs-comment"># To work with a different \`lora_scale\`, first reverse the effects of \`fuse_lora()\`.</span>
pipe.unfuse_lora()

<span class="hljs-comment"># Then proceed as follows.</span>
pipe.load_lora_weights(lora_model_id, weight_name=lora_filename)
pipe.fuse_lora(lora_scale=<span class="hljs-number">0.5</span>)

generator = torch.manual_seed(<span class="hljs-number">0</span>)
images_fusion = pipe(
    <span class="hljs-string">&quot;masterpiece, best quality, mountain&quot;</span>, generator=generator, num_inference_steps=<span class="hljs-number">2</span>
).images`,wrap:!1}}),Ye=new J({props:{title:"Serializing pipelines with fused LoRA parameters",local:"serializing-pipelines-with-fused-lora-parameters",headingTag:"h2"}}),Ae=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMjAlMEElMEFwaXBlJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi14bC1iYXNlLTEuMCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMiklMEFsb3JhX21vZGVsX2lkJTIwJTNEJTIwJTIyaGYtaW50ZXJuYWwtdGVzdGluZyUyRnNkeGwtMS4wLWxvcmElMjIlMEFsb3JhX2ZpbGVuYW1lJTIwJTNEJTIwJTIyc2RfeGxfb2Zmc2V0X2V4YW1wbGUtbG9yYV8xLjAuc2FmZXRlbnNvcnMlMjIlMEFwaXBlLmxvYWRfbG9yYV93ZWlnaHRzKGxvcmFfbW9kZWxfaWQlMkMlMjB3ZWlnaHRfbmFtZSUzRGxvcmFfZmlsZW5hbWUpJTBBJTBBJTIzJTIwRmlyc3QlMkMlMjBmdXNlJTIwdGhlJTIwTG9SQSUyMHBhcmFtZXRlcnMuJTBBcGlwZS5mdXNlX2xvcmEoKSUwQSUwQSUyMyUyMFRoZW4lMjBzYXZlLiUwQXBpcGUuc2F2ZV9wcmV0cmFpbmVkKCUyMm15LXBpcGVsaW5lLXdpdGgtZnVzZWQtbG9yYSUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">import</span> torch 

pipe = DiffusionPipeline.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>)
lora_model_id = <span class="hljs-string">&quot;hf-internal-testing/sdxl-1.0-lora&quot;</span>
lora_filename = <span class="hljs-string">&quot;sd_xl_offset_example-lora_1.0.safetensors&quot;</span>
pipe.load_lora_weights(lora_model_id, weight_name=lora_filename)

<span class="hljs-comment"># First, fuse the LoRA parameters.</span>
pipe.fuse_lora()

<span class="hljs-comment"># Then save.</span>
pipe.save_pretrained(<span class="hljs-string">&quot;my-pipeline-with-fused-lora&quot;</span>)`,wrap:!1}}),ze=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMjAlMEElMEFwaXBlJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMm15LXBpcGVsaW5lLXdpdGgtZnVzZWQtbG9yYSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMiklMEElMEFnZW5lcmF0b3IlMjAlM0QlMjB0b3JjaC5tYW51YWxfc2VlZCgwKSUwQWltYWdlc19mdXNpb24lMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMCUyMm1hc3RlcnBpZWNlJTJDJTIwYmVzdCUyMHF1YWxpdHklMkMlMjBtb3VudGFpbiUyMiUyQyUyMGdlbmVyYXRvciUzRGdlbmVyYXRvciUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QyJTBBKS5pbWFnZXM=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">import</span> torch 

pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;my-pipeline-with-fused-lora&quot;</span>, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)

generator = torch.manual_seed(<span class="hljs-number">0</span>)
images_fusion = pipe(
    <span class="hljs-string">&quot;masterpiece, best quality, mountain&quot;</span>, generator=generator, num_inference_steps=<span class="hljs-number">2</span>
).images`,wrap:!1}}),qe=new J({props:{title:"Working with multiple LoRA checkpoints",local:"working-with-multiple-lora-checkpoints",headingTag:"h2"}}),Pe=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblhMUGlwZWxpbmUlMkMlMjBBdXRvZW5jb2RlcktMJTBBaW1wb3J0JTIwdG9yY2glMEElMEF2YWUlMjAlM0QlMjBBdXRvZW5jb2RlcktMLmZyb21fcHJldHJhaW5lZCglMjJtYWRlYnlvbGxpbiUyRnNkeGwtdmFlLWZwMTYtZml4JTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXBpcGUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25YTFBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtYmFzZS0xLjAlMjIlMkMlMEElMjAlMjAlMjAlMjB2YWUlM0R2YWUlMkMlMEElMjAlMjAlMjAlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMEEpJTBBcGlwZS50byglMjJjdWRhJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionXLPipeline, AutoencoderKL
<span class="hljs-keyword">import</span> torch

vae = AutoencoderKL.from_pretrained(<span class="hljs-string">&quot;madebyollin/sdxl-vae-fp16-fix&quot;</span>, torch_dtype=torch.float16)
pipe = StableDiffusionXLPipeline.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>,
    vae=vae,
    torch_dtype=torch.float16,
)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),Oe=new T({props:{code:"JTIzJTIwTG9SQSUyMG9uZS4lMEFwaXBlLmxvYWRfbG9yYV93ZWlnaHRzKCUyMmdvb2Z5YWklMkZjeWJvcmdfc3R5bGVfeGwlMjIpJTBBcGlwZS5mdXNlX2xvcmEobG9yYV9zY2FsZSUzRDAuNyklMEElMEElMjMlMjBMb1JBJTIwdHdvLiUwQXBpcGUubG9hZF9sb3JhX3dlaWdodHMoJTIyVGhlTGFzdEJlbiUyRlBpa2FjaHVfU0RYTCUyMiklMEFwaXBlLmZ1c2VfbG9yYShsb3JhX3NjYWxlJTNEMC43KQ==",highlighted:`<span class="hljs-comment"># LoRA one.</span>
pipe.load_lora_weights(<span class="hljs-string">&quot;goofyai/cyborg_style_xl&quot;</span>)
pipe.fuse_lora(lora_scale=<span class="hljs-number">0.7</span>)

<span class="hljs-comment"># LoRA two.</span>
pipe.load_lora_weights(<span class="hljs-string">&quot;TheLastBen/Pikachu_SDXL&quot;</span>)
pipe.fuse_lora(lora_scale=<span class="hljs-number">0.7</span>)`,wrap:!1}}),L=new Z({props:{$$slots:{default:[_n]},$$scope:{ctx:g}}}),tt=new T({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyY3lib3JnJTIwc3R5bGUlMjBwaWthY2h1JTIyJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKHByb21wdCUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QzMCUyQyUyMGd1aWRhbmNlX3NjYWxlJTNENy41KS5pbWFnZXMlNUIwJTVE",highlighted:`prompt = <span class="hljs-string">&quot;cyborg style pikachu&quot;</span>
image = pipe(prompt, num_inference_steps=<span class="hljs-number">30</span>, guidance_scale=<span class="hljs-number">7.5</span>).images[<span class="hljs-number">0</span>]`,wrap:!1}}),C=new Z({props:{warning:!0,$$slots:{default:[Zn]},$$scope:{ctx:g}}}),st=new J({props:{title:"Supporting different LoRA checkpoints from Diffusers",local:"supporting-different-lora-checkpoints-from-diffusers",headingTag:"h2"}}),nt=new J({props:{title:"Kohya",local:"kohya",headingTag:"h3"}}),rt=new T({props:{code:"d2dldCUyMGh0dHBzJTNBJTJGJTJGY2l2aXRhaS5jb20lMkZhcGklMkZkb3dubG9hZCUyRm1vZGVscyUyRjE1NjAzJTIwLU8lMjBsaWdodF9hbmRfc2hhZG93LnNhZmV0ZW5zb3Jz",highlighted:"wget https://civitai.com/api/download/models/15603 -O light_and_shadow.safetensors",wrap:!1}}),mt=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUlMkMlMjBEUE1Tb2x2ZXJNdWx0aXN0ZXBTY2hlZHVsZXIlMEElMEFwaXBlbGluZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJnc2RmJTJGQ291bnRlcmZlaXQtVjIuNSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHNhZmV0eV9jaGVja2VyJTNETm9uZSUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUlMEEpLnRvKCUyMmN1ZGElMjIpJTBBcGlwZWxpbmUuc2NoZWR1bGVyJTIwJTNEJTIwRFBNU29sdmVyTXVsdGlzdGVwU2NoZWR1bGVyLmZyb21fY29uZmlnKCUwQSUyMCUyMCUyMCUyMHBpcGVsaW5lLnNjaGVkdWxlci5jb25maWclMkMlMjB1c2Vfa2FycmFzX3NpZ21hcyUzRFRydWUlMEEp",highlighted:`<span class="hljs-keyword">import</span> torch

<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline, DPMSolverMultistepScheduler

pipeline = StableDiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;gsdf/Counterfeit-V2.5&quot;</span>, torch_dtype=torch.float16, safety_checker=<span class="hljs-literal">None</span>, use_safetensors=<span class="hljs-literal">True</span>
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline.scheduler = DPMSolverMultistepScheduler.from_config(
    pipeline.scheduler.config, use_karras_sigmas=<span class="hljs-literal">True</span>
)`,wrap:!1}}),ht=new T({props:{code:"cGlwZWxpbmUubG9hZF9sb3JhX3dlaWdodHMoJTIyLiUyMiUyQyUyMHdlaWdodF9uYW1lJTNEJTIybGlnaHRfYW5kX3NoYWRvdy5zYWZldGVuc29ycyUyMik=",highlighted:'pipeline.load_lora_weights(<span class="hljs-string">&quot;.&quot;</span>, weight_name=<span class="hljs-string">&quot;light_and_shadow.safetensors&quot;</span>)',wrap:!1}}),V=new Z({props:{warning:!0,$$slots:{default:[jn]},$$scope:{ctx:g}}}),ct=new T({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIybWFzdGVycGllY2UlMkMlMjBiZXN0JTIwcXVhbGl0eSUyQyUyMDFnaXJsJTJDJTIwYXQlMjBkdXNrJTIyJTBBbmVnYXRpdmVfcHJvbXB0JTIwJTNEJTIwKCUyMihsb3clMjBxdWFsaXR5JTJDJTIwd29yc3QlMjBxdWFsaXR5JTNBMS40KSUyQyUyMChiYWQlMjBhbmF0b215KSUyQyUyMChpbmFjY3VyYXRlJTIwbGltYiUzQTEuMiklMkMlMjAlMjIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJiYWQlMjBjb21wb3NpdGlvbiUyQyUyMGluYWNjdXJhdGUlMjBleWVzJTJDJTIwZXh0cmElMjBkaWdpdCUyQyUyMGZld2VyJTIwZGlnaXRzJTJDJTIwKGV4dHJhJTIwYXJtcyUzQTEuMiklMkMlMjBsYXJnZSUyMGJyZWFzdHMlMjIpJTBBJTBBaW1hZ2VzJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0JTNEcHJvbXB0JTJDJTIwJTBBJTIwJTIwJTIwJTIwbmVnYXRpdmVfcHJvbXB0JTNEbmVnYXRpdmVfcHJvbXB0JTJDJTIwJTBBJTIwJTIwJTIwJTIwd2lkdGglM0Q1MTIlMkMlMjAlMEElMjAlMjAlMjAlMjBoZWlnaHQlM0Q3NjglMkMlMjAlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMTUlMkMlMjAlMEElMjAlMjAlMjAlMjBudW1faW1hZ2VzX3Blcl9wcm9tcHQlM0Q0JTJDJTBBJTIwJTIwJTIwJTIwZ2VuZXJhdG9yJTNEdG9yY2gubWFudWFsX3NlZWQoMCklMEEpLmltYWdlcw==",highlighted:`prompt = <span class="hljs-string">&quot;masterpiece, best quality, 1girl, at dusk&quot;</span>
negative_prompt = (<span class="hljs-string">&quot;(low quality, worst quality:1.4), (bad anatomy), (inaccurate limb:1.2), &quot;</span>
                   <span class="hljs-string">&quot;bad composition, inaccurate eyes, extra digit, fewer digits, (extra arms:1.2), large breasts&quot;</span>)

images = pipeline(prompt=prompt, 
    negative_prompt=negative_prompt, 
    width=<span class="hljs-number">512</span>, 
    height=<span class="hljs-number">768</span>, 
    num_inference_steps=<span class="hljs-number">15</span>, 
    num_images_per_prompt=<span class="hljs-number">4</span>,
    generator=torch.manual_seed(<span class="hljs-number">0</span>)
).images`,wrap:!1}}),bt=new T({props:{code:"bG9yYV9tb2RlbF9pZCUyMCUzRCUyMCUyMnNheWFrcGF1bCUyRmNpdml0YWktbGlnaHQtc2hhZG93LWxvcmElMjIlMEFsb3JhX2ZpbGVuYW1lJTIwJTNEJTIwJTIybGlnaHRfYW5kX3NoYWRvdy5zYWZldGVuc29ycyUyMiUwQXBpcGVsaW5lLmxvYWRfbG9yYV93ZWlnaHRzKGxvcmFfbW9kZWxfaWQlMkMlMjB3ZWlnaHRfbmFtZSUzRGxvcmFfZmlsZW5hbWUp",highlighted:`lora_model_id = <span class="hljs-string">&quot;sayakpaul/civitai-light-shadow-lora&quot;</span>
lora_filename = <span class="hljs-string">&quot;light_and_shadow.safetensors&quot;</span>
pipeline.load_lora_weights(lora_model_id, weight_name=lora_filename)`,wrap:!1}}),gt=new J({props:{title:"Kohya + Stable Diffusion XL",local:"kohya--stable-diffusion-xl",headingTag:"h3"}}),Zt=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMjAlMEElMEFiYXNlX21vZGVsX2lkJTIwJTNEJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMC45JTIyJTBBcGlwZWxpbmUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoYmFzZV9tb2RlbF9pZCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMiklMEFwaXBlbGluZS5sb2FkX2xvcmFfd2VpZ2h0cyglMjIuJTIyJTJDJTIwd2VpZ2h0X25hbWUlM0QlMjJLYW1lcGFuLnNhZmV0ZW5zb3JzJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMmFuaW1lJTIwc2NyZWVuY2FwJTJDJTIwZ2xpbnQlMkMlMjBkcmF3aW5nJTJDJTIwYmVzdCUyMHF1YWxpdHklMkMlMjBsaWdodCUyMHNtaWxlJTJDJTIwc2h5JTJDJTIwYSUyMGZ1bGwlMjBib2R5JTIwb2YlMjBhJTIwZ2lybCUyMHdlYXJpbmclMjB3ZWRkaW5nJTIwZHJlc3MlMjBpbiUyMHRoZSUyMG1pZGRsZSUyMG9mJTIwdGhlJTIwZm9yZXN0JTIwYmVuZWF0aCUyMHRoZSUyMHRyZWVzJTJDJTIwZmlyZWZsaWVzJTJDJTIwYmlnJTIwZXllcyUyQyUyMDJkJTJDJTIwY3V0ZSUyQyUyMGFuaW1lJTIwZ2lybCUyQyUyMHdhaWZ1JTJDJTIwY2VsJTIwc2hhZGluZyUyQyUyMG1hZ2ljYWwlMjBnaXJsJTJDJTIwdml2aWQlMjBjb2xvcnMlMkMlMjAob3V0bGluZSUzQTEuMSklMkMlMjBtYW5nYSUyMGFuaW1lJTIwYXJ0c3R5bGUlMkMlMjBtYXN0ZXJwaWVjZSUyQyUyMG9mZmljaWFsJTIwd2FsbHBhcGVyJTJDJTIwZ2xpbnQlMjAlM0Nsb3JhJTNBa2FtZV9zZHhsX3YyJTNBMSUzRSUyMiUwQW5lZ2F0aXZlX3Byb21wdCUyMCUzRCUyMCUyMihkZWZvcm1lZCUyQyUyMGJhZCUyMHF1YWxpdHklMkMlMjBza2V0Y2glMkMlMjBkZXB0aCUyMG9mJTIwZmllbGQlMkMlMjBibHVycnklM0ExLjEpJTJDJTIwZ3JhaW55JTJDJTIwYmFkJTIwYW5hdG9teSUyQyUyMGJhZCUyMHBlcnNwZWN0aXZlJTJDJTIwb2xkJTJDJTIwdWdseSUyQyUyMHJlYWxpc3RpYyUyQyUyMGNhcnRvb24lMkMlMjBkaXNuZXklMkMlMjBiYWQlMjBwcm9wb3J0aW9ucyUyMiUwQWdlbmVyYXRvciUyMCUzRCUyMHRvcmNoLm1hbnVhbF9zZWVkKDI5NDc4ODMwNjApJTBBbnVtX2luZmVyZW5jZV9zdGVwcyUyMCUzRCUyMDMwJTBBZ3VpZGFuY2Vfc2NhbGUlMjAlM0QlMjA3JTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlbGluZSglMEElMjAlMjAlMjAlMjBwcm9tcHQlM0Rwcm9tcHQlMkMlMjBuZWdhdGl2ZV9wcm9tcHQlM0RuZWdhdGl2ZV9wcm9tcHQlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEbnVtX2luZmVyZW5jZV9zdGVwcyUyQyUwQSUyMCUyMCUyMCUyMGdlbmVyYXRvciUzRGdlbmVyYXRvciUyQyUyMGd1aWRhbmNlX3NjYWxlJTNEZ3VpZGFuY2Vfc2NhbGUlMEEpLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMkthbWVwYW4ucG5nJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">import</span> torch 

base_model_id = <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-0.9&quot;</span>
pipeline = DiffusionPipeline.from_pretrained(base_model_id, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline.load_lora_weights(<span class="hljs-string">&quot;.&quot;</span>, weight_name=<span class="hljs-string">&quot;Kamepan.safetensors&quot;</span>)

prompt = <span class="hljs-string">&quot;anime screencap, glint, drawing, best quality, light smile, shy, a full body of a girl wearing wedding dress in the middle of the forest beneath the trees, fireflies, big eyes, 2d, cute, anime girl, waifu, cel shading, magical girl, vivid colors, (outline:1.1), manga anime artstyle, masterpiece, official wallpaper, glint &lt;lora:kame_sdxl_v2:1&gt;&quot;</span>
negative_prompt = <span class="hljs-string">&quot;(deformed, bad quality, sketch, depth of field, blurry:1.1), grainy, bad anatomy, bad perspective, old, ugly, realistic, cartoon, disney, bad proportions&quot;</span>
generator = torch.manual_seed(<span class="hljs-number">2947883060</span>)
num_inference_steps = <span class="hljs-number">30</span>
guidance_scale = <span class="hljs-number">7</span>

image = pipeline(
    prompt=prompt, negative_prompt=negative_prompt, num_inference_steps=num_inference_steps,
    generator=generator, guidance_scale=guidance_scale
).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;Kamepan.png&quot;</span>)`,wrap:!1}}),X=new Z({props:{warning:!0,$$slots:{default:[$n]},$$scope:{ctx:g}}}),Wt=new J({props:{title:"TheLastBen",local:"thelastben",headingTag:"h3"}}),Rt=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlbGluZV9pZCUyMCUzRCUyMCUyMkx5a29uJTJGZHJlYW1zaGFwZXIteGwtMS0wJTIyJTBBJTBBcGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChwaXBlbGluZV9pZCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBbG9yYV9tb2RlbF9pZCUyMCUzRCUyMCUyMlRoZUxhc3RCZW4lMkZQYXBlcmN1dF9TRFhMJTIyJTBBbG9yYV9maWxlbmFtZSUyMCUzRCUyMCUyMnBhcGVyY3V0LnNhZmV0ZW5zb3JzJTIyJTBBcGlwZS5sb2FkX2xvcmFfd2VpZ2h0cyhsb3JhX21vZGVsX2lkJTJDJTIwd2VpZ2h0X25hbWUlM0Rsb3JhX2ZpbGVuYW1lKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMnBhcGVyY3V0JTIwc29uaWMlMjIlMEFpbWFnZSUyMCUzRCUyMHBpcGUocHJvbXB0JTNEcHJvbXB0JTJDJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDIwJTJDJTIwZ2VuZXJhdG9yJTNEdG9yY2gubWFudWFsX3NlZWQoMCkpLmltYWdlcyU1QjAlNUQlMEFpbWFnZQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">import</span> torch

pipeline_id = <span class="hljs-string">&quot;Lykon/dreamshaper-xl-1-0&quot;</span>

pipe = DiffusionPipeline.from_pretrained(pipeline_id, torch_dtype=torch.float16)
pipe.enable_model_cpu_offload()

lora_model_id = <span class="hljs-string">&quot;TheLastBen/Papercut_SDXL&quot;</span>
lora_filename = <span class="hljs-string">&quot;papercut.safetensors&quot;</span>
pipe.load_lora_weights(lora_model_id, weight_name=lora_filename)

prompt = <span class="hljs-string">&quot;papercut sonic&quot;</span>
image = pipe(prompt=prompt, num_inference_steps=<span class="hljs-number">20</span>, generator=torch.manual_seed(<span class="hljs-number">0</span>)).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),{c(){i=o("meta"),w=a(),r=o("p"),y=a(),m(_.$$.fragment),b=a(),m(U.$$.fragment),Xt=a(),x=o("p"),x.innerHTML=As,xt=a(),N=o("ul"),N.innerHTML=Qs,Nt=a(),m($.$$.fragment),Yt=a(),Y=o("p"),Y.innerHTML=zs,Et=a(),E=o("p"),E.innerHTML=qs,Ht=a(),m(H.$$.fragment),Ft=a(),m(F.$$.fragment),St=a(),S=o("p"),S.textContent=Ds,At=a(),m(A.$$.fragment),Qt=a(),Q=o("p"),Q.innerHTML=Ps,zt=a(),z=o("p"),z.innerHTML=Ks,qt=a(),q=o("p"),q.innerHTML=Os,Dt=a(),m(D.$$.fragment),Pt=a(),P=o("p"),P.textContent=ea,Kt=a(),K=o("ul"),K.innerHTML=ta,Ot=a(),O=o("p"),O.innerHTML=la,el=a(),m(ee.$$.fragment),tl=a(),m(te.$$.fragment),ll=a(),le=o("p"),le.innerHTML=sa,sl=a(),m(se.$$.fragment),al=a(),ae=o("p"),ae.innerHTML=aa,nl=a(),m(v.$$.fragment),il=a(),m(ne.$$.fragment),ol=a(),m(W.$$.fragment),pl=a(),m(ie.$$.fragment),rl=a(),oe=o("p"),oe.innerHTML=na,fl=a(),m(G.$$.fragment),ml=a(),m(pe.$$.fragment),ul=a(),re=o("p"),re.innerHTML=ia,hl=a(),fe=o("p"),fe.innerHTML=oa,dl=a(),me=o("p"),me.innerHTML=pa,cl=a(),m(ue.$$.fragment),Ml=a(),he=o("p"),he.textContent=ra,wl=a(),de=o("ul"),de.innerHTML=fa,yl=a(),ce=o("p"),ce.innerHTML=ma,bl=a(),Me=o("p"),Me.innerHTML=ua,gl=a(),m(we.$$.fragment),Tl=a(),m(ye.$$.fragment),Jl=a(),be=o("p"),be.innerHTML=ha,Ul=a(),m(ge.$$.fragment),_l=a(),Te=o("p"),Te.innerHTML=da,Zl=a(),m(R.$$.fragment),jl=a(),m(Je.$$.fragment),$l=a(),Ue=o("p"),Ue.innerHTML=ca,vl=a(),m(_e.$$.fragment),Wl=a(),m(B.$$.fragment),Gl=a(),Ze=o("p"),Ze.innerHTML=Ma,Rl=a(),I=o("ul"),je=o("li"),kt=o("p"),kt.innerHTML=wa,Fs=a(),m($e.$$.fragment),Ss=a(),Lt=o("li"),Lt.innerHTML=ya,Bl=a(),m(k.$$.fragment),Il=a(),m(ve.$$.fragment),kl=a(),We=o("p"),We.innerHTML=ba,Ll=a(),Ge=o("ul"),Ge.innerHTML=ga,Cl=a(),m(Re.$$.fragment),Vl=a(),Be=o("p"),Be.innerHTML=Ta,Xl=a(),m(Ie.$$.fragment),xl=a(),ke=o("p"),ke.innerHTML=Ja,Nl=a(),m(Le.$$.fragment),Yl=a(),Ce=o("p"),Ce.innerHTML=Ua,El=a(),m(Ve.$$.fragment),Hl=a(),Xe=o("p"),Xe.innerHTML=_a,Fl=a(),xe=o("p"),xe.innerHTML=Za,Sl=a(),m(Ne.$$.fragment),Al=a(),m(Ye.$$.fragment),Ql=a(),Ee=o("p"),Ee.innerHTML=ja,zl=a(),He=o("p"),He.textContent=$a,ql=a(),Fe=o("ul"),Fe.innerHTML=va,Dl=a(),Se=o("p"),Se.textContent=Wa,Pl=a(),m(Ae.$$.fragment),Kl=a(),Qe=o("p"),Qe.textContent=Ga,Ol=a(),m(ze.$$.fragment),es=a(),m(qe.$$.fragment),ts=a(),De=o("p"),De.innerHTML=Ra,ls=a(),m(Pe.$$.fragment),ss=a(),Ke=o("p"),Ke.innerHTML=Ba,as=a(),m(Oe.$$.fragment),ns=a(),m(L.$$.fragment),is=a(),et=o("p"),et.textContent=Ia,os=a(),m(tt.$$.fragment),ps=a(),lt=o("p"),lt.innerHTML=ka,rs=a(),m(C.$$.fragment),fs=a(),m(st.$$.fragment),ms=a(),at=o("p"),at.innerHTML=La,us=a(),m(nt.$$.fragment),hs=a(),it=o("p"),it.innerHTML=Ca,ds=a(),ot=o("p"),ot.innerHTML=Va,cs=a(),pt=o("p"),pt.innerHTML=Xa,Ms=a(),m(rt.$$.fragment),ws=a(),ft=o("p"),ft.innerHTML=xa,ys=a(),m(mt.$$.fragment),bs=a(),ut=o("p"),ut.textContent=Na,gs=a(),m(ht.$$.fragment),Ts=a(),m(V.$$.fragment),Js=a(),dt=o("p"),dt.textContent=Ya,Us=a(),m(ct.$$.fragment),_s=a(),Mt=o("p"),Mt.textContent=Ea,Zs=a(),wt=o("p"),wt.innerHTML=Ha,js=a(),yt=o("p"),yt.innerHTML=Fa,$s=a(),m(bt.$$.fragment),vs=a(),m(gt.$$.fragment),Ws=a(),Tt=o("p"),Tt.innerHTML=Sa,Gs=a(),Jt=o("p"),Jt.textContent=Aa,Rs=a(),Ut=o("ul"),Ut.innerHTML=Qa,Bs=a(),_t=o("p"),_t.innerHTML=za,Is=a(),m(Zt.$$.fragment),ks=a(),jt=o("p"),jt.innerHTML=qa,Ls=a(),$t=o("p"),$t.textContent=Da,Cs=a(),vt=o("p"),vt.innerHTML=Pa,Vs=a(),m(X.$$.fragment),Xs=a(),m(Wt.$$.fragment),xs=a(),Gt=o("p"),Gt.textContent=Ka,Ns=a(),m(Rt.$$.fragment),Ys=a(),Vt=o("p"),this.h()},l(e){const t=cn("svelte-u9bgzb",document.head);i=p(t,"META",{name:!0,content:!0}),t.forEach(l),w=n(e),r=p(e,"P",{}),Hs(r).forEach(l),y=n(e),u(_.$$.fragment,e),b=n(e),u(U.$$.fragment,e),Xt=n(e),x=p(e,"P",{"data-svelte-h":!0}),f(x)!=="svelte-162fd4o"&&(x.innerHTML=As),xt=n(e),N=p(e,"UL",{"data-svelte-h":!0}),f(N)!=="svelte-1k61glr"&&(N.innerHTML=Qs),Nt=n(e),u($.$$.fragment,e),Yt=n(e),Y=p(e,"P",{"data-svelte-h":!0}),f(Y)!=="svelte-1mrdz4f"&&(Y.innerHTML=zs),Et=n(e),E=p(e,"P",{"data-svelte-h":!0}),f(E)!=="svelte-g6vnky"&&(E.innerHTML=qs),Ht=n(e),u(H.$$.fragment,e),Ft=n(e),u(F.$$.fragment,e),St=n(e),S=p(e,"P",{"data-svelte-h":!0}),f(S)!=="svelte-10agb32"&&(S.textContent=Ds),At=n(e),u(A.$$.fragment,e),Qt=n(e),Q=p(e,"P",{"data-svelte-h":!0}),f(Q)!=="svelte-1lh1npc"&&(Q.innerHTML=Ps),zt=n(e),z=p(e,"P",{"data-svelte-h":!0}),f(z)!=="svelte-mnv49s"&&(z.innerHTML=Ks),qt=n(e),q=p(e,"P",{"data-svelte-h":!0}),f(q)!=="svelte-np14fc"&&(q.innerHTML=Os),Dt=n(e),u(D.$$.fragment,e),Pt=n(e),P=p(e,"P",{"data-svelte-h":!0}),f(P)!=="svelte-vjf3go"&&(P.textContent=ea),Kt=n(e),K=p(e,"UL",{"data-svelte-h":!0}),f(K)!=="svelte-11vsf6h"&&(K.innerHTML=ta),Ot=n(e),O=p(e,"P",{"data-svelte-h":!0}),f(O)!=="svelte-1u3y683"&&(O.innerHTML=la),el=n(e),u(ee.$$.fragment,e),tl=n(e),u(te.$$.fragment,e),ll=n(e),le=p(e,"P",{"data-svelte-h":!0}),f(le)!=="svelte-r58hl3"&&(le.innerHTML=sa),sl=n(e),u(se.$$.fragment,e),al=n(e),ae=p(e,"P",{"data-svelte-h":!0}),f(ae)!=="svelte-1c0cjnc"&&(ae.innerHTML=aa),nl=n(e),u(v.$$.fragment,e),il=n(e),u(ne.$$.fragment,e),ol=n(e),u(W.$$.fragment,e),pl=n(e),u(ie.$$.fragment,e),rl=n(e),oe=p(e,"P",{"data-svelte-h":!0}),f(oe)!=="svelte-kko4zn"&&(oe.innerHTML=na),fl=n(e),u(G.$$.fragment,e),ml=n(e),u(pe.$$.fragment,e),ul=n(e),re=p(e,"P",{"data-svelte-h":!0}),f(re)!=="svelte-fgnnhh"&&(re.innerHTML=ia),hl=n(e),fe=p(e,"P",{"data-svelte-h":!0}),f(fe)!=="svelte-1ep7b0t"&&(fe.innerHTML=oa),dl=n(e),me=p(e,"P",{"data-svelte-h":!0}),f(me)!=="svelte-foqllp"&&(me.innerHTML=pa),cl=n(e),u(ue.$$.fragment,e),Ml=n(e),he=p(e,"P",{"data-svelte-h":!0}),f(he)!=="svelte-vjf3go"&&(he.textContent=ra),wl=n(e),de=p(e,"UL",{"data-svelte-h":!0}),f(de)!=="svelte-11vsf6h"&&(de.innerHTML=fa),yl=n(e),ce=p(e,"P",{"data-svelte-h":!0}),f(ce)!=="svelte-1ohvlep"&&(ce.innerHTML=ma),bl=n(e),Me=p(e,"P",{"data-svelte-h":!0}),f(Me)!=="svelte-13qtcom"&&(Me.innerHTML=ua),gl=n(e),u(we.$$.fragment,e),Tl=n(e),u(ye.$$.fragment,e),Jl=n(e),be=p(e,"P",{"data-svelte-h":!0}),f(be)!=="svelte-1w15lhx"&&(be.innerHTML=ha),Ul=n(e),u(ge.$$.fragment,e),_l=n(e),Te=p(e,"P",{"data-svelte-h":!0}),f(Te)!=="svelte-x23tn5"&&(Te.innerHTML=da),Zl=n(e),u(R.$$.fragment,e),jl=n(e),u(Je.$$.fragment,e),$l=n(e),Ue=p(e,"P",{"data-svelte-h":!0}),f(Ue)!=="svelte-1x0rrf1"&&(Ue.innerHTML=ca),vl=n(e),u(_e.$$.fragment,e),Wl=n(e),u(B.$$.fragment,e),Gl=n(e),Ze=p(e,"P",{"data-svelte-h":!0}),f(Ze)!=="svelte-1xi3nsc"&&(Ze.innerHTML=Ma),Rl=n(e),I=p(e,"UL",{});var Bt=Hs(I);je=p(Bt,"LI",{});var It=Hs(je);kt=p(It,"P",{"data-svelte-h":!0}),f(kt)!=="svelte-1fzrg1n"&&(kt.innerHTML=wa),Fs=n(It),u($e.$$.fragment,It),It.forEach(l),Ss=n(Bt),Lt=p(Bt,"LI",{"data-svelte-h":!0}),f(Lt)!=="svelte-1smxhmx"&&(Lt.innerHTML=ya),Bt.forEach(l),Bl=n(e),u(k.$$.fragment,e),Il=n(e),u(ve.$$.fragment,e),kl=n(e),We=p(e,"P",{"data-svelte-h":!0}),f(We)!=="svelte-xe4oxf"&&(We.innerHTML=ba),Ll=n(e),Ge=p(e,"UL",{"data-svelte-h":!0}),f(Ge)!=="svelte-19vwamc"&&(Ge.innerHTML=ga),Cl=n(e),u(Re.$$.fragment,e),Vl=n(e),Be=p(e,"P",{"data-svelte-h":!0}),f(Be)!=="svelte-3u7y7w"&&(Be.innerHTML=Ta),Xl=n(e),u(Ie.$$.fragment,e),xl=n(e),ke=p(e,"P",{"data-svelte-h":!0}),f(ke)!=="svelte-rwqa5a"&&(ke.innerHTML=Ja),Nl=n(e),u(Le.$$.fragment,e),Yl=n(e),Ce=p(e,"P",{"data-svelte-h":!0}),f(Ce)!=="svelte-up503a"&&(Ce.innerHTML=Ua),El=n(e),u(Ve.$$.fragment,e),Hl=n(e),Xe=p(e,"P",{"data-svelte-h":!0}),f(Xe)!=="svelte-1739hjj"&&(Xe.innerHTML=_a),Fl=n(e),xe=p(e,"P",{"data-svelte-h":!0}),f(xe)!=="svelte-rw21g0"&&(xe.innerHTML=Za),Sl=n(e),u(Ne.$$.fragment,e),Al=n(e),u(Ye.$$.fragment,e),Ql=n(e),Ee=p(e,"P",{"data-svelte-h":!0}),f(Ee)!=="svelte-scdyk5"&&(Ee.innerHTML=ja),zl=n(e),He=p(e,"P",{"data-svelte-h":!0}),f(He)!=="svelte-1ktiavg"&&(He.textContent=$a),ql=n(e),Fe=p(e,"UL",{"data-svelte-h":!0}),f(Fe)!=="svelte-lf7at2"&&(Fe.innerHTML=va),Dl=n(e),Se=p(e,"P",{"data-svelte-h":!0}),f(Se)!=="svelte-1plkp10"&&(Se.textContent=Wa),Pl=n(e),u(Ae.$$.fragment,e),Kl=n(e),Qe=p(e,"P",{"data-svelte-h":!0}),f(Qe)!=="svelte-17ca37g"&&(Qe.textContent=Ga),Ol=n(e),u(ze.$$.fragment,e),es=n(e),u(qe.$$.fragment,e),ts=n(e),De=p(e,"P",{"data-svelte-h":!0}),f(De)!=="svelte-1vg1fxr"&&(De.innerHTML=Ra),ls=n(e),u(Pe.$$.fragment,e),ss=n(e),Ke=p(e,"P",{"data-svelte-h":!0}),f(Ke)!=="svelte-va7o95"&&(Ke.innerHTML=Ba),as=n(e),u(Oe.$$.fragment,e),ns=n(e),u(L.$$.fragment,e),is=n(e),et=p(e,"P",{"data-svelte-h":!0}),f(et)!=="svelte-d3kqb7"&&(et.textContent=Ia),os=n(e),u(tt.$$.fragment,e),ps=n(e),lt=p(e,"P",{"data-svelte-h":!0}),f(lt)!=="svelte-fjwyvv"&&(lt.innerHTML=ka),rs=n(e),u(C.$$.fragment,e),fs=n(e),u(st.$$.fragment,e),ms=n(e),at=p(e,"P",{"data-svelte-h":!0}),f(at)!=="svelte-1nkpd1u"&&(at.innerHTML=La),us=n(e),u(nt.$$.fragment,e),hs=n(e),it=p(e,"P",{"data-svelte-h":!0}),f(it)!=="svelte-12q1ys0"&&(it.innerHTML=Ca),ds=n(e),ot=p(e,"P",{"data-svelte-h":!0}),f(ot)!=="svelte-3vr8ts"&&(ot.innerHTML=Va),cs=n(e),pt=p(e,"P",{"data-svelte-h":!0}),f(pt)!=="svelte-gud49k"&&(pt.innerHTML=Xa),Ms=n(e),u(rt.$$.fragment,e),ws=n(e),ft=p(e,"P",{"data-svelte-h":!0}),f(ft)!=="svelte-gd9hnc"&&(ft.innerHTML=xa),ys=n(e),u(mt.$$.fragment,e),bs=n(e),ut=p(e,"P",{"data-svelte-h":!0}),f(ut)!=="svelte-15lsk7k"&&(ut.textContent=Na),gs=n(e),u(ht.$$.fragment,e),Ts=n(e),u(V.$$.fragment,e),Js=n(e),dt=p(e,"P",{"data-svelte-h":!0}),f(dt)!=="svelte-3vmmy1"&&(dt.textContent=Ya),Us=n(e),u(ct.$$.fragment,e),_s=n(e),Mt=p(e,"P",{"data-svelte-h":!0}),f(Mt)!=="svelte-5o1ip6"&&(Mt.textContent=Ea),Zs=n(e),wt=p(e,"P",{"data-svelte-h":!0}),f(wt)!=="svelte-5g4zu7"&&(wt.innerHTML=Ha),js=n(e),yt=p(e,"P",{"data-svelte-h":!0}),f(yt)!=="svelte-icc6o8"&&(yt.innerHTML=Fa),$s=n(e),u(bt.$$.fragment,e),vs=n(e),u(gt.$$.fragment,e),Ws=n(e),Tt=p(e,"P",{"data-svelte-h":!0}),f(Tt)!=="svelte-11mak8l"&&(Tt.innerHTML=Sa),Gs=n(e),Jt=p(e,"P",{"data-svelte-h":!0}),f(Jt)!=="svelte-7e6ei7"&&(Jt.textContent=Aa),Rs=n(e),Ut=p(e,"UL",{"data-svelte-h":!0}),f(Ut)!=="svelte-ybml08"&&(Ut.innerHTML=Qa),Bs=n(e),_t=p(e,"P",{"data-svelte-h":!0}),f(_t)!=="svelte-1rpkybg"&&(_t.innerHTML=za),Is=n(e),u(Zt.$$.fragment,e),ks=n(e),jt=p(e,"P",{"data-svelte-h":!0}),f(jt)!=="svelte-1bce4zd"&&(jt.innerHTML=qa),Ls=n(e),$t=p(e,"P",{"data-svelte-h":!0}),f($t)!=="svelte-v0ield"&&($t.textContent=Da),Cs=n(e),vt=p(e,"P",{"data-svelte-h":!0}),f(vt)!=="svelte-t4r5z0"&&(vt.innerHTML=Pa),Vs=n(e),u(X.$$.fragment,e),Xs=n(e),u(Wt.$$.fragment,e),xs=n(e),Gt=p(e,"P",{"data-svelte-h":!0}),f(Gt)!=="svelte-1240csr"&&(Gt.textContent=Ka),Ns=n(e),u(Rt.$$.fragment,e),Ys=n(e),Vt=p(e,"P",{}),Hs(Vt).forEach(l),this.h()},h(){fn(i,"name","hf:doc:metadata"),fn(i,"content",Wn)},m(e,t){Ct(document.head,i),s(e,w,t),s(e,r,t),s(e,y,t),h(_,e,t),s(e,b,t),h(U,e,t),s(e,Xt,t),s(e,x,t),s(e,xt,t),s(e,N,t),s(e,Nt,t),h($,e,t),s(e,Yt,t),s(e,Y,t),s(e,Et,t),s(e,E,t),s(e,Ht,t),h(H,e,t),s(e,Ft,t),h(F,e,t),s(e,St,t),s(e,S,t),s(e,At,t),h(A,e,t),s(e,Qt,t),s(e,Q,t),s(e,zt,t),s(e,z,t),s(e,qt,t),s(e,q,t),s(e,Dt,t),h(D,e,t),s(e,Pt,t),s(e,P,t),s(e,Kt,t),s(e,K,t),s(e,Ot,t),s(e,O,t),s(e,el,t),h(ee,e,t),s(e,tl,t),h(te,e,t),s(e,ll,t),s(e,le,t),s(e,sl,t),h(se,e,t),s(e,al,t),s(e,ae,t),s(e,nl,t),h(v,e,t),s(e,il,t),h(ne,e,t),s(e,ol,t),h(W,e,t),s(e,pl,t),h(ie,e,t),s(e,rl,t),s(e,oe,t),s(e,fl,t),h(G,e,t),s(e,ml,t),h(pe,e,t),s(e,ul,t),s(e,re,t),s(e,hl,t),s(e,fe,t),s(e,dl,t),s(e,me,t),s(e,cl,t),h(ue,e,t),s(e,Ml,t),s(e,he,t),s(e,wl,t),s(e,de,t),s(e,yl,t),s(e,ce,t),s(e,bl,t),s(e,Me,t),s(e,gl,t),h(we,e,t),s(e,Tl,t),h(ye,e,t),s(e,Jl,t),s(e,be,t),s(e,Ul,t),h(ge,e,t),s(e,_l,t),s(e,Te,t),s(e,Zl,t),h(R,e,t),s(e,jl,t),h(Je,e,t),s(e,$l,t),s(e,Ue,t),s(e,vl,t),h(_e,e,t),s(e,Wl,t),h(B,e,t),s(e,Gl,t),s(e,Ze,t),s(e,Rl,t),s(e,I,t),Ct(I,je),Ct(je,kt),Ct(je,Fs),h($e,je,null),Ct(I,Ss),Ct(I,Lt),s(e,Bl,t),h(k,e,t),s(e,Il,t),h(ve,e,t),s(e,kl,t),s(e,We,t),s(e,Ll,t),s(e,Ge,t),s(e,Cl,t),h(Re,e,t),s(e,Vl,t),s(e,Be,t),s(e,Xl,t),h(Ie,e,t),s(e,xl,t),s(e,ke,t),s(e,Nl,t),h(Le,e,t),s(e,Yl,t),s(e,Ce,t),s(e,El,t),h(Ve,e,t),s(e,Hl,t),s(e,Xe,t),s(e,Fl,t),s(e,xe,t),s(e,Sl,t),h(Ne,e,t),s(e,Al,t),h(Ye,e,t),s(e,Ql,t),s(e,Ee,t),s(e,zl,t),s(e,He,t),s(e,ql,t),s(e,Fe,t),s(e,Dl,t),s(e,Se,t),s(e,Pl,t),h(Ae,e,t),s(e,Kl,t),s(e,Qe,t),s(e,Ol,t),h(ze,e,t),s(e,es,t),h(qe,e,t),s(e,ts,t),s(e,De,t),s(e,ls,t),h(Pe,e,t),s(e,ss,t),s(e,Ke,t),s(e,as,t),h(Oe,e,t),s(e,ns,t),h(L,e,t),s(e,is,t),s(e,et,t),s(e,os,t),h(tt,e,t),s(e,ps,t),s(e,lt,t),s(e,rs,t),h(C,e,t),s(e,fs,t),h(st,e,t),s(e,ms,t),s(e,at,t),s(e,us,t),h(nt,e,t),s(e,hs,t),s(e,it,t),s(e,ds,t),s(e,ot,t),s(e,cs,t),s(e,pt,t),s(e,Ms,t),h(rt,e,t),s(e,ws,t),s(e,ft,t),s(e,ys,t),h(mt,e,t),s(e,bs,t),s(e,ut,t),s(e,gs,t),h(ht,e,t),s(e,Ts,t),h(V,e,t),s(e,Js,t),s(e,dt,t),s(e,Us,t),h(ct,e,t),s(e,_s,t),s(e,Mt,t),s(e,Zs,t),s(e,wt,t),s(e,js,t),s(e,yt,t),s(e,$s,t),h(bt,e,t),s(e,vs,t),h(gt,e,t),s(e,Ws,t),s(e,Tt,t),s(e,Gs,t),s(e,Jt,t),s(e,Rs,t),s(e,Ut,t),s(e,Bs,t),s(e,_t,t),s(e,Is,t),h(Zt,e,t),s(e,ks,t),s(e,jt,t),s(e,Ls,t),s(e,$t,t),s(e,Cs,t),s(e,vt,t),s(e,Vs,t),h(X,e,t),s(e,Xs,t),h(Wt,e,t),s(e,xs,t),s(e,Gt,t),s(e,Ns,t),h(Rt,e,t),s(e,Ys,t),s(e,Vt,t),Es=!0},p(e,[t]){const Bt={};t&2&&(Bt.$$scope={dirty:t,ctx:e}),U.$set(Bt);const It={};t&2&&(It.$$scope={dirty:t,ctx:e}),$.$set(It);const Oa={};t&2&&(Oa.$$scope={dirty:t,ctx:e}),v.$set(Oa);const en={};t&2&&(en.$$scope={dirty:t,ctx:e}),W.$set(en);const tn={};t&2&&(tn.$$scope={dirty:t,ctx:e}),G.$set(tn);const ln={};t&2&&(ln.$$scope={dirty:t,ctx:e}),R.$set(ln);const sn={};t&2&&(sn.$$scope={dirty:t,ctx:e}),B.$set(sn);const an={};t&2&&(an.$$scope={dirty:t,ctx:e}),k.$set(an);const nn={};t&2&&(nn.$$scope={dirty:t,ctx:e}),L.$set(nn);const on={};t&2&&(on.$$scope={dirty:t,ctx:e}),C.$set(on);const pn={};t&2&&(pn.$$scope={dirty:t,ctx:e}),V.$set(pn);const rn={};t&2&&(rn.$$scope={dirty:t,ctx:e}),X.$set(rn)},i(e){Es||(d(_.$$.fragment,e),d(U.$$.fragment,e),d($.$$.fragment,e),d(H.$$.fragment,e),d(F.$$.fragment,e),d(A.$$.fragment,e),d(D.$$.fragment,e),d(ee.$$.fragment,e),d(te.$$.fragment,e),d(se.$$.fragment,e),d(v.$$.fragment,e),d(ne.$$.fragment,e),d(W.$$.fragment,e),d(ie.$$.fragment,e),d(G.$$.fragment,e),d(pe.$$.fragment,e),d(ue.$$.fragment,e),d(we.$$.fragment,e),d(ye.$$.fragment,e),d(ge.$$.fragment,e),d(R.$$.fragment,e),d(Je.$$.fragment,e),d(_e.$$.fragment,e),d(B.$$.fragment,e),d($e.$$.fragment,e),d(k.$$.fragment,e),d(ve.$$.fragment,e),d(Re.$$.fragment,e),d(Ie.$$.fragment,e),d(Le.$$.fragment,e),d(Ve.$$.fragment,e),d(Ne.$$.fragment,e),d(Ye.$$.fragment,e),d(Ae.$$.fragment,e),d(ze.$$.fragment,e),d(qe.$$.fragment,e),d(Pe.$$.fragment,e),d(Oe.$$.fragment,e),d(L.$$.fragment,e),d(tt.$$.fragment,e),d(C.$$.fragment,e),d(st.$$.fragment,e),d(nt.$$.fragment,e),d(rt.$$.fragment,e),d(mt.$$.fragment,e),d(ht.$$.fragment,e),d(V.$$.fragment,e),d(ct.$$.fragment,e),d(bt.$$.fragment,e),d(gt.$$.fragment,e),d(Zt.$$.fragment,e),d(X.$$.fragment,e),d(Wt.$$.fragment,e),d(Rt.$$.fragment,e),Es=!0)},o(e){c(_.$$.fragment,e),c(U.$$.fragment,e),c($.$$.fragment,e),c(H.$$.fragment,e),c(F.$$.fragment,e),c(A.$$.fragment,e),c(D.$$.fragment,e),c(ee.$$.fragment,e),c(te.$$.fragment,e),c(se.$$.fragment,e),c(v.$$.fragment,e),c(ne.$$.fragment,e),c(W.$$.fragment,e),c(ie.$$.fragment,e),c(G.$$.fragment,e),c(pe.$$.fragment,e),c(ue.$$.fragment,e),c(we.$$.fragment,e),c(ye.$$.fragment,e),c(ge.$$.fragment,e),c(R.$$.fragment,e),c(Je.$$.fragment,e),c(_e.$$.fragment,e),c(B.$$.fragment,e),c($e.$$.fragment,e),c(k.$$.fragment,e),c(ve.$$.fragment,e),c(Re.$$.fragment,e),c(Ie.$$.fragment,e),c(Le.$$.fragment,e),c(Ve.$$.fragment,e),c(Ne.$$.fragment,e),c(Ye.$$.fragment,e),c(Ae.$$.fragment,e),c(ze.$$.fragment,e),c(qe.$$.fragment,e),c(Pe.$$.fragment,e),c(Oe.$$.fragment,e),c(L.$$.fragment,e),c(tt.$$.fragment,e),c(C.$$.fragment,e),c(st.$$.fragment,e),c(nt.$$.fragment,e),c(rt.$$.fragment,e),c(mt.$$.fragment,e),c(ht.$$.fragment,e),c(V.$$.fragment,e),c(ct.$$.fragment,e),c(bt.$$.fragment,e),c(gt.$$.fragment,e),c(Zt.$$.fragment,e),c(X.$$.fragment,e),c(Wt.$$.fragment,e),c(Rt.$$.fragment,e),Es=!1},d(e){e&&(l(w),l(r),l(y),l(b),l(Xt),l(x),l(xt),l(N),l(Nt),l(Yt),l(Y),l(Et),l(E),l(Ht),l(Ft),l(St),l(S),l(At),l(Qt),l(Q),l(zt),l(z),l(qt),l(q),l(Dt),l(Pt),l(P),l(Kt),l(K),l(Ot),l(O),l(el),l(tl),l(ll),l(le),l(sl),l(al),l(ae),l(nl),l(il),l(ol),l(pl),l(rl),l(oe),l(fl),l(ml),l(ul),l(re),l(hl),l(fe),l(dl),l(me),l(cl),l(Ml),l(he),l(wl),l(de),l(yl),l(ce),l(bl),l(Me),l(gl),l(Tl),l(Jl),l(be),l(Ul),l(_l),l(Te),l(Zl),l(jl),l($l),l(Ue),l(vl),l(Wl),l(Gl),l(Ze),l(Rl),l(I),l(Bl),l(Il),l(kl),l(We),l(Ll),l(Ge),l(Cl),l(Vl),l(Be),l(Xl),l(xl),l(ke),l(Nl),l(Yl),l(Ce),l(El),l(Hl),l(Xe),l(Fl),l(xe),l(Sl),l(Al),l(Ql),l(Ee),l(zl),l(He),l(ql),l(Fe),l(Dl),l(Se),l(Pl),l(Kl),l(Qe),l(Ol),l(es),l(ts),l(De),l(ls),l(ss),l(Ke),l(as),l(ns),l(is),l(et),l(os),l(ps),l(lt),l(rs),l(fs),l(ms),l(at),l(us),l(hs),l(it),l(ds),l(ot),l(cs),l(pt),l(Ms),l(ws),l(ft),l(ys),l(bs),l(ut),l(gs),l(Ts),l(Js),l(dt),l(Us),l(_s),l(Mt),l(Zs),l(wt),l(js),l(yt),l($s),l(vs),l(Ws),l(Tt),l(Gs),l(Jt),l(Rs),l(Ut),l(Bs),l(_t),l(Is),l(ks),l(jt),l(Ls),l($t),l(Cs),l(vt),l(Vs),l(Xs),l(xs),l(Gt),l(Ns),l(Ys),l(Vt)),l(i),M(_,e),M(U,e),M($,e),M(H,e),M(F,e),M(A,e),M(D,e),M(ee,e),M(te,e),M(se,e),M(v,e),M(ne,e),M(W,e),M(ie,e),M(G,e),M(pe,e),M(ue,e),M(we,e),M(ye,e),M(ge,e),M(R,e),M(Je,e),M(_e,e),M(B,e),M($e),M(k,e),M(ve,e),M(Re,e),M(Ie,e),M(Le,e),M(Ve,e),M(Ne,e),M(Ye,e),M(Ae,e),M(ze,e),M(qe,e),M(Pe,e),M(Oe,e),M(L,e),M(tt,e),M(C,e),M(st,e),M(nt,e),M(rt,e),M(mt,e),M(ht,e),M(V,e),M(ct,e),M(bt,e),M(gt,e),M(Zt,e),M(X,e),M(Wt,e),M(Rt,e)}}}const Wn='{"title":"Low-Rank Adaptation of Large Language Models (LoRA)","local":"low-rank-adaptation-of-large-language-models-lora","sections":[{"title":"Text-to-image","local":"text-to-image","sections":[{"title":"Training","local":"text-to-image-training","sections":[],"depth":3},{"title":"Inference","local":"text-to-image-inference","sections":[],"depth":3}],"depth":2},{"title":"DreamBooth","local":"dreambooth","sections":[{"title":"Training","local":"dreambooth-training","sections":[],"depth":3},{"title":"Inference","local":"dreambooth-inference","sections":[],"depth":3}],"depth":2},{"title":"Stable Diffusion XL","local":"stable-diffusion-xl","sections":[],"depth":2},{"title":"Unloading LoRA parameters","local":"unloading-lora-parameters","sections":[],"depth":2},{"title":"Fusing LoRA parameters","local":"fusing-lora-parameters","sections":[],"depth":2},{"title":"Unfusing LoRA parameters","local":"unfusing-lora-parameters","sections":[],"depth":2},{"title":"Working with different LoRA scales when using LoRA fusion","local":"working-with-different-lora-scales-when-using-lora-fusion","sections":[],"depth":2},{"title":"Serializing pipelines with fused LoRA parameters","local":"serializing-pipelines-with-fused-lora-parameters","sections":[],"depth":2},{"title":"Working with multiple LoRA checkpoints","local":"working-with-multiple-lora-checkpoints","sections":[],"depth":2},{"title":"Supporting different LoRA checkpoints from Diffusers","local":"supporting-different-lora-checkpoints-from-diffusers","sections":[{"title":"Kohya","local":"kohya","sections":[],"depth":3},{"title":"Kohya + Stable Diffusion XL","local":"kohya--stable-diffusion-xl","sections":[],"depth":3},{"title":"TheLastBen","local":"thelastben","sections":[],"depth":3}],"depth":2}],"depth":1}';function Gn(g){return un(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Cn extends hn{constructor(i){super(),dn(this,i,Gn,vn,mn,{})}}export{Cn as component};
