import{s as Va,a as Ca,o as va,n as _l}from"../chunks/scheduler.53228c21.js";import{S as qa,i as Aa,e as r,s as a,c as d,h as Xa,a as M,d as t,b as n,f as Ws,g as m,j as w,k as W,l as $s,m as s,n as u,t as c,o as h,p as f}from"../chunks/index.100fac89.js";import{C as Ea}from"../chunks/CopyLLMTxtMenu.9360b11d.js";import{C as j}from"../chunks/CodeBlock.d30a6509.js";import{H as Z,E as La}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.c9001d7a.js";import{H as Gs,a as Wl}from"../chunks/HfOption.fad27e59.js";function xa(U){let i,y;return i=new j({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZSUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lLmxvYWRfbG9yYV93ZWlnaHRzKCUwQSUyMCUyMCUyMCUyMCUyMm9zdHJpcyUyRnN1cGVyLWNlcmVhbC1zZHhsLWxvcmElMjIlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfbmFtZSUzRCUyMmNlcmVhbF9ib3hfc2R4bF92MS5zYWZldGVuc29ycyUyMiUyQyUwQSUyMCUyMCUyMCUyMGFkYXB0ZXJfbmFtZSUzRCUyMmNlcmVhbCUyMiUwQSklMEFwaXBlbGluZSglMjJiZWFycyUyQyUyMHBpenphJTIwYml0ZXMlMjIpLmltYWdlcyU1QjAlNUQ=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image

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;ostris/super-cereal-sdxl-lora&quot;</span>,
    weight_name=<span class="hljs-string">&quot;cereal_box_sdxl_v1.safetensors&quot;</span>,
    adapter_name=<span class="hljs-string">&quot;cereal&quot;</span>
)
pipeline(<span class="hljs-string">&quot;bears, pizza bites&quot;</span>).images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){d(i.$$.fragment)},l(p){m(i.$$.fragment,p)},m(p,T){u(i,p,T),y=!0},p:_l,i(p){y||(c(i.$$.fragment,p),y=!0)},o(p){h(i.$$.fragment,p),y=!1},d(p){f(i,p)}}}function Fa(U){let i,y;return i=new j({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwTFRYQ29uZGl0aW9uUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwZXhwb3J0X3RvX3ZpZGVvJTJDJTIwbG9hZF9pbWFnZSUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwTFRYQ29uZGl0aW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMkxpZ2h0cmlja3MlMkZMVFgtVmlkZW8tMC45LjUlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2JTBBKSUwQSUwQXBpcGVsaW5lLmxvYWRfbG9yYV93ZWlnaHRzKCUwQSUyMCUyMCUyMCUyMCUyMkxpZ2h0cmlja3MlMkZMVFgtVmlkZW8tQ2FrZWlmeS1Mb1JBJTIyJTJDJTBBJTIwJTIwJTIwJTIwd2VpZ2h0X25hbWUlM0QlMjJsdHh2XzA5NV9jYWtlaWZ5X2xvcmEuc2FmZXRlbnNvcnMlMjIlMkMlMEElMjAlMjAlMjAlMjBhZGFwdGVyX25hbWUlM0QlMjJjYWtlaWZ5JTIyJTBBKSUwQXBpcGVsaW5lLnNldF9hZGFwdGVycyglMjJjYWtlaWZ5JTIyKSUwQSUwQSUyMyUyMHVzZSUyMCUyMkNBS0VJRlklMjIlMjB0byUyMHRyaWdnZXIlMjB0aGUlMjBMb1JBJTBBcHJvbXB0JTIwJTNEJTIwJTIyQ0FLRUlGWSUyMGElMjBwZXJzb24lMjB1c2luZyUyMGElMjBrbmlmZSUyMHRvJTIwY3V0JTIwYSUyMGNha2UlMjBzaGFwZWQlMjBsaWtlJTIwYSUyMFBpa2FjaHUlMjBwbHVzaGllJTIyJTBBaW1hZ2UlMjAlM0QlMjBsb2FkX2ltYWdlKCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZMaWdodHJpY2tzJTJGTFRYLVZpZGVvLUNha2VpZnktTG9SQSUyRnJlc29sdmUlMkZtYWluJTJGYXNzZXRzJTJGaW1hZ2VzJTJGcGlrYWNodS5wbmclMjIpJTBBJTBBdmlkZW8lMjAlM0QlMjBwaXBlbGluZSglMEElMjAlMjAlMjAlMjBwcm9tcHQlM0Rwcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBpbWFnZSUzRGltYWdlJTJDJTBBJTIwJTIwJTIwJTIwd2lkdGglM0Q1NzYlMkMlMEElMjAlMjAlMjAlMjBoZWlnaHQlM0Q1NzYlMkMlMEElMjAlMjAlMjAlMjBudW1fZnJhbWVzJTNEMTYxJTJDJTBBJTIwJTIwJTIwJTIwZGVjb2RlX3RpbWVzdGVwJTNEMC4wMyUyQyUwQSUyMCUyMCUyMCUyMGRlY29kZV9ub2lzZV9zY2FsZSUzRDAuMDI1JTJDJTBBJTIwJTIwJTIwJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDUwJTJDJTBBKS5mcmFtZXMlNUIwJTVEJTBBZXhwb3J0X3RvX3ZpZGVvKHZpZGVvJTJDJTIwJTIyb3V0cHV0Lm1wNCUyMiUyQyUyMGZwcyUzRDI2KQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> LTXConditionPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video, load_image

pipeline = LTXConditionPipeline.from_pretrained(
    <span class="hljs-string">&quot;Lightricks/LTX-Video-0.9.5&quot;</span>, torch_dtype=torch.bfloat16
)

pipeline.load_lora_weights(
    <span class="hljs-string">&quot;Lightricks/LTX-Video-Cakeify-LoRA&quot;</span>,
    weight_name=<span class="hljs-string">&quot;ltxv_095_cakeify_lora.safetensors&quot;</span>,
    adapter_name=<span class="hljs-string">&quot;cakeify&quot;</span>
)
pipeline.set_adapters(<span class="hljs-string">&quot;cakeify&quot;</span>)

<span class="hljs-comment"># use &quot;CAKEIFY&quot; to trigger the LoRA</span>
prompt = <span class="hljs-string">&quot;CAKEIFY a person using a knife to cut a cake shaped like a Pikachu plushie&quot;</span>
image = load_image(<span class="hljs-string">&quot;https://huggingface.co/Lightricks/LTX-Video-Cakeify-LoRA/resolve/main/assets/images/pikachu.png&quot;</span>)

video = pipeline(
    prompt=prompt,
    image=image,
    width=<span class="hljs-number">576</span>,
    height=<span class="hljs-number">576</span>,
    num_frames=<span class="hljs-number">161</span>,
    decode_timestep=<span class="hljs-number">0.03</span>,
    decode_noise_scale=<span class="hljs-number">0.025</span>,
    num_inference_steps=<span class="hljs-number">50</span>,
).frames[<span class="hljs-number">0</span>]
export_to_video(video, <span class="hljs-string">&quot;output.mp4&quot;</span>, fps=<span class="hljs-number">26</span>)`,wrap:!1}}),{c(){d(i.$$.fragment)},l(p){m(i.$$.fragment,p)},m(p,T){u(i,p,T),y=!0},p:_l,i(p){y||(c(i.$$.fragment,p),y=!0)},o(p){h(i.$$.fragment,p),y=!1},d(p){f(i,p)}}}function Ya(U){let i,y,p,T;return i=new Wl({props:{id:"usage",option:"text-to-image",$$slots:{default:[xa]},$$scope:{ctx:U}}}),p=new Wl({props:{id:"usage",option:"text-to-video",$$slots:{default:[Fa]},$$scope:{ctx:U}}}),{c(){d(i.$$.fragment),y=a(),d(p.$$.fragment)},l(o){m(i.$$.fragment,o),y=n(o),m(p.$$.fragment,o)},m(o,J){u(i,o,J),s(o,y,J),u(p,o,J),T=!0},p(o,J){const b={};J&2&&(b.$$scope={dirty:J,ctx:o}),i.$set(b);const I={};J&2&&(I.$$scope={dirty:J,ctx:o}),p.$set(I)},i(o){T||(c(i.$$.fragment,o),c(p.$$.fragment,o),T=!0)},o(o){h(i.$$.fragment,o),h(p.$$.fragment,o),T=!1},d(o){o&&t(y),f(i,o),f(p,o)}}}function Sa(U){let i,y="For simple use cases, you can pass <code>cross_attention_kwargs={&quot;scale&quot;: 1.0}</code> to the pipeline.",p,T,o;return T=new j({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZSUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lLmxvYWRfbG9yYV93ZWlnaHRzKCUwQSUyMCUyMCUyMCUyMCUyMm9zdHJpcyUyRnN1cGVyLWNlcmVhbC1zZHhsLWxvcmElMjIlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfbmFtZSUzRCUyMmNlcmVhbF9ib3hfc2R4bF92MS5zYWZldGVuc29ycyUyMiUyQyUwQSUyMCUyMCUyMCUyMGFkYXB0ZXJfbmFtZSUzRCUyMmNlcmVhbCUyMiUwQSklMEFwaXBlbGluZSglMjJiZWFycyUyQyUyMHBpenphJTIwYml0ZXMlMjIlMkMlMjBjcm9zc19hdHRlbnRpb25fa3dhcmdzJTNEJTdCJTIyc2NhbGUlMjIlM0ElMjAxLjAlN0QpLmltYWdlcyU1QjAlNUQ=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image

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;ostris/super-cereal-sdxl-lora&quot;</span>,
    weight_name=<span class="hljs-string">&quot;cereal_box_sdxl_v1.safetensors&quot;</span>,
    adapter_name=<span class="hljs-string">&quot;cereal&quot;</span>
)
pipeline(<span class="hljs-string">&quot;bears, pizza bites&quot;</span>, cross_attention_kwargs={<span class="hljs-string">&quot;scale&quot;</span>: <span class="hljs-number">1.0</span>}).images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){i=r("p"),i.innerHTML=y,p=a(),d(T.$$.fragment)},l(J){i=M(J,"P",{"data-svelte-h":!0}),w(i)!=="svelte-190bybd"&&(i.innerHTML=y),p=n(J),m(T.$$.fragment,J)},m(J,b){s(J,i,b),s(J,p,b),u(T,J,b),o=!0},p:_l,i(J){o||(c(T.$$.fragment,J),o=!0)},o(J){h(T.$$.fragment,J),o=!1},d(J){J&&(t(i),t(p)),f(T,J)}}}function Ha(U){let i,y='<p>The <a href="/docs/diffusers/main/en/api/loaders/peft#diffusers.loaders.PeftAdapterMixin.set_adapters">set_adapters()</a> method only scales attention weights. If a LoRA has ResNets or down and upsamplers, these components keep a scale value of <code>1.0</code>.</p>',p,T,o="For finer control over each individual component of the UNet or text encoder, pass a dictionary instead. In the example below, the <code>&quot;down&quot;</code> block in the UNet is scaled by 0.9 and you can further specify in the <code>&quot;up&quot;</code> block the scales of the transformers in <code>&quot;block_0&quot;</code> and <code>&quot;block_1&quot;</code>. If a block like <code>&quot;mid&quot;</code> isn’t specified, the default value <code>1.0</code> is used.",J,b,I;return b=new j({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZSUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lLmxvYWRfbG9yYV93ZWlnaHRzKCUwQSUyMCUyMCUyMCUyMCUyMm9zdHJpcyUyRnN1cGVyLWNlcmVhbC1zZHhsLWxvcmElMjIlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfbmFtZSUzRCUyMmNlcmVhbF9ib3hfc2R4bF92MS5zYWZldGVuc29ycyUyMiUyQyUwQSUyMCUyMCUyMCUyMGFkYXB0ZXJfbmFtZSUzRCUyMmNlcmVhbCUyMiUwQSklMEFzY2FsZXMlMjAlM0QlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjJ0ZXh0X2VuY29kZXIlMjIlM0ElMjAwLjUlMkMlMEElMjAlMjAlMjAlMjAlMjJ0ZXh0X2VuY29kZXJfMiUyMiUzQSUyMDAuNSUyQyUwQSUyMCUyMCUyMCUyMCUyMnVuZXQlMjIlM0ElMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJkb3duJTIyJTNBJTIwMC45JTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIydXAlMjIlM0ElMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJibG9ja18wJTIyJTNBJTIwMC42JTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyYmxvY2tfMSUyMiUzQSUyMCU1QjAuNCUyQyUyMDAuOCUyQyUyMDEuMCU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3RCUwQSUyMCUyMCUyMCUyMCU3RCUwQSU3RCUwQXBpcGVsaW5lLnNldF9hZGFwdGVycyglMjJjZXJlYWwlMjIlMkMlMjBzY2FsZXMpJTBBcGlwZWxpbmUoJTIyYmVhcnMlMkMlMjBwaXp6YSUyMGJpdGVzJTIyKS5pbWFnZXMlNUIwJTVE",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image

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;ostris/super-cereal-sdxl-lora&quot;</span>,
    weight_name=<span class="hljs-string">&quot;cereal_box_sdxl_v1.safetensors&quot;</span>,
    adapter_name=<span class="hljs-string">&quot;cereal&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-string">&quot;unet&quot;</span>: {
        <span class="hljs-string">&quot;down&quot;</span>: <span class="hljs-number">0.9</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-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>],
        }
    }
}
pipeline.set_adapters(<span class="hljs-string">&quot;cereal&quot;</span>, scales)
pipeline(<span class="hljs-string">&quot;bears, pizza bites&quot;</span>).images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){i=r("blockquote"),i.innerHTML=y,p=a(),T=r("p"),T.innerHTML=o,J=a(),d(b.$$.fragment),this.h()},l(g){i=M(g,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),w(i)!=="svelte-hhwbuw"&&(i.innerHTML=y),p=n(g),T=M(g,"P",{"data-svelte-h":!0}),w(T)!=="svelte-1gwev2i"&&(T.innerHTML=o),J=n(g),m(b.$$.fragment,g),this.h()},h(){W(i,"class","warning")},m(g,G){s(g,i,G),s(g,p,G),s(g,T,G),s(g,J,G),u(b,g,G),I=!0},p:_l,i(g){I||(c(b.$$.fragment,g),I=!0)},o(g){h(b.$$.fragment,g),I=!1},d(g){g&&(t(i),t(p),t(T),t(J)),f(b,g)}}}function za(U){let i,y,p,T;return i=new Wl({props:{id:"weight-scale",option:"simple use case",$$slots:{default:[Sa]},$$scope:{ctx:U}}}),p=new Wl({props:{id:"weight-scale",option:"finer control",$$slots:{default:[Ha]},$$scope:{ctx:U}}}),{c(){d(i.$$.fragment),y=a(),d(p.$$.fragment)},l(o){m(i.$$.fragment,o),y=n(o),m(p.$$.fragment,o)},m(o,J){u(i,o,J),s(o,y,J),u(p,o,J),T=!0},p(o,J){const b={};J&2&&(b.$$scope={dirty:J,ctx:o}),i.$set(b);const I={};J&2&&(I.$$scope={dirty:J,ctx:o}),p.$set(I)},i(o){T||(c(i.$$.fragment,o),c(p.$$.fragment,o),T=!0)},o(o){h(i.$$.fragment,o),h(p.$$.fragment,o),T=!1},d(o){o&&t(y),f(i,o),f(p,o)}}}function Qa(U){let i,y;return i=new j({props:{code:"cGlwZWxpbmUudW5sb2FkX2xvcmFfd2VpZ2h0cygpJTBBcGlwZWxpbmUuc2F2ZV9wcmV0cmFpbmVkKCUyMnBhdGglMkZ0byUyRmZ1c2VkLXBpcGVsaW5lJTIyKQ==",highlighted:`pipeline.unload_lora_weights()
pipeline.save_pretrained(<span class="hljs-string">&quot;path/to/fused-pipeline&quot;</span>)`,wrap:!1}}),{c(){d(i.$$.fragment)},l(p){m(i.$$.fragment,p)},m(p,T){u(i,p,T),y=!0},p:_l,i(p){y||(c(i.$$.fragment,p),y=!0)},o(p){h(i.$$.fragment,p),y=!1},d(p){f(i,p)}}}function Na(U){let i,y;return i=new j({props:{code:"cGlwZWxpbmUudW5sb2FkX2xvcmFfd2VpZ2h0cygpJTBBcGlwZWxpbmUucHVzaF90b19odWIoJTIyZnVzZWQtaWtlYS1mZW5nJTIyKQ==",highlighted:`pipeline.unload_lora_weights()
pipeline.push_to_hub(<span class="hljs-string">&quot;fused-ikea-feng&quot;</span>)`,wrap:!1}}),{c(){d(i.$$.fragment)},l(p){m(i.$$.fragment,p)},m(p,T){u(i,p,T),y=!0},p:_l,i(p){y||(c(i.$$.fragment,p),y=!0)},o(p){h(i.$$.fragment,p),y=!1},d(p){f(i,p)}}}function Da(U){let i,y,p,T;return i=new Wl({props:{id:"save",option:"save locally",$$slots:{default:[Qa]},$$scope:{ctx:U}}}),p=new Wl({props:{id:"save",option:"save to Hub",$$slots:{default:[Na]},$$scope:{ctx:U}}}),{c(){d(i.$$.fragment),y=a(),d(p.$$.fragment)},l(o){m(i.$$.fragment,o),y=n(o),m(p.$$.fragment,o)},m(o,J){u(i,o,J),s(o,y,J),u(p,o,J),T=!0},p(o,J){const b={};J&2&&(b.$$scope={dirty:J,ctx:o}),i.$set(b);const I={};J&2&&(I.$$scope={dirty:J,ctx:o}),p.$set(I)},i(o){T||(c(i.$$.fragment,o),c(p.$$.fragment,o),T=!0)},o(o){h(i.$$.fragment,o),h(p.$$.fragment,o),T=!1},d(o){o&&t(y),f(i,o),f(p,o)}}}function Pa(U){let i,y,p,T,o,J,b,I,g,G='<a href="https://huggingface.co/papers/2106.09685" rel="nofollow">LoRA (Low-Rank Adaptation)</a> is a method for quickly training a model for a new task. It works by freezing the original model weights and adding a small number of <em>new</em> trainable parameters. This means it is significantly faster and cheaper to adapt an existing model to new tasks, such as generating images in a new style.',Gl,x,ks='LoRA checkpoints are typically only a couple hundred MBs in size, so they’re very lightweight and easy to store. Load these smaller set of weights into an existing base model with <a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.StableDiffusionLoraLoaderMixin.load_lora_weights">load_lora_weights()</a> and specify the file name.',kl,k,Bl,F,Bs='The <a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.StableDiffusionLoraLoaderMixin.load_lora_weights">load_lora_weights()</a> method is the preferred way to load LoRA weights into the UNet and text encoder because it can handle cases where:',Rl,Y,Rs="<li>the LoRA weights don’t have separate UNet and text encoder identifiers</li> <li>the LoRA weights have separate UNet and text encoder identifiers</li>",Vl,S,Vs='The <a href="/docs/diffusers/main/en/api/loaders/peft#diffusers.loaders.PeftAdapterMixin.load_lora_adapter">load_lora_adapter()</a> method is used to directly load a LoRA adapter at the <em>model-level</em>, as long as the model is a Diffusers model that is a subclass of <code>PeftAdapterMixin</code>. It builds and prepares the necessary model configuration for the adapter. This method also loads the LoRA adapter into the UNet.',Cl,H,Cs='For example, if you’re only loading a LoRA into the UNet, <a href="/docs/diffusers/main/en/api/loaders/peft#diffusers.loaders.PeftAdapterMixin.load_lora_adapter">load_lora_adapter()</a> ignores the text encoder keys. Use the <code>prefix</code> parameter to filter and load the appropriate state dicts, <code>&quot;unet&quot;</code> to load.',vl,z,ql,Q,Al,N,vs='<a href="../optimization/fp16#torchcompile">torch.compile</a> speeds up inference by compiling the PyTorch model to use optimized kernels. Before compiling, the LoRA weights need to be fused into the base model and unloaded first.',Xl,D,El,P,qs="Typically, the UNet is compiled because its the most compute intensive component of the pipeline.",Ll,K,xl,O,As='Refer to the <a href="#hotswapping">hotswapping</a> section to learn how to avoid recompilation when working with compiled models and multiple LoRAs.',Fl,ee,Yl,le,Xs="The <code>scale</code> parameter is used to control how much of a LoRA to apply. A value of <code>0</code> is equivalent to only using the base model weights and a value of <code>1</code> is equivalent to fully using the LoRA.",Sl,B,Hl,te,zl,se,Es="Dynamically adjusting the LoRA scale during sampling gives you better control over the overall composition and layout because certain steps may benefit more from an increased or reduced scale.",Ql,ae,Ls='The <a href="https://huggingface.co/alvarobartt/ghibli-characters-flux-lora" rel="nofollow">character LoRA</a> in the example below starts with a higher scale that gradually decays over the first 20 steps to establish the character generation. In the later steps, only a scale of 0.2 is applied to avoid adding too much of the LoRA features to other parts of the image the LoRA wasn’t trained on.',Nl,ne,Dl,ie,Pl,pe,xs='Hotswapping LoRAs is an efficient way to work with multiple LoRAs while avoiding accumulating memory from multiple calls to <a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.StableDiffusionLoraLoaderMixin.load_lora_weights">load_lora_weights()</a> and in some cases, recompilation, if a model is compiled. This workflow requires a loaded LoRA because the new LoRA weights are swapped in place for the existing loaded LoRA.',Kl,oe,Ol,R,Fs="<p>Hotswapping is unsupported for LoRAs that target the text encoder.</p>",et,re,Ys='Set <code>hotswap=True</code> in <a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.StableDiffusionLoraLoaderMixin.load_lora_weights">load_lora_weights()</a> to swap the second LoRA. Use the <code>adapter_name</code> parameter to indicate which LoRA to swap (<code>default_0</code> is the default name).',lt,Me,tt,de,st,me,Ss='For compiled models, use <a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.lora_base.LoraBaseMixin.enable_lora_hotswap">enable_lora_hotswap()</a> to avoid recompilation when hotswapping LoRAs. This method should be called <em>before</em> loading the first LoRA and <code>torch.compile</code> should be called <em>after</em> loading the first LoRA.',at,V,Hs='<p>The <a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.lora_base.LoraBaseMixin.enable_lora_hotswap">enable_lora_hotswap()</a> method isn’t always necessary if the second LoRA targets the identical LoRA ranks and scales as the first LoRA.</p>',nt,ue,zs='Within <a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.lora_base.LoraBaseMixin.enable_lora_hotswap">enable_lora_hotswap()</a>, the <code>target_rank</code> parameter is important for setting the rank for all LoRA adapters. Setting it to <code>max_rank</code> sets it to the highest value. For LoRAs with different ranks, you set it to a higher rank value. The default rank value is 128.',it,ce,pt,C,Qs='<p>Move your code inside the <code>with torch._dynamo.config.patch(error_on_recompile=True)</code> context manager to detect if a model was recompiled. If a model is recompiled despite following all the steps above, please open an <a href="https://github.com/huggingface/diffusers/issues" rel="nofollow">issue</a> with a reproducible example.</p>',ot,he,Ns='If you expect to varied resolutions during inference with this feature, then make sure set <code>dynamic=True</code> during compilation. Refer to <a href="../optimization/fp16#dynamic-shape-compilation">this document</a> for more details.',rt,fe,Ds='There are still scenarios where recompulation is unavoidable, such as when the hotswapped LoRA targets more layers than the initial adapter. Try to load the LoRA that targets the most layers <em>first</em>. For more details about this limitation, refer to the PEFT <a href="https://huggingface.co/docs/peft/main/en/package_reference/hotswap#peft.utils.hotswap.hotswap_adapter" rel="nofollow">hotswapping</a> docs.',Mt,we,Ps='<summary>Technical details of hotswapping</summary> <p>The <a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.lora_base.LoraBaseMixin.enable_lora_hotswap">enable_lora_hotswap()</a> method converts the LoRA scaling factor from floats to torch.tensors and pads the shape of the weights to the largest required shape to avoid reassigning the whole attribute when the data in the weights are replaced.</p> <p>This is why the <code>max_rank</code> argument is important. The results are unchanged even when the values are padded with zeros. Computation may be slower though depending on the padding size.</p> <p>Since no new LoRA attributes are added, each subsequent LoRA is only allowed to target the same layers, or subset of layers, the first LoRA targets. Choosing the LoRA loading order is important because if the LoRAs target disjoint layers, you may end up creating a dummy LoRA that targets the union of all target layers.</p> <p>For more implementation details, take a look at the <a href="https://github.com/huggingface/peft/blob/92d65cafa51c829484ad3d95cf71d09de57ff066/src/peft/utils/hotswap.py" rel="nofollow"><code>hotswap.py</code></a> file.</p>',dt,Je,mt,ye,Ks="The weights from each LoRA can be merged together to produce a blend of multiple existing styles. There are several methods for merging LoRAs, each of which differ in <em>how</em> the weights are merged (may affect generation quality).",ut,Te,ct,je,Os='The <a href="/docs/diffusers/main/en/api/loaders/peft#diffusers.loaders.PeftAdapterMixin.set_adapters">set_adapters()</a> method merges LoRAs by concatenating their weighted matrices. Pass the LoRA names to <a href="/docs/diffusers/main/en/api/loaders/peft#diffusers.loaders.PeftAdapterMixin.set_adapters">set_adapters()</a> and use the <code>adapter_weights</code> parameter to control the scaling of each LoRA. For example, if <code>adapter_weights=[0.5, 0.5]</code>, the output is an average of both LoRAs.',ht,v,ea='<p>The <code>&quot;scale&quot;</code> parameter determines how much of the merged LoRA to apply. See the <a href="#weight-scale">Weight scale</a> section for more details.</p>',ft,be,wt,q,la='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/lora_merge_set_adapters.png"/>',Jt,ge,yt,A,ta='<p>This is an experimental method and you can refer to PEFTs <a href="https://huggingface.co/docs/peft/developer_guides/model_merging" rel="nofollow">Model merging</a> for more details. Take a look at this <a href="https://github.com/huggingface/diffusers/issues/6892" rel="nofollow">issue</a> if you’re interested in the motivation and design behind this integration.</p>',Tt,Ue,sa='The <code>~peft.LoraModel.add_weighted_adapter</code> method enables more efficient merging methods like <a href="https://huggingface.co/papers/2306.01708" rel="nofollow">TIES</a> or <a href="https://huggingface.co/papers/2311.03099" rel="nofollow">DARE</a>. These merging methods remove redundant and potentially interfering parameters from merged models. Keep in mind the LoRA ranks need to have identical ranks to be merged.',jt,Ze,aa="Make sure the latest stable version of Diffusers and PEFT is installed.",bt,Ie,gt,We,na="Load a UNET that corresponds to the LoRA UNet.",Ut,_e,Zt,$e,ia="Load a pipeline, pass the UNet to it, and load a LoRA.",It,Ge,Wt,ke,pa="Create a <code>~peft.PeftModel</code> from the LoRA checkpoint by combining the first UNet you loaded and the LoRA UNet from the pipeline.",_t,Be,$t,$,Il,oa="You can save and reuse the <code>ikea_peft_model</code> by pushing it to the Hub as shown below.",_s,Re,Gt,Ve,ra="Repeat this process and create a <code>~peft.PeftModel</code> for the second LoRA.",kt,Ce,Bt,ve,Ma="Load a base UNet model and load the adapters.",Rt,qe,Vt,Ae,da='Merge the LoRAs with <code>~peft.LoraModel.add_weighted_adapter</code> and specify how you want to merge them with <code>combination_type</code>. The example below uses the <code>&quot;dare_linear&quot;</code> method (refer to this <a href="https://huggingface.co/blog/peft_merging" rel="nofollow">blog post</a> to learn more about these merging methods), which randomly prunes some weights and then performs a weighted sum of the tensors based on the set weightage of each LoRA in <code>weights</code>.',Ct,Xe,ma='Activate the merged LoRAs with <a href="/docs/diffusers/main/en/api/loaders/peft#diffusers.loaders.PeftAdapterMixin.set_adapters">set_adapters()</a>.',vt,Ee,qt,X,ua='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/ikea-feng-dare-linear.png"/>',At,Le,Xt,xe,ca='The <a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.lora_base.LoraBaseMixin.fuse_lora">fuse_lora()</a> method fuses the LoRA weights directly with the original UNet and text encoder weights of the underlying model. This reduces the overhead of loading the underlying model for each LoRA because it only loads the model once, which lowers memory usage and increases inference speed.',Et,Fe,Lt,Ye,ha='Call <a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.lora_base.LoraBaseMixin.fuse_lora">fuse_lora()</a> to fuse them. The <code>lora_scale</code> parameter controls how much to scale the output by with the LoRA weights. It is important to make this adjustment now because passing <code>scale</code> to <code>cross_attention_kwargs</code> won’t work in the pipeline.',xt,Se,Ft,He,fa='Unload the LoRA weights since they’re already fused with the underlying model. Save the fused pipeline with either <a href="/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline.save_pretrained">save_pretrained()</a> to save it locally or <code>~PushToHubMixin.push_to_hub</code> to save it to the Hub.',Yt,E,St,ze,wa="The fused pipeline can now be quickly loaded for inference without requiring each LoRA to be separately loaded.",Ht,Qe,zt,Ne,Ja="Use <code>unfuse_lora()</code> to restore the underlying models weights, for example, if you want to use a different <code>lora_scale</code> value. You can only unfuse if there is a single LoRA fused. For example, it won’t work with the pipeline from above because there are multiple fused LoRAs. In these cases, you’ll need to reload the entire model.",Qt,De,Nt,L,ya='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/fuse_lora.png"/>',Dt,Pe,Pt,Ke,Ta="Diffusers provides several methods to help you manage working with LoRAs. These methods can be especially useful if you’re working with multiple LoRAs.",Kt,Oe,Ot,el,ja='<a href="/docs/diffusers/main/en/api/loaders/peft#diffusers.loaders.PeftAdapterMixin.set_adapters">set_adapters()</a> also activates the current LoRA to use if there are multiple active LoRAs. This allows you to switch between different LoRAs by specifying their name.',es,ll,ls,tl,ts,sl,ba='Save an adapter with <a href="/docs/diffusers/main/en/api/loaders/peft#diffusers.loaders.PeftAdapterMixin.save_lora_adapter">save_lora_adapter()</a>.',ss,al,as,nl,ns,il,ga='The <a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.lora_base.LoraBaseMixin.unload_lora_weights">unload_lora_weights()</a> method unloads any LoRA weights in the pipeline to restore the underlying model weights.',is,pl,ps,ol,os,rl,Ua='The <a href="/docs/diffusers/main/en/api/loaders/peft#diffusers.loaders.PeftAdapterMixin.disable_lora">disable_lora()</a> method disables all LoRAs (but they’re still kept on the pipeline) and restores the pipeline to the underlying model weights.',rs,Ml,Ms,dl,ds,ml,Za='The <a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.lora_base.LoraBaseMixin.get_active_adapters">get_active_adapters()</a> method returns a list of active LoRAs attached to a pipeline.',ms,ul,us,cl,cs,hl,Ia='The <a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.lora_base.LoraBaseMixin.get_list_adapters">get_list_adapters()</a> method returns the active LoRAs for each component in the pipeline.',hs,fl,fs,wl,ws,Jl,Wa='The <a href="/docs/diffusers/main/en/api/loaders/peft#diffusers.loaders.PeftAdapterMixin.delete_adapters">delete_adapters()</a> method completely removes a LoRA and its layers from a model.',Js,yl,ys,Tl,Ts,jl,_a='Browse the <a href="https://lorastudio.co/models" rel="nofollow">LoRA Studio</a> for different LoRAs to use or you can upload your favorite LoRAs from Civitai to the Hub with the Space below.',js,_,$a,bs,bl,Ga='You can find additional LoRAs in the <a href="https://huggingface.co/spaces/multimodalart/flux-lora-the-explorer" rel="nofollow">FLUX LoRA the Explorer</a> and <a href="https://huggingface.co/spaces/multimodalart/LoraTheExplorer" rel="nofollow">LoRA the Explorer</a> Spaces.',gs,gl,ka='Check out the <a href="https://huggingface.co/blog/lora-fast" rel="nofollow">Fast LoRA inference for Flux with Diffusers and PEFT</a> blog post to learn how to optimize LoRA inference with methods like FlashAttention-3 and fp8 quantization.',Us,Ul,Zs,$l,Is;return o=new Ea({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),b=new Z({props:{title:"LoRA",local:"lora",headingTag:"h1"}}),k=new Gs({props:{id:"usage",options:["text-to-image","text-to-video"],$$slots:{default:[Ya]},$$scope:{ctx:U}}}),z=new j({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZSUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lLnVuZXQubG9hZF9sb3JhX2FkYXB0ZXIoJTBBJTIwJTIwJTIwJTIwJTIyamJpbGNrZS1oZiUyRnNkeGwtY2luZW1hdGljLTElMjIlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfbmFtZSUzRCUyMnB5dG9yY2hfbG9yYV93ZWlnaHRzLnNhZmV0ZW5zb3JzJTIyJTJDJTBBJTIwJTIwJTIwJTIwYWRhcHRlcl9uYW1lJTNEJTIyY2luZW1hdGljJTIyJTJDJTBBJTIwJTIwJTIwJTIwcHJlZml4JTNEJTIydW5ldCUyMiUwQSklMEElMjMlMjB1c2UlMjBjbm10JTIwaW4lMjB0aGUlMjBwcm9tcHQlMjB0byUyMHRyaWdnZXIlMjB0aGUlMjBMb1JBJTBBcGlwZWxpbmUoJTIyQSUyMGN1dGUlMjBjbm10JTIwZWF0aW5nJTIwYSUyMHNsaWNlJTIwb2YlMjBwaXp6YSUyQyUyMHN0dW5uaW5nJTIwY29sb3IlMjBzY2hlbWUlMkMlMjBtYXN0ZXJwaWVjZSUyQyUyMGlsbHVzdHJhdGlvbiUyMikuaW1hZ2VzJTVCMCU1RA==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image

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_lora_adapter(
    <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>,
    adapter_name=<span class="hljs-string">&quot;cinematic&quot;</span>,
    prefix=<span class="hljs-string">&quot;unet&quot;</span>
)
<span class="hljs-comment"># use cnmt in the prompt to trigger the LoRA</span>
pipeline(<span class="hljs-string">&quot;A cute cnmt eating a slice of pizza, stunning color scheme, masterpiece, illustration&quot;</span>).images[<span class="hljs-number">0</span>]`,wrap:!1}}),Q=new Z({props:{title:"torch.compile",local:"torchcompile",headingTag:"h2"}}),D=new j({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEElMjMlMjBsb2FkJTIwYmFzZSUyMG1vZGVsJTIwYW5kJTIwTG9SQSUwQXBpcGVsaW5lJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi14bC1iYXNlLTEuMCUyMiUyQyUwQSUyMCUyMCUyMCUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSkudG8oJTIyY3VkYSUyMiklMEFwaXBlbGluZS5sb2FkX2xvcmFfd2VpZ2h0cyglMEElMjAlMjAlMjAlMjAlMjJvc3RyaXMlMkZpa2VhLWluc3RydWN0aW9ucy1sb3JhLXNkeGwlMjIlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfbmFtZSUzRCUyMmlrZWFfaW5zdHJ1Y3Rpb25zX3hsX3YxXzUuc2FmZXRlbnNvcnMlMjIlMkMlMEElMjAlMjAlMjAlMjBhZGFwdGVyX25hbWUlM0QlMjJpa2VhJTIyJTBBKSUwQSUwQSUyMyUyMGFjdGl2YXRlJTIwTG9SQSUyMGFuZCUyMHNldCUyMGFkYXB0ZXIlMjB3ZWlnaHQlMEFwaXBlbGluZS5zZXRfYWRhcHRlcnMoJTIyaWtlYSUyMiUyQyUyMGFkYXB0ZXJfd2VpZ2h0cyUzRDAuNyklMEElMEElMjMlMjBmdXNlJTIwTG9SQXMlMjBhbmQlMjB1bmxvYWQlMjB3ZWlnaHRzJTBBcGlwZWxpbmUuZnVzZV9sb3JhKGFkYXB0ZXJfbmFtZXMlM0QlNUIlMjJpa2VhJTIyJTVEJTJDJTIwbG9yYV9zY2FsZSUzRDEuMCklMEFwaXBlbGluZS51bmxvYWRfbG9yYV93ZWlnaHRzKCk=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

<span class="hljs-comment"># load base model and LoRA</span>
pipeline = 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>)
pipeline.load_lora_weights(
    <span class="hljs-string">&quot;ostris/ikea-instructions-lora-sdxl&quot;</span>,
    weight_name=<span class="hljs-string">&quot;ikea_instructions_xl_v1_5.safetensors&quot;</span>,
    adapter_name=<span class="hljs-string">&quot;ikea&quot;</span>
)

<span class="hljs-comment"># activate LoRA and set adapter weight</span>
pipeline.set_adapters(<span class="hljs-string">&quot;ikea&quot;</span>, adapter_weights=<span class="hljs-number">0.7</span>)

<span class="hljs-comment"># fuse LoRAs and unload weights</span>
pipeline.fuse_lora(adapter_names=[<span class="hljs-string">&quot;ikea&quot;</span>], lora_scale=<span class="hljs-number">1.0</span>)
pipeline.unload_lora_weights()`,wrap:!1}}),K=new j({props:{code:"cGlwZWxpbmUudW5ldC50byhtZW1vcnlfZm9ybWF0JTNEdG9yY2guY2hhbm5lbHNfbGFzdCklMEFwaXBlbGluZS51bmV0JTIwJTNEJTIwdG9yY2guY29tcGlsZShwaXBlbGluZS51bmV0JTJDJTIwbW9kZSUzRCUyMnJlZHVjZS1vdmVyaGVhZCUyMiUyQyUyMGZ1bGxncmFwaCUzRFRydWUpJTBBJTBBcGlwZWxpbmUoJTIyQSUyMGJvd2wlMjBvZiUyMHJhbWVuJTIwc2hhcGVkJTIwbGlrZSUyMGElMjBjdXRlJTIwa2F3YWlpJTIwYmVhciUyMikuaW1hZ2VzJTVCMCU1RA==",highlighted:`pipeline.unet.to(memory_format=torch.channels_last)
pipeline.unet = torch.<span class="hljs-built_in">compile</span>(pipeline.unet, mode=<span class="hljs-string">&quot;reduce-overhead&quot;</span>, fullgraph=<span class="hljs-literal">True</span>)

pipeline(<span class="hljs-string">&quot;A bowl of ramen shaped like a cute kawaii bear&quot;</span>).images[<span class="hljs-number">0</span>]`,wrap:!1}}),ee=new Z({props:{title:"Weight scale",local:"weight-scale",headingTag:"h2"}}),B=new Gs({props:{id:"weight-scale",options:["simple use case","finer control"],$$slots:{default:[za]},$$scope:{ctx:U}}}),te=new Z({props:{title:"Scale scheduling",local:"scale-scheduling",headingTag:"h3"}}),ne=new j({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRmx1eFBpcGVsaW5lJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBGbHV4UGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmJsYWNrLWZvcmVzdC1sYWJzJTJGRkxVWC4xLWRldiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYlMEEpLnRvKCUyMmN1ZGElMjIpJTBBJTBBcGlwZWxuZS5sb2FkX2xvcmFfd2VpZ2h0cyglMjJhbHZhcm9iYXJ0dCUyRmdoaWJsaS1jaGFyYWN0ZXJzLWZsdXgtbG9yYSUyMiUyQyUyMCUyMmxvcmElMjIpJTBBJTBBbnVtX2luZmVyZW5jZV9zdGVwcyUyMCUzRCUyMDMwJTBBbG9yYV9zdGVwcyUyMCUzRCUyMDIwJTBBbG9yYV9zY2FsZXMlMjAlM0QlMjB0b3JjaC5saW5zcGFjZSgxLjUlMkMlMjAwLjclMkMlMjBsb3JhX3N0ZXBzKS50b2xpc3QoKSUwQWxvcmFfc2NhbGVzJTIwJTJCJTNEJTIwJTVCMC4yJTVEJTIwKiUyMChudW1faW5mZXJlbmNlX3N0ZXBzJTIwLSUyMGxvcmFfc3RlcHMlMjAlMkIlMjAxKSUwQSUwQXBpcGVsaW5lLnNldF9hZGFwdGVycyglMjJsb3JhJTIyJTJDJTIwbG9yYV9zY2FsZXMlNUIwJTVEKSUwQSUwQWRlZiUyMGNhbGxiYWNrKHBpcGVsaW5lJTNBJTIwRmx1eFBpcGVsaW5lJTJDJTIwc3RlcCUzQSUyMGludCUyQyUyMHRpbWVzdGVwJTNBJTIwdG9yY2guTG9uZ1RlbnNvciUyQyUyMGNhbGxiYWNrX2t3YXJncyUzQSUyMGRpY3QpJTNBJTBBJTIwJTIwJTIwJTIwcGlwZWxpbmUuc2V0X2FkYXB0ZXJzKCUyMmxvcmElMjIlMkMlMjBsb3JhX3NjYWxlcyU1QnN0ZXAlMjAlMkIlMjAxJTVEKSUwQSUyMCUyMCUyMCUyMHJldHVybiUyMGNhbGxiYWNrX2t3YXJncyUwQSUwQXByb21wdCUyMCUzRCUyMCUyMiUyMiUyMiUwQUdoaWJsaSUyMHN0eWxlJTIwVGhlJTIwR3JpbmNoJTJDJTIwYSUyMG1pc2NoaWV2b3VzJTIwZ3JlZW4lMjBjcmVhdHVyZSUyMHdpdGglMjBhJTIwc2x5JTIwZ3JpbiUyQyUyMHBlZWtpbmclMjBvdXQlMjBmcm9tJTIwYmVoaW5kJTIwYSUyMHNub3ctY292ZXJlZCUyMHRyZWUlMjB3aGlsZSUyMHBsb3R0aW5nJTIwaGlzJTIwYW50aWNzJTJDJTIwJTBBaW4lMjBhJTIwcXVhaW50JTIwc25vd3klMjB2aWxsYWdlJTIwZGVjb3JhdGVkJTIwZm9yJTIwdGhlJTIwaG9saWRheXMlMkMlMjB3YXJtJTIwbGlnaHQlMjBnbG93aW5nJTIwZnJvbSUyMGNvenklMjBob21lcyUyQyUyMHdpdGglMjBwbGF5ZnVsJTIwc25vd2ZsYWtlcyUyMGRhbmNpbmclMjBpbiUyMHRoZSUyMGFpciUwQSUyMiUyMiUyMiUwQXBpcGVsaW5lKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMGd1aWRhbmNlX3NjYWxlJTNEMy4wJTJDJTBBJTIwJTIwJTIwJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRG51bV9pbmZlcmVuY2Vfc3RlcHMlMkMlMEElMjAlMjAlMjAlMjBnZW5lcmF0b3IlM0R0b3JjaC5HZW5lcmF0b3IoKS5tYW51YWxfc2VlZCg0MiklMkMlMEElMjAlMjAlMjAlMjBjYWxsYmFja19vbl9zdGVwX2VuZCUzRGNhbGxiYWNrJTJDJTBBKS5pbWFnZXMlNUIwJTVE",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> FluxPipeline

pipeline = FluxPipeline.from_pretrained(
    <span class="hljs-string">&quot;black-forest-labs/FLUX.1-dev&quot;</span>, torch_dtype=torch.bfloat16
).to(<span class="hljs-string">&quot;cuda&quot;</span>)

pipelne.load_lora_weights(<span class="hljs-string">&quot;alvarobartt/ghibli-characters-flux-lora&quot;</span>, <span class="hljs-string">&quot;lora&quot;</span>)

num_inference_steps = <span class="hljs-number">30</span>
lora_steps = <span class="hljs-number">20</span>
lora_scales = torch.linspace(<span class="hljs-number">1.5</span>, <span class="hljs-number">0.7</span>, lora_steps).tolist()
lora_scales += [<span class="hljs-number">0.2</span>] * (num_inference_steps - lora_steps + <span class="hljs-number">1</span>)

pipeline.set_adapters(<span class="hljs-string">&quot;lora&quot;</span>, lora_scales[<span class="hljs-number">0</span>])

<span class="hljs-keyword">def</span> <span class="hljs-title function_">callback</span>(<span class="hljs-params">pipeline: FluxPipeline, step: <span class="hljs-built_in">int</span>, timestep: torch.LongTensor, callback_kwargs: <span class="hljs-built_in">dict</span></span>):
    pipeline.set_adapters(<span class="hljs-string">&quot;lora&quot;</span>, lora_scales[step + <span class="hljs-number">1</span>])
    <span class="hljs-keyword">return</span> callback_kwargs

prompt = <span class="hljs-string">&quot;&quot;&quot;
Ghibli style The Grinch, a mischievous green creature with a sly grin, peeking out from behind a snow-covered tree while plotting his antics, 
in a quaint snowy village decorated for the holidays, warm light glowing from cozy homes, with playful snowflakes dancing in the air
&quot;&quot;&quot;</span>
pipeline(
    prompt=prompt,
    guidance_scale=<span class="hljs-number">3.0</span>,
    num_inference_steps=num_inference_steps,
    generator=torch.Generator().manual_seed(<span class="hljs-number">42</span>),
    callback_on_step_end=callback,
).images[<span class="hljs-number">0</span>]`,wrap:!1}}),ie=new Z({props:{title:"Hotswapping",local:"hotswapping",headingTag:"h2"}}),oe=new j({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEElMjMlMjBsb2FkJTIwYmFzZSUyMG1vZGVsJTIwYW5kJTIwTG9SQXMlMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtYmFzZS0xLjAlMjIlMkMlMEElMjAlMjAlMjAlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMEEpLnRvKCUyMmN1ZGElMjIpJTBBcGlwZWxpbmUubG9hZF9sb3JhX3dlaWdodHMoJTBBJTIwJTIwJTIwJTIwJTIyb3N0cmlzJTJGaWtlYS1pbnN0cnVjdGlvbnMtbG9yYS1zZHhsJTIyJTJDJTBBJTIwJTIwJTIwJTIwd2VpZ2h0X25hbWUlM0QlMjJpa2VhX2luc3RydWN0aW9uc194bF92MV81LnNhZmV0ZW5zb3JzJTIyJTJDJTBBJTIwJTIwJTIwJTIwYWRhcHRlcl9uYW1lJTNEJTIyaWtlYSUyMiUwQSk=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

<span class="hljs-comment"># load base model and LoRAs</span>
pipeline = 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>)
pipeline.load_lora_weights(
    <span class="hljs-string">&quot;ostris/ikea-instructions-lora-sdxl&quot;</span>,
    weight_name=<span class="hljs-string">&quot;ikea_instructions_xl_v1_5.safetensors&quot;</span>,
    adapter_name=<span class="hljs-string">&quot;ikea&quot;</span>
)`,wrap:!1}}),Me=new j({props:{code:"cGlwZWxpbmUubG9hZF9sb3JhX3dlaWdodHMoJTBBJTIwJTIwJTIwJTIwJTIybG9yZGppYSUyRmJ5LWZlbmctemlrYWklMjIlMkMlMEElMjAlMjAlMjAlMjBob3Rzd2FwJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMGFkYXB0ZXJfbmFtZSUzRCUyMmlrZWElMjIlMEEp",highlighted:`pipeline.load_lora_weights(
    <span class="hljs-string">&quot;lordjia/by-feng-zikai&quot;</span>,
    hotswap=<span class="hljs-literal">True</span>,
    adapter_name=<span class="hljs-string">&quot;ikea&quot;</span>
)`,wrap:!1}}),de=new Z({props:{title:"Compiled models",local:"compiled-models",headingTag:"h3"}}),ce=new j({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEElMjMlMjBsb2FkJTIwYmFzZSUyMG1vZGVsJTIwYW5kJTIwTG9SQXMlMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtYmFzZS0xLjAlMjIlMkMlMEElMjAlMjAlMjAlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMEEpLnRvKCUyMmN1ZGElMjIpJTBBJTIzJTIwMS4lMjBlbmFibGVfbG9yYV9ob3Rzd2FwJTBBcGlwZWxpbmUuZW5hYmxlX2xvcmFfaG90c3dhcCh0YXJnZXRfcmFuayUzRG1heF9yYW5rKSUwQXBpcGVsaW5lLmxvYWRfbG9yYV93ZWlnaHRzKCUwQSUyMCUyMCUyMCUyMCUyMm9zdHJpcyUyRmlrZWEtaW5zdHJ1Y3Rpb25zLWxvcmEtc2R4bCUyMiUyQyUwQSUyMCUyMCUyMCUyMHdlaWdodF9uYW1lJTNEJTIyaWtlYV9pbnN0cnVjdGlvbnNfeGxfdjFfNS5zYWZldGVuc29ycyUyMiUyQyUwQSUyMCUyMCUyMCUyMGFkYXB0ZXJfbmFtZSUzRCUyMmlrZWElMjIlMEEpJTBBJTIzJTIwMi4lMjB0b3JjaC5jb21waWxlJTBBcGlwZWxpbmUudW5ldCUyMCUzRCUyMHRvcmNoLmNvbXBpbGUocGlwZWxpbmUudW5ldCUyQyUyMG1vZGUlM0QlMjJyZWR1Y2Utb3ZlcmhlYWQlMjIlMkMlMjBmdWxsZ3JhcGglM0RUcnVlKSUwQSUwQSUyMyUyMDMuJTIwaG90c3dhcCUwQXBpcGVsaW5lLmxvYWRfbG9yYV93ZWlnaHRzKCUwQSUyMCUyMCUyMCUyMCUyMmxvcmRqaWElMkZieS1mZW5nLXppa2FpJTIyJTJDJTBBJTIwJTIwJTIwJTIwaG90c3dhcCUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBhZGFwdGVyX25hbWUlM0QlMjJpa2VhJTIyJTBBKQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

<span class="hljs-comment"># load base model and LoRAs</span>
pipeline = 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>)
<span class="hljs-comment"># 1. enable_lora_hotswap</span>
pipeline.enable_lora_hotswap(target_rank=max_rank)
pipeline.load_lora_weights(
    <span class="hljs-string">&quot;ostris/ikea-instructions-lora-sdxl&quot;</span>,
    weight_name=<span class="hljs-string">&quot;ikea_instructions_xl_v1_5.safetensors&quot;</span>,
    adapter_name=<span class="hljs-string">&quot;ikea&quot;</span>
)
<span class="hljs-comment"># 2. torch.compile</span>
pipeline.unet = torch.<span class="hljs-built_in">compile</span>(pipeline.unet, mode=<span class="hljs-string">&quot;reduce-overhead&quot;</span>, fullgraph=<span class="hljs-literal">True</span>)

<span class="hljs-comment"># 3. hotswap</span>
pipeline.load_lora_weights(
    <span class="hljs-string">&quot;lordjia/by-feng-zikai&quot;</span>,
    hotswap=<span class="hljs-literal">True</span>,
    adapter_name=<span class="hljs-string">&quot;ikea&quot;</span>
)`,wrap:!1}}),Je=new Z({props:{title:"Merge",local:"merge",headingTag:"h2"}}),Te=new Z({props:{title:"set_adapters",local:"setadapters",headingTag:"h3"}}),be=new j({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtYmFzZS0xLjAlMjIlMkMlMEElMjAlMjAlMjAlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMEEpLnRvKCUyMmN1ZGElMjIpJTBBcGlwZWxpbmUubG9hZF9sb3JhX3dlaWdodHMoJTBBJTIwJTIwJTIwJTIwJTIyb3N0cmlzJTJGaWtlYS1pbnN0cnVjdGlvbnMtbG9yYS1zZHhsJTIyJTJDJTBBJTIwJTIwJTIwJTIwd2VpZ2h0X25hbWUlM0QlMjJpa2VhX2luc3RydWN0aW9uc194bF92MV81LnNhZmV0ZW5zb3JzJTIyJTJDJTBBJTIwJTIwJTIwJTIwYWRhcHRlcl9uYW1lJTNEJTIyaWtlYSUyMiUwQSklMEFwaXBlbGluZS5sb2FkX2xvcmFfd2VpZ2h0cyglMEElMjAlMjAlMjAlMjAlMjJsb3JkamlhJTJGYnktZmVuZy16aWthaSUyMiUyQyUwQSUyMCUyMCUyMCUyMHdlaWdodF9uYW1lJTNEJTIyZmVuZ3ppa2FpX3YxLjBfWEwuc2FmZXRlbnNvcnMlMjIlMkMlMEElMjAlMjAlMjAlMjBhZGFwdGVyX25hbWUlM0QlMjJmZW5nJTIyJTBBKSUwQXBpcGVsaW5lLnNldF9hZGFwdGVycyglNUIlMjJpa2VhJTIyJTJDJTIwJTIyZmVuZyUyMiU1RCUyQyUyMGFkYXB0ZXJfd2VpZ2h0cyUzRCU1QjAuNyUyQyUyMDAuOCU1RCklMEElMjMlMjB1c2UlMjBieSUyMEZlbmclMjBaaWthaSUyMHRvJTIwYWN0aXZhdGUlMjB0aGUlMjBsb3JkamlhJTJGYnktZmVuZy16aWthaSUyMExvUkElMEFwaXBlbGluZSglMjJBJTIwYm93bCUyMG9mJTIwcmFtZW4lMjBzaGFwZWQlMjBsaWtlJTIwYSUyMGN1dGUlMjBrYXdhaWklMjBiZWFyJTJDJTIwYnklMjBGZW5nJTIwWmlrYWklMjIlMkMlMjBjcm9zc19hdHRlbnRpb25fa3dhcmdzJTNEJTdCJTIyc2NhbGUlMjIlM0ElMjAxLjAlN0QpLmltYWdlcyU1QjAlNUQ=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

pipeline = 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>)
pipeline.load_lora_weights(
    <span class="hljs-string">&quot;ostris/ikea-instructions-lora-sdxl&quot;</span>,
    weight_name=<span class="hljs-string">&quot;ikea_instructions_xl_v1_5.safetensors&quot;</span>,
    adapter_name=<span class="hljs-string">&quot;ikea&quot;</span>
)
pipeline.load_lora_weights(
    <span class="hljs-string">&quot;lordjia/by-feng-zikai&quot;</span>,
    weight_name=<span class="hljs-string">&quot;fengzikai_v1.0_XL.safetensors&quot;</span>,
    adapter_name=<span class="hljs-string">&quot;feng&quot;</span>
)
pipeline.set_adapters([<span class="hljs-string">&quot;ikea&quot;</span>, <span class="hljs-string">&quot;feng&quot;</span>], adapter_weights=[<span class="hljs-number">0.7</span>, <span class="hljs-number">0.8</span>])
<span class="hljs-comment"># use by Feng Zikai to activate the lordjia/by-feng-zikai LoRA</span>
pipeline(<span class="hljs-string">&quot;A bowl of ramen shaped like a cute kawaii bear, by Feng Zikai&quot;</span>, cross_attention_kwargs={<span class="hljs-string">&quot;scale&quot;</span>: <span class="hljs-number">1.0</span>}).images[<span class="hljs-number">0</span>]`,wrap:!1}}),ge=new Z({props:{title:"add_weighted_adapter",local:"addweightedadapter",headingTag:"h3"}}),Ie=new j({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1VJTIwLXElMjBkaWZmdXNlcnMlMjBwZWZ0",highlighted:"pip install -U -q diffusers peft",wrap:!1}}),_e=new j({props:{code:"aW1wb3J0JTIwY29weSUwQWltcG9ydCUyMHRvcmNoJTBBZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9Nb2RlbCUyQyUyMERpZmZ1c2lvblBpcGVsaW5lJTBBZnJvbSUyMHBlZnQlMjBpbXBvcnQlMjBnZXRfcGVmdF9tb2RlbCUyQyUyMExvcmFDb25maWclMkMlMjBQZWZ0TW9kZWwlMEElMEF1bmV0JTIwJTNEJTIwQXV0b01vZGVsLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtYmFzZS0xLjAlMjIlMkMlMEElMjAlMjAlMjAlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMEElMjAlMjAlMjAlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIlMkMlMEElMjAlMjAlMjAlMjBzdWJmb2xkZXIlM0QlMjJ1bmV0JTIyJTJDJTBBKS50byglMjJjdWRhJTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> copy
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoModel, DiffusionPipeline
<span class="hljs-keyword">from</span> peft <span class="hljs-keyword">import</span> get_peft_model, LoraConfig, PeftModel

unet = AutoModel.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>,
    torch_dtype=torch.float16,
    use_safetensors=<span class="hljs-literal">True</span>,
    variant=<span class="hljs-string">&quot;fp16&quot;</span>,
    subfolder=<span class="hljs-string">&quot;unet&quot;</span>,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),Ge=new j({props:{code:"cGlwZWxpbmUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTJDJTBBJTIwJTIwJTIwJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIlMkMlMEElMjAlMjAlMjAlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMEElMjAlMjAlMjAlMjB1bmV0JTNEdW5ldCUwQSkudG8oJTIyY3VkYSUyMiklMEFwaXBlbGluZS5sb2FkX2xvcmFfd2VpZ2h0cyglMEElMjAlMjAlMjAlMjAlMjJvc3RyaXMlMkZpa2VhLWluc3RydWN0aW9ucy1sb3JhLXNkeGwlMjIlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfbmFtZSUzRCUyMmlrZWFfaW5zdHJ1Y3Rpb25zX3hsX3YxXzUuc2FmZXRlbnNvcnMlMjIlMkMlMEElMjAlMjAlMjAlMjBhZGFwdGVyX25hbWUlM0QlMjJpa2VhJTIyJTBBKQ==",highlighted:`pipeline = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>,
    variant=<span class="hljs-string">&quot;fp16&quot;</span>,
    torch_dtype=torch.float16,
    unet=unet
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline.load_lora_weights(
    <span class="hljs-string">&quot;ostris/ikea-instructions-lora-sdxl&quot;</span>,
    weight_name=<span class="hljs-string">&quot;ikea_instructions_xl_v1_5.safetensors&quot;</span>,
    adapter_name=<span class="hljs-string">&quot;ikea&quot;</span>
)`,wrap:!1}}),Be=new j({props:{code:"c2R4bF91bmV0JTIwJTNEJTIwY29weS5kZWVwY29weSh1bmV0KSUwQWlrZWFfcGVmdF9tb2RlbCUyMCUzRCUyMGdldF9wZWZ0X21vZGVsKCUwQSUyMCUyMCUyMCUyMHNkeGxfdW5ldCUyQyUwQSUyMCUyMCUyMCUyMHBpcGVsaW5lLnVuZXQucGVmdF9jb25maWclNUIlMjJpa2VhJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwYWRhcHRlcl9uYW1lJTNEJTIyaWtlYSUyMiUwQSklMEElMEFvcmlnaW5hbF9zdGF0ZV9kaWN0JTIwJTNEJTIwJTdCZiUyMmJhc2VfbW9kZWwubW9kZWwuJTdCayU3RCUyMiUzQSUyMHYlMjBmb3IlMjBrJTJDJTIwdiUyMGluJTIwcGlwZWxpbmUudW5ldC5zdGF0ZV9kaWN0KCkuaXRlbXMoKSU3RCUwQWlrZWFfcGVmdF9tb2RlbC5sb2FkX3N0YXRlX2RpY3Qob3JpZ2luYWxfc3RhdGVfZGljdCUyQyUyMHN0cmljdCUzRFRydWUp",highlighted:`sdxl_unet = copy.deepcopy(unet)
ikea_peft_model = get_peft_model(
    sdxl_unet,
    pipeline.unet.peft_config[<span class="hljs-string">&quot;ikea&quot;</span>],
    adapter_name=<span class="hljs-string">&quot;ikea&quot;</span>
)

original_state_dict = {<span class="hljs-string">f&quot;base_model.model.<span class="hljs-subst">{k}</span>&quot;</span>: v <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> pipeline.unet.state_dict().items()}
ikea_peft_model.load_state_dict(original_state_dict, strict=<span class="hljs-literal">True</span>)`,wrap:!1}}),Re=new j({props:{code:"aWtlYV9wZWZ0X21vZGVsLnB1c2hfdG9faHViKCUyMmlrZWFfcGVmdF9tb2RlbCUyMiUyQyUyMHRva2VuJTNEVE9LRU4p",highlighted:'ikea_peft_model.push_to_hub(<span class="hljs-string">&quot;ikea_peft_model&quot;</span>, token=TOKEN)',wrap:!1}}),Ce=new j({props:{code:"cGlwZWxpbmUuZGVsZXRlX2FkYXB0ZXJzKCUyMmlrZWElMjIpJTBBc2R4bF91bmV0LmRlbGV0ZV9hZGFwdGVycyglMjJpa2VhJTIyKSUwQSUwQXBpcGVsaW5lLmxvYWRfbG9yYV93ZWlnaHRzKCUwQSUyMCUyMCUyMCUyMCUyMmxvcmRqaWElMkZieS1mZW5nLXppa2FpJTIyJTJDJTBBJTIwJTIwJTIwJTIwd2VpZ2h0X25hbWUlM0QlMjJmZW5nemlrYWlfdjEuMF9YTC5zYWZldGVuc29ycyUyMiUyQyUwQSUyMCUyMCUyMCUyMGFkYXB0ZXJfbmFtZSUzRCUyMmZlbmclMjIlMEEpJTBBcGlwZWxpbmUuc2V0X2FkYXB0ZXJzKGFkYXB0ZXJfbmFtZXMlM0QlMjJmZW5nJTIyKSUwQSUwQWZlbmdfcGVmdF9tb2RlbCUyMCUzRCUyMGdldF9wZWZ0X21vZGVsKCUwQSUyMCUyMCUyMCUyMHNkeGxfdW5ldCUyQyUwQSUyMCUyMCUyMCUyMHBpcGVsaW5lLnVuZXQucGVmdF9jb25maWclNUIlMjJmZW5nJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwYWRhcHRlcl9uYW1lJTNEJTIyZmVuZyUyMiUwQSklMEElMEFvcmlnaW5hbF9zdGF0ZV9kaWN0JTIwJTNEJTIwJTdCZiUyMmJhc2VfbW9kZWwubW9kZWwuJTdCayU3RCUyMiUzQSUyMHYlMjBmb3IlMjBrJTJDJTIwdiUyMGluJTIwcGlwZS51bmV0LnN0YXRlX2RpY3QoKS5pdGVtcygpJTdEJTBBZmVuZ19wZWZ0X21vZGVsLmxvYWRfc3RhdGVfZGljdChvcmlnaW5hbF9zdGF0ZV9kaWN0JTJDJTIwc3RyaWN0JTNEVHJ1ZSk=",highlighted:`pipeline.delete_adapters(<span class="hljs-string">&quot;ikea&quot;</span>)
sdxl_unet.delete_adapters(<span class="hljs-string">&quot;ikea&quot;</span>)

pipeline.load_lora_weights(
    <span class="hljs-string">&quot;lordjia/by-feng-zikai&quot;</span>,
    weight_name=<span class="hljs-string">&quot;fengzikai_v1.0_XL.safetensors&quot;</span>,
    adapter_name=<span class="hljs-string">&quot;feng&quot;</span>
)
pipeline.set_adapters(adapter_names=<span class="hljs-string">&quot;feng&quot;</span>)

feng_peft_model = get_peft_model(
    sdxl_unet,
    pipeline.unet.peft_config[<span class="hljs-string">&quot;feng&quot;</span>],
    adapter_name=<span class="hljs-string">&quot;feng&quot;</span>
)

original_state_dict = {<span class="hljs-string">f&quot;base_model.model.<span class="hljs-subst">{k}</span>&quot;</span>: v <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> pipe.unet.state_dict().items()}
feng_peft_model.load_state_dict(original_state_dict, strict=<span class="hljs-literal">True</span>)`,wrap:!1}}),qe=new j({props:{code:"YmFzZV91bmV0JTIwJTNEJTIwQXV0b01vZGVsLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtYmFzZS0xLjAlMjIlMkMlMEElMjAlMjAlMjAlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMEElMjAlMjAlMjAlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIlMkMlMEElMjAlMjAlMjAlMjBzdWJmb2xkZXIlM0QlMjJ1bmV0JTIyJTJDJTBBKS50byglMjJjdWRhJTIyKSUwQSUwQW1vZGVsJTIwJTNEJTIwUGVmdE1vZGVsLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjBiYXNlX3VuZXQlMkMlMEElMjAlMjAlMjAlMjAlMjJzdGV2aGxpdSUyRmlrZWFfcGVmdF9tb2RlbCUyMiUyQyUwQSUyMCUyMCUyMCUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBzdWJmb2xkZXIlM0QlMjJpa2VhJTIyJTJDJTBBJTIwJTIwJTIwJTIwYWRhcHRlcl9uYW1lJTNEJTIyaWtlYSUyMiUwQSklMEFtb2RlbC5sb2FkX2FkYXB0ZXIoJTBBJTIwJTIwJTIwJTIwJTIyc3RldmhsaXUlMkZmZW5nX3BlZnRfbW9kZWwlMjIlMkMlMEElMjAlMjAlMjAlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwc3ViZm9sZGVyJTNEJTIyZmVuZyUyMiUyQyUwQSUyMCUyMCUyMCUyMGFkYXB0ZXJfbmFtZSUzRCUyMmZlbmclMjIlMEEp",highlighted:`base_unet = AutoModel.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>,
    torch_dtype=torch.float16,
    use_safetensors=<span class="hljs-literal">True</span>,
    variant=<span class="hljs-string">&quot;fp16&quot;</span>,
    subfolder=<span class="hljs-string">&quot;unet&quot;</span>,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)

model = PeftModel.from_pretrained(
    base_unet,
    <span class="hljs-string">&quot;stevhliu/ikea_peft_model&quot;</span>,
    use_safetensors=<span class="hljs-literal">True</span>,
    subfolder=<span class="hljs-string">&quot;ikea&quot;</span>,
    adapter_name=<span class="hljs-string">&quot;ikea&quot;</span>
)
model.load_adapter(
    <span class="hljs-string">&quot;stevhliu/feng_peft_model&quot;</span>,
    use_safetensors=<span class="hljs-literal">True</span>,
    subfolder=<span class="hljs-string">&quot;feng&quot;</span>,
    adapter_name=<span class="hljs-string">&quot;feng&quot;</span>
)`,wrap:!1}}),Ee=new j({props:{code:"bW9kZWwuYWRkX3dlaWdodGVkX2FkYXB0ZXIoJTBBJTIwJTIwJTIwJTIwYWRhcHRlcnMlM0QlNUIlMjJpa2VhJTIyJTJDJTIwJTIyZmVuZyUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMGNvbWJpbmF0aW9uX3R5cGUlM0QlMjJkYXJlX2xpbmVhciUyMiUyQyUwQSUyMCUyMCUyMCUyMHdlaWdodHMlM0QlNUIxLjAlMkMlMjAxLjAlNUQlMkMlMEElMjAlMjAlMjAlMjBhZGFwdGVyX25hbWUlM0QlMjJpa2VhLWZlbmclMjIlMEEpJTBBbW9kZWwuc2V0X2FkYXB0ZXJzKCUyMmlrZWEtZmVuZyUyMiklMEElMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtYmFzZS0xLjAlMjIlMkMlMEElMjAlMjAlMjAlMjB1bmV0JTNEbW9kZWwlMkMlMEElMjAlMjAlMjAlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUwQSUyMCUyMCUyMCUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUwQSkudG8oJTIyY3VkYSUyMiklMEFwaXBlbGluZSglMjJBJTIwYm93bCUyMG9mJTIwcmFtZW4lMjBzaGFwZWQlMjBsaWtlJTIwYSUyMGN1dGUlMjBrYXdhaWklMjBiZWFyJTJDJTIwYnklMjBGZW5nJTIwWmlrYWklMjIpLmltYWdlcyU1QjAlNUQ=",highlighted:`model.add_weighted_adapter(
    adapters=[<span class="hljs-string">&quot;ikea&quot;</span>, <span class="hljs-string">&quot;feng&quot;</span>],
    combination_type=<span class="hljs-string">&quot;dare_linear&quot;</span>,
    weights=[<span class="hljs-number">1.0</span>, <span class="hljs-number">1.0</span>],
    adapter_name=<span class="hljs-string">&quot;ikea-feng&quot;</span>
)
model.set_adapters(<span class="hljs-string">&quot;ikea-feng&quot;</span>)

pipeline = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>,
    unet=model,
    variant=<span class="hljs-string">&quot;fp16&quot;</span>,
    torch_dtype=torch.float16,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline(<span class="hljs-string">&quot;A bowl of ramen shaped like a cute kawaii bear, by Feng Zikai&quot;</span>).images[<span class="hljs-number">0</span>]`,wrap:!1}}),Le=new Z({props:{title:"fuse_lora",local:"fuselora",headingTag:"h3"}}),Fe=new j({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtYmFzZS0xLjAlMjIlMkMlMEElMjAlMjAlMjAlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMEEpLnRvKCUyMmN1ZGElMjIpJTBBcGlwZWxpbmUubG9hZF9sb3JhX3dlaWdodHMoJTBBJTIwJTIwJTIwJTIwJTIyb3N0cmlzJTJGaWtlYS1pbnN0cnVjdGlvbnMtbG9yYS1zZHhsJTIyJTJDJTBBJTIwJTIwJTIwJTIwd2VpZ2h0X25hbWUlM0QlMjJpa2VhX2luc3RydWN0aW9uc194bF92MV81LnNhZmV0ZW5zb3JzJTIyJTJDJTBBJTIwJTIwJTIwJTIwYWRhcHRlcl9uYW1lJTNEJTIyaWtlYSUyMiUwQSklMEFwaXBlbGluZS5sb2FkX2xvcmFfd2VpZ2h0cyglMEElMjAlMjAlMjAlMjAlMjJsb3JkamlhJTJGYnktZmVuZy16aWthaSUyMiUyQyUwQSUyMCUyMCUyMCUyMHdlaWdodF9uYW1lJTNEJTIyZmVuZ3ppa2FpX3YxLjBfWEwuc2FmZXRlbnNvcnMlMjIlMkMlMEElMjAlMjAlMjAlMjBhZGFwdGVyX25hbWUlM0QlMjJmZW5nJTIyJTBBKSUwQXBpcGVsaW5lLnNldF9hZGFwdGVycyglNUIlMjJpa2VhJTIyJTJDJTIwJTIyZmVuZyUyMiU1RCUyQyUyMGFkYXB0ZXJfd2VpZ2h0cyUzRCU1QjAuNyUyQyUyMDAuOCU1RCk=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

pipeline = 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>)
pipeline.load_lora_weights(
    <span class="hljs-string">&quot;ostris/ikea-instructions-lora-sdxl&quot;</span>,
    weight_name=<span class="hljs-string">&quot;ikea_instructions_xl_v1_5.safetensors&quot;</span>,
    adapter_name=<span class="hljs-string">&quot;ikea&quot;</span>
)
pipeline.load_lora_weights(
    <span class="hljs-string">&quot;lordjia/by-feng-zikai&quot;</span>,
    weight_name=<span class="hljs-string">&quot;fengzikai_v1.0_XL.safetensors&quot;</span>,
    adapter_name=<span class="hljs-string">&quot;feng&quot;</span>
)
pipeline.set_adapters([<span class="hljs-string">&quot;ikea&quot;</span>, <span class="hljs-string">&quot;feng&quot;</span>], adapter_weights=[<span class="hljs-number">0.7</span>, <span class="hljs-number">0.8</span>])`,wrap:!1}}),Se=new j({props:{code:"cGlwZWxpbmUuZnVzZV9sb3JhKGFkYXB0ZXJfbmFtZXMlM0QlNUIlMjJpa2VhJTIyJTJDJTIwJTIyZmVuZyUyMiU1RCUyQyUyMGxvcmFfc2NhbGUlM0QxLjAp",highlighted:'pipeline.fuse_lora(adapter_names=[<span class="hljs-string">&quot;ikea&quot;</span>, <span class="hljs-string">&quot;feng&quot;</span>], lora_scale=<span class="hljs-number">1.0</span>)',wrap:!1}}),E=new Gs({props:{id:"save",options:["save locally","save to Hub"],$$slots:{default:[Da]},$$scope:{ctx:U}}}),Qe=new j({props:{code:"cGlwZWxpbmUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIydXNlcm5hbWUlMkZmdXNlZC1pa2VhLWZlbmclMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMEEpLnRvKCUyMmN1ZGElMjIpJTBBcGlwZWxpbmUoJTIyQSUyMGJvd2wlMjBvZiUyMHJhbWVuJTIwc2hhcGVkJTIwbGlrZSUyMGElMjBjdXRlJTIwa2F3YWlpJTIwYmVhciUyQyUyMGJ5JTIwRmVuZyUyMFppa2FpJTIyKS5pbWFnZXMlNUIwJTVE",highlighted:`pipeline = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;username/fused-ikea-feng&quot;</span>, torch_dtype=torch.float16,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline(<span class="hljs-string">&quot;A bowl of ramen shaped like a cute kawaii bear, by Feng Zikai&quot;</span>).images[<span class="hljs-number">0</span>]`,wrap:!1}}),De=new j({props:{code:"cGlwZWxpbmUudW5mdXNlX2xvcmEoKQ==",highlighted:"pipeline.unfuse_lora()",wrap:!1}}),Pe=new Z({props:{title:"Manage",local:"manage",headingTag:"h2"}}),Oe=new Z({props:{title:"set_adapters",local:"setadapters",headingTag:"h3"}}),ll=new j({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtYmFzZS0xLjAlMjIlMkMlMEElMjAlMjAlMjAlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMEEpLnRvKCUyMmN1ZGElMjIpJTBBcGlwZWxpbmUubG9hZF9sb3JhX3dlaWdodHMoJTBBJTIwJTIwJTIwJTIwJTIyb3N0cmlzJTJGaWtlYS1pbnN0cnVjdGlvbnMtbG9yYS1zZHhsJTIyJTJDJTBBJTIwJTIwJTIwJTIwd2VpZ2h0X25hbWUlM0QlMjJpa2VhX2luc3RydWN0aW9uc194bF92MV81LnNhZmV0ZW5zb3JzJTIyJTJDJTBBJTIwJTIwJTIwJTIwYWRhcHRlcl9uYW1lJTNEJTIyaWtlYSUyMiUwQSklMEFwaXBlbGluZS5sb2FkX2xvcmFfd2VpZ2h0cyglMEElMjAlMjAlMjAlMjAlMjJsb3JkamlhJTJGYnktZmVuZy16aWthaSUyMiUyQyUwQSUyMCUyMCUyMCUyMHdlaWdodF9uYW1lJTNEJTIyZmVuZ3ppa2FpX3YxLjBfWEwuc2FmZXRlbnNvcnMlMjIlMkMlMEElMjAlMjAlMjAlMjBhZGFwdGVyX25hbWUlM0QlMjJmZW5nJTIyJTBBKSUwQSUyMyUyMGFjdGl2YXRlcyUyMHRoZSUyMGZlbmclMjBMb1JBJTIwaW5zdGVhZCUyMG9mJTIwdGhlJTIwaWtlYSUyMExvUkElMEFwaXBlbGluZS5zZXRfYWRhcHRlcnMoJTIyZmVuZyUyMik=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

pipeline = 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>)
pipeline.load_lora_weights(
    <span class="hljs-string">&quot;ostris/ikea-instructions-lora-sdxl&quot;</span>,
    weight_name=<span class="hljs-string">&quot;ikea_instructions_xl_v1_5.safetensors&quot;</span>,
    adapter_name=<span class="hljs-string">&quot;ikea&quot;</span>
)
pipeline.load_lora_weights(
    <span class="hljs-string">&quot;lordjia/by-feng-zikai&quot;</span>,
    weight_name=<span class="hljs-string">&quot;fengzikai_v1.0_XL.safetensors&quot;</span>,
    adapter_name=<span class="hljs-string">&quot;feng&quot;</span>
)
<span class="hljs-comment"># activates the feng LoRA instead of the ikea LoRA</span>
pipeline.set_adapters(<span class="hljs-string">&quot;feng&quot;</span>)`,wrap:!1}}),tl=new Z({props:{title:"save_lora_adapter",local:"saveloraadapter",headingTag:"h3"}}),al=new j({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZSUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lLnVuZXQubG9hZF9sb3JhX2FkYXB0ZXIoJTBBJTIwJTIwJTIwJTIwJTIyamJpbGNrZS1oZiUyRnNkeGwtY2luZW1hdGljLTElMjIlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfbmFtZSUzRCUyMnB5dG9yY2hfbG9yYV93ZWlnaHRzLnNhZmV0ZW5zb3JzJTIyJTJDJTBBJTIwJTIwJTIwJTIwYWRhcHRlcl9uYW1lJTNEJTIyY2luZW1hdGljJTIyJTBBJTIwJTIwJTIwJTIwcHJlZml4JTNEJTIydW5ldCUyMiUwQSklMEFwaXBlbGluZS5zYXZlX2xvcmFfYWRhcHRlciglMjJwYXRoJTJGdG8lMkZzYXZlJTIyJTJDJTIwYWRhcHRlcl9uYW1lJTNEJTIyY2luZW1hdGljJTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image

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_lora_adapter(
    <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>,
    adapter_name=<span class="hljs-string">&quot;cinematic&quot;</span>
    prefix=<span class="hljs-string">&quot;unet&quot;</span>
)
pipeline.save_lora_adapter(<span class="hljs-string">&quot;path/to/save&quot;</span>, adapter_name=<span class="hljs-string">&quot;cinematic&quot;</span>)`,wrap:!1}}),nl=new Z({props:{title:"unload_lora_weights",local:"unloadloraweights",headingTag:"h3"}}),pl=new j({props:{code:"cGlwZWxpbmUudW5sb2FkX2xvcmFfd2VpZ2h0cygp",highlighted:"pipeline.unload_lora_weights()",wrap:!1}}),ol=new Z({props:{title:"disable_lora",local:"disablelora",headingTag:"h3"}}),Ml=new j({props:{code:"cGlwZWxpbmUuZGlzYWJsZV9sb3JhKCk=",highlighted:"pipeline.disable_lora()",wrap:!1}}),dl=new Z({props:{title:"get_active_adapters",local:"getactiveadapters",headingTag:"h3"}}),ul=new j({props:{code:"cGlwZWxpbmUuZ2V0X2FjdGl2ZV9hZGFwdGVycygpJTBBJTVCJTIyY2VyZWFsJTIyJTJDJTIwJTIyaWtlYSUyMiU1RA==",highlighted:`pipeline.get_active_adapters()
[<span class="hljs-string">&quot;cereal&quot;</span>, <span class="hljs-string">&quot;ikea&quot;</span>]`,wrap:!1}}),cl=new Z({props:{title:"get_list_adapters",local:"getlistadapters",headingTag:"h3"}}),fl=new j({props:{code:"cGlwZWxpbmUuZ2V0X2xpc3RfYWRhcHRlcnMoKSUwQSU3QiUyMnVuZXQlMjIlM0ElMjAlNUIlMjJjZXJlYWwlMjIlMkMlMjAlMjJpa2VhJTIyJTVEJTJDJTIwJTIydGV4dF9lbmNvZGVyXzIlMjIlM0ElMjAlNUIlMjJjZXJlYWwlMjIlNUQlN0Q=",highlighted:`pipeline.get_list_adapters()
{<span class="hljs-string">&quot;unet&quot;</span>: [<span class="hljs-string">&quot;cereal&quot;</span>, <span class="hljs-string">&quot;ikea&quot;</span>], <span class="hljs-string">&quot;text_encoder_2&quot;</span>: [<span class="hljs-string">&quot;cereal&quot;</span>]}`,wrap:!1}}),wl=new Z({props:{title:"delete_adapters",local:"deleteadapters",headingTag:"h3"}}),yl=new j({props:{code:"cGlwZWxpbmUuZGVsZXRlX2FkYXB0ZXJzKCUyMmlrZWElMjIp",highlighted:'pipeline.delete_adapters(<span class="hljs-string">&quot;ikea&quot;</span>)',wrap:!1}}),Tl=new Z({props:{title:"Resources",local:"resources",headingTag:"h2"}}),Ul=new La({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/tutorials/using_peft_for_inference.md"}}),{c(){i=r("meta"),y=a(),p=r("p"),T=a(),d(o.$$.fragment),J=a(),d(b.$$.fragment),I=a(),g=r("p"),g.innerHTML=G,Gl=a(),x=r("p"),x.innerHTML=ks,kl=a(),d(k.$$.fragment),Bl=a(),F=r("p"),F.innerHTML=Bs,Rl=a(),Y=r("ul"),Y.innerHTML=Rs,Vl=a(),S=r("p"),S.innerHTML=Vs,Cl=a(),H=r("p"),H.innerHTML=Cs,vl=a(),d(z.$$.fragment),ql=a(),d(Q.$$.fragment),Al=a(),N=r("p"),N.innerHTML=vs,Xl=a(),d(D.$$.fragment),El=a(),P=r("p"),P.textContent=qs,Ll=a(),d(K.$$.fragment),xl=a(),O=r("p"),O.innerHTML=As,Fl=a(),d(ee.$$.fragment),Yl=a(),le=r("p"),le.innerHTML=Xs,Sl=a(),d(B.$$.fragment),Hl=a(),d(te.$$.fragment),zl=a(),se=r("p"),se.textContent=Es,Ql=a(),ae=r("p"),ae.innerHTML=Ls,Nl=a(),d(ne.$$.fragment),Dl=a(),d(ie.$$.fragment),Pl=a(),pe=r("p"),pe.innerHTML=xs,Kl=a(),d(oe.$$.fragment),Ol=a(),R=r("blockquote"),R.innerHTML=Fs,et=a(),re=r("p"),re.innerHTML=Ys,lt=a(),d(Me.$$.fragment),tt=a(),d(de.$$.fragment),st=a(),me=r("p"),me.innerHTML=Ss,at=a(),V=r("blockquote"),V.innerHTML=Hs,nt=a(),ue=r("p"),ue.innerHTML=zs,it=a(),d(ce.$$.fragment),pt=a(),C=r("blockquote"),C.innerHTML=Qs,ot=a(),he=r("p"),he.innerHTML=Ns,rt=a(),fe=r("p"),fe.innerHTML=Ds,Mt=a(),we=r("details"),we.innerHTML=Ps,dt=a(),d(Je.$$.fragment),mt=a(),ye=r("p"),ye.innerHTML=Ks,ut=a(),d(Te.$$.fragment),ct=a(),je=r("p"),je.innerHTML=Os,ht=a(),v=r("blockquote"),v.innerHTML=ea,ft=a(),d(be.$$.fragment),wt=a(),q=r("div"),q.innerHTML=la,Jt=a(),d(ge.$$.fragment),yt=a(),A=r("blockquote"),A.innerHTML=ta,Tt=a(),Ue=r("p"),Ue.innerHTML=sa,jt=a(),Ze=r("p"),Ze.textContent=aa,bt=a(),d(Ie.$$.fragment),gt=a(),We=r("p"),We.textContent=na,Ut=a(),d(_e.$$.fragment),Zt=a(),$e=r("p"),$e.textContent=ia,It=a(),d(Ge.$$.fragment),Wt=a(),ke=r("p"),ke.innerHTML=pa,_t=a(),d(Be.$$.fragment),$t=a(),$=r("blockquote"),Il=r("p"),Il.innerHTML=oa,_s=a(),d(Re.$$.fragment),Gt=a(),Ve=r("p"),Ve.innerHTML=ra,kt=a(),d(Ce.$$.fragment),Bt=a(),ve=r("p"),ve.textContent=Ma,Rt=a(),d(qe.$$.fragment),Vt=a(),Ae=r("p"),Ae.innerHTML=da,Ct=a(),Xe=r("p"),Xe.innerHTML=ma,vt=a(),d(Ee.$$.fragment),qt=a(),X=r("div"),X.innerHTML=ua,At=a(),d(Le.$$.fragment),Xt=a(),xe=r("p"),xe.innerHTML=ca,Et=a(),d(Fe.$$.fragment),Lt=a(),Ye=r("p"),Ye.innerHTML=ha,xt=a(),d(Se.$$.fragment),Ft=a(),He=r("p"),He.innerHTML=fa,Yt=a(),d(E.$$.fragment),St=a(),ze=r("p"),ze.textContent=wa,Ht=a(),d(Qe.$$.fragment),zt=a(),Ne=r("p"),Ne.innerHTML=Ja,Qt=a(),d(De.$$.fragment),Nt=a(),L=r("div"),L.innerHTML=ya,Dt=a(),d(Pe.$$.fragment),Pt=a(),Ke=r("p"),Ke.textContent=Ta,Kt=a(),d(Oe.$$.fragment),Ot=a(),el=r("p"),el.innerHTML=ja,es=a(),d(ll.$$.fragment),ls=a(),d(tl.$$.fragment),ts=a(),sl=r("p"),sl.innerHTML=ba,ss=a(),d(al.$$.fragment),as=a(),d(nl.$$.fragment),ns=a(),il=r("p"),il.innerHTML=ga,is=a(),d(pl.$$.fragment),ps=a(),d(ol.$$.fragment),os=a(),rl=r("p"),rl.innerHTML=Ua,rs=a(),d(Ml.$$.fragment),Ms=a(),d(dl.$$.fragment),ds=a(),ml=r("p"),ml.innerHTML=Za,ms=a(),d(ul.$$.fragment),us=a(),d(cl.$$.fragment),cs=a(),hl=r("p"),hl.innerHTML=Ia,hs=a(),d(fl.$$.fragment),fs=a(),d(wl.$$.fragment),ws=a(),Jl=r("p"),Jl.innerHTML=Wa,Js=a(),d(yl.$$.fragment),ys=a(),d(Tl.$$.fragment),Ts=a(),jl=r("p"),jl.innerHTML=_a,js=a(),_=r("iframe"),bs=a(),bl=r("p"),bl.innerHTML=Ga,gs=a(),gl=r("p"),gl.innerHTML=ka,Us=a(),d(Ul.$$.fragment),Zs=a(),$l=r("p"),this.h()},l(e){const l=Xa("svelte-u9bgzb",document.head);i=M(l,"META",{name:!0,content:!0}),l.forEach(t),y=n(e),p=M(e,"P",{}),Ws(p).forEach(t),T=n(e),m(o.$$.fragment,e),J=n(e),m(b.$$.fragment,e),I=n(e),g=M(e,"P",{"data-svelte-h":!0}),w(g)!=="svelte-1gj8vby"&&(g.innerHTML=G),Gl=n(e),x=M(e,"P",{"data-svelte-h":!0}),w(x)!=="svelte-kdtvgq"&&(x.innerHTML=ks),kl=n(e),m(k.$$.fragment,e),Bl=n(e),F=M(e,"P",{"data-svelte-h":!0}),w(F)!=="svelte-1kkl0lk"&&(F.innerHTML=Bs),Rl=n(e),Y=M(e,"UL",{"data-svelte-h":!0}),w(Y)!=="svelte-1kdz0wg"&&(Y.innerHTML=Rs),Vl=n(e),S=M(e,"P",{"data-svelte-h":!0}),w(S)!=="svelte-1u2w295"&&(S.innerHTML=Vs),Cl=n(e),H=M(e,"P",{"data-svelte-h":!0}),w(H)!=="svelte-1ryv6ll"&&(H.innerHTML=Cs),vl=n(e),m(z.$$.fragment,e),ql=n(e),m(Q.$$.fragment,e),Al=n(e),N=M(e,"P",{"data-svelte-h":!0}),w(N)!=="svelte-k3ae2b"&&(N.innerHTML=vs),Xl=n(e),m(D.$$.fragment,e),El=n(e),P=M(e,"P",{"data-svelte-h":!0}),w(P)!=="svelte-1bxdxvu"&&(P.textContent=qs),Ll=n(e),m(K.$$.fragment,e),xl=n(e),O=M(e,"P",{"data-svelte-h":!0}),w(O)!=="svelte-1con55w"&&(O.innerHTML=As),Fl=n(e),m(ee.$$.fragment,e),Yl=n(e),le=M(e,"P",{"data-svelte-h":!0}),w(le)!=="svelte-1rhjdt1"&&(le.innerHTML=Xs),Sl=n(e),m(B.$$.fragment,e),Hl=n(e),m(te.$$.fragment,e),zl=n(e),se=M(e,"P",{"data-svelte-h":!0}),w(se)!=="svelte-1a0w4u0"&&(se.textContent=Es),Ql=n(e),ae=M(e,"P",{"data-svelte-h":!0}),w(ae)!=="svelte-x7hl2g"&&(ae.innerHTML=Ls),Nl=n(e),m(ne.$$.fragment,e),Dl=n(e),m(ie.$$.fragment,e),Pl=n(e),pe=M(e,"P",{"data-svelte-h":!0}),w(pe)!=="svelte-uywnza"&&(pe.innerHTML=xs),Kl=n(e),m(oe.$$.fragment,e),Ol=n(e),R=M(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),w(R)!=="svelte-itcjwr"&&(R.innerHTML=Fs),et=n(e),re=M(e,"P",{"data-svelte-h":!0}),w(re)!=="svelte-1ecua0e"&&(re.innerHTML=Ys),lt=n(e),m(Me.$$.fragment,e),tt=n(e),m(de.$$.fragment,e),st=n(e),me=M(e,"P",{"data-svelte-h":!0}),w(me)!=="svelte-110ub4a"&&(me.innerHTML=Ss),at=n(e),V=M(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),w(V)!=="svelte-1ljbunl"&&(V.innerHTML=Hs),nt=n(e),ue=M(e,"P",{"data-svelte-h":!0}),w(ue)!=="svelte-18chx34"&&(ue.innerHTML=zs),it=n(e),m(ce.$$.fragment,e),pt=n(e),C=M(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),w(C)!=="svelte-2euzrb"&&(C.innerHTML=Qs),ot=n(e),he=M(e,"P",{"data-svelte-h":!0}),w(he)!=="svelte-jjek3c"&&(he.innerHTML=Ns),rt=n(e),fe=M(e,"P",{"data-svelte-h":!0}),w(fe)!=="svelte-ggb744"&&(fe.innerHTML=Ds),Mt=n(e),we=M(e,"DETAILS",{"data-svelte-h":!0}),w(we)!=="svelte-h5s0ma"&&(we.innerHTML=Ps),dt=n(e),m(Je.$$.fragment,e),mt=n(e),ye=M(e,"P",{"data-svelte-h":!0}),w(ye)!=="svelte-10rq47h"&&(ye.innerHTML=Ks),ut=n(e),m(Te.$$.fragment,e),ct=n(e),je=M(e,"P",{"data-svelte-h":!0}),w(je)!=="svelte-1ihzjzr"&&(je.innerHTML=Os),ht=n(e),v=M(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),w(v)!=="svelte-19x1eqs"&&(v.innerHTML=ea),ft=n(e),m(be.$$.fragment,e),wt=n(e),q=M(e,"DIV",{class:!0,"data-svelte-h":!0}),w(q)!=="svelte-rp1f80"&&(q.innerHTML=la),Jt=n(e),m(ge.$$.fragment,e),yt=n(e),A=M(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),w(A)!=="svelte-1hdvsb4"&&(A.innerHTML=ta),Tt=n(e),Ue=M(e,"P",{"data-svelte-h":!0}),w(Ue)!=="svelte-8091mm"&&(Ue.innerHTML=sa),jt=n(e),Ze=M(e,"P",{"data-svelte-h":!0}),w(Ze)!=="svelte-1nseei8"&&(Ze.textContent=aa),bt=n(e),m(Ie.$$.fragment,e),gt=n(e),We=M(e,"P",{"data-svelte-h":!0}),w(We)!=="svelte-bdkl20"&&(We.textContent=na),Ut=n(e),m(_e.$$.fragment,e),Zt=n(e),$e=M(e,"P",{"data-svelte-h":!0}),w($e)!=="svelte-9gm80r"&&($e.textContent=ia),It=n(e),m(Ge.$$.fragment,e),Wt=n(e),ke=M(e,"P",{"data-svelte-h":!0}),w(ke)!=="svelte-tujdh1"&&(ke.innerHTML=pa),_t=n(e),m(Be.$$.fragment,e),$t=n(e),$=M(e,"BLOCKQUOTE",{class:!0});var Zl=Ws($);Il=M(Zl,"P",{"data-svelte-h":!0}),w(Il)!=="svelte-1js0tt0"&&(Il.innerHTML=oa),_s=n(Zl),m(Re.$$.fragment,Zl),Zl.forEach(t),Gt=n(e),Ve=M(e,"P",{"data-svelte-h":!0}),w(Ve)!=="svelte-s05kyc"&&(Ve.innerHTML=ra),kt=n(e),m(Ce.$$.fragment,e),Bt=n(e),ve=M(e,"P",{"data-svelte-h":!0}),w(ve)!=="svelte-4qxxrf"&&(ve.textContent=Ma),Rt=n(e),m(qe.$$.fragment,e),Vt=n(e),Ae=M(e,"P",{"data-svelte-h":!0}),w(Ae)!=="svelte-1my1cqt"&&(Ae.innerHTML=da),Ct=n(e),Xe=M(e,"P",{"data-svelte-h":!0}),w(Xe)!=="svelte-1tmnflg"&&(Xe.innerHTML=ma),vt=n(e),m(Ee.$$.fragment,e),qt=n(e),X=M(e,"DIV",{class:!0,"data-svelte-h":!0}),w(X)!=="svelte-o7lfk9"&&(X.innerHTML=ua),At=n(e),m(Le.$$.fragment,e),Xt=n(e),xe=M(e,"P",{"data-svelte-h":!0}),w(xe)!=="svelte-rr1kg"&&(xe.innerHTML=ca),Et=n(e),m(Fe.$$.fragment,e),Lt=n(e),Ye=M(e,"P",{"data-svelte-h":!0}),w(Ye)!=="svelte-hlsd8u"&&(Ye.innerHTML=ha),xt=n(e),m(Se.$$.fragment,e),Ft=n(e),He=M(e,"P",{"data-svelte-h":!0}),w(He)!=="svelte-tdu9sv"&&(He.innerHTML=fa),Yt=n(e),m(E.$$.fragment,e),St=n(e),ze=M(e,"P",{"data-svelte-h":!0}),w(ze)!=="svelte-13ek29m"&&(ze.textContent=wa),Ht=n(e),m(Qe.$$.fragment,e),zt=n(e),Ne=M(e,"P",{"data-svelte-h":!0}),w(Ne)!=="svelte-1kdk8my"&&(Ne.innerHTML=Ja),Qt=n(e),m(De.$$.fragment,e),Nt=n(e),L=M(e,"DIV",{class:!0,"data-svelte-h":!0}),w(L)!=="svelte-d7vbup"&&(L.innerHTML=ya),Dt=n(e),m(Pe.$$.fragment,e),Pt=n(e),Ke=M(e,"P",{"data-svelte-h":!0}),w(Ke)!=="svelte-lfexew"&&(Ke.textContent=Ta),Kt=n(e),m(Oe.$$.fragment,e),Ot=n(e),el=M(e,"P",{"data-svelte-h":!0}),w(el)!=="svelte-tmlt47"&&(el.innerHTML=ja),es=n(e),m(ll.$$.fragment,e),ls=n(e),m(tl.$$.fragment,e),ts=n(e),sl=M(e,"P",{"data-svelte-h":!0}),w(sl)!=="svelte-3etak2"&&(sl.innerHTML=ba),ss=n(e),m(al.$$.fragment,e),as=n(e),m(nl.$$.fragment,e),ns=n(e),il=M(e,"P",{"data-svelte-h":!0}),w(il)!=="svelte-1fejyxp"&&(il.innerHTML=ga),is=n(e),m(pl.$$.fragment,e),ps=n(e),m(ol.$$.fragment,e),os=n(e),rl=M(e,"P",{"data-svelte-h":!0}),w(rl)!=="svelte-12mv6li"&&(rl.innerHTML=Ua),rs=n(e),m(Ml.$$.fragment,e),Ms=n(e),m(dl.$$.fragment,e),ds=n(e),ml=M(e,"P",{"data-svelte-h":!0}),w(ml)!=="svelte-ojvh3n"&&(ml.innerHTML=Za),ms=n(e),m(ul.$$.fragment,e),us=n(e),m(cl.$$.fragment,e),cs=n(e),hl=M(e,"P",{"data-svelte-h":!0}),w(hl)!=="svelte-1vo1u23"&&(hl.innerHTML=Ia),hs=n(e),m(fl.$$.fragment,e),fs=n(e),m(wl.$$.fragment,e),ws=n(e),Jl=M(e,"P",{"data-svelte-h":!0}),w(Jl)!=="svelte-1lvb4fg"&&(Jl.innerHTML=Wa),Js=n(e),m(yl.$$.fragment,e),ys=n(e),m(Tl.$$.fragment,e),Ts=n(e),jl=M(e,"P",{"data-svelte-h":!0}),w(jl)!=="svelte-rzdugq"&&(jl.innerHTML=_a),js=n(e),_=M(e,"IFRAME",{src:!0,frameborder:!0,width:!0,height:!0}),Ws(_).forEach(t),bs=n(e),bl=M(e,"P",{"data-svelte-h":!0}),w(bl)!=="svelte-1u6fnk7"&&(bl.innerHTML=Ga),gs=n(e),gl=M(e,"P",{"data-svelte-h":!0}),w(gl)!=="svelte-1qbj6sf"&&(gl.innerHTML=ka),Us=n(e),m(Ul.$$.fragment,e),Zs=n(e),$l=M(e,"P",{}),Ws($l).forEach(t),this.h()},h(){W(i,"name","hf:doc:metadata"),W(i,"content",Ka),W(R,"class","warning"),W(V,"class","tip"),W(C,"class","tip"),W(v,"class","tip"),W(q,"class","flex justify-center"),W(A,"class","tip"),W($,"class","tip"),W(X,"class","flex justify-center"),W(L,"class","flex justify-center"),Ca(_.src,$a="https://multimodalart-civitai-to-hf.hf.space")||W(_,"src",$a),W(_,"frameborder","0"),W(_,"width","850"),W(_,"height","450")},m(e,l){$s(document.head,i),s(e,y,l),s(e,p,l),s(e,T,l),u(o,e,l),s(e,J,l),u(b,e,l),s(e,I,l),s(e,g,l),s(e,Gl,l),s(e,x,l),s(e,kl,l),u(k,e,l),s(e,Bl,l),s(e,F,l),s(e,Rl,l),s(e,Y,l),s(e,Vl,l),s(e,S,l),s(e,Cl,l),s(e,H,l),s(e,vl,l),u(z,e,l),s(e,ql,l),u(Q,e,l),s(e,Al,l),s(e,N,l),s(e,Xl,l),u(D,e,l),s(e,El,l),s(e,P,l),s(e,Ll,l),u(K,e,l),s(e,xl,l),s(e,O,l),s(e,Fl,l),u(ee,e,l),s(e,Yl,l),s(e,le,l),s(e,Sl,l),u(B,e,l),s(e,Hl,l),u(te,e,l),s(e,zl,l),s(e,se,l),s(e,Ql,l),s(e,ae,l),s(e,Nl,l),u(ne,e,l),s(e,Dl,l),u(ie,e,l),s(e,Pl,l),s(e,pe,l),s(e,Kl,l),u(oe,e,l),s(e,Ol,l),s(e,R,l),s(e,et,l),s(e,re,l),s(e,lt,l),u(Me,e,l),s(e,tt,l),u(de,e,l),s(e,st,l),s(e,me,l),s(e,at,l),s(e,V,l),s(e,nt,l),s(e,ue,l),s(e,it,l),u(ce,e,l),s(e,pt,l),s(e,C,l),s(e,ot,l),s(e,he,l),s(e,rt,l),s(e,fe,l),s(e,Mt,l),s(e,we,l),s(e,dt,l),u(Je,e,l),s(e,mt,l),s(e,ye,l),s(e,ut,l),u(Te,e,l),s(e,ct,l),s(e,je,l),s(e,ht,l),s(e,v,l),s(e,ft,l),u(be,e,l),s(e,wt,l),s(e,q,l),s(e,Jt,l),u(ge,e,l),s(e,yt,l),s(e,A,l),s(e,Tt,l),s(e,Ue,l),s(e,jt,l),s(e,Ze,l),s(e,bt,l),u(Ie,e,l),s(e,gt,l),s(e,We,l),s(e,Ut,l),u(_e,e,l),s(e,Zt,l),s(e,$e,l),s(e,It,l),u(Ge,e,l),s(e,Wt,l),s(e,ke,l),s(e,_t,l),u(Be,e,l),s(e,$t,l),s(e,$,l),$s($,Il),$s($,_s),u(Re,$,null),s(e,Gt,l),s(e,Ve,l),s(e,kt,l),u(Ce,e,l),s(e,Bt,l),s(e,ve,l),s(e,Rt,l),u(qe,e,l),s(e,Vt,l),s(e,Ae,l),s(e,Ct,l),s(e,Xe,l),s(e,vt,l),u(Ee,e,l),s(e,qt,l),s(e,X,l),s(e,At,l),u(Le,e,l),s(e,Xt,l),s(e,xe,l),s(e,Et,l),u(Fe,e,l),s(e,Lt,l),s(e,Ye,l),s(e,xt,l),u(Se,e,l),s(e,Ft,l),s(e,He,l),s(e,Yt,l),u(E,e,l),s(e,St,l),s(e,ze,l),s(e,Ht,l),u(Qe,e,l),s(e,zt,l),s(e,Ne,l),s(e,Qt,l),u(De,e,l),s(e,Nt,l),s(e,L,l),s(e,Dt,l),u(Pe,e,l),s(e,Pt,l),s(e,Ke,l),s(e,Kt,l),u(Oe,e,l),s(e,Ot,l),s(e,el,l),s(e,es,l),u(ll,e,l),s(e,ls,l),u(tl,e,l),s(e,ts,l),s(e,sl,l),s(e,ss,l),u(al,e,l),s(e,as,l),u(nl,e,l),s(e,ns,l),s(e,il,l),s(e,is,l),u(pl,e,l),s(e,ps,l),u(ol,e,l),s(e,os,l),s(e,rl,l),s(e,rs,l),u(Ml,e,l),s(e,Ms,l),u(dl,e,l),s(e,ds,l),s(e,ml,l),s(e,ms,l),u(ul,e,l),s(e,us,l),u(cl,e,l),s(e,cs,l),s(e,hl,l),s(e,hs,l),u(fl,e,l),s(e,fs,l),u(wl,e,l),s(e,ws,l),s(e,Jl,l),s(e,Js,l),u(yl,e,l),s(e,ys,l),u(Tl,e,l),s(e,Ts,l),s(e,jl,l),s(e,js,l),s(e,_,l),s(e,bs,l),s(e,bl,l),s(e,gs,l),s(e,gl,l),s(e,Us,l),u(Ul,e,l),s(e,Zs,l),s(e,$l,l),Is=!0},p(e,[l]){const Zl={};l&2&&(Zl.$$scope={dirty:l,ctx:e}),k.$set(Zl);const Ba={};l&2&&(Ba.$$scope={dirty:l,ctx:e}),B.$set(Ba);const Ra={};l&2&&(Ra.$$scope={dirty:l,ctx:e}),E.$set(Ra)},i(e){Is||(c(o.$$.fragment,e),c(b.$$.fragment,e),c(k.$$.fragment,e),c(z.$$.fragment,e),c(Q.$$.fragment,e),c(D.$$.fragment,e),c(K.$$.fragment,e),c(ee.$$.fragment,e),c(B.$$.fragment,e),c(te.$$.fragment,e),c(ne.$$.fragment,e),c(ie.$$.fragment,e),c(oe.$$.fragment,e),c(Me.$$.fragment,e),c(de.$$.fragment,e),c(ce.$$.fragment,e),c(Je.$$.fragment,e),c(Te.$$.fragment,e),c(be.$$.fragment,e),c(ge.$$.fragment,e),c(Ie.$$.fragment,e),c(_e.$$.fragment,e),c(Ge.$$.fragment,e),c(Be.$$.fragment,e),c(Re.$$.fragment,e),c(Ce.$$.fragment,e),c(qe.$$.fragment,e),c(Ee.$$.fragment,e),c(Le.$$.fragment,e),c(Fe.$$.fragment,e),c(Se.$$.fragment,e),c(E.$$.fragment,e),c(Qe.$$.fragment,e),c(De.$$.fragment,e),c(Pe.$$.fragment,e),c(Oe.$$.fragment,e),c(ll.$$.fragment,e),c(tl.$$.fragment,e),c(al.$$.fragment,e),c(nl.$$.fragment,e),c(pl.$$.fragment,e),c(ol.$$.fragment,e),c(Ml.$$.fragment,e),c(dl.$$.fragment,e),c(ul.$$.fragment,e),c(cl.$$.fragment,e),c(fl.$$.fragment,e),c(wl.$$.fragment,e),c(yl.$$.fragment,e),c(Tl.$$.fragment,e),c(Ul.$$.fragment,e),Is=!0)},o(e){h(o.$$.fragment,e),h(b.$$.fragment,e),h(k.$$.fragment,e),h(z.$$.fragment,e),h(Q.$$.fragment,e),h(D.$$.fragment,e),h(K.$$.fragment,e),h(ee.$$.fragment,e),h(B.$$.fragment,e),h(te.$$.fragment,e),h(ne.$$.fragment,e),h(ie.$$.fragment,e),h(oe.$$.fragment,e),h(Me.$$.fragment,e),h(de.$$.fragment,e),h(ce.$$.fragment,e),h(Je.$$.fragment,e),h(Te.$$.fragment,e),h(be.$$.fragment,e),h(ge.$$.fragment,e),h(Ie.$$.fragment,e),h(_e.$$.fragment,e),h(Ge.$$.fragment,e),h(Be.$$.fragment,e),h(Re.$$.fragment,e),h(Ce.$$.fragment,e),h(qe.$$.fragment,e),h(Ee.$$.fragment,e),h(Le.$$.fragment,e),h(Fe.$$.fragment,e),h(Se.$$.fragment,e),h(E.$$.fragment,e),h(Qe.$$.fragment,e),h(De.$$.fragment,e),h(Pe.$$.fragment,e),h(Oe.$$.fragment,e),h(ll.$$.fragment,e),h(tl.$$.fragment,e),h(al.$$.fragment,e),h(nl.$$.fragment,e),h(pl.$$.fragment,e),h(ol.$$.fragment,e),h(Ml.$$.fragment,e),h(dl.$$.fragment,e),h(ul.$$.fragment,e),h(cl.$$.fragment,e),h(fl.$$.fragment,e),h(wl.$$.fragment,e),h(yl.$$.fragment,e),h(Tl.$$.fragment,e),h(Ul.$$.fragment,e),Is=!1},d(e){e&&(t(y),t(p),t(T),t(J),t(I),t(g),t(Gl),t(x),t(kl),t(Bl),t(F),t(Rl),t(Y),t(Vl),t(S),t(Cl),t(H),t(vl),t(ql),t(Al),t(N),t(Xl),t(El),t(P),t(Ll),t(xl),t(O),t(Fl),t(Yl),t(le),t(Sl),t(Hl),t(zl),t(se),t(Ql),t(ae),t(Nl),t(Dl),t(Pl),t(pe),t(Kl),t(Ol),t(R),t(et),t(re),t(lt),t(tt),t(st),t(me),t(at),t(V),t(nt),t(ue),t(it),t(pt),t(C),t(ot),t(he),t(rt),t(fe),t(Mt),t(we),t(dt),t(mt),t(ye),t(ut),t(ct),t(je),t(ht),t(v),t(ft),t(wt),t(q),t(Jt),t(yt),t(A),t(Tt),t(Ue),t(jt),t(Ze),t(bt),t(gt),t(We),t(Ut),t(Zt),t($e),t(It),t(Wt),t(ke),t(_t),t($t),t($),t(Gt),t(Ve),t(kt),t(Bt),t(ve),t(Rt),t(Vt),t(Ae),t(Ct),t(Xe),t(vt),t(qt),t(X),t(At),t(Xt),t(xe),t(Et),t(Lt),t(Ye),t(xt),t(Ft),t(He),t(Yt),t(St),t(ze),t(Ht),t(zt),t(Ne),t(Qt),t(Nt),t(L),t(Dt),t(Pt),t(Ke),t(Kt),t(Ot),t(el),t(es),t(ls),t(ts),t(sl),t(ss),t(as),t(ns),t(il),t(is),t(ps),t(os),t(rl),t(rs),t(Ms),t(ds),t(ml),t(ms),t(us),t(cs),t(hl),t(hs),t(fs),t(ws),t(Jl),t(Js),t(ys),t(Ts),t(jl),t(js),t(_),t(bs),t(bl),t(gs),t(gl),t(Us),t(Zs),t($l)),t(i),f(o,e),f(b,e),f(k,e),f(z,e),f(Q,e),f(D,e),f(K,e),f(ee,e),f(B,e),f(te,e),f(ne,e),f(ie,e),f(oe,e),f(Me,e),f(de,e),f(ce,e),f(Je,e),f(Te,e),f(be,e),f(ge,e),f(Ie,e),f(_e,e),f(Ge,e),f(Be,e),f(Re),f(Ce,e),f(qe,e),f(Ee,e),f(Le,e),f(Fe,e),f(Se,e),f(E,e),f(Qe,e),f(De,e),f(Pe,e),f(Oe,e),f(ll,e),f(tl,e),f(al,e),f(nl,e),f(pl,e),f(ol,e),f(Ml,e),f(dl,e),f(ul,e),f(cl,e),f(fl,e),f(wl,e),f(yl,e),f(Tl,e),f(Ul,e)}}}const Ka='{"title":"LoRA","local":"lora","sections":[{"title":"torch.compile","local":"torchcompile","sections":[],"depth":2},{"title":"Weight scale","local":"weight-scale","sections":[{"title":"Scale scheduling","local":"scale-scheduling","sections":[],"depth":3}],"depth":2},{"title":"Hotswapping","local":"hotswapping","sections":[{"title":"Compiled models","local":"compiled-models","sections":[],"depth":3}],"depth":2},{"title":"Merge","local":"merge","sections":[{"title":"set_adapters","local":"setadapters","sections":[],"depth":3},{"title":"add_weighted_adapter","local":"addweightedadapter","sections":[],"depth":3},{"title":"fuse_lora","local":"fuselora","sections":[],"depth":3}],"depth":2},{"title":"Manage","local":"manage","sections":[{"title":"set_adapters","local":"setadapters","sections":[],"depth":3},{"title":"save_lora_adapter","local":"saveloraadapter","sections":[],"depth":3},{"title":"unload_lora_weights","local":"unloadloraweights","sections":[],"depth":3},{"title":"disable_lora","local":"disablelora","sections":[],"depth":3},{"title":"get_active_adapters","local":"getactiveadapters","sections":[],"depth":3},{"title":"get_list_adapters","local":"getlistadapters","sections":[],"depth":3},{"title":"delete_adapters","local":"deleteadapters","sections":[],"depth":3}],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2}],"depth":1}';function Oa(U){return va(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class pn extends qa{constructor(i){super(),Aa(this,i,Oa,Pa,Va,{})}}export{pn as component};
