import{s as Pl,o as Ol,n as rl}from"../chunks/scheduler.53228c21.js";import{S as le,i as ee,e as h,s as c,c as b,h as se,a as y,d as e,b as M,f as ql,g as f,j as w,k as pl,l as ae,m as s,n as U,t as Z,o as j,p as g}from"../chunks/index.100fac89.js";import{C as te}from"../chunks/CopyLLMTxtMenu.9360b11d.js";import{C as X}from"../chunks/CodeBlock.d30a6509.js";import{D as ne}from"../chunks/DocNotebookDropdown.1a28089c.js";import{H as nl,E as ie}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.c9001d7a.js";import{H as Kl,a as ol}from"../chunks/HfOption.fad27e59.js";function pe(I){let t,u,o,d='<img src="https://github.com/jabir-zheng/TCD/raw/main/assets/demo_image.png"/>',i;return t=new X({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uWExQaXBlbGluZSUyQyUyMFRDRFNjaGVkdWxlciUwQSUwQWRldmljZSUyMCUzRCUyMCUyMmN1ZGElMjIlMEFiYXNlX21vZGVsX2lkJTIwJTNEJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTBBdGNkX2xvcmFfaWQlMjAlM0QlMjAlMjJoMXQlMkZUQ0QtU0RYTC1Mb1JBJTIyJTBBJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblhMUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKGJhc2VfbW9kZWxfaWQlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMikudG8oZGV2aWNlKSUwQXBpcGUuc2NoZWR1bGVyJTIwJTNEJTIwVENEU2NoZWR1bGVyLmZyb21fY29uZmlnKHBpcGUuc2NoZWR1bGVyLmNvbmZpZyklMEElMEFwaXBlLmxvYWRfbG9yYV93ZWlnaHRzKHRjZF9sb3JhX2lkKSUwQXBpcGUuZnVzZV9sb3JhKCklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJQYWludGluZyUyMG9mJTIwdGhlJTIwb3JhbmdlJTIwY2F0JTIwT3R0byUyMHZvbiUyMEdhcmZpZWxkJTJDJTIwQ291bnQlMjBvZiUyMEJpc21hcmNrLVNjaCVDMyVCNm5oYXVzZW4lMkMlMjBEdWtlJTIwb2YlMjBMYXVlbmJ1cmclMkMlMjBNaW5pc3Rlci1QcmVzaWRlbnQlMjBvZiUyMFBydXNzaWEuJTIwRGVwaWN0ZWQlMjB3ZWFyaW5nJTIwYSUyMFBydXNzaWFuJTIwUGlja2VsaGF1YmUlMjBhbmQlMjBlYXRpbmclMjBoaXMlMjBmYXZvcml0ZSUyMG1lYWwlMjAtJTIwbGFzYWduYS4lMjIlMEElMEFpbWFnZSUyMCUzRCUyMHBpcGUoJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTNEcHJvbXB0JTJDJTBBJTIwJTIwJTIwJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDQlMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDAlMkMlMEElMjAlMjAlMjAlMjBldGElM0QwLjMlMkMlMEElMjAlMjAlMjAlMjBnZW5lcmF0b3IlM0R0b3JjaC5HZW5lcmF0b3IoZGV2aWNlJTNEZGV2aWNlKS5tYW51YWxfc2VlZCgwKSUyQyUwQSkuaW1hZ2VzJTVCMCU1RA==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionXLPipeline, TCDScheduler

device = <span class="hljs-string">&quot;cuda&quot;</span>
base_model_id = <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>
tcd_lora_id = <span class="hljs-string">&quot;h1t/TCD-SDXL-LoRA&quot;</span>

pipe = StableDiffusionXLPipeline.from_pretrained(base_model_id, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>).to(device)
pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)

pipe.load_lora_weights(tcd_lora_id)
pipe.fuse_lora()

prompt = <span class="hljs-string">&quot;Painting of the orange cat Otto von Garfield, Count of Bismarck-Schönhausen, Duke of Lauenburg, Minister-President of Prussia. Depicted wearing a Prussian Pickelhaube and eating his favorite meal - lasagna.&quot;</span>

image = pipe(
    prompt=prompt,
    num_inference_steps=<span class="hljs-number">4</span>,
    guidance_scale=<span class="hljs-number">0</span>,
    eta=<span class="hljs-number">0.3</span>,
    generator=torch.Generator(device=device).manual_seed(<span class="hljs-number">0</span>),
).images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){b(t.$$.fragment),u=c(),o=h("p"),o.innerHTML=d},l(n){f(t.$$.fragment,n),u=M(n),o=y(n,"P",{"data-svelte-h":!0}),w(o)!=="svelte-nuvmzb"&&(o.innerHTML=d)},m(n,p){U(t,n,p),s(n,u,p),s(n,o,p),i=!0},p:rl,i(n){i||(Z(t.$$.fragment,n),i=!0)},o(n){j(t.$$.fragment,n),i=!1},d(n){n&&(e(u),e(o)),g(t,n)}}}function oe(I){let t,u,o,d='<img src="https://github.com/jabir-zheng/TCD/raw/main/assets/inpainting_tcd.png"/>',i;return t=new X({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b1BpcGVsaW5lRm9ySW5wYWludGluZyUyQyUyMFRDRFNjaGVkdWxlciUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBsb2FkX2ltYWdlJTJDJTIwbWFrZV9pbWFnZV9ncmlkJTBBJTBBZGV2aWNlJTIwJTNEJTIwJTIyY3VkYSUyMiUwQWJhc2VfbW9kZWxfaWQlMjAlM0QlMjAlMjJkaWZmdXNlcnMlMkZzdGFibGUtZGlmZnVzaW9uLXhsLTEuMC1pbnBhaW50aW5nLTAuMSUyMiUwQXRjZF9sb3J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BBJTBBcHJvbXB0JTIwJTNEJTIwJTIyYSUyMHRpZ2VyJTIwc2l0dGluZyUyMG9uJTIwYSUyMHBhcmslMjBiZW5jaCUyMiUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZSglMEElMjAlMjBwcm9tcHQlM0Rwcm9tcHQlMkMlMEElMjAlMjBpbWFnZSUzRGluaXRfaW1hZ2UlMkMlMEElMjAlMjBtYXNrX2ltYWdlJTNEbWFza19pbWFnZSUyQyUwQSUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0Q4JTJDJTBBJTIwJTIwZ3VpZGFuY2Vfc2NhbGUlM0QwJTJDJTBBJTIwJTIwZXRhJTNEMC4zJTJDJTBBJTIwJTIwc3RyZW5ndGglM0QwLjk5JTJDJTIwJTIwJTIzJTIwbWFrZSUyMHN1cmUlMjB0byUyMHVzZSUyMCU2MHN0cmVuZ3RoJTYwJTIwYmVsb3clMjAxLjAlMEElMjAlMjBnZW5lcmF0b3IlM0R0b3JjaC5HZW5lcmF0b3IoZGV2aWNlJTNEZGV2aWNlKS5tYW51YWxfc2VlZCgwKSUyQyUwQSkuaW1hZ2VzJTVCMCU1RCUwQSUwQWdyaWRfaW1hZ2UlMjAlM0QlMjBtYWtlX2ltYWdlX2dyaWQoJTVCaW5pdF9pbWFnZSUyQyUyMG1hc2tfaW1hZ2UlMkMlMjBpbWFnZSU1RCUyQyUyMHJvd3MlM0QxJTJDJTIwY29scyUzRDMp",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForInpainting, TCDScheduler
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image, make_image_grid

device = <span class="hljs-string">&quot;cuda&quot;</span>
base_model_id = <span class="hljs-string">&quot;diffusers/stable-diffusion-xl-1.0-inpainting-0.1&quot;</span>
tcd_lora_id = <span class="hljs-string">&quot;h1t/TCD-SDXL-LoRA&quot;</span>

pipe = AutoPipelineForInpainting.from_pretrained(base_model_id, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>).to(device)
pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)

pipe.load_lora_weights(tcd_lora_id)
pipe.fuse_lora()

img_url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png&quot;</span>
mask_url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png&quot;</span>

init_image = load_image(img_url).resize((<span class="hljs-number">1024</span>, <span class="hljs-number">1024</span>))
mask_image = load_image(mask_url).resize((<span class="hljs-number">1024</span>, <span class="hljs-number">1024</span>))

prompt = <span class="hljs-string">&quot;a tiger sitting on a park bench&quot;</span>

image = pipe(
  prompt=prompt,
  image=init_image,
  mask_image=mask_image,
  num_inference_steps=<span class="hljs-number">8</span>,
  guidance_scale=<span class="hljs-number">0</span>,
  eta=<span class="hljs-number">0.3</span>,
  strength=<span class="hljs-number">0.99</span>,  <span class="hljs-comment"># make sure to use \`strength\` below 1.0</span>
  generator=torch.Generator(device=device).manual_seed(<span class="hljs-number">0</span>),
).images[<span class="hljs-number">0</span>]

grid_image = make_image_grid([init_image, mask_image, image], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">3</span>)`,wrap:!1}}),{c(){b(t.$$.fragment),u=c(),o=h("p"),o.innerHTML=d},l(n){f(t.$$.fragment,n),u=M(n),o=y(n,"P",{"data-svelte-h":!0}),w(o)!=="svelte-wsv6yl"&&(o.innerHTML=d)},m(n,p){U(t,n,p),s(n,u,p),s(n,o,p),i=!0},p:rl,i(n){i||(Z(t.$$.fragment,n),i=!0)},o(n){j(t.$$.fragment,n),i=!1},d(n){n&&(e(u),e(o)),g(t,n)}}}function re(I){let t,u,o,d;return t=new ol({props:{id:"tasks",option:"text-to-image",$$slots:{default:[pe]},$$scope:{ctx:I}}}),o=new ol({props:{id:"tasks",option:"inpainting",$$slots:{default:[oe]},$$scope:{ctx:I}}}),{c(){b(t.$$.fragment),u=c(),b(o.$$.fragment)},l(i){f(t.$$.fragment,i),u=M(i),f(o.$$.fragment,i)},m(i,n){U(t,i,n),s(i,u,n),U(o,i,n),d=!0},p(i,n){const p={};n&2&&(p.$$scope={dirty:n,ctx:i}),t.$set(p);const J={};n&2&&(J.$$scope={dirty:n,ctx:i}),o.$set(J)},i(i){d||(Z(t.$$.fragment,i),Z(o.$$.fragment,i),d=!0)},o(i){j(t.$$.fragment,i),j(o.$$.fragment,i),d=!1},d(i){i&&e(u),g(t,i),g(o,i)}}}function me(I){let t,u,o,d,i,n='<img src="https://github.com/jabir-zheng/TCD/raw/main/assets/controlnet_depth_tcd.png"/>',p,J,r,T,G,R,Y='<img src="https://github.com/jabir-zheng/TCD/raw/main/assets/controlnet_canny_tcd.png"/>',C,_,N="<p>The inference parameters in this example might not work for all examples, so we recommend you to try different values for <code>num_inference_steps</code>, <code>guidance_scale</code>, <code>controlnet_conditioning_scale</code> and <code>cross_attention_kwargs</code> parameters and choose the best one.</p>",B;return t=new nl({props:{title:"Depth ControlNet",local:"depth-controlnet",headingTag:"h3"}}),o=new X({props:{code:" ",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DPTImageProcessor, DPTForDepthEstimation
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ControlNetModel, StableDiffusionXLControlNetPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image, make_image_grid
<span class="hljs-keyword">from</span> scheduling_tcd <span class="hljs-keyword">import</span> TCDScheduler

device = <span class="hljs-string">&quot;cuda&quot;</span>
depth_estimator = DPTForDepthEstimation.from_pretrained(<span class="hljs-string">&quot;Intel/dpt-hybrid-midas&quot;</span>).to(device)
feature_extractor = DPTImageProcessor.from_pretrained(<span class="hljs-string">&quot;Intel/dpt-hybrid-midas&quot;</span>)

<span class="hljs-keyword">def</span> <span class="hljs-title function_">get_depth_map</span>(<span class="hljs-params">image</span>):
    image = feature_extractor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).pixel_values.to(device)
    <span class="hljs-keyword">with</span> torch.no_grad(), torch.autocast(device):
        depth_map = depth_estimator(image).predicted_depth

    depth_map = torch.nn.functional.interpolate(
        depth_map.unsqueeze(<span class="hljs-number">1</span>),
        size=(<span class="hljs-number">1024</span>, <span class="hljs-number">1024</span>),
        mode=<span class="hljs-string">&quot;bicubic&quot;</span>,
        align_corners=<span class="hljs-literal">False</span>,
    )
    depth_min = torch.amin(depth_map, dim=[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>], keepdim=<span class="hljs-literal">True</span>)
    depth_max = torch.amax(depth_map, dim=[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>], keepdim=<span class="hljs-literal">True</span>)
    depth_map = (depth_map - depth_min) / (depth_max - depth_min)
    image = torch.cat([depth_map] * <span class="hljs-number">3</span>, dim=<span class="hljs-number">1</span>)

    image = image.permute(<span class="hljs-number">0</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">1</span>).cpu().numpy()[<span class="hljs-number">0</span>]
    image = Image.fromarray((image * <span class="hljs-number">255.0</span>).clip(<span class="hljs-number">0</span>, <span class="hljs-number">255</span>).astype(np.uint8))
    <span class="hljs-keyword">return</span> image

base_model_id = <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>
controlnet_id = <span class="hljs-string">&quot;diffusers/controlnet-depth-sdxl-1.0&quot;</span>
tcd_lora_id = <span class="hljs-string">&quot;h1t/TCD-SDXL-LoRA&quot;</span>

controlnet = ControlNetModel.from_pretrained(
    controlnet_id,
    torch_dtype=torch.float16,
    variant=<span class="hljs-string">&quot;fp16&quot;</span>,
)
pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
    base_model_id,
    controlnet=controlnet,
    torch_dtype=torch.float16,
    variant=<span class="hljs-string">&quot;fp16&quot;</span>,
)
pipe.enable_model_cpu_offload()

pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)

pipe.load_lora_weights(tcd_lora_id)
pipe.fuse_lora()

prompt = <span class="hljs-string">&quot;stormtrooper lecture, photorealistic&quot;</span>

image = load_image(<span class="hljs-string">&quot;https://huggingface.co/lllyasviel/sd-controlnet-depth/resolve/main/images/stormtrooper.png&quot;</span>)
depth_image = get_depth_map(image)

controlnet_conditioning_scale = <span class="hljs-number">0.5</span>  <span class="hljs-comment"># recommended for good generalization</span>

image = pipe(
    prompt,
    image=depth_image,
    num_inference_steps=<span class="hljs-number">4</span>,
    guidance_scale=<span class="hljs-number">0</span>,
    eta=<span class="hljs-number">0.3</span>,
    controlnet_conditioning_scale=controlnet_conditioning_scale,
    generator=torch.Generator(device=device).manual_seed(<span class="hljs-number">0</span>),
).images[<span class="hljs-number">0</span>]

grid_image = make_image_grid([depth_image, image], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">2</span>)`,wrap:!1}}),J=new nl({props:{title:"Canny ControlNet",local:"canny-controlnet",headingTag:"h3"}}),T=new X({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQ29udHJvbE5ldE1vZGVsJTJDJTIwU3RhYmxlRGlmZnVzaW9uWExDb250cm9sTmV0UGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUyQyUyMG1ha2VfaW1hZ2VfZ3JpZCUwQWZyb20lMjBzY2hlZHVsaW5nX3RjZCUyMGltcG9ydCUyMFRDRFNjaGVkdWxlciUwQSUwQWRldmljZSUyMCUzRCUyMCUyMmN1ZGElMj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lighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ControlNetModel, StableDiffusionXLControlNetPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image, make_image_grid
<span class="hljs-keyword">from</span> scheduling_tcd <span class="hljs-keyword">import</span> TCDScheduler

device = <span class="hljs-string">&quot;cuda&quot;</span>
base_model_id = <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>
controlnet_id = <span class="hljs-string">&quot;diffusers/controlnet-canny-sdxl-1.0&quot;</span>
tcd_lora_id = <span class="hljs-string">&quot;h1t/TCD-SDXL-LoRA&quot;</span>

controlnet = ControlNetModel.from_pretrained(
    controlnet_id,
    torch_dtype=torch.float16,
    variant=<span class="hljs-string">&quot;fp16&quot;</span>,
)
pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
    base_model_id,
    controlnet=controlnet,
    torch_dtype=torch.float16,
    variant=<span class="hljs-string">&quot;fp16&quot;</span>,
)
pipe.enable_model_cpu_offload()

pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)

pipe.load_lora_weights(tcd_lora_id)
pipe.fuse_lora()

prompt = <span class="hljs-string">&quot;ultrarealistic shot of a furry blue bird&quot;</span>

canny_image = load_image(<span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd_controlnet/bird_canny.png&quot;</span>)

controlnet_conditioning_scale = <span class="hljs-number">0.5</span>  <span class="hljs-comment"># recommended for good generalization</span>

image = pipe(
    prompt,
    image=canny_image,
    num_inference_steps=<span class="hljs-number">4</span>,
    guidance_scale=<span class="hljs-number">0</span>,
    eta=<span class="hljs-number">0.3</span>,
    controlnet_conditioning_scale=controlnet_conditioning_scale,
    generator=torch.Generator(device=device).manual_seed(<span class="hljs-number">0</span>),
).images[<span class="hljs-number">0</span>]

grid_image = make_image_grid([canny_image, image], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">2</span>)`,wrap:!1}}),{c(){b(t.$$.fragment),u=c(),b(o.$$.fragment),d=c(),i=h("p"),i.innerHTML=n,p=c(),b(J.$$.fragment),r=c(),b(T.$$.fragment),G=c(),R=h("p"),R.innerHTML=Y,C=c(),_=h("blockquote"),_.innerHTML=N,this.h()},l(m){f(t.$$.fragment,m),u=M(m),f(o.$$.fragment,m),d=M(m),i=y(m,"P",{"data-svelte-h":!0}),w(i)!=="svelte-jfsnb4"&&(i.innerHTML=n),p=M(m),f(J.$$.fragment,m),r=M(m),f(T.$$.fragment,m),G=M(m),R=y(m,"P",{"data-svelte-h":!0}),w(R)!=="svelte-x8em4a"&&(R.innerHTML=Y),C=M(m),_=y(m,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),w(_)!=="svelte-ruvki8"&&(_.innerHTML=N),this.h()},h(){pl(_,"class","tip")},m(m,W){U(t,m,W),s(m,u,W),U(o,m,W),s(m,d,W),s(m,i,W),s(m,p,W),U(J,m,W),s(m,r,W),U(T,m,W),s(m,G,W),s(m,R,W),s(m,C,W),s(m,_,W),B=!0},p:rl,i(m){B||(Z(t.$$.fragment,m),Z(o.$$.fragment,m),Z(J.$$.fragment,m),Z(T.$$.fragment,m),B=!0)},o(m){j(t.$$.fragment,m),j(o.$$.fragment,m),j(J.$$.fragment,m),j(T.$$.fragment,m),B=!1},d(m){m&&(e(u),e(d),e(i),e(p),e(r),e(G),e(R),e(C),e(_)),g(t,m),g(o,m),g(J,m),g(T,m)}}}function ce(I){let t,u='This example shows how to use the TCD-LoRA with the <a href="https://github.com/tencent-ailab/IP-Adapter/tree/main" rel="nofollow">IP-Adapter</a> and SDXL.',o,d,i,n,p='<img src="https://github.com/jabir-zheng/TCD/raw/main/assets/ip_adapter.png"/>',J;return d=new X({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uWExQaXBlbGluZSUwQWZyb20lMjBkaWZmdXN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NvZGVyX3BhdGglMkMlMjBpcF9ja3B0JTJDJTIwZGV2aWNlKSUwQSUwQXJlZl9pbWFnZSUyMCUzRCUyMGxvYWRfaW1hZ2UoJTIyaHR0cHMlM0ElMkYlMkZyYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tJTJGdGVuY2VudC1haWxhYiUyRklQLUFkYXB0ZXIlMkZtYWluJTJGYXNzZXRzJTJGaW1hZ2VzJTJGd29tYW4ucG5nJTIyKS5yZXNpemUoKDUxMiUyQyUyMDUxMikpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyYmVzdCUyMHF1YWxpdHklMkMlMjBoaWdoJTIwcXVhbGl0eSUyQyUyMHdlYXJpbmclMjBzdW5nbGFzc2VzJTIyJTBBJTBBaW1hZ2UlMjAlM0QlMjBpcF9tb2RlbC5nZW5lcmF0ZSglMEElMjAlMjAlMjAlMjBwaWxfaW1hZ2UlM0RyZWZfaW1hZ2UlMkMlMEElMjAlMjAlMjAlMjBwcm9tcHQlM0Rwcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBzY2FsZSUzRDAuNSUyQyUwQSUyMCUyMCUyMCUyMG51bV9zYW1wbGVzJTNEMSUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0Q0JTJDJTBBJTIwJTIwJTIwJTIwZ3VpZGFuY2Vfc2NhbGUlM0QwJTJDJTBBJTIwJTIwJTIwJTIwZXRhJTNEMC4zJTJDJTBBJTIwJTIwJTIwJTIwc2VlZCUzRDAlMkMlMEEpJTVCMCU1RCUwQSUwQWdyaWRfaW1hZ2UlMjAlM0QlMjBtYWtlX2ltYWdlX2dyaWQoJTVCcmVmX2ltYWdlJTJDJTIwaW1hZ2UlNUQlMkMlMjByb3dzJTNEMSUyQyUyMGNvbHMlM0QyKQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionXLPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image, make_image_grid

<span class="hljs-keyword">from</span> ip_adapter <span class="hljs-keyword">import</span> IPAdapterXL
<span class="hljs-keyword">from</span> scheduling_tcd <span class="hljs-keyword">import</span> TCDScheduler

device = <span class="hljs-string">&quot;cuda&quot;</span>
base_model_path = <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>
image_encoder_path = <span class="hljs-string">&quot;sdxl_models/image_encoder&quot;</span>
ip_ckpt = <span class="hljs-string">&quot;sdxl_models/ip-adapter_sdxl.bin&quot;</span>
tcd_lora_id = <span class="hljs-string">&quot;h1t/TCD-SDXL-LoRA&quot;</span>

pipe = StableDiffusionXLPipeline.from_pretrained(
    base_model_path,
    torch_dtype=torch.float16,
    variant=<span class="hljs-string">&quot;fp16&quot;</span>
)
pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)

pipe.load_lora_weights(tcd_lora_id)
pipe.fuse_lora()

ip_model = IPAdapterXL(pipe, image_encoder_path, ip_ckpt, device)

ref_image = load_image(<span class="hljs-string">&quot;https://raw.githubusercontent.com/tencent-ailab/IP-Adapter/main/assets/images/woman.png&quot;</span>).resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))

prompt = <span class="hljs-string">&quot;best quality, high quality, wearing sunglasses&quot;</span>

image = ip_model.generate(
    pil_image=ref_image,
    prompt=prompt,
    scale=<span class="hljs-number">0.5</span>,
    num_samples=<span class="hljs-number">1</span>,
    num_inference_steps=<span class="hljs-number">4</span>,
    guidance_scale=<span class="hljs-number">0</span>,
    eta=<span class="hljs-number">0.3</span>,
    seed=<span class="hljs-number">0</span>,
)[<span class="hljs-number">0</span>]

grid_image = make_image_grid([ref_image, image], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">2</span>)`,wrap:!1}}),{c(){t=h("p"),t.innerHTML=u,o=c(),b(d.$$.fragment),i=c(),n=h("p"),n.innerHTML=p},l(r){t=y(r,"P",{"data-svelte-h":!0}),w(t)!=="svelte-fqwnz0"&&(t.innerHTML=u),o=M(r),f(d.$$.fragment,r),i=M(r),n=y(r,"P",{"data-svelte-h":!0}),w(n)!=="svelte-1nkh4zf"&&(n.innerHTML=p)},m(r,T){s(r,t,T),s(r,o,T),U(d,r,T),s(r,i,T),s(r,n,T),J=!0},p:rl,i(r){J||(Z(d.$$.fragment,r),J=!0)},o(r){j(d.$$.fragment,r),J=!1},d(r){r&&(e(t),e(o),e(i),e(n)),g(d,r)}}}function Me(I){let t,u="<code>AnimateDiff</code> allows animating images using Stable Diffusion models. TCD-LoRA can substantially accelerate the process without degrading image quality. The quality of animation with TCD-LoRA and AnimateDiff has a more lucid outcome.",o,d,i,n,p='<img src="https://github.com/jabir-zheng/TCD/raw/main/assets/animation_example.gif"/>',J;return d=new X({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwTW90aW9uQWRhcHRlciUyQyUyMEFuaW1hdGVEaWZmUGlwZWxpbmUlMkMlMjBERElNU2NoZWR1bGVyJTBBZnJvbSUyMHNjaGVkdWxpbmdfdGNkJTIwaW1wb3J0JTIwVENEU2NoZWR1bGVyJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGV4cG9ydF90b19naWYlMEElMEFhZGFwdGVyJTIwJTNEJTIwTW90aW9uQWRhcHRlci5mcm9tX3ByZXRyYWluZWQoJTIyZ3VveXd3JTJGYW5pbWF0ZWRpZmYtbW90aW9uLWFkYXB0ZXItdjEtNSUyMiklMEFwaXBlJTIwJTNEJTIwQW5pbWF0ZURpZmZQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyZnJhbmtqb3NodWElMkZ0b29ueW91X2JldGE2JTIyJTJDJTBBJTIwJTIwJTIwJTIwbW90aW9uX2FkYXB0ZXIlM0RhZGFwdGVyJTJDJTBBKS50byglMjJjdWRhJTIyKSUwQSUwQSUyMyUyMHNldCU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TIwJTIwZ3VpZGFuY2Vfc2NhbGUlM0QwJTJDJTBBJTIwJTIwJTIwJTIwY3Jvc3NfYXR0ZW50aW9uX2t3YXJncyUzRCU3QiUyMnNjYWxlJTIyJTNBJTIwMSU3RCUyQyUwQSUyMCUyMCUyMCUyMG51bV9mcmFtZXMlM0QyNCUyQyUwQSUyMCUyMCUyMCUyMGV0YSUzRDAuMyUyQyUwQSUyMCUyMCUyMCUyMGdlbmVyYXRvciUzRGdlbmVyYXRvciUwQSkuZnJhbWVzJTVCMCU1RCUwQWV4cG9ydF90b19naWYoZnJhbWVzJTJDJTIwJTIyYW5pbWF0aW9uLmdpZiUyMik=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> MotionAdapter, AnimateDiffPipeline, DDIMScheduler
<span class="hljs-keyword">from</span> scheduling_tcd <span class="hljs-keyword">import</span> TCDScheduler
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_gif

adapter = MotionAdapter.from_pretrained(<span class="hljs-string">&quot;guoyww/animatediff-motion-adapter-v1-5&quot;</span>)
pipe = AnimateDiffPipeline.from_pretrained(
    <span class="hljs-string">&quot;frankjoshua/toonyou_beta6&quot;</span>,
    motion_adapter=adapter,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-comment"># set TCDScheduler</span>
pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)

<span class="hljs-comment"># load TCD LoRA</span>
pipe.load_lora_weights(<span class="hljs-string">&quot;h1t/TCD-SD15-LoRA&quot;</span>, adapter_name=<span class="hljs-string">&quot;tcd&quot;</span>)
pipe.load_lora_weights(<span class="hljs-string">&quot;guoyww/animatediff-motion-lora-zoom-in&quot;</span>, weight_name=<span class="hljs-string">&quot;diffusion_pytorch_model.safetensors&quot;</span>, adapter_name=<span class="hljs-string">&quot;motion-lora&quot;</span>)

pipe.set_adapters([<span class="hljs-string">&quot;tcd&quot;</span>, <span class="hljs-string">&quot;motion-lora&quot;</span>], adapter_weights=[<span class="hljs-number">1.0</span>, <span class="hljs-number">1.2</span>])

prompt = <span class="hljs-string">&quot;best quality, masterpiece, 1girl, looking at viewer, blurry background, upper body, contemporary, dress&quot;</span>
generator = torch.manual_seed(<span class="hljs-number">0</span>)
frames = pipe(
    prompt=prompt,
    num_inference_steps=<span class="hljs-number">5</span>,
    guidance_scale=<span class="hljs-number">0</span>,
    cross_attention_kwargs={<span class="hljs-string">&quot;scale&quot;</span>: <span class="hljs-number">1</span>},
    num_frames=<span class="hljs-number">24</span>,
    eta=<span class="hljs-number">0.3</span>,
    generator=generator
).frames[<span class="hljs-number">0</span>]
export_to_gif(frames, <span class="hljs-string">&quot;animation.gif&quot;</span>)`,wrap:!1}}),{c(){t=h("p"),t.innerHTML=u,o=c(),b(d.$$.fragment),i=c(),n=h("p"),n.innerHTML=p},l(r){t=y(r,"P",{"data-svelte-h":!0}),w(t)!=="svelte-nxio7r"&&(t.innerHTML=u),o=M(r),f(d.$$.fragment,r),i=M(r),n=y(r,"P",{"data-svelte-h":!0}),w(n)!=="svelte-it1yry"&&(n.innerHTML=p)},m(r,T){s(r,t,T),s(r,o,T),U(d,r,T),s(r,i,T),s(r,n,T),J=!0},p:rl,i(r){J||(Z(d.$$.fragment,r),J=!0)},o(r){j(d.$$.fragment,r),J=!1},d(r){r&&(e(t),e(o),e(i),e(n)),g(d,r)}}}function de(I){let t,u,o,d,i,n;return t=new ol({props:{id:"adapters",option:"ControlNet",$$slots:{default:[me]},$$scope:{ctx:I}}}),o=new ol({props:{id:"adapters",option:"IP-Adapter",$$slots:{default:[ce]},$$scope:{ctx:I}}}),i=new ol({props:{id:"adapters",option:"AnimateDiff",$$slots:{default:[Me]},$$scope:{ctx:I}}}),{c(){b(t.$$.fragment),u=c(),b(o.$$.fragment),d=c(),b(i.$$.fragment)},l(p){f(t.$$.fragment,p),u=M(p),f(o.$$.fragment,p),d=M(p),f(i.$$.fragment,p)},m(p,J){U(t,p,J),s(p,u,J),U(o,p,J),s(p,d,J),U(i,p,J),n=!0},p(p,J){const r={};J&2&&(r.$$scope={dirty:J,ctx:p}),t.$set(r);const T={};J&2&&(T.$$scope={dirty:J,ctx:p}),o.$set(T);const G={};J&2&&(G.$$scope={dirty:J,ctx:p}),i.$set(G)},i(p){n||(Z(t.$$.fragment,p),Z(o.$$.fragment,p),Z(i.$$.fragment,p),n=!0)},o(p){j(t.$$.fragment,p),j(o.$$.fragment,p),j(i.$$.fragment,p),n=!1},d(p){p&&(e(u),e(d)),g(t,p),g(o,p),g(i,p)}}}function Je(I){let t,u,o,d,i,n,p,J,r,T,G,R="Trajectory Consistency Distillation (TCD) enables a model to generate higher quality and more detailed images with fewer steps. Moreover, owing to the effective error mitigation during the distillation process, TCD demonstrates superior performance even under conditions of large inference steps.",Y,C,_="The major advantages of TCD are:",N,B,m='<li><p>Better than Teacher: TCD demonstrates superior generative quality at both small and large inference steps and exceeds the performance of <a href="../../api/schedulers/multistep_dpm_solver">DPM-Solver++(2S)</a> with Stable Diffusion XL (SDXL). There is no additional discriminator or LPIPS supervision included during TCD training.</p></li> <li><p>Flexible Inference Steps: The inference steps for TCD sampling can be freely adjusted without adversely affecting the image quality.</p></li> <li><p>Freely change detail level: During inference, the level of detail in the image can be adjusted with a single hyperparameter, <em>gamma</em>.</p></li>',W,k,kl='<p>For more technical details of TCD, please refer to the <a href="https://huggingface.co/papers/2402.19159" rel="nofollow">paper</a> or official <a href="https://mhh0318.github.io/tcd/" rel="nofollow">project page</a>.</p>',ml,S,Vl='For large models like SDXL, TCD is trained with <a href="https://huggingface.co/docs/peft/conceptual_guides/adapter#low-rank-adaptation-lora" rel="nofollow">LoRA</a> to reduce memory usage. This is also useful because you can reuse LoRAs between different finetuned models, as long as they share the same base model, without further training.',cl,Q,El="This guide will show you how to perform inference with TCD-LoRAs for a variety of tasks like text-to-image and inpainting, as well as how you can easily combine TCD-LoRAs with other adapters. Choose one of the supported base model and it’s corresponding TCD-LoRA checkpoint from the table below to get started.",Ml,v,Fl='<thead><tr><th>Base model</th> <th>TCD-LoRA checkpoint</th></tr></thead> <tbody><tr><td><a href="https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5" rel="nofollow">stable-diffusion-v1-5</a></td> <td><a href="https://huggingface.co/h1t/TCD-SD15-LoRA" rel="nofollow">TCD-SD15</a></td></tr> <tr><td><a href="https://huggingface.co/stabilityai/stable-diffusion-2-1-base" rel="nofollow">stable-diffusion-2-1-base</a></td> <td><a href="https://huggingface.co/h1t/TCD-SD21-base-LoRA" rel="nofollow">TCD-SD21-base</a></td></tr> <tr><td><a href="https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0" rel="nofollow">stable-diffusion-xl-base-1.0</a></td> <td><a href="https://huggingface.co/h1t/TCD-SDXL-LoRA" rel="nofollow">TCD-SDXL</a></td></tr></tbody>',dl,$,Yl='Make sure you have <a href="https://github.com/huggingface/peft" rel="nofollow">PEFT</a> installed for better LoRA support.',Jl,D,ul,z,hl,A,Nl='In this guide, let’s use the <a href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLPipeline">StableDiffusionXLPipeline</a> and the <a href="/docs/diffusers/main/en/api/schedulers/tcd#diffusers.TCDScheduler">TCDScheduler</a>. Use the <a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.StableDiffusionLoraLoaderMixin.load_lora_weights">load_lora_weights()</a> method to load the SDXL-compatible TCD-LoRA weights.',yl,H,Sl="A few tips to keep in mind for TCD-LoRA inference are to:",Tl,x,Ql='<li>Keep the <code>num_inference_steps</code> between 4 and 50</li> <li>Set <code>eta</code> (used to control stochasticity at each step) between 0 and 1. You should use a higher <code>eta</code> when increasing the number of inference steps, but the downside is that a larger <code>eta</code> in <a href="/docs/diffusers/main/en/api/schedulers/tcd#diffusers.TCDScheduler">TCDScheduler</a> leads to blurrier images. A value of 0.3 is recommended to produce good results.</li>',wl,V,bl,L,fl,q,vl='TCD-LoRA also works with many community finetuned models and plugins. For example, load the <a href="https://huggingface.co/cagliostrolab/animagine-xl-3.0" rel="nofollow">animagine-xl-3.0</a> checkpoint which is a community finetuned version of SDXL for generating anime images.',Ul,K,Zl,P,$l='<img src="https://github.com/jabir-zheng/TCD/raw/main/assets/animagine_xl.png"/>',jl,O,Dl='TCD-LoRA also supports other LoRAs trained on different styles. For example, let’s load the <a href="https://huggingface.co/TheLastBen/Papercut_SDXL" rel="nofollow">TheLastBen/Papercut_SDXL</a> LoRA and fuse it with the TCD-LoRA with the <code>~loaders.UNet2DConditionLoadersMixin.set_adapters</code> method.',gl,E,zl='<p>Check out the <a href="merge_loras">Merge LoRAs</a> guide to learn more about efficient merging methods.</p>',Wl,ll,Il,el,Al='<img src="https://github.com/jabir-zheng/TCD/raw/main/assets/styled_lora.png"/>',Gl,sl,Cl,al,Hl="TCD-LoRA is very versatile, and it can be combined with other adapter types like ControlNets, IP-Adapter, and AnimateDiff.",Bl,F,_l,tl,Rl,il,Xl;return i=new ne({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/inference_with_tcd_lora.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/pytorch/inference_with_tcd_lora.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/tensorflow/inference_with_tcd_lora.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/inference_with_tcd_lora.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/pytorch/inference_with_tcd_lora.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/tensorflow/inference_with_tcd_lora.ipynb"}]}}),p=new te({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),r=new nl({props:{title:"Trajectory Consistency Distillation-LoRA",local:"trajectory-consistency-distillation-lora",headingTag:"h1"}}),D=new X({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1VJTIwcGVmdA==",highlighted:"pip install -U peft",wrap:!1}}),z=new nl({props:{title:"General tasks",local:"general-tasks",headingTag:"h2"}}),V=new Kl({props:{id:"tasks",options:["text-to-image","inpainting"],$$slots:{default:[re]},$$scope:{ctx:I}}}),L=new nl({props:{title:"Community models",local:"community-models",headingTag:"h2"}}),K=new X({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uWExQaXBlbGluZSUyQyUyMFRDRFNjaGVkdWxlciUwQSUwQWRldmljZSUyMCUzRCUyMCUyMmN1ZGElMjIlMEFiYXNlX21vZGVsX2lkJTIwJTNEJTIwJTIyY2FnbGlvc3Ryb2xhYiUyRmFuaW1hZ2luZS14bC0zLjAlMjIlMEF0Y2RfbG9yYV9pZCUyMCUzRCUyMCUyMmgxdCUyRlRDRC1TRFhMLUxvUkElMjIlMEElMEFwaXBlJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uWExQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoYmFzZV9tb2RlbF9pZCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHZhcmlhbnQlM0QlMjJmcDE2JTIyKS50byhkZXZpY2UpJTBBcGlwZS5zY2hlZHVsZXIlMjAlM0QlMjBUQ0RTY2hlZHVsZXIuZnJvbV9jb25maWcocGlwZS5zY2hlZHVsZXIuY29uZmlnKSUwQSUwQXBpcGUubG9hZF9sb3JhX3dlaWdodHModGNkX2xvcmFfaWQpJTBBcGlwZS5mdXNlX2xvcmEoKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBtYW4lMkMlMjBjbGFkJTIwaW4lMjBhJTIwbWV0aWN1bG91c2x5JTIwdGFpbG9yZWQlMjBtaWxpdGFyeSUyMHVuaWZvcm0lMkMlMjBzdGFuZHMlMjB3aXRoJTIwdW53YXZlcmluZyUyMHJlc29sdmUuJTIwVGhlJTIwdW5pZm9ybSUyMGJvYXN0cyUyMGludHJpY2F0ZSUyMGRldGFpbHMlMkMlMjBhbmQlMjBoaXMlMjBleWVzJTIwZ2xlYW0lMjB3aXRoJTIwZGV0ZXJtaW5hdGlvbi4lMjBTdHJhbmRzJTIwb2YlMjB2aWJyYW50JTJDJTIwd2luZHN3ZXB0JTIwaGFpciUyMHBlZWslMjBvdXQlMjBmcm9tJTIwYmVuZWF0aCUyMHRoZSUyMGJyaW0lMjBvZiUyMGhpcyUyMGNhcC4lMjIlMEElMEFpbWFnZSUyMCUzRCUyMHBpcGUoJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTNEcHJvbXB0JTJDJTBBJTIwJTIwJTIwJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDglMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDAlMkMlMEElMjAlMjAlMjAlMjBldGElM0QwLjMlMkMlMEElMjAlMjAlMjAlMjBnZW5lcmF0b3IlM0R0b3JjaC5HZW5lcmF0b3IoZGV2aWNlJTNEZGV2aWNlKS5tYW51YWxfc2VlZCgwKSUyQyUwQSkuaW1hZ2VzJTVCMCU1RA==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionXLPipeline, TCDScheduler

device = <span class="hljs-string">&quot;cuda&quot;</span>
base_model_id = <span class="hljs-string">&quot;cagliostrolab/animagine-xl-3.0&quot;</span>
tcd_lora_id = <span class="hljs-string">&quot;h1t/TCD-SDXL-LoRA&quot;</span>

pipe = StableDiffusionXLPipeline.from_pretrained(base_model_id, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>).to(device)
pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)

pipe.load_lora_weights(tcd_lora_id)
pipe.fuse_lora()

prompt = <span class="hljs-string">&quot;A man, clad in a meticulously tailored military uniform, stands with unwavering resolve. The uniform boasts intricate details, and his eyes gleam with determination. Strands of vibrant, windswept hair peek out from beneath the brim of his cap.&quot;</span>

image = pipe(
    prompt=prompt,
    num_inference_steps=<span class="hljs-number">8</span>,
    guidance_scale=<span class="hljs-number">0</span>,
    eta=<span class="hljs-number">0.3</span>,
    generator=torch.Generator(device=device).manual_seed(<span class="hljs-number">0</span>),
).images[<span class="hljs-number">0</span>]`,wrap:!1}}),ll=new X({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uWExQaXBlbGluZSUwQWZyb20lMjBzY2hlZHVsaW5nX3RjZCUyMGltcG9ydCUyMFRDRFNjaGVkdWxlciUwQSUwQWRldmljZSUyMCUzRCUyMCUyMmN1ZGElMjIlMEFiYXNlX21vZGVsX2lkJTIwJTNEJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTBBdGNkX2xvcmFfaWQlMjAlM0QlMjAlMjJoMXQlMkZUQ0QtU0RYTC1Mb1JBJTIyJTBBc3R5bGVkX2xvcmFfaWQlMjAlM0QlMjAlMjJUaGVMYXN0QmVuJTJGUGFwZXJjdXRfU0RYTCUyMiUwQSUwQXBpcGUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25YTFBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChiYXNlX21vZGVsX2lkJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIpLnRvKGRldmljZSklMEFwaXBlLnNjaGVkdWxlciUyMCUzRCUyMFRDRFNjaGVkdWxlci5mcm9tX2NvbmZpZyhwaXBlLnNjaGVkdWxlci5jb25maWcpJTBBJTBBcGlwZS5sb2FkX2xvcmFfd2VpZ2h0cyh0Y2RfbG9yYV9pZCUyQyUyMGFkYXB0ZXJfbmFtZSUzRCUyMnRjZCUyMiklMEFwaXBlLmxvYWRfbG9yYV93ZWlnaHRzKHN0eWxlZF9sb3JhX2lkJTJDJTIwYWRhcHRlcl9uYW1lJTNEJTIyc3R5bGUlMjIpJTBBcGlwZS5zZXRfYWRhcHRlcnMoJTVCJTIydGNkJTIyJTJDJTIwJTIyc3R5bGUlMjIlNUQlMkMlMjBhZGFwdGVyX3dlaWdodHMlM0QlNUIxLjAlMkMlMjAxLjAlNUQpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIycGFwZXJjdXQlMjBvZiUyMGElMjB3aW50ZXIlMjBtb3VudGFpbiUyQyUyMHNub3clMjIlMEElMEFpbWFnZSUyMCUzRCUyMHBpcGUoJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTNEcHJvbXB0JTJDJTBBJTIwJTIwJTIwJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDQlMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDAlMkMlMEElMjAlMjAlMjAlMjBldGElM0QwLjMlMkMlMEElMjAlMjAlMjAlMjBnZW5lcmF0b3IlM0R0b3JjaC5HZW5lcmF0b3IoZGV2aWNlJTNEZGV2aWNlKS5tYW51YWxfc2VlZCgwKSUyQyUwQSkuaW1hZ2VzJTVCMCU1RA==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionXLPipeline
<span class="hljs-keyword">from</span> scheduling_tcd <span class="hljs-keyword">import</span> TCDScheduler

device = <span class="hljs-string">&quot;cuda&quot;</span>
base_model_id = <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>
tcd_lora_id = <span class="hljs-string">&quot;h1t/TCD-SDXL-LoRA&quot;</span>
styled_lora_id = <span class="hljs-string">&quot;TheLastBen/Papercut_SDXL&quot;</span>

pipe = StableDiffusionXLPipeline.from_pretrained(base_model_id, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>).to(device)
pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)

pipe.load_lora_weights(tcd_lora_id, adapter_name=<span class="hljs-string">&quot;tcd&quot;</span>)
pipe.load_lora_weights(styled_lora_id, adapter_name=<span class="hljs-string">&quot;style&quot;</span>)
pipe.set_adapters([<span class="hljs-string">&quot;tcd&quot;</span>, <span class="hljs-string">&quot;style&quot;</span>], adapter_weights=[<span class="hljs-number">1.0</span>, <span class="hljs-number">1.0</span>])

prompt = <span class="hljs-string">&quot;papercut of a winter mountain, snow&quot;</span>

image = pipe(
    prompt=prompt,
    num_inference_steps=<span class="hljs-number">4</span>,
    guidance_scale=<span class="hljs-number">0</span>,
    eta=<span class="hljs-number">0.3</span>,
    generator=torch.Generator(device=device).manual_seed(<span class="hljs-number">0</span>),
).images[<span class="hljs-number">0</span>]`,wrap:!1}}),sl=new nl({props:{title:"Adapters",local:"adapters",headingTag:"h2"}}),F=new Kl({props:{id:"adapters",options:["ControlNet","IP-Adapter","AnimateDiff"],$$slots:{default:[de]},$$scope:{ctx:I}}}),tl=new ie({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/using-diffusers/inference_with_tcd_lora.md"}}),{c(){t=h("meta"),u=c(),o=h("p"),d=c(),b(i.$$.fragment),n=c(),b(p.$$.fragment),J=c(),b(r.$$.fragment),T=c(),G=h("p"),G.textContent=R,Y=c(),C=h("p"),C.textContent=_,N=c(),B=h("ul"),B.innerHTML=m,W=c(),k=h("blockquote"),k.innerHTML=kl,ml=c(),S=h("p"),S.innerHTML=Vl,cl=c(),Q=h("p"),Q.textContent=El,Ml=c(),v=h("table"),v.innerHTML=Fl,dl=c(),$=h("p"),$.innerHTML=Yl,Jl=c(),b(D.$$.fragment),ul=c(),b(z.$$.fragment),hl=c(),A=h("p"),A.innerHTML=Nl,yl=c(),H=h("p"),H.textContent=Sl,Tl=c(),x=h("ul"),x.innerHTML=Ql,wl=c(),b(V.$$.fragment),bl=c(),b(L.$$.fragment),fl=c(),q=h("p"),q.innerHTML=vl,Ul=c(),b(K.$$.fragment),Zl=c(),P=h("p"),P.innerHTML=$l,jl=c(),O=h("p"),O.innerHTML=Dl,gl=c(),E=h("blockquote"),E.innerHTML=zl,Wl=c(),b(ll.$$.fragment),Il=c(),el=h("p"),el.innerHTML=Al,Gl=c(),b(sl.$$.fragment),Cl=c(),al=h("p"),al.textContent=Hl,Bl=c(),b(F.$$.fragment),_l=c(),b(tl.$$.fragment),Rl=c(),il=h("p"),this.h()},l(l){const a=se("svelte-u9bgzb",document.head);t=y(a,"META",{name:!0,content:!0}),a.forEach(e),u=M(l),o=y(l,"P",{}),ql(o).forEach(e),d=M(l),f(i.$$.fragment,l),n=M(l),f(p.$$.fragment,l),J=M(l),f(r.$$.fragment,l),T=M(l),G=y(l,"P",{"data-svelte-h":!0}),w(G)!=="svelte-1ipiy2w"&&(G.textContent=R),Y=M(l),C=y(l,"P",{"data-svelte-h":!0}),w(C)!=="svelte-lghdda"&&(C.textContent=_),N=M(l),B=y(l,"UL",{"data-svelte-h":!0}),w(B)!=="svelte-s8ifhe"&&(B.innerHTML=m),W=M(l),k=y(l,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),w(k)!=="svelte-1hjcy1r"&&(k.innerHTML=kl),ml=M(l),S=y(l,"P",{"data-svelte-h":!0}),w(S)!=="svelte-ss6l19"&&(S.innerHTML=Vl),cl=M(l),Q=y(l,"P",{"data-svelte-h":!0}),w(Q)!=="svelte-4sxfqt"&&(Q.textContent=El),Ml=M(l),v=y(l,"TABLE",{"data-svelte-h":!0}),w(v)!=="svelte-143krth"&&(v.innerHTML=Fl),dl=M(l),$=y(l,"P",{"data-svelte-h":!0}),w($)!=="svelte-18m9u5y"&&($.innerHTML=Yl),Jl=M(l),f(D.$$.fragment,l),ul=M(l),f(z.$$.fragment,l),hl=M(l),A=y(l,"P",{"data-svelte-h":!0}),w(A)!=="svelte-12a7e7b"&&(A.innerHTML=Nl),yl=M(l),H=y(l,"P",{"data-svelte-h":!0}),w(H)!=="svelte-49ynuh"&&(H.textContent=Sl),Tl=M(l),x=y(l,"UL",{"data-svelte-h":!0}),w(x)!=="svelte-8y919q"&&(x.innerHTML=Ql),wl=M(l),f(V.$$.fragment,l),bl=M(l),f(L.$$.fragment,l),fl=M(l),q=y(l,"P",{"data-svelte-h":!0}),w(q)!=="svelte-188pw20"&&(q.innerHTML=vl),Ul=M(l),f(K.$$.fragment,l),Zl=M(l),P=y(l,"P",{"data-svelte-h":!0}),w(P)!=="svelte-iffd98"&&(P.innerHTML=$l),jl=M(l),O=y(l,"P",{"data-svelte-h":!0}),w(O)!=="svelte-1bzy2jr"&&(O.innerHTML=Dl),gl=M(l),E=y(l,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),w(E)!=="svelte-pajc1d"&&(E.innerHTML=zl),Wl=M(l),f(ll.$$.fragment,l),Il=M(l),el=y(l,"P",{"data-svelte-h":!0}),w(el)!=="svelte-64b3tk"&&(el.innerHTML=Al),Gl=M(l),f(sl.$$.fragment,l),Cl=M(l),al=y(l,"P",{"data-svelte-h":!0}),w(al)!=="svelte-jvx8ap"&&(al.textContent=Hl),Bl=M(l),f(F.$$.fragment,l),_l=M(l),f(tl.$$.fragment,l),Rl=M(l),il=y(l,"P",{}),ql(il).forEach(e),this.h()},h(){pl(t,"name","hf:doc:metadata"),pl(t,"content",ue),pl(k,"class","tip"),pl(E,"class","tip")},m(l,a){ae(document.head,t),s(l,u,a),s(l,o,a),s(l,d,a),U(i,l,a),s(l,n,a),U(p,l,a),s(l,J,a),U(r,l,a),s(l,T,a),s(l,G,a),s(l,Y,a),s(l,C,a),s(l,N,a),s(l,B,a),s(l,W,a),s(l,k,a),s(l,ml,a),s(l,S,a),s(l,cl,a),s(l,Q,a),s(l,Ml,a),s(l,v,a),s(l,dl,a),s(l,$,a),s(l,Jl,a),U(D,l,a),s(l,ul,a),U(z,l,a),s(l,hl,a),s(l,A,a),s(l,yl,a),s(l,H,a),s(l,Tl,a),s(l,x,a),s(l,wl,a),U(V,l,a),s(l,bl,a),U(L,l,a),s(l,fl,a),s(l,q,a),s(l,Ul,a),U(K,l,a),s(l,Zl,a),s(l,P,a),s(l,jl,a),s(l,O,a),s(l,gl,a),s(l,E,a),s(l,Wl,a),U(ll,l,a),s(l,Il,a),s(l,el,a),s(l,Gl,a),U(sl,l,a),s(l,Cl,a),s(l,al,a),s(l,Bl,a),U(F,l,a),s(l,_l,a),U(tl,l,a),s(l,Rl,a),s(l,il,a),Xl=!0},p(l,[a]){const xl={};a&2&&(xl.$$scope={dirty:a,ctx:l}),V.$set(xl);const Ll={};a&2&&(Ll.$$scope={dirty:a,ctx:l}),F.$set(Ll)},i(l){Xl||(Z(i.$$.fragment,l),Z(p.$$.fragment,l),Z(r.$$.fragment,l),Z(D.$$.fragment,l),Z(z.$$.fragment,l),Z(V.$$.fragment,l),Z(L.$$.fragment,l),Z(K.$$.fragment,l),Z(ll.$$.fragment,l),Z(sl.$$.fragment,l),Z(F.$$.fragment,l),Z(tl.$$.fragment,l),Xl=!0)},o(l){j(i.$$.fragment,l),j(p.$$.fragment,l),j(r.$$.fragment,l),j(D.$$.fragment,l),j(z.$$.fragment,l),j(V.$$.fragment,l),j(L.$$.fragment,l),j(K.$$.fragment,l),j(ll.$$.fragment,l),j(sl.$$.fragment,l),j(F.$$.fragment,l),j(tl.$$.fragment,l),Xl=!1},d(l){l&&(e(u),e(o),e(d),e(n),e(J),e(T),e(G),e(Y),e(C),e(N),e(B),e(W),e(k),e(ml),e(S),e(cl),e(Q),e(Ml),e(v),e(dl),e($),e(Jl),e(ul),e(hl),e(A),e(yl),e(H),e(Tl),e(x),e(wl),e(bl),e(fl),e(q),e(Ul),e(Zl),e(P),e(jl),e(O),e(gl),e(E),e(Wl),e(Il),e(el),e(Gl),e(Cl),e(al),e(Bl),e(_l),e(Rl),e(il)),e(t),g(i,l),g(p,l),g(r,l),g(D,l),g(z,l),g(V,l),g(L,l),g(K,l),g(ll,l),g(sl,l),g(F,l),g(tl,l)}}}const ue='{"title":"Trajectory Consistency Distillation-LoRA","local":"trajectory-consistency-distillation-lora","sections":[{"title":"General tasks","local":"general-tasks","sections":[],"depth":2},{"title":"Community models","local":"community-models","sections":[],"depth":2},{"title":"Adapters","local":"adapters","sections":[{"title":"Depth ControlNet","local":"depth-controlnet","sections":[],"depth":3},{"title":"Canny ControlNet","local":"canny-controlnet","sections":[],"depth":3}],"depth":2}],"depth":1}';function he(I){return Ol(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class je extends le{constructor(t){super(),ee(this,t,he,Je,Pl,{})}}export{je as component};
