import{s as Ta,f as ja,o as ba,n as I}from"../chunks/scheduler.8c3d61f6.js";import{S as ga,i as Ua,g as w,s as i,r as M,A as Za,h as J,f as s,c as p,j as wt,u as m,x as T,k as G,y as $a,a as t,v as d,d as u,t as c,w as f}from"../chunks/index.da70eac4.js";import{T as jl}from"../chunks/Tip.1d9b8c37.js";import{C as g}from"../chunks/CodeBlock.a9c4becf.js";import{H as Z,E as Ia}from"../chunks/getInferenceSnippets.86beaec3.js";import{H as Jt,a as bl}from"../chunks/HfOption.6ab18950.js";function _a(b){let a,h;return a=new g({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(){M(a.$$.fragment)},l(n){m(a.$$.fragment,n)},m(n,y){d(a,n,y),h=!0},p:I,i(n){h||(u(a.$$.fragment,n),h=!0)},o(n){c(a.$$.fragment,n),h=!1},d(n){f(a,n)}}}function Wa(b){let a,h;return a=new g({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(){M(a.$$.fragment)},l(n){m(a.$$.fragment,n)},m(n,y){d(a,n,y),h=!0},p:I,i(n){h||(u(a.$$.fragment,n),h=!0)},o(n){c(a.$$.fragment,n),h=!1},d(n){f(a,n)}}}function Ga(b){let a,h,n,y;return a=new bl({props:{id:"usage",option:"text-to-image",$$slots:{default:[_a]},$$scope:{ctx:b}}}),n=new bl({props:{id:"usage",option:"text-to-video",$$slots:{default:[Wa]},$$scope:{ctx:b}}}),{c(){M(a.$$.fragment),h=i(),M(n.$$.fragment)},l(o){m(a.$$.fragment,o),h=p(o),m(n.$$.fragment,o)},m(o,r){d(a,o,r),t(o,h,r),d(n,o,r),y=!0},p(o,r){const U={};r&2&&(U.$$scope={dirty:r,ctx:o}),a.$set(U);const j={};r&2&&(j.$$scope={dirty:r,ctx:o}),n.$set(j)},i(o){y||(u(a.$$.fragment,o),u(n.$$.fragment,o),y=!0)},o(o){c(a.$$.fragment,o),c(n.$$.fragment,o),y=!1},d(o){o&&s(h),f(a,o),f(n,o)}}}function ka(b){let a,h="For simple use cases, you can pass <code>cross_attention_kwargs={&quot;scale&quot;: 1.0}</code> to the pipeline.",n,y,o;return y=new g({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(){a=w("p"),a.innerHTML=h,n=i(),M(y.$$.fragment)},l(r){a=J(r,"P",{"data-svelte-h":!0}),T(a)!=="svelte-190bybd"&&(a.innerHTML=h),n=p(r),m(y.$$.fragment,r)},m(r,U){t(r,a,U),t(r,n,U),d(y,r,U),o=!0},p:I,i(r){o||(u(y.$$.fragment,r),o=!0)},o(r){c(y.$$.fragment,r),o=!1},d(r){r&&(s(a),s(n)),f(y,r)}}}function Ba(b){let a,h='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>.';return{c(){a=w("p"),a.innerHTML=h},l(n){a=J(n,"P",{"data-svelte-h":!0}),T(a)!=="svelte-83s57e"&&(a.innerHTML=h)},m(n,y){t(n,a,y)},p:I,d(n){n&&s(a)}}}function Ra(b){let a,h,n,y="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.",o,r,U;return a=new jl({props:{warning:!0,$$slots:{default:[Ba]},$$scope:{ctx:b}}}),r=new g({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(){M(a.$$.fragment),h=i(),n=w("p"),n.innerHTML=y,o=i(),M(r.$$.fragment)},l(j){m(a.$$.fragment,j),h=p(j),n=J(j,"P",{"data-svelte-h":!0}),T(n)!=="svelte-1gwev2i"&&(n.innerHTML=y),o=p(j),m(r.$$.fragment,j)},m(j,$){d(a,j,$),t(j,h,$),t(j,n,$),t(j,o,$),d(r,j,$),U=!0},p(j,$){const _={};$&2&&(_.$$scope={dirty:$,ctx:j}),a.$set(_)},i(j){U||(u(a.$$.fragment,j),u(r.$$.fragment,j),U=!0)},o(j){c(a.$$.fragment,j),c(r.$$.fragment,j),U=!1},d(j){j&&(s(h),s(n),s(o)),f(a,j),f(r,j)}}}function Va(b){let a,h,n,y;return a=new bl({props:{id:"weight-scale",option:"simple use case",$$slots:{default:[ka]},$$scope:{ctx:b}}}),n=new bl({props:{id:"weight-scale",option:"finer control",$$slots:{default:[Ra]},$$scope:{ctx:b}}}),{c(){M(a.$$.fragment),h=i(),M(n.$$.fragment)},l(o){m(a.$$.fragment,o),h=p(o),m(n.$$.fragment,o)},m(o,r){d(a,o,r),t(o,h,r),d(n,o,r),y=!0},p(o,r){const U={};r&2&&(U.$$scope={dirty:r,ctx:o}),a.$set(U);const j={};r&2&&(j.$$scope={dirty:r,ctx:o}),n.$set(j)},i(o){y||(u(a.$$.fragment,o),u(n.$$.fragment,o),y=!0)},o(o){c(a.$$.fragment,o),c(n.$$.fragment,o),y=!1},d(o){o&&s(h),f(a,o),f(n,o)}}}function Ca(b){let a,h="Hotswapping is unsupported for LoRAs that target the text encoder.";return{c(){a=w("p"),a.textContent=h},l(n){a=J(n,"P",{"data-svelte-h":!0}),T(a)!=="svelte-vi6xdl"&&(a.textContent=h)},m(n,y){t(n,a,y)},p:I,d(n){n&&s(a)}}}function va(b){let a,h='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.';return{c(){a=w("p"),a.innerHTML=h},l(n){a=J(n,"P",{"data-svelte-h":!0}),T(a)!=="svelte-760szu"&&(a.innerHTML=h)},m(n,y){t(n,a,y)},p:I,d(n){n&&s(a)}}}function Aa(b){let a,h='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.';return{c(){a=w("p"),a.innerHTML=h},l(n){a=J(n,"P",{"data-svelte-h":!0}),T(a)!=="svelte-1vjkmsg"&&(a.innerHTML=h)},m(n,y){t(n,a,y)},p:I,d(n){n&&s(a)}}}function qa(b){let a,h='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.';return{c(){a=w("p"),a.innerHTML=h},l(n){a=J(n,"P",{"data-svelte-h":!0}),T(a)!=="svelte-bul9pr"&&(a.innerHTML=h)},m(n,y){t(n,a,y)},p:I,d(n){n&&s(a)}}}function Xa(b){let a,h='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.';return{c(){a=w("p"),a.innerHTML=h},l(n){a=J(n,"P",{"data-svelte-h":!0}),T(a)!=="svelte-1p11i4r"&&(a.innerHTML=h)},m(n,y){t(n,a,y)},p:I,d(n){n&&s(a)}}}function Ea(b){let a,h="You can save and reuse the <code>ikea_peft_model</code> by pushing it to the Hub as shown below.",n,y,o;return y=new g({props:{code:"aWtlYV9wZWZ0X21vZGVsLnB1c2hfdG9faHViKCUyMmlrZWFfcGVmdF9tb2RlbCUyMiUyQyUyMHRva2VuJTNEVE9LRU4p",highlighted:'ikea_peft_model.push_to_hub(<span class="hljs-string">&quot;ikea_peft_model&quot;</span>, token=TOKEN)',wrap:!1}}),{c(){a=w("p"),a.innerHTML=h,n=i(),M(y.$$.fragment)},l(r){a=J(r,"P",{"data-svelte-h":!0}),T(a)!=="svelte-odteom"&&(a.innerHTML=h),n=p(r),m(y.$$.fragment,r)},m(r,U){t(r,a,U),t(r,n,U),d(y,r,U),o=!0},p:I,i(r){o||(u(y.$$.fragment,r),o=!0)},o(r){c(y.$$.fragment,r),o=!1},d(r){r&&(s(a),s(n)),f(y,r)}}}function Fa(b){let a,h;return a=new g({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(){M(a.$$.fragment)},l(n){m(a.$$.fragment,n)},m(n,y){d(a,n,y),h=!0},p:I,i(n){h||(u(a.$$.fragment,n),h=!0)},o(n){c(a.$$.fragment,n),h=!1},d(n){f(a,n)}}}function xa(b){let a,h;return a=new g({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(){M(a.$$.fragment)},l(n){m(a.$$.fragment,n)},m(n,y){d(a,n,y),h=!0},p:I,i(n){h||(u(a.$$.fragment,n),h=!0)},o(n){c(a.$$.fragment,n),h=!1},d(n){f(a,n)}}}function La(b){let a,h,n,y;return a=new bl({props:{id:"save",option:"save locally",$$slots:{default:[Fa]},$$scope:{ctx:b}}}),n=new bl({props:{id:"save",option:"save to Hub",$$slots:{default:[xa]},$$scope:{ctx:b}}}),{c(){M(a.$$.fragment),h=i(),M(n.$$.fragment)},l(o){m(a.$$.fragment,o),h=p(o),m(n.$$.fragment,o)},m(o,r){d(a,o,r),t(o,h,r),d(n,o,r),y=!0},p(o,r){const U={};r&2&&(U.$$scope={dirty:r,ctx:o}),a.$set(U);const j={};r&2&&(j.$$scope={dirty:r,ctx:o}),n.$set(j)},i(o){y||(u(a.$$.fragment,o),u(n.$$.fragment,o),y=!0)},o(o){c(a.$$.fragment,o),c(n.$$.fragment,o),y=!1},d(o){o&&s(h),f(a,o),f(n,o)}}}function Ya(b){let a,h,n,y,o,r,U,j='<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.',$,_,yt='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.',Ul,k,Zl,L,Tt='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:',$l,Y,jt="<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>",Il,S,bt='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.',_l,z,gt='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.',Wl,H,Gl,Q,kl,N,Ut='<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.',Bl,D,Rl,P,Zt="Typically, the UNet is compiled because its the most compute intensive component of the pipeline.",Vl,K,Cl,O,$t='Refer to the <a href="#hotswapping">hotswapping</a> section to learn how to avoid recompilation when working with compiled models and multiple LoRAs.',vl,ee,Al,le,It="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.",ql,B,Xl,se,El,te,_t="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.",Fl,ae,Wt='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.',xl,ne,Ll,ie,Yl,pe,Gt='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.',Sl,oe,zl,R,Hl,re,kt='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).',Ql,Me,Nl,me,Dl,de,Bt='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.',Pl,V,Kl,ue,Rt='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.',Ol,ce,es,C,ls,fe,Vt='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.',ss,he,ts,we,Ct="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).",as,Je,ns,ye,vt='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.',is,v,ps,Te,os,A,At='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/lora_merge_set_adapters.png"/>',rs,je,Ms,q,ms,be,qt='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.',ds,ge,Xt="Make sure the latest stable version of Diffusers and PEFT is installed.",us,Ue,cs,Ze,Et="Load a UNET that corresponds to the LoRA UNet.",fs,$e,hs,Ie,Ft="Load a pipeline, pass the UNet to it, and load a LoRA.",ws,_e,Js,We,xt="Create a <code>~peft.PeftModel</code> from the LoRA checkpoint by combining the first UNet you loaded and the LoRA UNet from the pipeline.",ys,Ge,Ts,X,js,ke,Lt="Repeat this process and create a <code>~peft.PeftModel</code> for the second LoRA.",bs,Be,gs,Re,Yt="Load a base UNet model and load the adapters.",Us,Ve,Zs,Ce,St='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>.',$s,ve,zt='Activate the merged LoRAs with <a href="/docs/diffusers/main/en/api/loaders/peft#diffusers.loaders.PeftAdapterMixin.set_adapters">set_adapters()</a>.',Is,Ae,_s,E,Ht='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/ikea-feng-dare-linear.png"/>',Ws,qe,Gs,Xe,Qt='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.',ks,Ee,Bs,Fe,Nt='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.',Rs,xe,Vs,Le,Dt='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.',Cs,F,vs,Ye,Pt="The fused pipeline can now be quickly loaded for inference without requiring each LoRA to be separately loaded.",As,Se,qs,ze,Kt="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.",Xs,He,Es,x,Ot='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/fuse_lora.png"/>',Fs,Qe,xs,Ne,ea="Diffusers provides several methods to help you manage working with LoRAs. These methods can be especially useful if you’re working with multiple LoRAs.",Ls,De,Ys,Pe,la='<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.',Ss,Ke,zs,Oe,Hs,el,sa='Save an adapter with <a href="/docs/diffusers/main/en/api/loaders/peft#diffusers.loaders.PeftAdapterMixin.save_lora_adapter">save_lora_adapter()</a>.',Qs,ll,Ns,sl,Ds,tl,ta='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.',Ps,al,Ks,nl,Os,il,aa='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.',et,pl,lt,ol,st,rl,na='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.',tt,Ml,at,ml,nt,dl,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.',it,ul,pt,cl,ot,fl,pa='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.',rt,hl,Mt,wl,mt,Jl,oa='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.',dt,W,ra,ut,yl,Ma='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.',ct,Tl,ft,gl,ht;return o=new Z({props:{title:"LoRA",local:"lora",headingTag:"h1"}}),k=new Jt({props:{id:"usage",options:["text-to-image","text-to-video"],$$slots:{default:[Ga]},$$scope:{ctx:b}}}),H=new g({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZSUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lLnVuZXQubG9hZF9sb3JhX2FkYXB0ZXIoJTBBJTIwJTIwJTIwJTIwJTIyamJpbGNrZS1oZiUyRnNkeGwtY2luZW1hdGljLTElMjIlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfbmFtZSUzRCUyMnB5dG9yY2hfbG9yYV93ZWlnaHRzLnNhZmV0ZW5zb3JzJTIyJTJDJTBBJTIwJTIwJTIwJTIwYWRhcHRlcl9uYW1lJTNEJTIyY2luZW1hdGljJTIyJTBBJTIwJTIwJTIwJTIwcHJlZml4JTNEJTIydW5ldCUyMiUwQSklMEElMjMlMjB1c2UlMjBjbm10JTIwaW4lMjB0aGUlMjBwcm9tcHQlMjB0byUyMHRyaWdnZXIlMjB0aGUlMjBMb1JBJTBBcGlwZWxpbmUoJTIyQSUyMGN1dGUlMjBjbm10JTIwZWF0aW5nJTIwYSUyMHNsaWNlJTIwb2YlMjBwaXp6YSUyQyUyMHN0dW5uaW5nJTIwY29sb3IlMjBzY2hlbWUlMkMlMjBtYXN0ZXJwaWVjZSUyQyUyMGlsbHVzdHJhdGlvbiUyMikuaW1hZ2VzJTVCMCU1RA==",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 g({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 g({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 Jt({props:{id:"weight-scale",options:["simple use case","finer control"],$$slots:{default:[Va]},$$scope:{ctx:b}}}),se=new Z({props:{title:"Scale scheduling",local:"scale-scheduling",headingTag:"h3"}}),ne=new g({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 g({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}}),R=new jl({props:{warning:!0,$$slots:{default:[Ca]},$$scope:{ctx:b}}}),Me=new g({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}}),me=new Z({props:{title:"Compiled models",local:"compiled-models",headingTag:"h3"}}),V=new jl({props:{warning:!1,$$slots:{default:[va]},$$scope:{ctx:b}}}),ce=new g({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}}),C=new jl({props:{warning:!1,$$slots:{default:[Aa]},$$scope:{ctx:b}}}),he=new Z({props:{title:"Merge",local:"merge",headingTag:"h2"}}),Je=new Z({props:{title:"set_adapters",local:"setadapters",headingTag:"h3"}}),v=new jl({props:{warning:!1,$$slots:{default:[qa]},$$scope:{ctx:b}}}),Te=new g({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}}),je=new Z({props:{title:"add_weighted_adapter",local:"addweightedadapter",headingTag:"h3"}}),q=new jl({props:{warning:!1,$$slots:{default:[Xa]},$$scope:{ctx:b}}}),Ue=new g({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1VJTIwLXElMjBkaWZmdXNlcnMlMjBwZWZ0",highlighted:"pip install -U -q diffusers peft",wrap:!1}}),$e=new g({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}}),_e=new g({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}}),Ge=new g({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}}),X=new jl({props:{warning:!1,$$slots:{default:[Ea]},$$scope:{ctx:b}}}),Be=new g({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}}),Ve=new g({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}}),Ae=new g({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}}),qe=new Z({props:{title:"fuse_lora",local:"fuselora",headingTag:"h3"}}),Ee=new g({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}}),xe=new g({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}}),F=new Jt({props:{id:"save",options:["save locally","save to Hub"],$$slots:{default:[La]},$$scope:{ctx:b}}}),Se=new g({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}}),He=new g({props:{code:"cGlwZWxpbmUudW5mdXNlX2xvcmEoKQ==",highlighted:"pipeline.unfuse_lora()",wrap:!1}}),Qe=new Z({props:{title:"Manage",local:"manage",headingTag:"h2"}}),De=new Z({props:{title:"set_adapters",local:"setadapters",headingTag:"h3"}}),Ke=new g({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}}),Oe=new Z({props:{title:"save_lora_adapter",local:"saveloraadapter",headingTag:"h3"}}),ll=new g({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}}),sl=new Z({props:{title:"unload_lora_weights",local:"unloadloraweights",headingTag:"h3"}}),al=new g({props:{code:"cGlwZWxpbmUudW5sb2FkX2xvcmFfd2VpZ2h0cygp",highlighted:"pipeline.unload_lora_weights()",wrap:!1}}),nl=new Z({props:{title:"disable_lora",local:"disablelora",headingTag:"h3"}}),pl=new g({props:{code:"cGlwZWxpbmUuZGlzYWJsZV9sb3JhKCk=",highlighted:"pipeline.disable_lora()",wrap:!1}}),ol=new Z({props:{title:"get_active_adapters",local:"getactiveadapters",headingTag:"h3"}}),Ml=new g({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}}),ml=new Z({props:{title:"get_list_adapters",local:"getlistadapters",headingTag:"h3"}}),ul=new g({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}}),cl=new Z({props:{title:"delete_adapters",local:"deleteadapters",headingTag:"h3"}}),hl=new g({props:{code:"cGlwZWxpbmUuZGVsZXRlX2FkYXB0ZXJzKCUyMmlrZWElMjIp",highlighted:'pipeline.delete_adapters(<span class="hljs-string">&quot;ikea&quot;</span>)',wrap:!1}}),wl=new Z({props:{title:"Resources",local:"resources",headingTag:"h2"}}),Tl=new Ia({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/tutorials/using_peft_for_inference.md"}}),{c(){a=w("meta"),h=i(),n=w("p"),y=i(),M(o.$$.fragment),r=i(),U=w("p"),U.innerHTML=j,$=i(),_=w("p"),_.innerHTML=yt,Ul=i(),M(k.$$.fragment),Zl=i(),L=w("p"),L.innerHTML=Tt,$l=i(),Y=w("ul"),Y.innerHTML=jt,Il=i(),S=w("p"),S.innerHTML=bt,_l=i(),z=w("p"),z.innerHTML=gt,Wl=i(),M(H.$$.fragment),Gl=i(),M(Q.$$.fragment),kl=i(),N=w("p"),N.innerHTML=Ut,Bl=i(),M(D.$$.fragment),Rl=i(),P=w("p"),P.textContent=Zt,Vl=i(),M(K.$$.fragment),Cl=i(),O=w("p"),O.innerHTML=$t,vl=i(),M(ee.$$.fragment),Al=i(),le=w("p"),le.innerHTML=It,ql=i(),M(B.$$.fragment),Xl=i(),M(se.$$.fragment),El=i(),te=w("p"),te.textContent=_t,Fl=i(),ae=w("p"),ae.innerHTML=Wt,xl=i(),M(ne.$$.fragment),Ll=i(),M(ie.$$.fragment),Yl=i(),pe=w("p"),pe.innerHTML=Gt,Sl=i(),M(oe.$$.fragment),zl=i(),M(R.$$.fragment),Hl=i(),re=w("p"),re.innerHTML=kt,Ql=i(),M(Me.$$.fragment),Nl=i(),M(me.$$.fragment),Dl=i(),de=w("p"),de.innerHTML=Bt,Pl=i(),M(V.$$.fragment),Kl=i(),ue=w("p"),ue.innerHTML=Rt,Ol=i(),M(ce.$$.fragment),es=i(),M(C.$$.fragment),ls=i(),fe=w("p"),fe.innerHTML=Vt,ss=i(),M(he.$$.fragment),ts=i(),we=w("p"),we.innerHTML=Ct,as=i(),M(Je.$$.fragment),ns=i(),ye=w("p"),ye.innerHTML=vt,is=i(),M(v.$$.fragment),ps=i(),M(Te.$$.fragment),os=i(),A=w("div"),A.innerHTML=At,rs=i(),M(je.$$.fragment),Ms=i(),M(q.$$.fragment),ms=i(),be=w("p"),be.innerHTML=qt,ds=i(),ge=w("p"),ge.textContent=Xt,us=i(),M(Ue.$$.fragment),cs=i(),Ze=w("p"),Ze.textContent=Et,fs=i(),M($e.$$.fragment),hs=i(),Ie=w("p"),Ie.textContent=Ft,ws=i(),M(_e.$$.fragment),Js=i(),We=w("p"),We.innerHTML=xt,ys=i(),M(Ge.$$.fragment),Ts=i(),M(X.$$.fragment),js=i(),ke=w("p"),ke.innerHTML=Lt,bs=i(),M(Be.$$.fragment),gs=i(),Re=w("p"),Re.textContent=Yt,Us=i(),M(Ve.$$.fragment),Zs=i(),Ce=w("p"),Ce.innerHTML=St,$s=i(),ve=w("p"),ve.innerHTML=zt,Is=i(),M(Ae.$$.fragment),_s=i(),E=w("div"),E.innerHTML=Ht,Ws=i(),M(qe.$$.fragment),Gs=i(),Xe=w("p"),Xe.innerHTML=Qt,ks=i(),M(Ee.$$.fragment),Bs=i(),Fe=w("p"),Fe.innerHTML=Nt,Rs=i(),M(xe.$$.fragment),Vs=i(),Le=w("p"),Le.innerHTML=Dt,Cs=i(),M(F.$$.fragment),vs=i(),Ye=w("p"),Ye.textContent=Pt,As=i(),M(Se.$$.fragment),qs=i(),ze=w("p"),ze.innerHTML=Kt,Xs=i(),M(He.$$.fragment),Es=i(),x=w("div"),x.innerHTML=Ot,Fs=i(),M(Qe.$$.fragment),xs=i(),Ne=w("p"),Ne.textContent=ea,Ls=i(),M(De.$$.fragment),Ys=i(),Pe=w("p"),Pe.innerHTML=la,Ss=i(),M(Ke.$$.fragment),zs=i(),M(Oe.$$.fragment),Hs=i(),el=w("p"),el.innerHTML=sa,Qs=i(),M(ll.$$.fragment),Ns=i(),M(sl.$$.fragment),Ds=i(),tl=w("p"),tl.innerHTML=ta,Ps=i(),M(al.$$.fragment),Ks=i(),M(nl.$$.fragment),Os=i(),il=w("p"),il.innerHTML=aa,et=i(),M(pl.$$.fragment),lt=i(),M(ol.$$.fragment),st=i(),rl=w("p"),rl.innerHTML=na,tt=i(),M(Ml.$$.fragment),at=i(),M(ml.$$.fragment),nt=i(),dl=w("p"),dl.innerHTML=ia,it=i(),M(ul.$$.fragment),pt=i(),M(cl.$$.fragment),ot=i(),fl=w("p"),fl.innerHTML=pa,rt=i(),M(hl.$$.fragment),Mt=i(),M(wl.$$.fragment),mt=i(),Jl=w("p"),Jl.innerHTML=oa,dt=i(),W=w("iframe"),ut=i(),yl=w("p"),yl.innerHTML=Ma,ct=i(),M(Tl.$$.fragment),ft=i(),gl=w("p"),this.h()},l(e){const l=Za("svelte-u9bgzb",document.head);a=J(l,"META",{name:!0,content:!0}),l.forEach(s),h=p(e),n=J(e,"P",{}),wt(n).forEach(s),y=p(e),m(o.$$.fragment,e),r=p(e),U=J(e,"P",{"data-svelte-h":!0}),T(U)!=="svelte-1gj8vby"&&(U.innerHTML=j),$=p(e),_=J(e,"P",{"data-svelte-h":!0}),T(_)!=="svelte-kdtvgq"&&(_.innerHTML=yt),Ul=p(e),m(k.$$.fragment,e),Zl=p(e),L=J(e,"P",{"data-svelte-h":!0}),T(L)!=="svelte-1kkl0lk"&&(L.innerHTML=Tt),$l=p(e),Y=J(e,"UL",{"data-svelte-h":!0}),T(Y)!=="svelte-1kdz0wg"&&(Y.innerHTML=jt),Il=p(e),S=J(e,"P",{"data-svelte-h":!0}),T(S)!=="svelte-1u2w295"&&(S.innerHTML=bt),_l=p(e),z=J(e,"P",{"data-svelte-h":!0}),T(z)!=="svelte-1ryv6ll"&&(z.innerHTML=gt),Wl=p(e),m(H.$$.fragment,e),Gl=p(e),m(Q.$$.fragment,e),kl=p(e),N=J(e,"P",{"data-svelte-h":!0}),T(N)!=="svelte-k3ae2b"&&(N.innerHTML=Ut),Bl=p(e),m(D.$$.fragment,e),Rl=p(e),P=J(e,"P",{"data-svelte-h":!0}),T(P)!=="svelte-1bxdxvu"&&(P.textContent=Zt),Vl=p(e),m(K.$$.fragment,e),Cl=p(e),O=J(e,"P",{"data-svelte-h":!0}),T(O)!=="svelte-1con55w"&&(O.innerHTML=$t),vl=p(e),m(ee.$$.fragment,e),Al=p(e),le=J(e,"P",{"data-svelte-h":!0}),T(le)!=="svelte-1rhjdt1"&&(le.innerHTML=It),ql=p(e),m(B.$$.fragment,e),Xl=p(e),m(se.$$.fragment,e),El=p(e),te=J(e,"P",{"data-svelte-h":!0}),T(te)!=="svelte-1a0w4u0"&&(te.textContent=_t),Fl=p(e),ae=J(e,"P",{"data-svelte-h":!0}),T(ae)!=="svelte-x7hl2g"&&(ae.innerHTML=Wt),xl=p(e),m(ne.$$.fragment,e),Ll=p(e),m(ie.$$.fragment,e),Yl=p(e),pe=J(e,"P",{"data-svelte-h":!0}),T(pe)!=="svelte-uywnza"&&(pe.innerHTML=Gt),Sl=p(e),m(oe.$$.fragment,e),zl=p(e),m(R.$$.fragment,e),Hl=p(e),re=J(e,"P",{"data-svelte-h":!0}),T(re)!=="svelte-1ecua0e"&&(re.innerHTML=kt),Ql=p(e),m(Me.$$.fragment,e),Nl=p(e),m(me.$$.fragment,e),Dl=p(e),de=J(e,"P",{"data-svelte-h":!0}),T(de)!=="svelte-110ub4a"&&(de.innerHTML=Bt),Pl=p(e),m(V.$$.fragment,e),Kl=p(e),ue=J(e,"P",{"data-svelte-h":!0}),T(ue)!=="svelte-18chx34"&&(ue.innerHTML=Rt),Ol=p(e),m(ce.$$.fragment,e),es=p(e),m(C.$$.fragment,e),ls=p(e),fe=J(e,"P",{"data-svelte-h":!0}),T(fe)!=="svelte-ggb744"&&(fe.innerHTML=Vt),ss=p(e),m(he.$$.fragment,e),ts=p(e),we=J(e,"P",{"data-svelte-h":!0}),T(we)!=="svelte-10rq47h"&&(we.innerHTML=Ct),as=p(e),m(Je.$$.fragment,e),ns=p(e),ye=J(e,"P",{"data-svelte-h":!0}),T(ye)!=="svelte-1ihzjzr"&&(ye.innerHTML=vt),is=p(e),m(v.$$.fragment,e),ps=p(e),m(Te.$$.fragment,e),os=p(e),A=J(e,"DIV",{class:!0,"data-svelte-h":!0}),T(A)!=="svelte-rp1f80"&&(A.innerHTML=At),rs=p(e),m(je.$$.fragment,e),Ms=p(e),m(q.$$.fragment,e),ms=p(e),be=J(e,"P",{"data-svelte-h":!0}),T(be)!=="svelte-8091mm"&&(be.innerHTML=qt),ds=p(e),ge=J(e,"P",{"data-svelte-h":!0}),T(ge)!=="svelte-1nseei8"&&(ge.textContent=Xt),us=p(e),m(Ue.$$.fragment,e),cs=p(e),Ze=J(e,"P",{"data-svelte-h":!0}),T(Ze)!=="svelte-bdkl20"&&(Ze.textContent=Et),fs=p(e),m($e.$$.fragment,e),hs=p(e),Ie=J(e,"P",{"data-svelte-h":!0}),T(Ie)!=="svelte-9gm80r"&&(Ie.textContent=Ft),ws=p(e),m(_e.$$.fragment,e),Js=p(e),We=J(e,"P",{"data-svelte-h":!0}),T(We)!=="svelte-tujdh1"&&(We.innerHTML=xt),ys=p(e),m(Ge.$$.fragment,e),Ts=p(e),m(X.$$.fragment,e),js=p(e),ke=J(e,"P",{"data-svelte-h":!0}),T(ke)!=="svelte-s05kyc"&&(ke.innerHTML=Lt),bs=p(e),m(Be.$$.fragment,e),gs=p(e),Re=J(e,"P",{"data-svelte-h":!0}),T(Re)!=="svelte-4qxxrf"&&(Re.textContent=Yt),Us=p(e),m(Ve.$$.fragment,e),Zs=p(e),Ce=J(e,"P",{"data-svelte-h":!0}),T(Ce)!=="svelte-1my1cqt"&&(Ce.innerHTML=St),$s=p(e),ve=J(e,"P",{"data-svelte-h":!0}),T(ve)!=="svelte-1tmnflg"&&(ve.innerHTML=zt),Is=p(e),m(Ae.$$.fragment,e),_s=p(e),E=J(e,"DIV",{class:!0,"data-svelte-h":!0}),T(E)!=="svelte-o7lfk9"&&(E.innerHTML=Ht),Ws=p(e),m(qe.$$.fragment,e),Gs=p(e),Xe=J(e,"P",{"data-svelte-h":!0}),T(Xe)!=="svelte-rr1kg"&&(Xe.innerHTML=Qt),ks=p(e),m(Ee.$$.fragment,e),Bs=p(e),Fe=J(e,"P",{"data-svelte-h":!0}),T(Fe)!=="svelte-hlsd8u"&&(Fe.innerHTML=Nt),Rs=p(e),m(xe.$$.fragment,e),Vs=p(e),Le=J(e,"P",{"data-svelte-h":!0}),T(Le)!=="svelte-tdu9sv"&&(Le.innerHTML=Dt),Cs=p(e),m(F.$$.fragment,e),vs=p(e),Ye=J(e,"P",{"data-svelte-h":!0}),T(Ye)!=="svelte-13ek29m"&&(Ye.textContent=Pt),As=p(e),m(Se.$$.fragment,e),qs=p(e),ze=J(e,"P",{"data-svelte-h":!0}),T(ze)!=="svelte-1kdk8my"&&(ze.innerHTML=Kt),Xs=p(e),m(He.$$.fragment,e),Es=p(e),x=J(e,"DIV",{class:!0,"data-svelte-h":!0}),T(x)!=="svelte-d7vbup"&&(x.innerHTML=Ot),Fs=p(e),m(Qe.$$.fragment,e),xs=p(e),Ne=J(e,"P",{"data-svelte-h":!0}),T(Ne)!=="svelte-lfexew"&&(Ne.textContent=ea),Ls=p(e),m(De.$$.fragment,e),Ys=p(e),Pe=J(e,"P",{"data-svelte-h":!0}),T(Pe)!=="svelte-tmlt47"&&(Pe.innerHTML=la),Ss=p(e),m(Ke.$$.fragment,e),zs=p(e),m(Oe.$$.fragment,e),Hs=p(e),el=J(e,"P",{"data-svelte-h":!0}),T(el)!=="svelte-3etak2"&&(el.innerHTML=sa),Qs=p(e),m(ll.$$.fragment,e),Ns=p(e),m(sl.$$.fragment,e),Ds=p(e),tl=J(e,"P",{"data-svelte-h":!0}),T(tl)!=="svelte-1fejyxp"&&(tl.innerHTML=ta),Ps=p(e),m(al.$$.fragment,e),Ks=p(e),m(nl.$$.fragment,e),Os=p(e),il=J(e,"P",{"data-svelte-h":!0}),T(il)!=="svelte-12mv6li"&&(il.innerHTML=aa),et=p(e),m(pl.$$.fragment,e),lt=p(e),m(ol.$$.fragment,e),st=p(e),rl=J(e,"P",{"data-svelte-h":!0}),T(rl)!=="svelte-ojvh3n"&&(rl.innerHTML=na),tt=p(e),m(Ml.$$.fragment,e),at=p(e),m(ml.$$.fragment,e),nt=p(e),dl=J(e,"P",{"data-svelte-h":!0}),T(dl)!=="svelte-1vo1u23"&&(dl.innerHTML=ia),it=p(e),m(ul.$$.fragment,e),pt=p(e),m(cl.$$.fragment,e),ot=p(e),fl=J(e,"P",{"data-svelte-h":!0}),T(fl)!=="svelte-1lvb4fg"&&(fl.innerHTML=pa),rt=p(e),m(hl.$$.fragment,e),Mt=p(e),m(wl.$$.fragment,e),mt=p(e),Jl=J(e,"P",{"data-svelte-h":!0}),T(Jl)!=="svelte-rzdugq"&&(Jl.innerHTML=oa),dt=p(e),W=J(e,"IFRAME",{src:!0,frameborder:!0,width:!0,height:!0}),wt(W).forEach(s),ut=p(e),yl=J(e,"P",{"data-svelte-h":!0}),T(yl)!=="svelte-1u6fnk7"&&(yl.innerHTML=Ma),ct=p(e),m(Tl.$$.fragment,e),ft=p(e),gl=J(e,"P",{}),wt(gl).forEach(s),this.h()},h(){G(a,"name","hf:doc:metadata"),G(a,"content",Sa),G(A,"class","flex justify-center"),G(E,"class","flex justify-center"),G(x,"class","flex justify-center"),ja(W.src,ra="https://multimodalart-civitai-to-hf.hf.space")||G(W,"src",ra),G(W,"frameborder","0"),G(W,"width","850"),G(W,"height","450")},m(e,l){$a(document.head,a),t(e,h,l),t(e,n,l),t(e,y,l),d(o,e,l),t(e,r,l),t(e,U,l),t(e,$,l),t(e,_,l),t(e,Ul,l),d(k,e,l),t(e,Zl,l),t(e,L,l),t(e,$l,l),t(e,Y,l),t(e,Il,l),t(e,S,l),t(e,_l,l),t(e,z,l),t(e,Wl,l),d(H,e,l),t(e,Gl,l),d(Q,e,l),t(e,kl,l),t(e,N,l),t(e,Bl,l),d(D,e,l),t(e,Rl,l),t(e,P,l),t(e,Vl,l),d(K,e,l),t(e,Cl,l),t(e,O,l),t(e,vl,l),d(ee,e,l),t(e,Al,l),t(e,le,l),t(e,ql,l),d(B,e,l),t(e,Xl,l),d(se,e,l),t(e,El,l),t(e,te,l),t(e,Fl,l),t(e,ae,l),t(e,xl,l),d(ne,e,l),t(e,Ll,l),d(ie,e,l),t(e,Yl,l),t(e,pe,l),t(e,Sl,l),d(oe,e,l),t(e,zl,l),d(R,e,l),t(e,Hl,l),t(e,re,l),t(e,Ql,l),d(Me,e,l),t(e,Nl,l),d(me,e,l),t(e,Dl,l),t(e,de,l),t(e,Pl,l),d(V,e,l),t(e,Kl,l),t(e,ue,l),t(e,Ol,l),d(ce,e,l),t(e,es,l),d(C,e,l),t(e,ls,l),t(e,fe,l),t(e,ss,l),d(he,e,l),t(e,ts,l),t(e,we,l),t(e,as,l),d(Je,e,l),t(e,ns,l),t(e,ye,l),t(e,is,l),d(v,e,l),t(e,ps,l),d(Te,e,l),t(e,os,l),t(e,A,l),t(e,rs,l),d(je,e,l),t(e,Ms,l),d(q,e,l),t(e,ms,l),t(e,be,l),t(e,ds,l),t(e,ge,l),t(e,us,l),d(Ue,e,l),t(e,cs,l),t(e,Ze,l),t(e,fs,l),d($e,e,l),t(e,hs,l),t(e,Ie,l),t(e,ws,l),d(_e,e,l),t(e,Js,l),t(e,We,l),t(e,ys,l),d(Ge,e,l),t(e,Ts,l),d(X,e,l),t(e,js,l),t(e,ke,l),t(e,bs,l),d(Be,e,l),t(e,gs,l),t(e,Re,l),t(e,Us,l),d(Ve,e,l),t(e,Zs,l),t(e,Ce,l),t(e,$s,l),t(e,ve,l),t(e,Is,l),d(Ae,e,l),t(e,_s,l),t(e,E,l),t(e,Ws,l),d(qe,e,l),t(e,Gs,l),t(e,Xe,l),t(e,ks,l),d(Ee,e,l),t(e,Bs,l),t(e,Fe,l),t(e,Rs,l),d(xe,e,l),t(e,Vs,l),t(e,Le,l),t(e,Cs,l),d(F,e,l),t(e,vs,l),t(e,Ye,l),t(e,As,l),d(Se,e,l),t(e,qs,l),t(e,ze,l),t(e,Xs,l),d(He,e,l),t(e,Es,l),t(e,x,l),t(e,Fs,l),d(Qe,e,l),t(e,xs,l),t(e,Ne,l),t(e,Ls,l),d(De,e,l),t(e,Ys,l),t(e,Pe,l),t(e,Ss,l),d(Ke,e,l),t(e,zs,l),d(Oe,e,l),t(e,Hs,l),t(e,el,l),t(e,Qs,l),d(ll,e,l),t(e,Ns,l),d(sl,e,l),t(e,Ds,l),t(e,tl,l),t(e,Ps,l),d(al,e,l),t(e,Ks,l),d(nl,e,l),t(e,Os,l),t(e,il,l),t(e,et,l),d(pl,e,l),t(e,lt,l),d(ol,e,l),t(e,st,l),t(e,rl,l),t(e,tt,l),d(Ml,e,l),t(e,at,l),d(ml,e,l),t(e,nt,l),t(e,dl,l),t(e,it,l),d(ul,e,l),t(e,pt,l),d(cl,e,l),t(e,ot,l),t(e,fl,l),t(e,rt,l),d(hl,e,l),t(e,Mt,l),d(wl,e,l),t(e,mt,l),t(e,Jl,l),t(e,dt,l),t(e,W,l),t(e,ut,l),t(e,yl,l),t(e,ct,l),d(Tl,e,l),t(e,ft,l),t(e,gl,l),ht=!0},p(e,[l]){const ma={};l&2&&(ma.$$scope={dirty:l,ctx:e}),k.$set(ma);const da={};l&2&&(da.$$scope={dirty:l,ctx:e}),B.$set(da);const ua={};l&2&&(ua.$$scope={dirty:l,ctx:e}),R.$set(ua);const ca={};l&2&&(ca.$$scope={dirty:l,ctx:e}),V.$set(ca);const fa={};l&2&&(fa.$$scope={dirty:l,ctx:e}),C.$set(fa);const ha={};l&2&&(ha.$$scope={dirty:l,ctx:e}),v.$set(ha);const wa={};l&2&&(wa.$$scope={dirty:l,ctx:e}),q.$set(wa);const Ja={};l&2&&(Ja.$$scope={dirty:l,ctx:e}),X.$set(Ja);const ya={};l&2&&(ya.$$scope={dirty:l,ctx:e}),F.$set(ya)},i(e){ht||(u(o.$$.fragment,e),u(k.$$.fragment,e),u(H.$$.fragment,e),u(Q.$$.fragment,e),u(D.$$.fragment,e),u(K.$$.fragment,e),u(ee.$$.fragment,e),u(B.$$.fragment,e),u(se.$$.fragment,e),u(ne.$$.fragment,e),u(ie.$$.fragment,e),u(oe.$$.fragment,e),u(R.$$.fragment,e),u(Me.$$.fragment,e),u(me.$$.fragment,e),u(V.$$.fragment,e),u(ce.$$.fragment,e),u(C.$$.fragment,e),u(he.$$.fragment,e),u(Je.$$.fragment,e),u(v.$$.fragment,e),u(Te.$$.fragment,e),u(je.$$.fragment,e),u(q.$$.fragment,e),u(Ue.$$.fragment,e),u($e.$$.fragment,e),u(_e.$$.fragment,e),u(Ge.$$.fragment,e),u(X.$$.fragment,e),u(Be.$$.fragment,e),u(Ve.$$.fragment,e),u(Ae.$$.fragment,e),u(qe.$$.fragment,e),u(Ee.$$.fragment,e),u(xe.$$.fragment,e),u(F.$$.fragment,e),u(Se.$$.fragment,e),u(He.$$.fragment,e),u(Qe.$$.fragment,e),u(De.$$.fragment,e),u(Ke.$$.fragment,e),u(Oe.$$.fragment,e),u(ll.$$.fragment,e),u(sl.$$.fragment,e),u(al.$$.fragment,e),u(nl.$$.fragment,e),u(pl.$$.fragment,e),u(ol.$$.fragment,e),u(Ml.$$.fragment,e),u(ml.$$.fragment,e),u(ul.$$.fragment,e),u(cl.$$.fragment,e),u(hl.$$.fragment,e),u(wl.$$.fragment,e),u(Tl.$$.fragment,e),ht=!0)},o(e){c(o.$$.fragment,e),c(k.$$.fragment,e),c(H.$$.fragment,e),c(Q.$$.fragment,e),c(D.$$.fragment,e),c(K.$$.fragment,e),c(ee.$$.fragment,e),c(B.$$.fragment,e),c(se.$$.fragment,e),c(ne.$$.fragment,e),c(ie.$$.fragment,e),c(oe.$$.fragment,e),c(R.$$.fragment,e),c(Me.$$.fragment,e),c(me.$$.fragment,e),c(V.$$.fragment,e),c(ce.$$.fragment,e),c(C.$$.fragment,e),c(he.$$.fragment,e),c(Je.$$.fragment,e),c(v.$$.fragment,e),c(Te.$$.fragment,e),c(je.$$.fragment,e),c(q.$$.fragment,e),c(Ue.$$.fragment,e),c($e.$$.fragment,e),c(_e.$$.fragment,e),c(Ge.$$.fragment,e),c(X.$$.fragment,e),c(Be.$$.fragment,e),c(Ve.$$.fragment,e),c(Ae.$$.fragment,e),c(qe.$$.fragment,e),c(Ee.$$.fragment,e),c(xe.$$.fragment,e),c(F.$$.fragment,e),c(Se.$$.fragment,e),c(He.$$.fragment,e),c(Qe.$$.fragment,e),c(De.$$.fragment,e),c(Ke.$$.fragment,e),c(Oe.$$.fragment,e),c(ll.$$.fragment,e),c(sl.$$.fragment,e),c(al.$$.fragment,e),c(nl.$$.fragment,e),c(pl.$$.fragment,e),c(ol.$$.fragment,e),c(Ml.$$.fragment,e),c(ml.$$.fragment,e),c(ul.$$.fragment,e),c(cl.$$.fragment,e),c(hl.$$.fragment,e),c(wl.$$.fragment,e),c(Tl.$$.fragment,e),ht=!1},d(e){e&&(s(h),s(n),s(y),s(r),s(U),s($),s(_),s(Ul),s(Zl),s(L),s($l),s(Y),s(Il),s(S),s(_l),s(z),s(Wl),s(Gl),s(kl),s(N),s(Bl),s(Rl),s(P),s(Vl),s(Cl),s(O),s(vl),s(Al),s(le),s(ql),s(Xl),s(El),s(te),s(Fl),s(ae),s(xl),s(Ll),s(Yl),s(pe),s(Sl),s(zl),s(Hl),s(re),s(Ql),s(Nl),s(Dl),s(de),s(Pl),s(Kl),s(ue),s(Ol),s(es),s(ls),s(fe),s(ss),s(ts),s(we),s(as),s(ns),s(ye),s(is),s(ps),s(os),s(A),s(rs),s(Ms),s(ms),s(be),s(ds),s(ge),s(us),s(cs),s(Ze),s(fs),s(hs),s(Ie),s(ws),s(Js),s(We),s(ys),s(Ts),s(js),s(ke),s(bs),s(gs),s(Re),s(Us),s(Zs),s(Ce),s($s),s(ve),s(Is),s(_s),s(E),s(Ws),s(Gs),s(Xe),s(ks),s(Bs),s(Fe),s(Rs),s(Vs),s(Le),s(Cs),s(vs),s(Ye),s(As),s(qs),s(ze),s(Xs),s(Es),s(x),s(Fs),s(xs),s(Ne),s(Ls),s(Ys),s(Pe),s(Ss),s(zs),s(Hs),s(el),s(Qs),s(Ns),s(Ds),s(tl),s(Ps),s(Ks),s(Os),s(il),s(et),s(lt),s(st),s(rl),s(tt),s(at),s(nt),s(dl),s(it),s(pt),s(ot),s(fl),s(rt),s(Mt),s(mt),s(Jl),s(dt),s(W),s(ut),s(yl),s(ct),s(ft),s(gl)),s(a),f(o,e),f(k,e),f(H,e),f(Q,e),f(D,e),f(K,e),f(ee,e),f(B,e),f(se,e),f(ne,e),f(ie,e),f(oe,e),f(R,e),f(Me,e),f(me,e),f(V,e),f(ce,e),f(C,e),f(he,e),f(Je,e),f(v,e),f(Te,e),f(je,e),f(q,e),f(Ue,e),f($e,e),f(_e,e),f(Ge,e),f(X,e),f(Be,e),f(Ve,e),f(Ae,e),f(qe,e),f(Ee,e),f(xe,e),f(F,e),f(Se,e),f(He,e),f(Qe,e),f(De,e),f(Ke,e),f(Oe,e),f(ll,e),f(sl,e),f(al,e),f(nl,e),f(pl,e),f(ol,e),f(Ml,e),f(ml,e),f(ul,e),f(cl,e),f(hl,e),f(wl,e),f(Tl,e)}}}const Sa='{"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 za(b){return ba(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Oa extends ga{constructor(a){super(),Ua(this,a,za,Ya,Ta,{})}}export{Oa as component};
