import{S as V1,i as N1,s as $1,e as o,k as r,w as f,t as a,M as P1,c as l,d as t,m as p,a as i,x as u,h as s,b as c,N as S1,G as e,g as m,y as h,q as _,o as y,B as b,v as Q1,L as js}from"../../../chunks/vendor-hf-doc-builder.js";import{D as x}from"../../../chunks/Docstring-hf-doc-builder.js";import{C as S}from"../../../chunks/CodeBlock-hf-doc-builder.js";import{I as N}from"../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Zs}from"../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Y1(P){let w,X,C,M,R;return M=new S({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGUGlwZWxpbmUlMkMlMjBJRlN1cGVyUmVzb2x1dGlvblBpcGVsaW5lJTJDJTIwRGlmZnVzaW9uUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwcHRfdG9fcGlsJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlJTIwJTNEJTIwSUZQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyRGVlcEZsb3lkJTJGSUYtSS1YTC12MS4wJTIyJTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQXByb21wdCUyMCUzRCUyMCdhJTIwcGhvdG8lMjBvZiUyMGElMjBrYW5nYXJvbyUyMHdlYXJpbmclMjBhbiUyMG9yYW5nZSUyMGhvb2RpZSUyMGFuZCUyMGJsdWUlMjBzdW5nbGFzc2VzJTIwc3RhbmRpbmclMjBpbiUyMGZyb250JTIwb2YlMjB0aGUlMjBlaWZmZWwlMjB0b3dlciUyMGhvbGRpbmclMjBhJTIwc2lnbiUyMHRoYXQlMjBzYXlzJTIwJTIydmVyeSUyMGRlZXAlMjBsZWFybmluZyUyMiclMEFwcm9tcHR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aW50ZXJtZWRpYXRlJTIwaW1hZ2UlMEFwaWxfaW1hZ2UlMjAlM0QlMjBwdF90b19waWwoaW1hZ2UpJTBBcGlsX2ltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JLnBuZyUyMiklMEElMEFzYWZldHlfbW9kdWxlcyUyMCUzRCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMmZlYXR1cmVfZXh0cmFjdG9yJTIyJTNBJTIwcGlwZS5mZWF0dXJlX2V4dHJhY3RvciUyQyUwQSUyMCUyMCUyMCUyMCUyMnNhZmV0eV9jaGVja2VyJTIyJTNBJTIwcGlwZS5zYWZldHlfY2hlY2tlciUyQyUwQSUyMCUyMCUyMCUyMCUyMndhdGVybWFya2VyJTIyJTNBJTIwcGlwZS53YXRlcm1hcmtlciUyQyUwQSU3RCUwQXN1cGVyX3Jlc18yX3BpcGUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXg0LXVwc2NhbGVyJTIyJTJDJTIwKipzYWZldHlfbW9kdWxlcyUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEFzdXBlcl9yZXNfMl9waXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBaW1hZ2UlMjAlM0QlMjBzdXBlcl9yZXNfMl9waXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMGltYWdlJTNEaW1hZ2UlMkMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> IFPipeline, IFSuperResolutionPipeline, DiffusionPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> pt_to_pil
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = IFPipeline.from_pretrained(<span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.enable_model_cpu_offload()

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&#x27;a photo of a kangaroo wearing an orange hoodie and blue sunglasses standing in front of the eiffel tower holding a sign that says &quot;very deep learning&quot;&#x27;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt_embeds, negative_embeds = pipe.encode_prompt(prompt)

<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(prompt_embeds=prompt_embeds, negative_prompt_embeds=negative_embeds, output_type=<span class="hljs-string">&quot;pt&quot;</span>).images

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># save intermediate image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pil_image = pt_to_pil(image)
<span class="hljs-meta">&gt;&gt;&gt; </span>pil_image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_I.png&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>super_res_1_pipe = IFSuperResolutionPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;DeepFloyd/IF-II-L-v1.0&quot;</span>, text_encoder=<span class="hljs-literal">None</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>super_res_1_pipe.enable_model_cpu_offload()

<span class="hljs-meta">&gt;&gt;&gt; </span>image = super_res_1_pipe(
<span class="hljs-meta">... </span>    image=image, prompt_embeds=prompt_embeds, negative_prompt_embeds=negative_embeds, output_type=<span class="hljs-string">&quot;pt&quot;</span>
<span class="hljs-meta">... </span>).images

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># save intermediate image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pil_image = pt_to_pil(image)
<span class="hljs-meta">&gt;&gt;&gt; </span>pil_image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_I.png&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>safety_modules = {
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;feature_extractor&quot;</span>: pipe.feature_extractor,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;safety_checker&quot;</span>: pipe.safety_checker,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;watermarker&quot;</span>: pipe.watermarker,
<span class="hljs-meta">... </span>}
<span class="hljs-meta">&gt;&gt;&gt; </span>super_res_2_pipe = DiffusionPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;stabilityai/stable-diffusion-x4-upscaler&quot;</span>, **safety_modules, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>super_res_2_pipe.enable_model_cpu_offload()

<span class="hljs-meta">&gt;&gt;&gt; </span>image = super_res_2_pipe(
<span class="hljs-meta">... </span>    prompt=prompt,
<span class="hljs-meta">... </span>    image=image,
<span class="hljs-meta">... </span>).images
<span class="hljs-meta">&gt;&gt;&gt; </span>image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_II.png&quot;</span>)`}}),{c(){w=o("p"),X=a("Examples:"),C=r(),f(M.$$.fragment)},l(g){w=l(g,"P",{});var G=i(w);X=s(G,"Examples:"),G.forEach(t),C=p(g),u(M.$$.fragment,g)},m(g,G){m(g,w,G),e(w,X),m(g,C,G),h(M,g,G),R=!0},p:js,i(g){R||(_(M.$$.fragment,g),R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JDJTIwb3V0cHV0X3R5cGUlM0QlMjJwdCUyMikuaW1hZ2VzJTBBJTBBJTIzJTIwc2F2ZSUyMGludGVybWVkaWF0ZSUyMGltYWdlJTBBcGlsX2ltYWdlJTIwJTNEJTIwcHRfdG9fcGlsKGltYWdlKSUwQXBpbF9pbWFnZSU1QjAlNUQuc2F2ZSglMjIuJTJGaWZfc3RhZ2VfSS5wbmclMjIpJTBBJTBBc3VwZXJfcmVzXzFfcGlwZSUyMCUzRCUyMElGU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMkRlZXBGbG95ZCUyRklGLUlJLUwtdjEuMCUyMiUyQyUyMHRleHRfZW5jb2RlciUzRE5vbmUlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEFzdXBlcl9yZXNfMV9waXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBaW1hZ2UlMjAlM0QlMjBzdXBlcl9yZXNfMV9waXBlKCUwQSUyMCUyMCUyMCUyMGltYWdlJTNEaW1hZ2UlMkMlMjBwcm9tcHRfZW1iZWRzJTNEcHJvbXB0X2VtYmVkcyUyQyUyMG5lZ2F0aXZlX3Byb21wdF9lbWJlZHMlM0RuZWdhdGl2ZV9lbWJlZHMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> IFPipeline, IFSuperResolutionPipeline, DiffusionPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> pt_to_pil
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = IFPipeline.from_pretrained(<span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.enable_model_cpu_offload()

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&#x27;a photo of a kangaroo wearing an orange hoodie and blue sunglasses standing in front of the eiffel tower holding a sign that says &quot;very deep learning&quot;&#x27;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt_embeds, negative_embeds = pipe.encode_prompt(prompt)

<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(prompt_embeds=prompt_embeds, negative_prompt_embeds=negative_embeds, output_type=<span class="hljs-string">&quot;pt&quot;</span>).images

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># save intermediate image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pil_image = pt_to_pil(image)
<span class="hljs-meta">&gt;&gt;&gt; </span>pil_image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_I.png&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>super_res_1_pipe = IFSuperResolutionPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;DeepFloyd/IF-II-L-v1.0&quot;</span>, text_encoder=<span class="hljs-literal">None</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>super_res_1_pipe.enable_model_cpu_offload()

<span class="hljs-meta">&gt;&gt;&gt; </span>image = super_res_1_pipe(
<span class="hljs-meta">... </span>    image=image, prompt_embeds=prompt_embeds, negative_prompt_embeds=negative_embeds
<span class="hljs-meta">... </span>).images
<span class="hljs-meta">&gt;&gt;&gt; </span>image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_II.png&quot;</span>)`}}),{c(){w=o("p"),X=a("Examples:"),C=r(),f(M.$$.fragment)},l(g){w=l(g,"P",{});var G=i(w);X=s(G,"Examples:"),G.forEach(t),C=p(g),u(M.$$.fragment,g)},m(g,G){m(g,w,G),e(w,X),m(g,C,G),h(M,g,G),R=!0},p:js,i(g){R||(_(M.$$.fragment,g),R=!0)},o(g){y(M.$$.fragment,g),R=!1},d(g){g&&t(w),g&&t(C),b(M,g)}}}function z1(P){let w,X,C,M,R;return M=new S({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW1nMkltZ1BpcGVsaW5lJTJDJTIwSUZJbWcySW1nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUlMkMlMjBEaWZmdXNpb25QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBwdF90b19waWwlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSUyRkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uJTJGbWFpbiUyRmFzc2V0cyUyRnN0YWJsZS1zYW1wbGVzJTJGaW1nMmltZyUyRnNrZXRjaC1tb3VudGFpbnMtaW5wdXQuanBnJTIyJTBBcmVzcG9uc2UlMjAlM0QlMjByZXF1ZXN0cy5nZXQodXJsKSUwQW9yaWdpbmFsX2ltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihCeXRlc0lPKHJlc3BvbnNlLmNvbnRlbnQpKS5jb252ZXJ0KCUyMlJHQiUyMiklMEFvcmlnaW5hbF9pbWFnZSUyMCUzRCUyMG9yaWdpbmFsX2ltYWdlLnJlc2l6Z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b25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyRGVlcEZsb3lkJTJGSUYtSUktTC12MS4wJTIyJTJDJTBBJTIwJTIwJTIwJTIwdGV4dF9lbmNvZGVyJTNETm9uZSUyQyUwQSUyMCUyMCUyMCUyMHZhcmlhbnQlM0QlMjJmcDE2JTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTBBKSUwQXN1cGVyX3Jlc18xX3BpcGUuZW5hYmxlX21vZGVsX2NwdV9vZmZsb2FkKCklMEElMEFpbWFnZSUyMCUzRCUyMHN1cGVyX3Jlc18xX3BpcGUoJTBBJTIwJTIwJTIwJTIwaW1hZ2UlM0RpbWFnZSUyQyUwQSUyMCUyMCUyMCUyMG9yaWdpbmFsX2ltYWdlJTNEb3JpZ2luYWxfaW1hZ2UlMkMlMEElMjAlMjAlMjAlMjBwcm9tcHRfZW1iZWRzJTNEcHJvbXB0X2VtYmVkcyUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX3Byb21wdF9lbWJlZHMlM0RuZWdhdGl2ZV9lbWJlZHMlMkMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> IFImg2ImgPipeline, IFImg2ImgSuperResolutionPipeline, DiffusionPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> pt_to_pil
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>response = requests.get(url)
<span class="hljs-meta">&gt;&gt;&gt; </span>original_image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>original_image = original_image.resize((<span class="hljs-number">768</span>, <span class="hljs-number">512</span>))

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = IFImg2ImgPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>,
<span class="hljs-meta">... </span>    variant=<span class="hljs-string">&quot;fp16&quot;</span>,
<span class="hljs-meta">... </span>    torch_dtype=torch.float16,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.enable_model_cpu_offload()

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;A fantasy landscape in style minecraft&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt_embeds, negative_embeds = pipe.encode_prompt(prompt)

<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(
<span class="hljs-meta">... </span>    image=original_image,
<span class="hljs-meta">... </span>    prompt_embeds=prompt_embeds,
<span class="hljs-meta">... </span>    negative_prompt_embeds=negative_embeds,
<span class="hljs-meta">... </span>    output_type=<span class="hljs-string">&quot;pt&quot;</span>,
<span class="hljs-meta">... </span>).images

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># save intermediate image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pil_image = pt_to_pil(image)
<span class="hljs-meta">&gt;&gt;&gt; </span>pil_image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_I.png&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>super_res_1_pipe = IFImg2ImgSuperResolutionPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;DeepFloyd/IF-II-L-v1.0&quot;</span>,
<span class="hljs-meta">... </span>    text_encoder=<span class="hljs-literal">None</span>,
<span class="hljs-meta">... </span>    variant=<span class="hljs-string">&quot;fp16&quot;</span>,
<span class="hljs-meta">... </span>    torch_dtype=torch.float16,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>super_res_1_pipe.enable_model_cpu_offload()

<span class="hljs-meta">&gt;&gt;&gt; </span>image = super_res_1_pipe(
<span class="hljs-meta">... </span>    image=image,
<span class="hljs-meta">... </span>    original_image=original_image,
<span class="hljs-meta">... </span>    prompt_embeds=prompt_embeds,
<span class="hljs-meta">... </span>    negative_prompt_embeds=negative_embeds,
<span class="hljs-meta">... </span>).images
<span class="hljs-meta">&gt;&gt;&gt; </span>image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_II.png&quot;</span>)`}}),{c(){w=o("p"),X=a("Examples:"),C=r(),f(M.$$.fragment)},l(g){w=l(g,"P",{});var G=i(w);X=s(G,"Examples:"),G.forEach(t),C=p(g),u(M.$$.fragment,g)},m(g,G){m(g,w,G),e(w,X),m(g,C,G),h(M,g,G),R=!0},p:js,i(g){R||(_(M.$$.fragment,g),R=!0)},o(g){y(M.$$.fragment,g),R=!1},d(g){g&&t(w),g&&t(C),b(M,g)}}}function H1(P){let w,X,C,M,R;return M=new S({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW1nMkltZ1BpcGVsaW5lJTJDJTIwSUZJbWcySW1nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUlMkMlMjBEaWZmdXNpb25QaXBlbGluZSUwQWZyb20lMjBkaWZmdXN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yMG9yaWdpbmFsX2ltYWdlJTNEb3JpZ2luYWxfaW1hZ2UlMkMlMEElMjAlMjAlMjAlMjBwcm9tcHRfZW1iZWRzJTNEcHJvbXB0X2VtYmVkcyUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX3Byb21wdF9lbWJlZHMlM0RuZWdhdGl2ZV9lbWJlZHMlMkMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> IFImg2ImgPipeline, IFImg2ImgSuperResolutionPipeline, DiffusionPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> pt_to_pil
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>response = requests.get(url)
<span class="hljs-meta">&gt;&gt;&gt; </span>original_image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>original_image = original_image.resize((<span class="hljs-number">768</span>, <span class="hljs-number">512</span>))

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = IFImg2ImgPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>,
<span class="hljs-meta">... </span>    variant=<span class="hljs-string">&quot;fp16&quot;</span>,
<span class="hljs-meta">... </span>    torch_dtype=torch.float16,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.enable_model_cpu_offload()

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;A fantasy landscape in style minecraft&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt_embeds, negative_embeds = pipe.encode_prompt(prompt)

<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(
<span class="hljs-meta">... </span>    image=original_image,
<span class="hljs-meta">... </span>    prompt_embeds=prompt_embeds,
<span class="hljs-meta">... </span>    negative_prompt_embeds=negative_embeds,
<span class="hljs-meta">... </span>    output_type=<span class="hljs-string">&quot;pt&quot;</span>,
<span class="hljs-meta">... </span>).images

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># save intermediate image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pil_image = pt_to_pil(image)
<span class="hljs-meta">&gt;&gt;&gt; </span>pil_image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_I.png&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>super_res_1_pipe = IFImg2ImgSuperResolutionPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;DeepFloyd/IF-II-L-v1.0&quot;</span>,
<span class="hljs-meta">... </span>    text_encoder=<span class="hljs-literal">None</span>,
<span class="hljs-meta">... </span>    variant=<span class="hljs-string">&quot;fp16&quot;</span>,
<span class="hljs-meta">... </span>    torch_dtype=torch.float16,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>super_res_1_pipe.enable_model_cpu_offload()

<span class="hljs-meta">&gt;&gt;&gt; </span>image = super_res_1_pipe(
<span class="hljs-meta">... </span>    image=image,
<span class="hljs-meta">... </span>    original_image=original_image,
<span class="hljs-meta">... </span>    prompt_embeds=prompt_embeds,
<span class="hljs-meta">... </span>    negative_prompt_embeds=negative_embeds,
<span class="hljs-meta">... </span>).images
<span class="hljs-meta">&gt;&gt;&gt; </span>image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_II.png&quot;</span>)`}}),{c(){w=o("p"),X=a("Examples:"),C=r(),f(M.$$.fragment)},l(g){w=l(g,"P",{});var G=i(w);X=s(G,"Examples:"),G.forEach(t),C=p(g),u(M.$$.fragment,g)},m(g,G){m(g,w,G),e(w,X),m(g,C,G),h(M,g,G),R=!0},p:js,i(g){R||(_(M.$$.fragment,g),R=!0)},o(g){y(M.$$.fragment,g),R=!1},d(g){g&&t(w),g&&t(C),b(M,g)}}}function q1(P){let w,X,C,M,R;return M=new S({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW5wYWludGluZ1BpcGVsaW5lJTJDJTIwSUZJbnBhaW50aW5nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUlMkMlMjBEaWZmdXNpb25QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBwdF90b19waWwlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmRpZmZ1c2VycyUyRmRvY3MtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZpZiUyRnBlcnNvbi5wbmclMjIlMEFyZXNwb25zZSUyMCUzRCUyMHJlcXVlc3RzLmdldCh1cmwpJTBBb3JpZ2luYWxfaW1hZ2UlMjAlM0QlMjBJbWFnZS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9lbWJlZHMlMkMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, DiffusionPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> pt_to_pil
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://huggingface.co/datasets/diffusers/docs-images/resolve/main/if/person.png&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>response = requests.get(url)
<span class="hljs-meta">&gt;&gt;&gt; </span>original_image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>original_image = original_image

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://huggingface.co/datasets/diffusers/docs-images/resolve/main/if/glasses_mask.png&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>response = requests.get(url)
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content))
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_image = mask_image

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = IFInpaintingPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.enable_model_cpu_offload()

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;blue sunglasses&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt_embeds, negative_embeds = pipe.encode_prompt(prompt)

<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(
<span class="hljs-meta">... </span>    image=original_image,
<span class="hljs-meta">... </span>    mask_image=mask_image,
<span class="hljs-meta">... </span>    prompt_embeds=prompt_embeds,
<span class="hljs-meta">... </span>    negative_prompt_embeds=negative_embeds,
<span class="hljs-meta">... </span>    output_type=<span class="hljs-string">&quot;pt&quot;</span>,
<span class="hljs-meta">... </span>).images

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># save intermediate image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pil_image = pt_to_pil(image)
<span class="hljs-meta">&gt;&gt;&gt; </span>pil_image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_I.png&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>super_res_1_pipe = IFInpaintingSuperResolutionPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;DeepFloyd/IF-II-L-v1.0&quot;</span>, text_encoder=<span class="hljs-literal">None</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>super_res_1_pipe.enable_model_cpu_offload()

<span class="hljs-meta">&gt;&gt;&gt; </span>image = super_res_1_pipe(
<span class="hljs-meta">... </span>    image=image,
<span class="hljs-meta">... </span>    mask_image=mask_image,
<span class="hljs-meta">... </span>    original_image=original_image,
<span class="hljs-meta">... </span>    prompt_embeds=prompt_embeds,
<span class="hljs-meta">... </span>    negative_prompt_embeds=negative_embeds,
<span class="hljs-meta">... </span>).images
<span class="hljs-meta">&gt;&gt;&gt; </span>image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_II.png&quot;</span>)`}}),{c(){w=o("p"),X=a("Examples:"),C=r(),f(M.$$.fragment)},l(g){w=l(g,"P",{});var G=i(w);X=s(G,"Examples:"),G.forEach(t),C=p(g),u(M.$$.fragment,g)},m(g,G){m(g,w,G),e(w,X),m(g,C,G),h(M,g,G),R=!0},p:js,i(g){R||(_(M.$$.fragment,g),R=!0)},o(g){y(M.$$.fragment,g),R=!1},d(g){g&&t(w),g&&t(C),b(M,g)}}}function L1(P){let w,X,C,M,R;return M=new S({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW5wYWludGluZ1BpcGVsaW5lJTJDJTIwSUZJbnBhaW50aW5nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUlMkMlMjBEaWZmdXNpb25QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBwdF90b19waWwlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmRpZmZ1c2VycyUyRmRvY3MtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZpZiUyRnBlcnNvbi5wbmclMjIlMEFyZXNwb25zZSUyMCUzRCUyMHJlcXVlc3RzLmdldCh1cmwpJTBBb3JpZ2luYWxfaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKEJ5dGVzSU8ocmVzcG9uc2UuY29udGVudCkpLmNvbnZlcnQo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KCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, DiffusionPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> pt_to_pil
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://huggingface.co/datasets/diffusers/docs-images/resolve/main/if/person.png&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>response = requests.get(url)
<span class="hljs-meta">&gt;&gt;&gt; </span>original_image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>original_image = original_image

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://huggingface.co/datasets/diffusers/docs-images/resolve/main/if/glasses_mask.png&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>response = requests.get(url)
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content))
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_image = mask_image

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = IFInpaintingPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.enable_model_cpu_offload()

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;blue sunglasses&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt_embeds, negative_embeds = pipe.encode_prompt(prompt)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(
<span class="hljs-meta">... </span>    image=original_image,
<span class="hljs-meta">... </span>    mask_image=mask_image,
<span class="hljs-meta">... </span>    prompt_embeds=prompt_embeds,
<span class="hljs-meta">... </span>    negative_prompt_embeds=negative_embeds,
<span class="hljs-meta">... </span>    output_type=<span class="hljs-string">&quot;pt&quot;</span>,
<span class="hljs-meta">... </span>).images

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># save intermediate image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pil_image = pt_to_pil(image)
<span class="hljs-meta">&gt;&gt;&gt; </span>pil_image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_I.png&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>super_res_1_pipe = IFInpaintingSuperResolutionPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;DeepFloyd/IF-II-L-v1.0&quot;</span>, text_encoder=<span class="hljs-literal">None</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>super_res_1_pipe.enable_model_cpu_offload()

<span class="hljs-meta">&gt;&gt;&gt; </span>image = super_res_1_pipe(
<span class="hljs-meta">... </span>    image=image,
<span class="hljs-meta">... </span>    mask_image=mask_image,
<span class="hljs-meta">... </span>    original_image=original_image,
<span class="hljs-meta">... </span>    prompt_embeds=prompt_embeds,
<span class="hljs-meta">... </span>    negative_prompt_embeds=negative_embeds,
<span class="hljs-meta">... </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:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGxvZ2luJTBBJTBBbG9naW4oKQ==",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> login

login()`}}),Ot=new S({props:{code:"cGlwJTIwaW5zdGFsbCUyMGRpZmZ1c2VycyUyMGFjY2VsZXJhdGUlMjB0cmFuc2Zvcm1lcnMlMjBzYWZldGVuc29ycw==",highlighted:"pip install diffusers accelerate transformers safetensors"}}),mn=new N({}),fn=new S({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMHB0X3RvX3BpbCUwQWltcG9ydCUyMHRvcmNoJTBBJTBBJTIzJTIwc3RhZ2UlMjAxJTBBc3RhZ2VfMSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJEZWVwRmxveWQlMkZJRi1JLVhMLXYxLjAlMjIlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFzdGFnZV8xLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBJTIzJTIwc3RhZ2UlMjAyJTBBc3RhZ2VfMiUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJEZWVwRmxveWQlMkZJRi1JSS1MLXYxLjAlMjIlMkMlMjB0ZXh0X2VuY29kZXIlM0ROb25lJTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMEEpJTBBc3RhZ2VfMi5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQSUyMyUyMHN0YWdl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5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSUkucG5nJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> pt_to_pil
<span class="hljs-keyword">import</span> torch

<span class="hljs-comment"># stage 1</span>
stage_1 = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16)
stage_1.enable_model_cpu_offload()

<span class="hljs-comment"># stage 2</span>
stage_2 = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;DeepFloyd/IF-II-L-v1.0&quot;</span>, text_encoder=<span class="hljs-literal">None</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16
)
stage_2.enable_model_cpu_offload()

<span class="hljs-comment"># stage 3</span>
safety_modules = {
    <span class="hljs-string">&quot;feature_extractor&quot;</span>: stage_1.feature_extractor,
    <span class="hljs-string">&quot;safety_checker&quot;</span>: stage_1.safety_checker,
    <span class="hljs-string">&quot;watermarker&quot;</span>: stage_1.watermarker,
}
stage_3 = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-x4-upscaler&quot;</span>, **safety_modules, torch_dtype=torch.float16
)
stage_3.enable_model_cpu_offload()

prompt = <span class="hljs-string">&#x27;a photo of a kangaroo wearing an orange hoodie and blue sunglasses standing in front of the eiffel tower holding a sign that says &quot;very deep learning&quot;&#x27;</span>
generator = torch.manual_seed(<span class="hljs-number">1</span>)

<span class="hljs-comment"># text embeds</span>
prompt_embeds, negative_embeds = stage_1.encode_prompt(prompt)

<span class="hljs-comment"># stage 1</span>
image = stage_1(
    prompt_embeds=prompt_embeds, negative_prompt_embeds=negative_embeds, generator=generator, output_type=<span class="hljs-string">&quot;pt&quot;</span>
).images
pt_to_pil(image)[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_I.png&quot;</span>)

<span class="hljs-comment"># stage 2</span>
image = stage_2(
    image=image,
    prompt_embeds=prompt_embeds,
    negative_prompt_embeds=negative_embeds,
    generator=generator,
    output_type=<span class="hljs-string">&quot;pt&quot;</span>,
).images
pt_to_pil(image)[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_II.png&quot;</span>)

<span class="hljs-comment"># stage 3</span>
image = stage_3(prompt=prompt, image=image, noise_level=<span class="hljs-number">100</span>, generator=generator).images
image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_III.png&quot;</span>)`}}),un=new N({}),hn=new S({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW1nMkltZ1BpcGVsaW5lJTJDJTIwSUZJbWcySW1nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUlMkMlMjBEaWZmdXNpb25QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBwdF90b19waWwlMEElMEFpbXBvcnQlMjB0b3JjaCUwQSUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQSUwQSUyMyUyMGRvd25sb2FkJTIwaW1hZ2UlMEF1cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRnJhdy5naXRodWJ1c2VyY29udGVudC5jb20lMkZDb21wVmlzJTJGc3RhYmxlLWRpZmZ1c2lvbiUyRm1haW4lMkZhc3NldHMlMkZzdGFibGUtc2FtcGxlcyUyRmltZzJpbWclMkZza2V0Y2gtbW91bnRhaW5zLWlucHV0LmpwZyUyMiUwQXJlc3BvbnNlJTIwJTNEJTIwcmVxdWVzdHMuZ2V0KHVybCklMEFvcmlnaW5hbF9pbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4oQnl0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lX0kucG5nJTIyKSUwQSUwQSUyMyUyMHN0YWdlJTIwMiUwQWltYWdlJTIwJTNEJTIwc3RhZ2VfMiglMEElMjAlMjAlMjAlMjBpbWFnZSUzRGltYWdlJTJDJTBBJTIwJTIwJTIwJTIwb3JpZ2luYWxfaW1hZ2UlM0RvcmlnaW5hbF9pbWFnZSUyQyUwQSUyMCUyMCUyMCUyMHByb21wdF9lbWJlZHMlM0Rwcm9tcHRfZW1iZWRzJTJDJTBBJTIwJTIwJTIwJTIwbmVnYXRpdmVfcHJvbXB0X2VtYmVkcyUzRG5lZ2F0aXZlX2VtYmVkcyUyQyUwQSUyMCUyMCUyMCUyMGdlbmVyYXRvciUzRGdlbmVyYXRvciUyQyUwQSUyMCUyMCUyMCUyMG91dHB1dF90eXBlJTNEJTIycHQlMjIlMkMlMEEpLmltYWdlcyUwQXB0X3RvX3BpbChpbWFnZSklNUIwJTVELnNhdmUoJTIyLiUyRmlmX3N0YWdlX0lJLnBuZyUyMiklMEElMEElMjMlMjBzdGFnZSUyMDMlMEFpbWFnZSUyMCUzRCUyMHN0YWdlXzMocHJvbXB0JTNEcHJvbXB0JTJDJTIwaW1hZ2UlM0RpbWFnZSUyQyUyMGdlbmVyYXRvciUzRGdlbmVyYXRvciUyQyUyMG5vaXNlX2xldmVsJTNEMTAwKS5pbWFnZXMlMEFpbWFnZSU1QjAlNUQuc2F2ZSglMjIuJTJGaWZfc3RhZ2VfSUlJLnBuZyUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> IFImg2ImgPipeline, IFImg2ImgSuperResolutionPipeline, DiffusionPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> pt_to_pil

<span class="hljs-keyword">import</span> torch

<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-keyword">import</span> requests
<span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO

<span class="hljs-comment"># download image</span>
url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg&quot;</span>
response = requests.get(url)
original_image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
original_image = original_image.resize((<span class="hljs-number">768</span>, <span class="hljs-number">512</span>))

<span class="hljs-comment"># stage 1</span>
stage_1 = IFImg2ImgPipeline.from_pretrained(<span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16)
stage_1.enable_model_cpu_offload()

<span class="hljs-comment"># stage 2</span>
stage_2 = IFImg2ImgSuperResolutionPipeline.from_pretrained(
    <span class="hljs-string">&quot;DeepFloyd/IF-II-L-v1.0&quot;</span>, text_encoder=<span class="hljs-literal">None</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16
)
stage_2.enable_model_cpu_offload()

<span class="hljs-comment"># stage 3</span>
safety_modules = {
    <span class="hljs-string">&quot;feature_extractor&quot;</span>: stage_1.feature_extractor,
    <span class="hljs-string">&quot;safety_checker&quot;</span>: stage_1.safety_checker,
    <span class="hljs-string">&quot;watermarker&quot;</span>: stage_1.watermarker,
}
stage_3 = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-x4-upscaler&quot;</span>, **safety_modules, torch_dtype=torch.float16
)
stage_3.enable_model_cpu_offload()

prompt = <span class="hljs-string">&quot;A fantasy landscape in style minecraft&quot;</span>
generator = torch.manual_seed(<span class="hljs-number">1</span>)

<span class="hljs-comment"># text embeds</span>
prompt_embeds, negative_embeds = stage_1.encode_prompt(prompt)

<span class="hljs-comment"># stage 1</span>
image = stage_1(
    image=original_image,
    prompt_embeds=prompt_embeds,
    negative_prompt_embeds=negative_embeds,
    generator=generator,
    output_type=<span class="hljs-string">&quot;pt&quot;</span>,
).images
pt_to_pil(image)[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_I.png&quot;</span>)

<span class="hljs-comment"># stage 2</span>
image = stage_2(
    image=image,
    original_image=original_image,
    prompt_embeds=prompt_embeds,
    negative_prompt_embeds=negative_embeds,
    generator=generator,
    output_type=<span class="hljs-string">&quot;pt&quot;</span>,
).images
pt_to_pil(image)[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_II.png&quot;</span>)

<span class="hljs-comment"># stage 3</span>
image = stage_3(prompt=prompt, image=image, generator=generator, noise_level=<span class="hljs-number">100</span>).images
image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_III.png&quot;</span>)`}}),_n=new N({}),yn=new S({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW5wYWludGluZ1BpcGVsaW5lJTJDJTIwSUZJbnBhaW50aW5nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUlMkMlMjBEaWZmdXNpb25QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBwdF90b19waWwlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQSUwQSUyMyUyMGRvd25sb2FkJTIwaW1hZ2UlMEF1cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZkaWZmdXNlcnMlMkZkb2NzLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGaWYlMkZwZXJzb24ucG5nJTIyJTBBcmVzcG9uc2UlMjAlM0QlMjByZXF1ZXN0cy5nZXQodXJsKSUwQW9yaWdpbmFsX2ltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihCeXRlc0lPKHJlc3BvbnNlLmNvbnRlbn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mVyYXRvciUzRGdlbmVyYXRvciUyQyUyMG5vaXNlX2xldmVsJTNEMTAwKS5pbWFnZXMlMEFpbWFnZSU1QjAlNUQuc2F2ZSglMjIuJTJGaWZfc3RhZ2VfSUlJLnBuZyUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, DiffusionPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> pt_to_pil
<span class="hljs-keyword">import</span> torch

<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-keyword">import</span> requests
<span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO

<span class="hljs-comment"># download image</span>
url = <span class="hljs-string">&quot;https://huggingface.co/datasets/diffusers/docs-images/resolve/main/if/person.png&quot;</span>
response = requests.get(url)
original_image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
original_image = original_image

<span class="hljs-comment"># download mask</span>
url = <span class="hljs-string">&quot;https://huggingface.co/datasets/diffusers/docs-images/resolve/main/if/glasses_mask.png&quot;</span>
response = requests.get(url)
mask_image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content))
mask_image = mask_image

<span class="hljs-comment"># stage 1</span>
stage_1 = IFInpaintingPipeline.from_pretrained(<span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16)
stage_1.enable_model_cpu_offload()

<span class="hljs-comment"># stage 2</span>
stage_2 = IFInpaintingSuperResolutionPipeline.from_pretrained(
    <span class="hljs-string">&quot;DeepFloyd/IF-II-L-v1.0&quot;</span>, text_encoder=<span class="hljs-literal">None</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16
)
stage_2.enable_model_cpu_offload()

<span class="hljs-comment"># stage 3</span>
safety_modules = {
    <span class="hljs-string">&quot;feature_extractor&quot;</span>: stage_1.feature_extractor,
    <span class="hljs-string">&quot;safety_checker&quot;</span>: stage_1.safety_checker,
    <span class="hljs-string">&quot;watermarker&quot;</span>: stage_1.watermarker,
}
stage_3 = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-x4-upscaler&quot;</span>, **safety_modules, torch_dtype=torch.float16
)
stage_3.enable_model_cpu_offload()

prompt = <span class="hljs-string">&quot;blue sunglasses&quot;</span>
generator = torch.manual_seed(<span class="hljs-number">1</span>)

<span class="hljs-comment"># text embeds</span>
prompt_embeds, negative_embeds = stage_1.encode_prompt(prompt)

<span class="hljs-comment"># stage 1</span>
image = stage_1(
    image=original_image,
    mask_image=mask_image,
    prompt_embeds=prompt_embeds,
    negative_prompt_embeds=negative_embeds,
    generator=generator,
    output_type=<span class="hljs-string">&quot;pt&quot;</span>,
).images
pt_to_pil(image)[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_I.png&quot;</span>)

<span class="hljs-comment"># stage 2</span>
image = stage_2(
    image=image,
    original_image=original_image,
    mask_image=mask_image,
    prompt_embeds=prompt_embeds,
    negative_prompt_embeds=negative_embeds,
    generator=generator,
    output_type=<span class="hljs-string">&quot;pt&quot;</span>,
).images
pt_to_pil(image)[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_II.png&quot;</span>)

<span class="hljs-comment"># stage 3</span>
image = stage_3(prompt=prompt, image=image, generator=generator, noise_level=<span class="hljs-number">100</span>).images
image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_III.png&quot;</span>)`}}),bn=new N({}),Mn=new S({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGUGlwZWxpbmUlMkMlMjBJRlN1cGVyUmVzb2x1dGlvblBpcGVsaW5lJTBBJTBBcGlwZV8xJTIwJTNEJTIwSUZQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyRGVlcEZsb3lkJTJGSUYtSS1YTC12MS4wJTIyKSUwQXBpcGVfMiUyMCUzRCUyMElGU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMkRlZXBGbG95ZCUyRklGLUlJLUwtdjEuMCUyMiklMEElMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwSUZJbWcySW1nUGlwZWxpbmUlMkMlMjBJRkltZzJJbWdTdXBlclJlc29sdXRpb25QaXBlbGluZSUwQSUwQXBpcGVfMSUyMCUzRCUyMElGSW1nMkltZ1BpcGVsaW5lKCoqcGlwZV8xLmNvbXBvbmVudHMpJTBBcGlwZV8yJTIwJTNEJTIwSUZJbWcySW1nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUoKipwaXBlXzIuY29tcG9uZW50cyklMEElMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwSUZJbnBhaW50aW5nUGlwZWxpbmUlMkMlMjBJRklucGFpbnRpbmdTdXBlclJlc29sdXRpb25QaXBlbGluZSUwQSUwQXBpcGVfMSUyMCUzRCUyMElGSW5wYWludGluZ1BpcGVsaW5lKCoqcGlwZV8xLmNvbXBvbmVudHMpJTBBcGlwZV8yJTIwJTNEJTIwSUZJbnBhaW50aW5nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUoKipwaXBlXzIuY29tcG9uZW50cyk=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> IFPipeline, IFSuperResolutionPipeline

pipe_1 = IFPipeline.from_pretrained(<span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>)
pipe_2 = IFSuperResolutionPipeline.from_pretrained(<span class="hljs-string">&quot;DeepFloyd/IF-II-L-v1.0&quot;</span>)


<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> IFImg2ImgPipeline, IFImg2ImgSuperResolutionPipeline

pipe_1 = IFImg2ImgPipeline(**pipe_1.components)
pipe_2 = IFImg2ImgSuperResolutionPipeline(**pipe_2.components)


<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline

pipe_1 = IFInpaintingPipeline(**pipe_1.components)
pipe_2 = IFInpaintingSuperResolutionPipeline(**pipe_2.components)`}}),wn=new N({}),vn=new S({props:{code:"cGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJEZWVwRmxveWQlMkZJRi1JLVhMLXYxLjAlMjIlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlLnRvKCUyMmN1ZGElMjIp",highlighted:`pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)`}}),In=new S({props:{code:"cGlwZSglMjIlM0Nwcm9tcHQlM0UlMjIlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMzAp",highlighted:'pipe(<span class="hljs-string">&quot;&lt;prompt&gt;&quot;</span>, num_inference_steps=<span class="hljs-number">30</span>)'}}),Jn=new S({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy5waXBlbGluZXMuZGVlcGZsb3lkX2lmJTIwaW1wb3J0JTIwZmFzdDI3X3RpbWVzdGVwcyUwQSUwQXBpcGUoJTIyJTNDcHJvbXB0JTNFJTIyJTJDJTIwdGltZXN0ZXBzJTNEZmFzdDI3X3RpbWVzdGVwcyk=",highlighted:`<span class="hljs-keyword">from</span> diffusers.pipelines.deepfloyd_if <span class="hljs-keyword">import</span> fast27_timesteps

pipe(<span class="hljs-string">&quot;&lt;prompt&gt;&quot;</span>, timesteps=fast27_timesteps)`}}),Un=new S({props:{code:"cGlwZSUyMCUzRCUyMElGSW1nMkltZ1BpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJEZWVwRmxveWQlMkZJRi1JLVhMLXYxLjAlMjIlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlLnRvKCUyMmN1ZGElMjIpJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKGltYWdlJTNEaW1hZ2UlMkMlMjBwcm9tcHQlM0QlMjIlM0Nwcm9tcHQlM0UlMjIlMkMlMjBzdHJlbmd0aCUzRDAuMykuaW1hZ2Vz",highlighted:`pipe = IFImg2ImgPipeline.from_pretrained(<span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

image = pipe(image=image, prompt=<span class="hljs-string">&quot;&lt;prompt&gt;&quot;</span>, strength=<span class="hljs-number">0.3</span>).images`}}),Tn=new S({props:{code:"aW1wb3J0JTIwdG9yY2glMEElMEFwaXBlJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMkRlZXBGbG95ZCUyRklGLUktWEwtdjEuMCUyMiUyQyUyMHZhcmlhbnQlM0QlMjJmcDE2JTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXBpcGUudG8oJTIyY3VkYSUyMiklMEElMEFwaXBlLnRleHRfZW5jb2RlciUyMCUzRCUyMHRvcmNoLmNvbXBpbGUocGlwZS50ZXh0X2VuY29kZXIpJTBBcGlwZS51bmV0JTIwJTNEJTIwdG9yY2guY29tcGlsZShwaXBlLnVuZXQp",highlighted:`<span class="hljs-keyword">import</span> torch

pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

pipe.text_encoder = torch.<span class="hljs-built_in">compile</span>(pipe.text_encoder)
pipe.unet = torch.<span class="hljs-built_in">compile</span>(pipe.unet)`}}),Zn=new N({}),jn=new S({props:{code:"cGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJEZWVwRmxveWQlMkZJRi1JLVhMLXYxLjAlMjIlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgp",highlighted:`pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16)
pipe.enable_model_cpu_offload()`}}),En=new S({props:{code:"cGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJEZWVwRmxveWQlMkZJRi1JLVhMLXYxLjAlMjIlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlLmVuYWJsZV9zZXF1ZW50aWFsX2NwdV9vZmZsb2FkKCk=",highlighted:`pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16)
pipe.enable_sequential_cpu_offload()`}}),Fn=new S({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFQ1RW5jb2Rlck1vZGVsJTBBJTBBdGV4dF9lbmNvZGVyJTIwJTNEJTIwVDVFbmNvZGVyTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMkRlZXBGbG95ZCUyRklGLUktWEwtdjEuMCUyMiUyQyUyMHN1YmZvbGRlciUzRCUyMnRleHRfZW5jb2RlciUyMiUyQyUyMGRldmljZV9tYXAlM0QlMjJhdXRvJTIyJTJDJTIwbG9hZF9pbl84Yml0JTNEVHJ1ZSUyQyUyMHZhcmlhbnQlM0QlMjI4Yml0JTIyJTBBKSUwQSUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBEaWZmdXNpb25QaXBlbGluZSUwQSUwQXBpcGUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyRGVlcEZsb3lkJTJGSUYtSS1YTC12MS4wJTIyJTJDJTBBJTIwJTIwJTIwJTIwdGV4dF9lbmNvZGVyJTNEdGV4dF9lbmNvZGVyJTJDJTIwJTIwJTIzJTIwcGFzcyUyMHRoZSUyMHByZXZpb3VzbHklMjBpbnN0YW50aWF0ZWQlMjA4Yml0JTIwdGV4dCUyMGVuY29kZXIlMEElMjAlMjAlMjAlMjB1bmV0JTNETm9uZSUyQyUwQSUyMCUyMCUyMCUyMGRldmljZV9tYXAlM0QlMjJhdXRvJTIyJTJDJTBBKSUwQSUwQXByb21wdF9lbWJlZHMlMkMlMjBuZWdhdGl2ZV9lbWJlZHMlMjAlM0QlMjBwaXBlLmVuY29kZV9wcm9tcHQoJTIyJTNDcHJvbXB0JTNFJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> T5EncoderModel

text_encoder = T5EncoderModel.from_pretrained(
    <span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>, subfolder=<span class="hljs-string">&quot;text_encoder&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>, load_in_8bit=<span class="hljs-literal">True</span>, variant=<span class="hljs-string">&quot;8bit&quot;</span>
)

<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

pipe = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>,
    text_encoder=text_encoder,  <span class="hljs-comment"># pass the previously instantiated 8bit text encoder</span>
    unet=<span class="hljs-literal">None</span>,
    device_map=<span class="hljs-string">&quot;auto&quot;</span>,
)

prompt_embeds, negative_embeds = pipe.encode_prompt(<span class="hljs-string">&quot;&lt;prompt&gt;&quot;</span>)`}}),Bn=new S({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGUGlwZWxpbmUlMkMlMjBJRlN1cGVyUmVzb2x1dGlvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBnYyUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBUNUVuY29kZXJNb2RlbCUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBwdF90b19waWwlMEElMEF0ZXh0X2VuY29kZXIlMjAlM0QlMjBUNUVuY29kZXJNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyRGVlcEZsb3lkJTJGSUYtSS1YTC12MS4wJTIyJTJDJTIwc3ViZm9sZGVyJTNEJTIydGV4dF9lbmNvZGVyJTIyJTJDJTIwZGV2aWNlX21hcCUzRCUyMmF1dG8lMjIlMkMlMjBsb2FkX2luXzhiaXQlM0RUcnVlJTJDJTIwdmFyaWFudCUzRCUyMjhiaXQlMjIlMEEpJTBBJTBBJTIzJTIwdGV4dCUyMHRvJTIwaW1hZ2UlMEElMEFwaXBlJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMkRlZXBGbG95ZCUyRklGLUktWEwtdjEuMCUyMiUyQyUwQSUyMCUyM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dDE2JTJDJTIwZGV2aWNlX21hcCUzRCUyMmF1dG8lMjIlMEEpJTBBJTBBZ2VuZXJhdG9yJTIwJTNEJTIwdG9yY2guR2VuZXJhdG9yKCkubWFudWFsX3NlZWQoMCklMEFpbWFnZSUyMCUzRCUyMHBpcGUoJTBBJTIwJTIwJTIwJTIwaW1hZ2UlM0RpbWFnZSUyQyUwQSUyMCUyMCUyMCUyMHByb21wdF9lbWJlZHMlM0Rwcm9tcHRfZW1iZWRzJTJDJTBBJTIwJTIwJTIwJTIwbmVnYXRpdmVfcHJvbXB0X2VtYmVkcyUzRG5lZ2F0aXZlX2VtYmVkcyUyQyUwQSUyMCUyMCUyMCUyMG91dHB1dF90eXBlJTNEJTIycHQlMjIlMkMlMEElMjAlMjAlMjAlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IlMkMlMEEpLmltYWdlcyUwQSUwQXB0X3RvX3BpbChpbWFnZSklNUIwJTVELnNhdmUoJTIyLiUyRmlmX3N0YWdlX0lJLnBuZyUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> IFPipeline, IFSuperResolutionPipeline
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> gc
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> T5EncoderModel
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> pt_to_pil

text_encoder = T5EncoderModel.from_pretrained(
    <span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>, subfolder=<span class="hljs-string">&quot;text_encoder&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>, load_in_8bit=<span class="hljs-literal">True</span>, variant=<span class="hljs-string">&quot;8bit&quot;</span>
)

<span class="hljs-comment"># text to image</span>

pipe = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>,
    text_encoder=text_encoder,  <span class="hljs-comment"># pass the previously instantiated 8bit text encoder</span>
    unet=<span class="hljs-literal">None</span>,
    device_map=<span class="hljs-string">&quot;auto&quot;</span>,
)

prompt = <span class="hljs-string">&#x27;a photo of a kangaroo wearing an orange hoodie and blue sunglasses standing in front of the eiffel tower holding a sign that says &quot;very deep learning&quot;&#x27;</span>
prompt_embeds, negative_embeds = pipe.encode_prompt(prompt)

<span class="hljs-comment"># Remove the pipeline so we can re-load the pipeline with the unet</span>
<span class="hljs-keyword">del</span> text_encoder
<span class="hljs-keyword">del</span> pipe
gc.collect()
torch.cuda.empty_cache()

pipe = IFPipeline.from_pretrained(
    <span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>, text_encoder=<span class="hljs-literal">None</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16, device_map=<span class="hljs-string">&quot;auto&quot;</span>
)

generator = torch.Generator().manual_seed(<span class="hljs-number">0</span>)
image = pipe(
    prompt_embeds=prompt_embeds,
    negative_prompt_embeds=negative_embeds,
    output_type=<span class="hljs-string">&quot;pt&quot;</span>,
    generator=generator,
).images

pt_to_pil(image)[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_I.png&quot;</span>)

<span class="hljs-comment"># Remove the pipeline so we can load the super-resolution pipeline</span>
<span class="hljs-keyword">del</span> pipe
gc.collect()
torch.cuda.empty_cache()

<span class="hljs-comment"># First super resolution</span>

pipe = IFSuperResolutionPipeline.from_pretrained(
    <span class="hljs-string">&quot;DeepFloyd/IF-II-L-v1.0&quot;</span>, text_encoder=<span class="hljs-literal">None</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16, device_map=<span class="hljs-string">&quot;auto&quot;</span>
)

generator = torch.Generator().manual_seed(<span class="hljs-number">0</span>)
image = pipe(
    image=image,
    prompt_embeds=prompt_embeds,
    negative_prompt_embeds=negative_embeds,
    output_type=<span class="hljs-string">&quot;pt&quot;</span>,
    generator=generator,
).images

pt_to_pil(image)[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;./if_stage_II.png&quot;</span>)`}}),Wn=new N({}),Sn=new N({}),Vn=new x({props:{name:"class diffusers.IFPipeline",anchor:"diffusers.IFPipeline",parameters:[{name:"tokenizer",val:": T5Tokenizer"},{name:"text_encoder",val:": T5EncoderModel"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDPMScheduler"},{name:"safety_checker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.safety_checker.IFSafetyChecker]"},{name:"feature_extractor",val:": typing.Optional[transformers.models.clip.image_processing_clip.CLIPImageProcessor]"},{name:"watermarker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.watermark.IFWatermarker]"},{name:"requires_safety_checker",val:": bool = True"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if.py#L89"}}),Nn=new x({props:{name:"__call__",anchor:"diffusers.IFPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"num_inference_steps",val:": int = 100"},{name:"timesteps",val:": typing.List[int] = None"},{name:"guidance_scale",val:": float = 7.0"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": int = 1"},{name:"clean_caption",val:": bool = True"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"}],parametersDescription:[{anchor:"diffusers.IFPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.IFPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.IFPipeline.__call__.timesteps",description:`<strong>timesteps</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Custom timesteps to use for the denoising process. If not defined, equal spaced <code>num_inference_steps</code>
timesteps are used. Must be in descending order.`,name:"timesteps"},{anchor:"diffusers.IFPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.IFPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.IFPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.IFPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.IFPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.IFPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.IFPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.IFPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.IFPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.IFPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.IFPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.IFPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.IFPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.IFPipeline.__call__.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the caption before creating embeddings. Requires <code>beautifulsoup4</code> and <code>ftfy</code> to
be installed. If the dependencies are not installed, the embeddings will be created from the raw
prompt.`,name:"clean_caption"},{anchor:"diffusers.IFPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if.py#L582",returnDescription:`
<p><code>~pipelines.stable_diffusion.IFPipelineOutput</code> if <code>return_dict</code> is True, otherwise a <code>tuple. When returning a tuple, the first element is a list with the generated images, and the second element is a list of </code>bool<code>s denoting whether the corresponding generated image likely represents "not-safe-for-work" (nsfw) or watermarked content, according to the </code>safety_checker\`.</p>
`,returnType:`
<p><code>~pipelines.stable_diffusion.IFPipelineOutput</code> or <code>tuple</code></p>
`}}),yt=new Zs({props:{anchor:"diffusers.IFPipeline.__call__.example",$$slots:{default:[Y1]},$$scope:{ctx:P}}}),$n=new x({props:{name:"enable_model_cpu_offload",anchor:"diffusers.IFPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if.py#L147"}}),Pn=new x({props:{name:"encode_prompt",anchor:"diffusers.IFPipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"do_classifier_free_guidance",val:" = True"},{name:"num_images_per_prompt",val:" = 1"},{name:"device",val:" = None"},{name:"negative_prompt",val:" = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"clean_caption",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.IFPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if.py#L202"}}),Qn=new N({}),Yn=new x({props:{name:"class diffusers.IFSuperResolutionPipeline",anchor:"diffusers.IFSuperResolutionPipeline",parameters:[{name:"tokenizer",val:": T5Tokenizer"},{name:"text_encoder",val:": T5EncoderModel"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDPMScheduler"},{name:"image_noising_scheduler",val:": DDPMScheduler"},{name:"safety_checker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.safety_checker.IFSafetyChecker]"},{name:"feature_extractor",val:": typing.Optional[transformers.models.clip.image_processing_clip.CLIPImageProcessor]"},{name:"watermarker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.watermark.IFWatermarker]"},{name:"requires_safety_checker",val:": bool = True"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py#L74"}}),Dn=new x({props:{name:"__call__",anchor:"diffusers.IFSuperResolutionPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"height",val:": int = None"},{name:"width",val:": int = None"},{name:"image",val:": typing.Union[PIL.Image.Image, numpy.ndarray, torch.FloatTensor] = None"},{name:"num_inference_steps",val:": int = 50"},{name:"timesteps",val:": typing.List[int] = None"},{name:"guidance_scale",val:": float = 4.0"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": int = 1"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"noise_level",val:": int = 250"},{name:"clean_caption",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.IFSuperResolutionPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code>, <code>np.ndarray</code>, <code>torch.FloatTensor</code>) &#x2014;
The image to be upscaled.`,name:"image"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.timesteps",description:`<strong>timesteps</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Custom timesteps to use for the denoising process. If not defined, equal spaced <code>num_inference_steps</code>
timesteps are used. Must be in descending order.`,name:"timesteps"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.noise_level",description:`<strong>noise_level</strong> (<code>int</code>, <em>optional</em>, defaults to 250) &#x2014;
The amount of noise to add to the upscaled image. Must be in the range <code>[0, 1000)</code>`,name:"noise_level"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the caption before creating embeddings. Requires <code>beautifulsoup4</code> and <code>ftfy</code> to
be installed. If the dependencies are not installed, the embeddings will be created from the raw
prompt.`,name:"clean_caption"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py#L650",returnDescription:`
<p><code>~pipelines.stable_diffusion.IFPipelineOutput</code> if <code>return_dict</code> is True, otherwise a <code>tuple. When returning a tuple, the first element is a list with the generated images, and the second element is a list of </code>bool<code>s denoting whether the corresponding generated image likely represents "not-safe-for-work" (nsfw) or watermarked content, according to the </code>safety_checker\`.</p>
`,returnType:`
<p><code>~pipelines.stable_diffusion.IFPipelineOutput</code> or <code>tuple</code></p>
`}}),wt=new Zs({props:{anchor:"diffusers.IFSuperResolutionPipeline.__call__.example",$$slots:{default:[D1]},$$scope:{ctx:P}}}),zn=new x({props:{name:"enable_model_cpu_offload",anchor:"diffusers.IFSuperResolutionPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py#L141"}}),Hn=new x({props:{name:"encode_prompt",anchor:"diffusers.IFSuperResolutionPipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"do_classifier_free_guidance",val:" = True"},{name:"num_images_per_prompt",val:" = 1"},{name:"device",val:" = None"},{name:"negative_prompt",val:" = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"clean_caption",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.IFSuperResolutionPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py#L337"}}),qn=new N({}),Ln=new x({props:{name:"class diffusers.IFImg2ImgPipeline",anchor:"diffusers.IFImg2ImgPipeline",parameters:[{name:"tokenizer",val:": T5Tokenizer"},{name:"text_encoder",val:": T5EncoderModel"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDPMScheduler"},{name:"safety_checker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.safety_checker.IFSafetyChecker]"},{name:"feature_extractor",val:": typing.Optional[transformers.models.clip.image_processing_clip.CLIPImageProcessor]"},{name:"watermarker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.watermark.IFWatermarker]"},{name:"requires_safety_checker",val:": bool = True"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py#L113"}}),An=new x({props:{name:"__call__",anchor:"diffusers.IFImg2ImgPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"image",val:": typing.Union[PIL.Image.Image, torch.Tensor, numpy.ndarray, typing.List[PIL.Image.Image], typing.List[torch.Tensor], typing.List[numpy.ndarray]] = None"},{name:"strength",val:": float = 0.7"},{name:"num_inference_steps",val:": int = 80"},{name:"timesteps",val:": typing.List[int] = None"},{name:"guidance_scale",val:": float = 10.0"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": int = 1"},{name:"clean_caption",val:": bool = True"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"}],parametersDescription:[{anchor:"diffusers.IFImg2ImgPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code> or <code>PIL.Image.Image</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch, that will be used as the starting point for the
process.`,name:"image"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.strength",description:`<strong>strength</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
Conceptually, indicates how much to transform the reference <code>image</code>. Must be between 0 and 1. <code>image</code>
will be used as a starting point, adding more noise to it the larger the <code>strength</code>. The number of
denoising steps depends on the amount of noise initially added. When <code>strength</code> is 1, added noise will
be maximum and the denoising process will run for the full number of iterations specified in
<code>num_inference_steps</code>. A value of 1, therefore, essentially ignores <code>image</code>.`,name:"strength"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.timesteps",description:`<strong>timesteps</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Custom timesteps to use for the denoising process. If not defined, equal spaced <code>num_inference_steps</code>
timesteps are used. Must be in descending order.`,name:"timesteps"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the caption before creating embeddings. Requires <code>beautifulsoup4</code> and <code>ftfy</code> to
be installed. If the dependencies are not installed, the embeddings will be created from the raw
prompt.`,name:"clean_caption"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py#L696",returnDescription:`
<p><code>~pipelines.stable_diffusion.IFPipelineOutput</code> if <code>return_dict</code> is True, otherwise a <code>tuple. When returning a tuple, the first element is a list with the generated images, and the second element is a list of </code>bool<code>s denoting whether the corresponding generated image likely represents "not-safe-for-work" (nsfw) or watermarked content, according to the </code>safety_checker\`.</p>
`,returnType:`
<p><code>~pipelines.stable_diffusion.IFPipelineOutput</code> or <code>tuple</code></p>
`}}),Jt=new Zs({props:{anchor:"diffusers.IFImg2ImgPipeline.__call__.example",$$slots:{default:[z1]},$$scope:{ctx:P}}}),On=new x({props:{name:"enable_model_cpu_offload",anchor:"diffusers.IFImg2ImgPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py#L172"}}),Kn=new x({props:{name:"encode_prompt",anchor:"diffusers.IFImg2ImgPipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"do_classifier_free_guidance",val:" = True"},{name:"num_images_per_prompt",val:" = 1"},{name:"device",val:" = None"},{name:"negative_prompt",val:" = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"clean_caption",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.IFImg2ImgPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py#L228"}}),ea=new N({}),ta=new x({props:{name:"class diffusers.IFImg2ImgSuperResolutionPipeline",anchor:"diffusers.IFImg2ImgSuperResolutionPipeline",parameters:[{name:"tokenizer",val:": T5Tokenizer"},{name:"text_encoder",val:": T5EncoderModel"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDPMScheduler"},{name:"image_noising_scheduler",val:": DDPMScheduler"},{name:"safety_checker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.safety_checker.IFSafetyChecker]"},{name:"feature_extractor",val:": typing.Optional[transformers.models.clip.image_processing_clip.CLIPImageProcessor]"},{name:"watermarker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.watermark.IFWatermarker]"},{name:"requires_safety_checker",val:": bool = True"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py#L116"}}),na=new x({props:{name:"__call__",anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__",parameters:[{name:"image",val:": typing.Union[PIL.Image.Image, numpy.ndarray, torch.FloatTensor]"},{name:"original_image",val:": typing.Union[PIL.Image.Image, torch.Tensor, numpy.ndarray, typing.List[PIL.Image.Image], typing.List[torch.Tensor], typing.List[numpy.ndarray]] = None"},{name:"strength",val:": float = 0.8"},{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"num_inference_steps",val:": int = 50"},{name:"timesteps",val:": typing.List[int] = None"},{name:"guidance_scale",val:": float = 4.0"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": int = 1"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"noise_level",val:": int = 250"},{name:"clean_caption",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code> or <code>PIL.Image.Image</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch, that will be used as the starting point for the
process.`,name:"image"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.original_image",description:`<strong>original_image</strong> (<code>torch.FloatTensor</code> or <code>PIL.Image.Image</code>) &#x2014;
The original image that <code>image</code> was varied from.`,name:"original_image"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.strength",description:`<strong>strength</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
Conceptually, indicates how much to transform the reference <code>image</code>. Must be between 0 and 1. <code>image</code>
will be used as a starting point, adding more noise to it the larger the <code>strength</code>. The number of
denoising steps depends on the amount of noise initially added. When <code>strength</code> is 1, added noise will
be maximum and the denoising process will run for the full number of iterations specified in
<code>num_inference_steps</code>. A value of 1, therefore, essentially ignores <code>image</code>.`,name:"strength"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.timesteps",description:`<strong>timesteps</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Custom timesteps to use for the denoising process. If not defined, equal spaced <code>num_inference_steps</code>
timesteps are used. Must be in descending order.`,name:"timesteps"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.noise_level",description:`<strong>noise_level</strong> (<code>int</code>, <em>optional</em>, defaults to 250) &#x2014;
The amount of noise to add to the upscaled image. Must be in the range <code>[0, 1000)</code>`,name:"noise_level"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the caption before creating embeddings. Requires <code>beautifulsoup4</code> and <code>ftfy</code> to
be installed. If the dependencies are not installed, the embeddings will be created from the raw
prompt.`,name:"clean_caption"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py#L778",returnDescription:`
<p><code>~pipelines.stable_diffusion.IFPipelineOutput</code> if <code>return_dict</code> is True, otherwise a <code>tuple. When returning a tuple, the first element is a list with the generated images, and the second element is a list of </code>bool<code>s denoting whether the corresponding generated image likely represents "not-safe-for-work" (nsfw) or watermarked content, according to the </code>safety_checker\`.</p>
`,returnType:`
<p><code>~pipelines.stable_diffusion.IFPipelineOutput</code> or <code>tuple</code></p>
`}}),Zt=new Zs({props:{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.example",$$slots:{default:[H1]},$$scope:{ctx:P}}}),aa=new x({props:{name:"enable_model_cpu_offload",anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py#L183"}}),sa=new x({props:{name:"encode_prompt",anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"do_classifier_free_guidance",val:" = True"},{name:"num_images_per_prompt",val:" = 1"},{name:"device",val:" = None"},{name:"negative_prompt",val:" = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"clean_caption",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py#L379"}}),oa=new N({}),la=new x({props:{name:"class diffusers.IFInpaintingPipeline",anchor:"diffusers.IFInpaintingPipeline",parameters:[{name:"tokenizer",val:": T5Tokenizer"},{name:"text_encoder",val:": T5EncoderModel"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDPMScheduler"},{name:"safety_checker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.safety_checker.IFSafetyChecker]"},{name:"feature_extractor",val:": typing.Optional[transformers.models.clip.image_processing_clip.CLIPImageProcessor]"},{name:"watermarker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.watermark.IFWatermarker]"},{name:"requires_safety_checker",val:": bool = True"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py#L116"}}),ia=new x({props:{name:"__call__",anchor:"diffusers.IFInpaintingPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"image",val:": typing.Union[PIL.Image.Image, torch.Tensor, numpy.ndarray, typing.List[PIL.Image.Image], typing.List[torch.Tensor], typing.List[numpy.ndarray]] = None"},{name:"mask_image",val:": typing.Union[PIL.Image.Image, torch.Tensor, numpy.ndarray, typing.List[PIL.Image.Image], typing.List[torch.Tensor], typing.List[numpy.ndarray]] = None"},{name:"strength",val:": float = 1.0"},{name:"num_inference_steps",val:": int = 50"},{name:"timesteps",val:": typing.List[int] = None"},{name:"guidance_scale",val:": float = 7.0"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": int = 1"},{name:"clean_caption",val:": bool = True"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"}],parametersDescription:[{anchor:"diffusers.IFInpaintingPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.IFInpaintingPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code> or <code>PIL.Image.Image</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch, that will be used as the starting point for the
process.`,name:"image"},{anchor:"diffusers.IFInpaintingPipeline.__call__.mask_image",description:`<strong>mask_image</strong> (<code>PIL.Image.Image</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch, to mask <code>image</code>. White pixels in the mask will be
repainted, while black pixels will be preserved. If <code>mask_image</code> is a PIL image, it will be converted
to a single channel (luminance) before use. If it&#x2019;s a tensor, it should contain one color channel (L)
instead of 3, so the expected shape would be <code>(B, H, W, 1)</code>.`,name:"mask_image"},{anchor:"diffusers.IFInpaintingPipeline.__call__.strength",description:`<strong>strength</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
Conceptually, indicates how much to transform the reference <code>image</code>. Must be between 0 and 1. <code>image</code>
will be used as a starting point, adding more noise to it the larger the <code>strength</code>. The number of
denoising steps depends on the amount of noise initially added. When <code>strength</code> is 1, added noise will
be maximum and the denoising process will run for the full number of iterations specified in
<code>num_inference_steps</code>. A value of 1, therefore, essentially ignores <code>image</code>.`,name:"strength"},{anchor:"diffusers.IFInpaintingPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.IFInpaintingPipeline.__call__.timesteps",description:`<strong>timesteps</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Custom timesteps to use for the denoising process. If not defined, equal spaced <code>num_inference_steps</code>
timesteps are used. Must be in descending order.`,name:"timesteps"},{anchor:"diffusers.IFInpaintingPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.IFInpaintingPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.IFInpaintingPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.IFInpaintingPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.IFInpaintingPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.IFInpaintingPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.IFInpaintingPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.IFInpaintingPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.IFInpaintingPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.IFInpaintingPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.IFInpaintingPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.IFInpaintingPipeline.__call__.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the caption before creating embeddings. Requires <code>beautifulsoup4</code> and <code>ftfy</code> to
be installed. If the dependencies are not installed, the embeddings will be created from the raw
prompt.`,name:"clean_caption"},{anchor:"diffusers.IFInpaintingPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py#L788",returnDescription:`
<p><code>~pipelines.stable_diffusion.IFPipelineOutput</code> if <code>return_dict</code> is True, otherwise a <code>tuple. When returning a tuple, the first element is a list with the generated images, and the second element is a list of </code>bool<code>s denoting whether the corresponding generated image likely represents "not-safe-for-work" (nsfw) or watermarked content, according to the </code>safety_checker\`.</p>
`,returnType:`
<p><code>~pipelines.stable_diffusion.IFPipelineOutput</code> or <code>tuple</code></p>
`}}),Ft=new Zs({props:{anchor:"diffusers.IFInpaintingPipeline.__call__.example",$$slots:{default:[q1]},$$scope:{ctx:P}}}),ra=new x({props:{name:"enable_model_cpu_offload",anchor:"diffusers.IFInpaintingPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py#L175"}}),pa=new x({props:{name:"encode_prompt",anchor:"diffusers.IFInpaintingPipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"do_classifier_free_guidance",val:" = True"},{name:"num_images_per_prompt",val:" = 1"},{name:"device",val:" = None"},{name:"negative_prompt",val:" = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"clean_caption",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.IFInpaintingPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py#L231"}}),da=new N({}),ca=new x({props:{name:"class diffusers.IFInpaintingSuperResolutionPipeline",anchor:"diffusers.IFInpaintingSuperResolutionPipeline",parameters:[{name:"tokenizer",val:": T5Tokenizer"},{name:"text_encoder",val:": T5EncoderModel"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDPMScheduler"},{name:"image_noising_scheduler",val:": DDPMScheduler"},{name:"safety_checker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.safety_checker.IFSafetyChecker]"},{name:"feature_extractor",val:": typing.Optional[transformers.models.clip.image_processing_clip.CLIPImageProcessor]"},{name:"watermarker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.watermark.IFWatermarker]"},{name:"requires_safety_checker",val:": bool = True"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py#L118"}}),ma=new x({props:{name:"__call__",anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__",parameters:[{name:"image",val:": typing.Union[PIL.Image.Image, numpy.ndarray, torch.FloatTensor]"},{name:"original_image",val:": typing.Union[PIL.Image.Image, torch.Tensor, numpy.ndarray, typing.List[PIL.Image.Image], typing.List[torch.Tensor], typing.List[numpy.ndarray]] = None"},{name:"mask_image",val:": typing.Union[PIL.Image.Image, torch.Tensor, numpy.ndarray, typing.List[PIL.Image.Image], typing.List[torch.Tensor], typing.List[numpy.ndarray]] = None"},{name:"strength",val:": float = 0.8"},{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"num_inference_steps",val:": int = 100"},{name:"timesteps",val:": typing.List[int] = None"},{name:"guidance_scale",val:": float = 4.0"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": int = 1"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"noise_level",val:": int = 0"},{name:"clean_caption",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code> or <code>PIL.Image.Image</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch, that will be used as the starting point for the
process.`,name:"image"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.original_image",description:`<strong>original_image</strong> (<code>torch.FloatTensor</code> or <code>PIL.Image.Image</code>) &#x2014;
The original image that <code>image</code> was varied from.`,name:"original_image"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.mask_image",description:`<strong>mask_image</strong> (<code>PIL.Image.Image</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch, to mask <code>image</code>. White pixels in the mask will be
repainted, while black pixels will be preserved. If <code>mask_image</code> is a PIL image, it will be converted
to a single channel (luminance) before use. If it&#x2019;s a tensor, it should contain one color channel (L)
instead of 3, so the expected shape would be <code>(B, H, W, 1)</code>.`,name:"mask_image"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.strength",description:`<strong>strength</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
Conceptually, indicates how much to transform the reference <code>image</code>. Must be between 0 and 1. <code>image</code>
will be used as a starting point, adding more noise to it the larger the <code>strength</code>. The number of
denoising steps depends on the amount of noise initially added. When <code>strength</code> is 1, added noise will
be maximum and the denoising process will run for the full number of iterations specified in
<code>num_inference_steps</code>. A value of 1, therefore, essentially ignores <code>image</code>.`,name:"strength"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.timesteps",description:`<strong>timesteps</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Custom timesteps to use for the denoising process. If not defined, equal spaced <code>num_inference_steps</code>
timesteps are used. Must be in descending order.`,name:"timesteps"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.noise_level",description:`<strong>noise_level</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The amount of noise to add to the upscaled image. Must be in the range <code>[0, 1000)</code>`,name:"noise_level"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the caption before creating embeddings. Requires <code>beautifulsoup4</code> and <code>ftfy</code> to
be installed. If the dependencies are not installed, the embeddings will be created from the raw
prompt.`,name:"clean_caption"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py#L866",returnDescription:`
<p><code>~pipelines.stable_diffusion.IFPipelineOutput</code> if <code>return_dict</code> is True, otherwise a <code>tuple. When returning a tuple, the first element is a list with the generated images, and the second element is a list of </code>bool<code>s denoting whether the corresponding generated image likely represents "not-safe-for-work" (nsfw) or watermarked content, according to the </code>safety_checker\`.</p>
`,returnType:`
<p><code>~pipelines.stable_diffusion.IFPipelineOutput</code> or <code>tuple</code></p>
`}}),kt=new Zs({props:{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.example",$$slots:{default:[L1]},$$scope:{ctx:P}}}),ga=new x({props:{name:"enable_model_cpu_offload",anchor:"diffusers.IFInpaintingSuperResolutionPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py#L185"}}),fa=new x({props:{name:"encode_prompt",anchor:"diffusers.IFInpaintingSuperResolutionPipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"do_classifier_free_guidance",val:" = True"},{name:"num_images_per_prompt",val:" = 1"},{name:"device",val:" = None"},{name:"negative_prompt",val:" = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"clean_caption",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py#L381"}}),{c(){w=o("meta"),X=r(),C=o("h1"),M=o("a"),R=o("span"),f(g.$$.fragment),G=r(),Es=o("span"),hc=a("DeepFloyd IF"),bp=r(),Fe=o("h2"),Ke=o("a"),Fs=o("span"),f(Nt.$$.fragment),_c=r(),Bs=o("span"),yc=a("Overview"),Mp=r(),ba=o("p"),bc=a(`DeepFloyd IF is a novel state-of-the-art open-source text-to-image model with a high degree of photorealism and language understanding.
The model is a modular composed of a frozen text encoder and three cascaded pixel diffusion modules:`),wp=r(),le=o("ul"),Ws=o("li"),Mc=a("Stage 1: a base model that generates 64x64 px image based on text prompt,"),wc=r(),ks=o("li"),vc=a("Stage 2: a 64x64 px => 256x256 px super-resolution model, and a"),Ic=r(),$t=o("li"),Jc=a(`Stage 3: a 256x256 px => 1024x1024 px super-resolution model
Stage 1 and Stage 2 utilize a frozen text encoder based on the T5 transformer to extract text embeddings,
which are then fed into a UNet architecture enhanced with cross-attention and attention pooling.
Stage 3 is `),Pt=o("a"),Uc=a("Stability\u2019s x4 Upscaling model"),Tc=a(`.
The result is a highly efficient model that outperforms current state-of-the-art models, achieving a zero-shot FID score of 6.66 on the COCO dataset.
Our work underscores the potential of larger UNet architectures in the first stage of cascaded diffusion models and depicts a promising future for text-to-image synthesis.`),vp=r(),Be=o("h2"),et=o("a"),Gs=o("span"),f(Qt.$$.fragment),Zc=r(),Cs=o("span"),jc=a("Usage"),Ip=r(),Ma=o("p"),Ec=a("Before you can use IF, you need to accept its usage conditions. To do so:"),Jp=r(),ie=o("ol"),Yt=o("li"),Fc=a("Make sure to have a "),Dt=o("a"),Bc=a("Hugging Face account"),Wc=a(" and be logged in"),kc=r(),zt=o("li"),Gc=a("Accept the license on the model card of "),Ht=o("a"),Cc=a("DeepFloyd/IF-I-XL-v1.0"),Rc=a(". Accepting the license on the stage I model card will auto accept for the other IF models."),Xc=r(),wa=o("li"),xc=a("Make sure to login locally. Install "),Rs=o("code"),Sc=a("huggingface_hub"),Up=r(),f(qt.$$.fragment),Tp=r(),va=o("p"),Vc=a("run the login function in a Python shell"),Zp=r(),f(Lt.$$.fragment),jp=r(),tt=o("p"),Nc=a("and enter your "),At=o("a"),$c=a("Hugging Face Hub access token"),Pc=a("."),Ep=r(),nt=o("p"),Qc=a("Next we install "),Xs=o("code"),Yc=a("diffusers"),Dc=a(" and dependencies:"),Fp=r(),f(Ot.$$.fragment),Bp=r(),Ia=o("p"),zc=a("The following sections give more in-detail examples of how to use IF. Specifically:"),Wp=r(),V=o("ul"),xs=o("li"),Ja=o("a"),Hc=a("Text-to-Image Generation"),qc=r(),Ss=o("li"),Ua=o("a"),Lc=a("Image-to-Image Generation"),Ac=r(),Vs=o("li"),Ta=o("a"),Oc=a("Inpainting"),Kc=r(),Ns=o("li"),Za=o("a"),em=a("Reusing model weights"),tm=r(),$s=o("li"),ja=o("a"),nm=a("Speed optimization"),am=r(),Ps=o("li"),Ea=o("a"),sm=a("Memory optimization"),kp=r(),Fa=o("p"),Qs=o("strong"),om=a("Available checkpoints"),Gp=r(),re=o("ul"),Kt=o("li"),Ys=o("p"),Ds=o("em"),lm=a("Stage-1"),im=r(),We=o("ul"),zs=o("li"),en=o("a"),rm=a("DeepFloyd/IF-I-XL-v1.0"),pm=r(),Hs=o("li"),tn=o("a"),dm=a("DeepFloyd/IF-I-L-v1.0"),cm=r(),qs=o("li"),nn=o("a"),mm=a("DeepFloyd/IF-I-M-v1.0"),gm=r(),an=o("li"),Ls=o("p"),As=o("em"),fm=a("Stage-2"),um=r(),sn=o("ul"),Os=o("li"),on=o("a"),hm=a("DeepFloyd/IF-II-L-v1.0"),_m=r(),Ks=o("li"),ln=o("a"),ym=a("DeepFloyd/IF-II-M-v1.0"),bm=r(),rn=o("li"),eo=o("p"),to=o("em"),Mm=a("Stage-3"),wm=r(),no=o("ul"),ao=o("li"),pn=o("a"),vm=a("stabilityai/stable-diffusion-x4-upscaler"),Cp=r(),at=o("p"),so=o("strong"),Im=a("Demo"),Jm=r(),dn=o("a"),Ba=o("img"),Rp=r(),st=o("p"),oo=o("strong"),Um=a("Google Colab"),Tm=r(),cn=o("a"),Wa=o("img"),Xp=r(),ke=o("h3"),ot=o("a"),lo=o("span"),f(mn.$$.fragment),Zm=r(),io=o("span"),jm=a("Text-to-Image Generation"),xp=r(),lt=o("p"),Em=a("By default diffusers makes use of "),gn=o("a"),Fm=a("model cpu offloading"),Bm=a(`
to run the whole IF pipeline with as little as 14 GB of VRAM.`),Sp=r(),f(fn.$$.fragment),Vp=r(),Ge=o("h3"),it=o("a"),ro=o("span"),f(un.$$.fragment),Wm=r(),po=o("span"),km=a("Text Guided Image-to-Image Generation"),Np=r(),pe=o("p"),Gm=a(`The same IF model weights can be used for text-guided image-to-image translation or image variation.
In this case just make sure to load the weights using the `),ka=o("a"),Cm=a("IFInpaintingPipeline"),Rm=a(" and "),Ga=o("a"),Xm=a("IFInpaintingSuperResolutionPipeline"),xm=a(" pipelines."),$p=r(),se=o("p"),co=o("strong"),Sm=a("Note"),Vm=a(`: You can also directly move the weights of the text-to-image pipelines to the image-to-image pipelines
without loading them twice by making use of the `),mo=o("code"),Nm=a("~DiffusionPipeline.components()"),$m=a(" function as explained "),Ca=o("a"),Pm=a("here"),Qm=a("."),Pp=r(),f(hn.$$.fragment),Qp=r(),Ce=o("h3"),rt=o("a"),go=o("span"),f(_n.$$.fragment),Ym=r(),fo=o("span"),Dm=a("Text Guided Inpainting Generation"),Yp=r(),de=o("p"),zm=a(`The same IF model weights can be used for text-guided image-to-image translation or image variation.
In this case just make sure to load the weights using the `),Ra=o("a"),Hm=a("IFInpaintingPipeline"),qm=a(" and "),Xa=o("a"),Lm=a("IFInpaintingSuperResolutionPipeline"),Am=a(" pipelines."),Dp=r(),oe=o("p"),uo=o("strong"),Om=a("Note"),Km=a(`: You can also directly move the weights of the text-to-image pipelines to the image-to-image pipelines
without loading them twice by making use of the `),ho=o("code"),eg=a("~DiffusionPipeline.components()"),tg=a(" function as explained "),xa=o("a"),ng=a("here"),ag=a("."),zp=r(),f(yn.$$.fragment),Hp=r(),Re=o("h3"),pt=o("a"),_o=o("span"),f(bn.$$.fragment),sg=r(),yo=o("span"),og=a("Converting between different pipelines"),qp=r(),dt=o("p"),lg=a("In addition to being loaded with "),bo=o("code"),ig=a("from_pretrained"),rg=a(", Pipelines can also be loaded directly from each other."),Lp=r(),f(Mn.$$.fragment),Ap=r(),Xe=o("h3"),ct=o("a"),Mo=o("span"),f(wn.$$.fragment),pg=r(),wo=o("span"),dg=a("Optimizing for speed"),Op=r(),Sa=o("p"),cg=a("The simplest optimization to run IF faster is to move all model components to the GPU."),Kp=r(),f(vn.$$.fragment),ed=r(),Va=o("p"),mg=a("You can also run the diffusion process for a shorter number of timesteps."),td=r(),mt=o("p"),gg=a("This can either be done with the "),vo=o("code"),fg=a("num_inference_steps"),ug=a(" argument"),nd=r(),f(In.$$.fragment),ad=r(),gt=o("p"),hg=a("Or with the "),Io=o("code"),_g=a("timesteps"),yg=a(" argument"),sd=r(),f(Jn.$$.fragment),od=r(),Na=o("p"),bg=a(`When doing image variation or inpainting, you can also decrease the number of timesteps
with the strength argument. The strength argument is the amount of noise to add to
the input image which also determines how many steps to run in the denoising process.
A smaller number will vary the image less but run faster.`),ld=r(),f(Un.$$.fragment),id=r(),ce=o("p"),Mg=a("You can also use "),$a=o("a"),Jo=o("code"),wg=a("torch.compile"),vg=a(". Note that we have not exhaustively tested "),Uo=o("code"),Ig=a("torch.compile"),Jg=a(`
with IF and it might not give expected results.`),rd=r(),f(Tn.$$.fragment),pd=r(),xe=o("h3"),ft=o("a"),To=o("span"),f(Zn.$$.fragment),Ug=r(),Zo=o("span"),Tg=a("Optimizing for memory"),dd=r(),Pa=o("p"),Zg=a("When optimizing for GPU memory, we can use the standard diffusers cpu offloading APIs."),cd=r(),Qa=o("p"),jg=a("Either the model based CPU offloading,"),md=r(),f(jn.$$.fragment),gd=r(),Ya=o("p"),Eg=a("or the more aggressive layer based CPU offloading."),fd=r(),f(En.$$.fragment),ud=r(),Da=o("p"),Fg=a("Additionally, T5 can be loaded in 8bit precision"),hd=r(),f(Fn.$$.fragment),_d=r(),za=o("p"),Bg=a(`For CPU RAM constrained machines like google colab free tier where we can\u2019t load all
model components to the CPU at once, we can manually only load the pipeline with
the text encoder or unet when the respective model components are needed.`),yd=r(),f(Bn.$$.fragment),bd=r(),Se=o("h2"),ut=o("a"),jo=o("span"),f(Wn.$$.fragment),Wg=r(),Eo=o("span"),kg=a("Available Pipelines:"),Md=r(),ht=o("table"),Fo=o("thead"),Ve=o("tr"),Bo=o("th"),Gg=a("Pipeline"),Cg=r(),Wo=o("th"),Rg=a("Tasks"),Xg=r(),Ha=o("th"),xg=a("Colab"),Sg=r(),$=o("tbody"),Ne=o("tr"),ko=o("td"),kn=o("a"),Vg=a("pipeline_if.py"),Ng=r(),Go=o("td"),Co=o("em"),$g=a("Text-to-Image Generation"),Pg=r(),qa=o("td"),Qg=a("-"),Yg=r(),$e=o("tr"),Ro=o("td"),Gn=o("a"),Dg=a("pipeline_if_superresolution.py"),zg=r(),Xo=o("td"),xo=o("em"),Hg=a("Text-to-Image Generation"),qg=r(),La=o("td"),Lg=a("-"),Ag=r(),Pe=o("tr"),So=o("td"),Cn=o("a"),Og=a("pipeline_if_img2img.py"),Kg=r(),Vo=o("td"),No=o("em"),ef=a("Image-to-Image Generation"),tf=r(),Aa=o("td"),nf=a("-"),af=r(),Qe=o("tr"),$o=o("td"),Rn=o("a"),sf=a("pipeline_if_img2img_superresolution.py"),of=r(),Po=o("td"),Qo=o("em"),lf=a("Image-to-Image Generation"),rf=r(),Oa=o("td"),pf=a("-"),df=r(),Ye=o("tr"),Yo=o("td"),Xn=o("a"),cf=a("pipeline_if_inpainting.py"),mf=r(),Do=o("td"),zo=o("em"),gf=a("Image-to-Image Generation"),ff=r(),Ka=o("td"),uf=a("-"),hf=r(),De=o("tr"),Ho=o("td"),xn=o("a"),_f=a("pipeline_if_inpainting_superresolution.py"),yf=r(),qo=o("td"),Lo=o("em"),bf=a("Image-to-Image Generation"),Mf=r(),es=o("td"),wf=a("-"),wd=r(),ze=o("h2"),_t=o("a"),Ao=o("span"),f(Sn.$$.fragment),vf=r(),Oo=o("span"),If=a("IFPipeline"),vd=r(),Q=o("div"),f(Vn.$$.fragment),Jf=r(),me=o("div"),f(Nn.$$.fragment),Uf=r(),Ko=o("p"),Tf=a("Function invoked when calling the pipeline for generation."),Zf=r(),f(yt.$$.fragment),jf=r(),bt=o("div"),f($n.$$.fragment),Ef=r(),Y=o("p"),Ff=a(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),el=o("code"),Bf=a("enable_sequential_cpu_offload"),Wf=a(", this method moves one whole model at a time to the GPU when its "),tl=o("code"),kf=a("forward"),Gf=a(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),nl=o("code"),Cf=a("enable_sequential_cpu_offload"),Rf=a(", but performance is much better due to the iterative execution of the "),al=o("code"),Xf=a("unet"),xf=a("."),Sf=r(),ge=o("div"),f(Pn.$$.fragment),Vf=r(),sl=o("p"),Nf=a("Encodes the prompt into text encoder hidden states."),$f=r(),v=o("p"),Pf=a("device: ("),ol=o("code"),Qf=a("torch.device"),Yf=a(", "),ll=o("em"),Df=a("optional"),zf=a(`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),il=o("code"),Hf=a("int"),qf=a(", "),rl=o("em"),Lf=a("optional"),Af=a(`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),pl=o("code"),Of=a("bool"),Kf=a(", "),dl=o("em"),eu=a("optional"),tu=a(", defaults to "),cl=o("code"),nu=a("True"),au=a(`):
whether to use classifier free guidance or not
negative_prompt (`),ml=o("code"),su=a("str"),ou=a(" or "),gl=o("code"),lu=a("List[str]"),iu=a(", "),fl=o("em"),ru=a("optional"),pu=a(`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),ul=o("code"),du=a("negative_prompt_embeds"),cu=a(". instead. If not defined, one has to pass "),hl=o("code"),mu=a("negative_prompt_embeds"),gu=a(`. instead.
Ignored when not using guidance (i.e., ignored if `),_l=o("code"),fu=a("guidance_scale"),uu=a(" is less than "),yl=o("code"),hu=a("1"),_u=a(`).
prompt_embeds (`),bl=o("code"),yu=a("torch.FloatTensor"),bu=a(", "),Ml=o("em"),Mu=a("optional"),wu=a(`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),wl=o("em"),vu=a("e.g."),Iu=a(` prompt weighting. If not
provided, text embeddings will be generated from `),vl=o("code"),Ju=a("prompt"),Uu=a(` input argument.
negative_prompt_embeds (`),Il=o("code"),Tu=a("torch.FloatTensor"),Zu=a(", "),Jl=o("em"),ju=a("optional"),Eu=a(`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),Ul=o("em"),Fu=a("e.g."),Bu=a(` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),Tl=o("code"),Wu=a("negative_prompt"),ku=a(` input
argument.`),Id=r(),He=o("h2"),Mt=o("a"),Zl=o("span"),f(Qn.$$.fragment),Gu=r(),jl=o("span"),Cu=a("IFSuperResolutionPipeline"),Jd=r(),D=o("div"),f(Yn.$$.fragment),Ru=r(),fe=o("div"),f(Dn.$$.fragment),Xu=r(),El=o("p"),xu=a("Function invoked when calling the pipeline for generation."),Su=r(),f(wt.$$.fragment),Vu=r(),vt=o("div"),f(zn.$$.fragment),Nu=r(),z=o("p"),$u=a(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Fl=o("code"),Pu=a("enable_sequential_cpu_offload"),Qu=a(", this method moves one whole model at a time to the GPU when its "),Bl=o("code"),Yu=a("forward"),Du=a(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Wl=o("code"),zu=a("enable_sequential_cpu_offload"),Hu=a(", but performance is much better due to the iterative execution of the "),kl=o("code"),qu=a("unet"),Lu=a("."),Au=r(),ue=o("div"),f(Hn.$$.fragment),Ou=r(),Gl=o("p"),Ku=a("Encodes the prompt into text encoder hidden states."),eh=r(),I=o("p"),th=a("device: ("),Cl=o("code"),nh=a("torch.device"),ah=a(", "),Rl=o("em"),sh=a("optional"),oh=a(`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),Xl=o("code"),lh=a("int"),ih=a(", "),xl=o("em"),rh=a("optional"),ph=a(`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),Sl=o("code"),dh=a("bool"),ch=a(", "),Vl=o("em"),mh=a("optional"),gh=a(", defaults to "),Nl=o("code"),fh=a("True"),uh=a(`):
whether to use classifier free guidance or not
negative_prompt (`),$l=o("code"),hh=a("str"),_h=a(" or "),Pl=o("code"),yh=a("List[str]"),bh=a(", "),Ql=o("em"),Mh=a("optional"),wh=a(`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),Yl=o("code"),vh=a("negative_prompt_embeds"),Ih=a(". instead. If not defined, one has to pass "),Dl=o("code"),Jh=a("negative_prompt_embeds"),Uh=a(`. instead.
Ignored when not using guidance (i.e., ignored if `),zl=o("code"),Th=a("guidance_scale"),Zh=a(" is less than "),Hl=o("code"),jh=a("1"),Eh=a(`).
prompt_embeds (`),ql=o("code"),Fh=a("torch.FloatTensor"),Bh=a(", "),Ll=o("em"),Wh=a("optional"),kh=a(`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),Al=o("em"),Gh=a("e.g."),Ch=a(` prompt weighting. If not
provided, text embeddings will be generated from `),Ol=o("code"),Rh=a("prompt"),Xh=a(` input argument.
negative_prompt_embeds (`),Kl=o("code"),xh=a("torch.FloatTensor"),Sh=a(", "),ei=o("em"),Vh=a("optional"),Nh=a(`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),ti=o("em"),$h=a("e.g."),Ph=a(` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),ni=o("code"),Qh=a("negative_prompt"),Yh=a(` input
argument.`),Ud=r(),qe=o("h2"),It=o("a"),ai=o("span"),f(qn.$$.fragment),Dh=r(),si=o("span"),zh=a("IFImg2ImgPipeline"),Td=r(),H=o("div"),f(Ln.$$.fragment),Hh=r(),he=o("div"),f(An.$$.fragment),qh=r(),oi=o("p"),Lh=a("Function invoked when calling the pipeline for generation."),Ah=r(),f(Jt.$$.fragment),Oh=r(),Ut=o("div"),f(On.$$.fragment),Kh=r(),q=o("p"),e_=a(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),li=o("code"),t_=a("enable_sequential_cpu_offload"),n_=a(", this method moves one whole model at a time to the GPU when its "),ii=o("code"),a_=a("forward"),s_=a(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),ri=o("code"),o_=a("enable_sequential_cpu_offload"),l_=a(", but performance is much better due to the iterative execution of the "),pi=o("code"),i_=a("unet"),r_=a("."),p_=r(),_e=o("div"),f(Kn.$$.fragment),d_=r(),di=o("p"),c_=a("Encodes the prompt into text encoder hidden states."),m_=r(),J=o("p"),g_=a("device: ("),ci=o("code"),f_=a("torch.device"),u_=a(", "),mi=o("em"),h_=a("optional"),__=a(`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),gi=o("code"),y_=a("int"),b_=a(", "),fi=o("em"),M_=a("optional"),w_=a(`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),ui=o("code"),v_=a("bool"),I_=a(", "),hi=o("em"),J_=a("optional"),U_=a(", defaults to "),_i=o("code"),T_=a("True"),Z_=a(`):
whether to use classifier free guidance or not
negative_prompt (`),yi=o("code"),j_=a("str"),E_=a(" or "),bi=o("code"),F_=a("List[str]"),B_=a(", "),Mi=o("em"),W_=a("optional"),k_=a(`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),wi=o("code"),G_=a("negative_prompt_embeds"),C_=a(". instead. If not defined, one has to pass "),vi=o("code"),R_=a("negative_prompt_embeds"),X_=a(`. instead.
Ignored when not using guidance (i.e., ignored if `),Ii=o("code"),x_=a("guidance_scale"),S_=a(" is less than "),Ji=o("code"),V_=a("1"),N_=a(`).
prompt_embeds (`),Ui=o("code"),$_=a("torch.FloatTensor"),P_=a(", "),Ti=o("em"),Q_=a("optional"),Y_=a(`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),Zi=o("em"),D_=a("e.g."),z_=a(` prompt weighting. If not
provided, text embeddings will be generated from `),ji=o("code"),H_=a("prompt"),q_=a(` input argument.
negative_prompt_embeds (`),Ei=o("code"),L_=a("torch.FloatTensor"),A_=a(", "),Fi=o("em"),O_=a("optional"),K_=a(`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),Bi=o("em"),ey=a("e.g."),ty=a(` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),Wi=o("code"),ny=a("negative_prompt"),ay=a(` input
argument.`),Zd=r(),Le=o("h2"),Tt=o("a"),ki=o("span"),f(ea.$$.fragment),sy=r(),Gi=o("span"),oy=a("IFImg2ImgSuperResolutionPipeline"),jd=r(),L=o("div"),f(ta.$$.fragment),ly=r(),ye=o("div"),f(na.$$.fragment),iy=r(),Ci=o("p"),ry=a("Function invoked when calling the pipeline for generation."),py=r(),f(Zt.$$.fragment),dy=r(),jt=o("div"),f(aa.$$.fragment),cy=r(),A=o("p"),my=a(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Ri=o("code"),gy=a("enable_sequential_cpu_offload"),fy=a(", this method moves one whole model at a time to the GPU when its "),Xi=o("code"),uy=a("forward"),hy=a(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),xi=o("code"),_y=a("enable_sequential_cpu_offload"),yy=a(", but performance is much better due to the iterative execution of the "),Si=o("code"),by=a("unet"),My=a("."),wy=r(),be=o("div"),f(sa.$$.fragment),vy=r(),Vi=o("p"),Iy=a("Encodes the prompt into text encoder hidden states."),Jy=r(),U=o("p"),Uy=a("device: ("),Ni=o("code"),Ty=a("torch.device"),Zy=a(", "),$i=o("em"),jy=a("optional"),Ey=a(`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),Pi=o("code"),Fy=a("int"),By=a(", "),Qi=o("em"),Wy=a("optional"),ky=a(`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),Yi=o("code"),Gy=a("bool"),Cy=a(", "),Di=o("em"),Ry=a("optional"),Xy=a(", defaults to "),zi=o("code"),xy=a("True"),Sy=a(`):
whether to use classifier free guidance or not
negative_prompt (`),Hi=o("code"),Vy=a("str"),Ny=a(" or "),qi=o("code"),$y=a("List[str]"),Py=a(", "),Li=o("em"),Qy=a("optional"),Yy=a(`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),Ai=o("code"),Dy=a("negative_prompt_embeds"),zy=a(". instead. If not defined, one has to pass "),Oi=o("code"),Hy=a("negative_prompt_embeds"),qy=a(`. instead.
Ignored when not using guidance (i.e., ignored if `),Ki=o("code"),Ly=a("guidance_scale"),Ay=a(" is less than "),er=o("code"),Oy=a("1"),Ky=a(`).
prompt_embeds (`),tr=o("code"),eb=a("torch.FloatTensor"),tb=a(", "),nr=o("em"),nb=a("optional"),ab=a(`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),ar=o("em"),sb=a("e.g."),ob=a(` prompt weighting. If not
provided, text embeddings will be generated from `),sr=o("code"),lb=a("prompt"),ib=a(` input argument.
negative_prompt_embeds (`),or=o("code"),rb=a("torch.FloatTensor"),pb=a(", "),lr=o("em"),db=a("optional"),cb=a(`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),ir=o("em"),mb=a("e.g."),gb=a(` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),rr=o("code"),fb=a("negative_prompt"),ub=a(` input
argument.`),Ed=r(),Ae=o("h2"),Et=o("a"),pr=o("span"),f(oa.$$.fragment),hb=r(),dr=o("span"),_b=a("IFInpaintingPipeline"),Fd=r(),O=o("div"),f(la.$$.fragment),yb=r(),Me=o("div"),f(ia.$$.fragment),bb=r(),cr=o("p"),Mb=a("Function invoked when calling the pipeline for generation."),wb=r(),f(Ft.$$.fragment),vb=r(),Bt=o("div"),f(ra.$$.fragment),Ib=r(),K=o("p"),Jb=a(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),mr=o("code"),Ub=a("enable_sequential_cpu_offload"),Tb=a(", this method moves one whole model at a time to the GPU when its "),gr=o("code"),Zb=a("forward"),jb=a(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),fr=o("code"),Eb=a("enable_sequential_cpu_offload"),Fb=a(", but performance is much better due to the iterative execution of the "),ur=o("code"),Bb=a("unet"),Wb=a("."),kb=r(),we=o("div"),f(pa.$$.fragment),Gb=r(),hr=o("p"),Cb=a("Encodes the prompt into text encoder hidden states."),Rb=r(),T=o("p"),Xb=a("device: ("),_r=o("code"),xb=a("torch.device"),Sb=a(", "),yr=o("em"),Vb=a("optional"),Nb=a(`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),br=o("code"),$b=a("int"),Pb=a(", "),Mr=o("em"),Qb=a("optional"),Yb=a(`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),wr=o("code"),Db=a("bool"),zb=a(", "),vr=o("em"),Hb=a("optional"),qb=a(", defaults to "),Ir=o("code"),Lb=a("True"),Ab=a(`):
whether to use classifier free guidance or not
negative_prompt (`),Jr=o("code"),Ob=a("str"),Kb=a(" or "),Ur=o("code"),eM=a("List[str]"),tM=a(", "),Tr=o("em"),nM=a("optional"),aM=a(`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),Zr=o("code"),sM=a("negative_prompt_embeds"),oM=a(". instead. If not defined, one has to pass "),jr=o("code"),lM=a("negative_prompt_embeds"),iM=a(`. instead.
Ignored when not using guidance (i.e., ignored if `),Er=o("code"),rM=a("guidance_scale"),pM=a(" is less than "),Fr=o("code"),dM=a("1"),cM=a(`).
prompt_embeds (`),Br=o("code"),mM=a("torch.FloatTensor"),gM=a(", "),Wr=o("em"),fM=a("optional"),uM=a(`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),kr=o("em"),hM=a("e.g."),_M=a(` prompt weighting. If not
provided, text embeddings will be generated from `),Gr=o("code"),yM=a("prompt"),bM=a(` input argument.
negative_prompt_embeds (`),Cr=o("code"),MM=a("torch.FloatTensor"),wM=a(", "),Rr=o("em"),vM=a("optional"),IM=a(`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),Xr=o("em"),JM=a("e.g."),UM=a(` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),xr=o("code"),TM=a("negative_prompt"),ZM=a(` input
argument.`),Bd=r(),Oe=o("h2"),Wt=o("a"),Sr=o("span"),f(da.$$.fragment),jM=r(),Vr=o("span"),EM=a("IFInpaintingSuperResolutionPipeline"),Wd=r(),ee=o("div"),f(ca.$$.fragment),FM=r(),ve=o("div"),f(ma.$$.fragment),BM=r(),Nr=o("p"),WM=a("Function invoked when calling the pipeline for generation."),kM=r(),f(kt.$$.fragment),GM=r(),Gt=o("div"),f(ga.$$.fragment),CM=r(),te=o("p"),RM=a(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),$r=o("code"),XM=a("enable_sequential_cpu_offload"),xM=a(", this method moves one whole model at a time to the GPU when its "),Pr=o("code"),SM=a("forward"),VM=a(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Qr=o("code"),NM=a("enable_sequential_cpu_offload"),$M=a(", but performance is much better due to the iterative execution of the "),Yr=o("code"),PM=a("unet"),QM=a("."),YM=r(),Ie=o("div"),f(fa.$$.fragment),DM=r(),Dr=o("p"),zM=a("Encodes the prompt into text encoder hidden states."),HM=r(),Z=o("p"),qM=a("device: ("),zr=o("code"),LM=a("torch.device"),AM=a(", "),Hr=o("em"),OM=a("optional"),KM=a(`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),qr=o("code"),ew=a("int"),tw=a(", "),Lr=o("em"),nw=a("optional"),aw=a(`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),Ar=o("code"),sw=a("bool"),ow=a(", "),Or=o("em"),lw=a("optional"),iw=a(", defaults to "),Kr=o("code"),rw=a("True"),pw=a(`):
whether to use classifier free guidance or not
negative_prompt (`),ep=o("code"),dw=a("str"),cw=a(" or "),tp=o("code"),mw=a("List[str]"),gw=a(", "),np=o("em"),fw=a("optional"),uw=a(`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),ap=o("code"),hw=a("negative_prompt_embeds"),_w=a(". instead. If not defined, one has to pass "),sp=o("code"),yw=a("negative_prompt_embeds"),bw=a(`. instead.
Ignored when not using guidance (i.e., ignored if `),op=o("code"),Mw=a("guidance_scale"),ww=a(" is less than "),lp=o("code"),vw=a("1"),Iw=a(`).
prompt_embeds (`),ip=o("code"),Jw=a("torch.FloatTensor"),Uw=a(", "),rp=o("em"),Tw=a("optional"),Zw=a(`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),pp=o("em"),jw=a("e.g."),Ew=a(` prompt weighting. If not
provided, text embeddings will be generated from `),dp=o("code"),Fw=a("prompt"),Bw=a(` input argument.
negative_prompt_embeds (`),cp=o("code"),Ww=a("torch.FloatTensor"),kw=a(", "),mp=o("em"),Gw=a("optional"),Cw=a(`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),gp=o("em"),Rw=a("e.g."),Xw=a(` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),fp=o("code"),xw=a("negative_prompt"),Sw=a(` input
argument.`),this.h()},l(n){const d=P1('[data-svelte="svelte-1phssyn"]',document.head);w=l(d,"META",{name:!0,content:!0}),d.forEach(t),X=p(n),C=l(n,"H1",{class:!0});var ua=i(C);M=l(ua,"A",{id:!0,class:!0,href:!0});var up=i(M);R=l(up,"SPAN",{});var hp=i(R);u(g.$$.fragment,hp),hp.forEach(t),up.forEach(t),G=p(ua),Es=l(ua,"SPAN",{});var _p=i(Es);hc=s(_p,"DeepFloyd IF"),_p.forEach(t),ua.forEach(t),bp=p(n),Fe=l(n,"H2",{class:!0});var ha=i(Fe);Ke=l(ha,"A",{id:!0,class:!0,href:!0});var yp=i(Ke);Fs=l(yp,"SPAN",{});var Pw=i(Fs);u(Nt.$$.fragment,Pw),Pw.forEach(t),yp.forEach(t),_c=p(ha),Bs=l(ha,"SPAN",{});var Qw=i(Bs);yc=s(Qw,"Overview"),Qw.forEach(t),ha.forEach(t),Mp=p(n),ba=l(n,"P",{});var Yw=i(ba);bc=s(Yw,`DeepFloyd IF is a novel state-of-the-art open-source text-to-image model with a high degree of photorealism and language understanding.
The model is a modular composed of a frozen text encoder and three cascaded pixel diffusion modules:`),Yw.forEach(t),wp=p(n),le=l(n,"UL",{});var ts=i(le);Ws=l(ts,"LI",{});var Dw=i(Ws);Mc=s(Dw,"Stage 1: a base model that generates 64x64 px image based on text prompt,"),Dw.forEach(t),wc=p(ts),ks=l(ts,"LI",{});var zw=i(ks);vc=s(zw,"Stage 2: a 64x64 px => 256x256 px super-resolution model, and a"),zw.forEach(t),Ic=p(ts),$t=l(ts,"LI",{});var Gd=i($t);Jc=s(Gd,`Stage 3: a 256x256 px => 1024x1024 px super-resolution model
Stage 1 and Stage 2 utilize a frozen text encoder based on the T5 transformer to extract text embeddings,
which are then fed into a UNet architecture enhanced with cross-attention and attention pooling.
Stage 3 is `),Pt=l(Gd,"A",{href:!0,rel:!0});var Hw=i(Pt);Uc=s(Hw,"Stability\u2019s x4 Upscaling model"),Hw.forEach(t),Tc=s(Gd,`.
The result is a highly efficient model that outperforms current state-of-the-art models, achieving a zero-shot FID score of 6.66 on the COCO dataset.
Our work underscores the potential of larger UNet architectures in the first stage of cascaded diffusion models and depicts a promising future for text-to-image synthesis.`),Gd.forEach(t),ts.forEach(t),vp=p(n),Be=l(n,"H2",{class:!0});var Cd=i(Be);et=l(Cd,"A",{id:!0,class:!0,href:!0});var qw=i(et);Gs=l(qw,"SPAN",{});var Lw=i(Gs);u(Qt.$$.fragment,Lw),Lw.forEach(t),qw.forEach(t),Zc=p(Cd),Cs=l(Cd,"SPAN",{});var Aw=i(Cs);jc=s(Aw,"Usage"),Aw.forEach(t),Cd.forEach(t),Ip=p(n),Ma=l(n,"P",{});var Ow=i(Ma);Ec=s(Ow,"Before you can use IF, you need to accept its usage conditions. To do so:"),Ow.forEach(t),Jp=p(n),ie=l(n,"OL",{});var ns=i(ie);Yt=l(ns,"LI",{});var Rd=i(Yt);Fc=s(Rd,"Make sure to have a "),Dt=l(Rd,"A",{href:!0,rel:!0});var Kw=i(Dt);Bc=s(Kw,"Hugging Face account"),Kw.forEach(t),Wc=s(Rd," and be logged in"),Rd.forEach(t),kc=p(ns),zt=l(ns,"LI",{});var Xd=i(zt);Gc=s(Xd,"Accept the license on the model card of "),Ht=l(Xd,"A",{href:!0,rel:!0});var ev=i(Ht);Cc=s(ev,"DeepFloyd/IF-I-XL-v1.0"),ev.forEach(t),Rc=s(Xd,". Accepting the license on the stage I model card will auto accept for the other IF models."),Xd.forEach(t),Xc=p(ns),wa=l(ns,"LI",{});var Vw=i(wa);xc=s(Vw,"Make sure to login locally. Install "),Rs=l(Vw,"CODE",{});var tv=i(Rs);Sc=s(tv,"huggingface_hub"),tv.forEach(t),Vw.forEach(t),ns.forEach(t),Up=p(n),u(qt.$$.fragment,n),Tp=p(n),va=l(n,"P",{});var nv=i(va);Vc=s(nv,"run the login function in a Python shell"),nv.forEach(t),Zp=p(n),u(Lt.$$.fragment,n),jp=p(n),tt=l(n,"P",{});var xd=i(tt);Nc=s(xd,"and enter your "),At=l(xd,"A",{href:!0,rel:!0});var av=i(At);$c=s(av,"Hugging Face Hub access token"),av.forEach(t),Pc=s(xd,"."),xd.forEach(t),Ep=p(n),nt=l(n,"P",{});var Sd=i(nt);Qc=s(Sd,"Next we install "),Xs=l(Sd,"CODE",{});var sv=i(Xs);Yc=s(sv,"diffusers"),sv.forEach(t),Dc=s(Sd," and dependencies:"),Sd.forEach(t),Fp=p(n),u(Ot.$$.fragment,n),Bp=p(n),Ia=l(n,"P",{});var ov=i(Ia);zc=s(ov,"The following sections give more in-detail examples of how to use IF. Specifically:"),ov.forEach(t),Wp=p(n),V=l(n,"UL",{});var ne=i(V);xs=l(ne,"LI",{});var lv=i(xs);Ja=l(lv,"A",{href:!0});var iv=i(Ja);Hc=s(iv,"Text-to-Image Generation"),iv.forEach(t),lv.forEach(t),qc=p(ne),Ss=l(ne,"LI",{});var rv=i(Ss);Ua=l(rv,"A",{href:!0});var pv=i(Ua);Lc=s(pv,"Image-to-Image Generation"),pv.forEach(t),rv.forEach(t),Ac=p(ne),Vs=l(ne,"LI",{});var dv=i(Vs);Ta=l(dv,"A",{href:!0});var cv=i(Ta);Oc=s(cv,"Inpainting"),cv.forEach(t),dv.forEach(t),Kc=p(ne),Ns=l(ne,"LI",{});var mv=i(Ns);Za=l(mv,"A",{href:!0});var gv=i(Za);em=s(gv,"Reusing model weights"),gv.forEach(t),mv.forEach(t),tm=p(ne),$s=l(ne,"LI",{});var fv=i($s);ja=l(fv,"A",{href:!0});var uv=i(ja);nm=s(uv,"Speed optimization"),uv.forEach(t),fv.forEach(t),am=p(ne),Ps=l(ne,"LI",{});var hv=i(Ps);Ea=l(hv,"A",{href:!0});var _v=i(Ea);sm=s(_v,"Memory optimization"),_v.forEach(t),hv.forEach(t),ne.forEach(t),kp=p(n),Fa=l(n,"P",{});var yv=i(Fa);Qs=l(yv,"STRONG",{});var bv=i(Qs);om=s(bv,"Available checkpoints"),bv.forEach(t),yv.forEach(t),Gp=p(n),re=l(n,"UL",{});var as=i(re);Kt=l(as,"LI",{});var Vd=i(Kt);Ys=l(Vd,"P",{});var Mv=i(Ys);Ds=l(Mv,"EM",{});var wv=i(Ds);lm=s(wv,"Stage-1"),wv.forEach(t),Mv.forEach(t),im=p(Vd),We=l(Vd,"UL",{});var ss=i(We);zs=l(ss,"LI",{});var vv=i(zs);en=l(vv,"A",{href:!0,rel:!0});var Iv=i(en);rm=s(Iv,"DeepFloyd/IF-I-XL-v1.0"),Iv.forEach(t),vv.forEach(t),pm=p(ss),Hs=l(ss,"LI",{});var Jv=i(Hs);tn=l(Jv,"A",{href:!0,rel:!0});var Uv=i(tn);dm=s(Uv,"DeepFloyd/IF-I-L-v1.0"),Uv.forEach(t),Jv.forEach(t),cm=p(ss),qs=l(ss,"LI",{});var Tv=i(qs);nn=l(Tv,"A",{href:!0,rel:!0});var Zv=i(nn);mm=s(Zv,"DeepFloyd/IF-I-M-v1.0"),Zv.forEach(t),Tv.forEach(t),ss.forEach(t),Vd.forEach(t),gm=p(as),an=l(as,"LI",{});var Nd=i(an);Ls=l(Nd,"P",{});var jv=i(Ls);As=l(jv,"EM",{});var Ev=i(As);fm=s(Ev,"Stage-2"),Ev.forEach(t),jv.forEach(t),um=p(Nd),sn=l(Nd,"UL",{});var $d=i(sn);Os=l($d,"LI",{});var Fv=i(Os);on=l(Fv,"A",{href:!0,rel:!0});var Bv=i(on);hm=s(Bv,"DeepFloyd/IF-II-L-v1.0"),Bv.forEach(t),Fv.forEach(t),_m=p($d),Ks=l($d,"LI",{});var Wv=i(Ks);ln=l(Wv,"A",{href:!0,rel:!0});var kv=i(ln);ym=s(kv,"DeepFloyd/IF-II-M-v1.0"),kv.forEach(t),Wv.forEach(t),$d.forEach(t),Nd.forEach(t),bm=p(as),rn=l(as,"LI",{});var Pd=i(rn);eo=l(Pd,"P",{});var Gv=i(eo);to=l(Gv,"EM",{});var Cv=i(to);Mm=s(Cv,"Stage-3"),Cv.forEach(t),Gv.forEach(t),wm=p(Pd),no=l(Pd,"UL",{});var Rv=i(no);ao=l(Rv,"LI",{});var Xv=i(ao);pn=l(Xv,"A",{href:!0,rel:!0});var xv=i(pn);vm=s(xv,"stabilityai/stable-diffusion-x4-upscaler"),xv.forEach(t),Xv.forEach(t),Rv.forEach(t),Pd.forEach(t),as.forEach(t),Cp=p(n),at=l(n,"P",{});var Qd=i(at);so=l(Qd,"STRONG",{});var Sv=i(so);Im=s(Sv,"Demo"),Sv.forEach(t),Jm=p(Qd),dn=l(Qd,"A",{href:!0,rel:!0});var Vv=i(dn);Ba=l(Vv,"IMG",{src:!0,alt:!0}),Vv.forEach(t),Qd.forEach(t),Rp=p(n),st=l(n,"P",{});var Yd=i(st);oo=l(Yd,"STRONG",{});var Nv=i(oo);Um=s(Nv,"Google Colab"),Nv.forEach(t),Tm=p(Yd),cn=l(Yd,"A",{href:!0,rel:!0});var $v=i(cn);Wa=l($v,"IMG",{src:!0,alt:!0}),$v.forEach(t),Yd.forEach(t),Xp=p(n),ke=l(n,"H3",{class:!0});var Dd=i(ke);ot=l(Dd,"A",{id:!0,class:!0,href:!0});var Pv=i(ot);lo=l(Pv,"SPAN",{});var Qv=i(lo);u(mn.$$.fragment,Qv),Qv.forEach(t),Pv.forEach(t),Zm=p(Dd),io=l(Dd,"SPAN",{});var Yv=i(io);jm=s(Yv,"Text-to-Image Generation"),Yv.forEach(t),Dd.forEach(t),xp=p(n),lt=l(n,"P",{});var zd=i(lt);Em=s(zd,"By default diffusers makes use of "),gn=l(zd,"A",{href:!0,rel:!0});var Dv=i(gn);Fm=s(Dv,"model cpu offloading"),Dv.forEach(t),Bm=s(zd,`
to run the whole IF pipeline with as little as 14 GB of VRAM.`),zd.forEach(t),Sp=p(n),u(fn.$$.fragment,n),Vp=p(n),Ge=l(n,"H3",{class:!0});var Hd=i(Ge);it=l(Hd,"A",{id:!0,class:!0,href:!0});var zv=i(it);ro=l(zv,"SPAN",{});var Hv=i(ro);u(un.$$.fragment,Hv),Hv.forEach(t),zv.forEach(t),Wm=p(Hd),po=l(Hd,"SPAN",{});var qv=i(po);km=s(qv,"Text Guided Image-to-Image Generation"),qv.forEach(t),Hd.forEach(t),Np=p(n),pe=l(n,"P",{});var os=i(pe);Gm=s(os,`The same IF model weights can be used for text-guided image-to-image translation or image variation.
In this case just make sure to load the weights using the `),ka=l(os,"A",{href:!0});var Lv=i(ka);Cm=s(Lv,"IFInpaintingPipeline"),Lv.forEach(t),Rm=s(os," and "),Ga=l(os,"A",{href:!0});var Av=i(Ga);Xm=s(Av,"IFInpaintingSuperResolutionPipeline"),Av.forEach(t),xm=s(os," pipelines."),os.forEach(t),$p=p(n),se=l(n,"P",{});var _a=i(se);co=l(_a,"STRONG",{});var Ov=i(co);Sm=s(Ov,"Note"),Ov.forEach(t),Vm=s(_a,`: You can also directly move the weights of the text-to-image pipelines to the image-to-image pipelines
without loading them twice by making use of the `),mo=l(_a,"CODE",{});var Kv=i(mo);Nm=s(Kv,"~DiffusionPipeline.components()"),Kv.forEach(t),$m=s(_a," function as explained "),Ca=l(_a,"A",{href:!0});var eI=i(Ca);Pm=s(eI,"here"),eI.forEach(t),Qm=s(_a,"."),_a.forEach(t),Pp=p(n),u(hn.$$.fragment,n),Qp=p(n),Ce=l(n,"H3",{class:!0});var qd=i(Ce);rt=l(qd,"A",{id:!0,class:!0,href:!0});var tI=i(rt);go=l(tI,"SPAN",{});var nI=i(go);u(_n.$$.fragment,nI),nI.forEach(t),tI.forEach(t),Ym=p(qd),fo=l(qd,"SPAN",{});var aI=i(fo);Dm=s(aI,"Text Guided Inpainting Generation"),aI.forEach(t),qd.forEach(t),Yp=p(n),de=l(n,"P",{});var ls=i(de);zm=s(ls,`The same IF model weights can be used for text-guided image-to-image translation or image variation.
In this case just make sure to load the weights using the `),Ra=l(ls,"A",{href:!0});var sI=i(Ra);Hm=s(sI,"IFInpaintingPipeline"),sI.forEach(t),qm=s(ls," and "),Xa=l(ls,"A",{href:!0});var oI=i(Xa);Lm=s(oI,"IFInpaintingSuperResolutionPipeline"),oI.forEach(t),Am=s(ls," pipelines."),ls.forEach(t),Dp=p(n),oe=l(n,"P",{});var ya=i(oe);uo=l(ya,"STRONG",{});var lI=i(uo);Om=s(lI,"Note"),lI.forEach(t),Km=s(ya,`: You can also directly move the weights of the text-to-image pipelines to the image-to-image pipelines
without loading them twice by making use of the `),ho=l(ya,"CODE",{});var iI=i(ho);eg=s(iI,"~DiffusionPipeline.components()"),iI.forEach(t),tg=s(ya," function as explained "),xa=l(ya,"A",{href:!0});var rI=i(xa);ng=s(rI,"here"),rI.forEach(t),ag=s(ya,"."),ya.forEach(t),zp=p(n),u(yn.$$.fragment,n),Hp=p(n),Re=l(n,"H3",{class:!0});var Ld=i(Re);pt=l(Ld,"A",{id:!0,class:!0,href:!0});var pI=i(pt);_o=l(pI,"SPAN",{});var dI=i(_o);u(bn.$$.fragment,dI),dI.forEach(t),pI.forEach(t),sg=p(Ld),yo=l(Ld,"SPAN",{});var cI=i(yo);og=s(cI,"Converting between different pipelines"),cI.forEach(t),Ld.forEach(t),qp=p(n),dt=l(n,"P",{});var Ad=i(dt);lg=s(Ad,"In addition to being loaded with "),bo=l(Ad,"CODE",{});var mI=i(bo);ig=s(mI,"from_pretrained"),mI.forEach(t),rg=s(Ad,", Pipelines can also be loaded directly from each other."),Ad.forEach(t),Lp=p(n),u(Mn.$$.fragment,n),Ap=p(n),Xe=l(n,"H3",{class:!0});var Od=i(Xe);ct=l(Od,"A",{id:!0,class:!0,href:!0});var gI=i(ct);Mo=l(gI,"SPAN",{});var fI=i(Mo);u(wn.$$.fragment,fI),fI.forEach(t),gI.forEach(t),pg=p(Od),wo=l(Od,"SPAN",{});var uI=i(wo);dg=s(uI,"Optimizing for speed"),uI.forEach(t),Od.forEach(t),Op=p(n),Sa=l(n,"P",{});var hI=i(Sa);cg=s(hI,"The simplest optimization to run IF faster is to move all model components to the GPU."),hI.forEach(t),Kp=p(n),u(vn.$$.fragment,n),ed=p(n),Va=l(n,"P",{});var _I=i(Va);mg=s(_I,"You can also run the diffusion process for a shorter number of timesteps."),_I.forEach(t),td=p(n),mt=l(n,"P",{});var Kd=i(mt);gg=s(Kd,"This can either be done with the "),vo=l(Kd,"CODE",{});var yI=i(vo);fg=s(yI,"num_inference_steps"),yI.forEach(t),ug=s(Kd," argument"),Kd.forEach(t),nd=p(n),u(In.$$.fragment,n),ad=p(n),gt=l(n,"P",{});var ec=i(gt);hg=s(ec,"Or with the "),Io=l(ec,"CODE",{});var bI=i(Io);_g=s(bI,"timesteps"),bI.forEach(t),yg=s(ec," argument"),ec.forEach(t),sd=p(n),u(Jn.$$.fragment,n),od=p(n),Na=l(n,"P",{});var MI=i(Na);bg=s(MI,`When doing image variation or inpainting, you can also decrease the number of timesteps
with the strength argument. The strength argument is the amount of noise to add to
the input image which also determines how many steps to run in the denoising process.
A smaller number will vary the image less but run faster.`),MI.forEach(t),ld=p(n),u(Un.$$.fragment,n),id=p(n),ce=l(n,"P",{});var is=i(ce);Mg=s(is,"You can also use "),$a=l(is,"A",{href:!0});var wI=i($a);Jo=l(wI,"CODE",{});var vI=i(Jo);wg=s(vI,"torch.compile"),vI.forEach(t),wI.forEach(t),vg=s(is,". Note that we have not exhaustively tested "),Uo=l(is,"CODE",{});var II=i(Uo);Ig=s(II,"torch.compile"),II.forEach(t),Jg=s(is,`
with IF and it might not give expected results.`),is.forEach(t),rd=p(n),u(Tn.$$.fragment,n),pd=p(n),xe=l(n,"H3",{class:!0});var tc=i(xe);ft=l(tc,"A",{id:!0,class:!0,href:!0});var JI=i(ft);To=l(JI,"SPAN",{});var UI=i(To);u(Zn.$$.fragment,UI),UI.forEach(t),JI.forEach(t),Ug=p(tc),Zo=l(tc,"SPAN",{});var TI=i(Zo);Tg=s(TI,"Optimizing for memory"),TI.forEach(t),tc.forEach(t),dd=p(n),Pa=l(n,"P",{});var ZI=i(Pa);Zg=s(ZI,"When optimizing for GPU memory, we can use the standard diffusers cpu offloading APIs."),ZI.forEach(t),cd=p(n),Qa=l(n,"P",{});var jI=i(Qa);jg=s(jI,"Either the model based CPU offloading,"),jI.forEach(t),md=p(n),u(jn.$$.fragment,n),gd=p(n),Ya=l(n,"P",{});var EI=i(Ya);Eg=s(EI,"or the more aggressive layer based CPU offloading."),EI.forEach(t),fd=p(n),u(En.$$.fragment,n),ud=p(n),Da=l(n,"P",{});var FI=i(Da);Fg=s(FI,"Additionally, T5 can be loaded in 8bit precision"),FI.forEach(t),hd=p(n),u(Fn.$$.fragment,n),_d=p(n),za=l(n,"P",{});var BI=i(za);Bg=s(BI,`For CPU RAM constrained machines like google colab free tier where we can\u2019t load all
model components to the CPU at once, we can manually only load the pipeline with
the text encoder or unet when the respective model components are needed.`),BI.forEach(t),yd=p(n),u(Bn.$$.fragment,n),bd=p(n),Se=l(n,"H2",{class:!0});var nc=i(Se);ut=l(nc,"A",{id:!0,class:!0,href:!0});var WI=i(ut);jo=l(WI,"SPAN",{});var kI=i(jo);u(Wn.$$.fragment,kI),kI.forEach(t),WI.forEach(t),Wg=p(nc),Eo=l(nc,"SPAN",{});var GI=i(Eo);kg=s(GI,"Available Pipelines:"),GI.forEach(t),nc.forEach(t),Md=p(n),ht=l(n,"TABLE",{});var ac=i(ht);Fo=l(ac,"THEAD",{});var CI=i(Fo);Ve=l(CI,"TR",{});var rs=i(Ve);Bo=l(rs,"TH",{});var RI=i(Bo);Gg=s(RI,"Pipeline"),RI.forEach(t),Cg=p(rs),Wo=l(rs,"TH",{});var XI=i(Wo);Rg=s(XI,"Tasks"),XI.forEach(t),Xg=p(rs),Ha=l(rs,"TH",{align:!0});var xI=i(Ha);xg=s(xI,"Colab"),xI.forEach(t),rs.forEach(t),CI.forEach(t),Sg=p(ac),$=l(ac,"TBODY",{});var ae=i($);Ne=l(ae,"TR",{});var ps=i(Ne);ko=l(ps,"TD",{});var SI=i(ko);kn=l(SI,"A",{href:!0,rel:!0});var VI=i(kn);Vg=s(VI,"pipeline_if.py"),VI.forEach(t),SI.forEach(t),Ng=p(ps),Go=l(ps,"TD",{});var NI=i(Go);Co=l(NI,"EM",{});var $I=i(Co);$g=s($I,"Text-to-Image Generation"),$I.forEach(t),NI.forEach(t),Pg=p(ps),qa=l(ps,"TD",{align:!0});var PI=i(qa);Qg=s(PI,"-"),PI.forEach(t),ps.forEach(t),Yg=p(ae),$e=l(ae,"TR",{});var ds=i($e);Ro=l(ds,"TD",{});var QI=i(Ro);Gn=l(QI,"A",{href:!0,rel:!0});var YI=i(Gn);Dg=s(YI,"pipeline_if_superresolution.py"),YI.forEach(t),QI.forEach(t),zg=p(ds),Xo=l(ds,"TD",{});var DI=i(Xo);xo=l(DI,"EM",{});var zI=i(xo);Hg=s(zI,"Text-to-Image Generation"),zI.forEach(t),DI.forEach(t),qg=p(ds),La=l(ds,"TD",{align:!0});var HI=i(La);Lg=s(HI,"-"),HI.forEach(t),ds.forEach(t),Ag=p(ae),Pe=l(ae,"TR",{});var cs=i(Pe);So=l(cs,"TD",{});var qI=i(So);Cn=l(qI,"A",{href:!0,rel:!0});var LI=i(Cn);Og=s(LI,"pipeline_if_img2img.py"),LI.forEach(t),qI.forEach(t),Kg=p(cs),Vo=l(cs,"TD",{});var AI=i(Vo);No=l(AI,"EM",{});var OI=i(No);ef=s(OI,"Image-to-Image Generation"),OI.forEach(t),AI.forEach(t),tf=p(cs),Aa=l(cs,"TD",{align:!0});var KI=i(Aa);nf=s(KI,"-"),KI.forEach(t),cs.forEach(t),af=p(ae),Qe=l(ae,"TR",{});var ms=i(Qe);$o=l(ms,"TD",{});var e2=i($o);Rn=l(e2,"A",{href:!0,rel:!0});var t2=i(Rn);sf=s(t2,"pipeline_if_img2img_superresolution.py"),t2.forEach(t),e2.forEach(t),of=p(ms),Po=l(ms,"TD",{});var n2=i(Po);Qo=l(n2,"EM",{});var a2=i(Qo);lf=s(a2,"Image-to-Image Generation"),a2.forEach(t),n2.forEach(t),rf=p(ms),Oa=l(ms,"TD",{align:!0});var s2=i(Oa);pf=s(s2,"-"),s2.forEach(t),ms.forEach(t),df=p(ae),Ye=l(ae,"TR",{});var gs=i(Ye);Yo=l(gs,"TD",{});var o2=i(Yo);Xn=l(o2,"A",{href:!0,rel:!0});var l2=i(Xn);cf=s(l2,"pipeline_if_inpainting.py"),l2.forEach(t),o2.forEach(t),mf=p(gs),Do=l(gs,"TD",{});var i2=i(Do);zo=l(i2,"EM",{});var r2=i(zo);gf=s(r2,"Image-to-Image Generation"),r2.forEach(t),i2.forEach(t),ff=p(gs),Ka=l(gs,"TD",{align:!0});var p2=i(Ka);uf=s(p2,"-"),p2.forEach(t),gs.forEach(t),hf=p(ae),De=l(ae,"TR",{});var fs=i(De);Ho=l(fs,"TD",{});var d2=i(Ho);xn=l(d2,"A",{href:!0,rel:!0});var c2=i(xn);_f=s(c2,"pipeline_if_inpainting_superresolution.py"),c2.forEach(t),d2.forEach(t),yf=p(fs),qo=l(fs,"TD",{});var m2=i(qo);Lo=l(m2,"EM",{});var g2=i(Lo);bf=s(g2,"Image-to-Image Generation"),g2.forEach(t),m2.forEach(t),Mf=p(fs),es=l(fs,"TD",{align:!0});var f2=i(es);wf=s(f2,"-"),f2.forEach(t),fs.forEach(t),ae.forEach(t),ac.forEach(t),wd=p(n),ze=l(n,"H2",{class:!0});var sc=i(ze);_t=l(sc,"A",{id:!0,class:!0,href:!0});var u2=i(_t);Ao=l(u2,"SPAN",{});var h2=i(Ao);u(Sn.$$.fragment,h2),h2.forEach(t),u2.forEach(t),vf=p(sc),Oo=l(sc,"SPAN",{});var _2=i(Oo);If=s(_2,"IFPipeline"),_2.forEach(t),sc.forEach(t),vd=p(n),Q=l(n,"DIV",{class:!0});var Ct=i(Q);u(Vn.$$.fragment,Ct),Jf=p(Ct),me=l(Ct,"DIV",{class:!0});var us=i(me);u(Nn.$$.fragment,us),Uf=p(us),Ko=l(us,"P",{});var y2=i(Ko);Tf=s(y2,"Function invoked when calling the pipeline for generation."),y2.forEach(t),Zf=p(us),u(yt.$$.fragment,us),us.forEach(t),jf=p(Ct),bt=l(Ct,"DIV",{class:!0});var oc=i(bt);u($n.$$.fragment,oc),Ef=p(oc),Y=l(oc,"P",{});var Je=i(Y);Ff=s(Je,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),el=l(Je,"CODE",{});var b2=i(el);Bf=s(b2,"enable_sequential_cpu_offload"),b2.forEach(t),Wf=s(Je,", this method moves one whole model at a time to the GPU when its "),tl=l(Je,"CODE",{});var M2=i(tl);kf=s(M2,"forward"),M2.forEach(t),Gf=s(Je,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),nl=l(Je,"CODE",{});var w2=i(nl);Cf=s(w2,"enable_sequential_cpu_offload"),w2.forEach(t),Rf=s(Je,", but performance is much better due to the iterative execution of the "),al=l(Je,"CODE",{});var v2=i(al);Xf=s(v2,"unet"),v2.forEach(t),xf=s(Je,"."),Je.forEach(t),oc.forEach(t),Sf=p(Ct),ge=l(Ct,"DIV",{class:!0});var hs=i(ge);u(Pn.$$.fragment,hs),Vf=p(hs),sl=l(hs,"P",{});var I2=i(sl);Nf=s(I2,"Encodes the prompt into text encoder hidden states."),I2.forEach(t),$f=p(hs),v=l(hs,"P",{});var j=i(v);Pf=s(j,"device: ("),ol=l(j,"CODE",{});var J2=i(ol);Qf=s(J2,"torch.device"),J2.forEach(t),Yf=s(j,", "),ll=l(j,"EM",{});var U2=i(ll);Df=s(U2,"optional"),U2.forEach(t),zf=s(j,`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),il=l(j,"CODE",{});var T2=i(il);Hf=s(T2,"int"),T2.forEach(t),qf=s(j,", "),rl=l(j,"EM",{});var Z2=i(rl);Lf=s(Z2,"optional"),Z2.forEach(t),Af=s(j,`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),pl=l(j,"CODE",{});var j2=i(pl);Of=s(j2,"bool"),j2.forEach(t),Kf=s(j,", "),dl=l(j,"EM",{});var E2=i(dl);eu=s(E2,"optional"),E2.forEach(t),tu=s(j,", defaults to "),cl=l(j,"CODE",{});var F2=i(cl);nu=s(F2,"True"),F2.forEach(t),au=s(j,`):
whether to use classifier free guidance or not
negative_prompt (`),ml=l(j,"CODE",{});var B2=i(ml);su=s(B2,"str"),B2.forEach(t),ou=s(j," or "),gl=l(j,"CODE",{});var W2=i(gl);lu=s(W2,"List[str]"),W2.forEach(t),iu=s(j,", "),fl=l(j,"EM",{});var k2=i(fl);ru=s(k2,"optional"),k2.forEach(t),pu=s(j,`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),ul=l(j,"CODE",{});var G2=i(ul);du=s(G2,"negative_prompt_embeds"),G2.forEach(t),cu=s(j,". instead. If not defined, one has to pass "),hl=l(j,"CODE",{});var C2=i(hl);mu=s(C2,"negative_prompt_embeds"),C2.forEach(t),gu=s(j,`. instead.
Ignored when not using guidance (i.e., ignored if `),_l=l(j,"CODE",{});var R2=i(_l);fu=s(R2,"guidance_scale"),R2.forEach(t),uu=s(j," is less than "),yl=l(j,"CODE",{});var X2=i(yl);hu=s(X2,"1"),X2.forEach(t),_u=s(j,`).
prompt_embeds (`),bl=l(j,"CODE",{});var x2=i(bl);yu=s(x2,"torch.FloatTensor"),x2.forEach(t),bu=s(j,", "),Ml=l(j,"EM",{});var S2=i(Ml);Mu=s(S2,"optional"),S2.forEach(t),wu=s(j,`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),wl=l(j,"EM",{});var V2=i(wl);vu=s(V2,"e.g."),V2.forEach(t),Iu=s(j,` prompt weighting. If not
provided, text embeddings will be generated from `),vl=l(j,"CODE",{});var N2=i(vl);Ju=s(N2,"prompt"),N2.forEach(t),Uu=s(j,` input argument.
negative_prompt_embeds (`),Il=l(j,"CODE",{});var $2=i(Il);Tu=s($2,"torch.FloatTensor"),$2.forEach(t),Zu=s(j,", "),Jl=l(j,"EM",{});var P2=i(Jl);ju=s(P2,"optional"),P2.forEach(t),Eu=s(j,`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),Ul=l(j,"EM",{});var Q2=i(Ul);Fu=s(Q2,"e.g."),Q2.forEach(t),Bu=s(j,` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),Tl=l(j,"CODE",{});var Y2=i(Tl);Wu=s(Y2,"negative_prompt"),Y2.forEach(t),ku=s(j,` input
argument.`),j.forEach(t),hs.forEach(t),Ct.forEach(t),Id=p(n),He=l(n,"H2",{class:!0});var lc=i(He);Mt=l(lc,"A",{id:!0,class:!0,href:!0});var D2=i(Mt);Zl=l(D2,"SPAN",{});var z2=i(Zl);u(Qn.$$.fragment,z2),z2.forEach(t),D2.forEach(t),Gu=p(lc),jl=l(lc,"SPAN",{});var H2=i(jl);Cu=s(H2,"IFSuperResolutionPipeline"),H2.forEach(t),lc.forEach(t),Jd=p(n),D=l(n,"DIV",{class:!0});var Rt=i(D);u(Yn.$$.fragment,Rt),Ru=p(Rt),fe=l(Rt,"DIV",{class:!0});var _s=i(fe);u(Dn.$$.fragment,_s),Xu=p(_s),El=l(_s,"P",{});var q2=i(El);xu=s(q2,"Function invoked when calling the pipeline for generation."),q2.forEach(t),Su=p(_s),u(wt.$$.fragment,_s),_s.forEach(t),Vu=p(Rt),vt=l(Rt,"DIV",{class:!0});var ic=i(vt);u(zn.$$.fragment,ic),Nu=p(ic),z=l(ic,"P",{});var Ue=i(z);$u=s(Ue,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Fl=l(Ue,"CODE",{});var L2=i(Fl);Pu=s(L2,"enable_sequential_cpu_offload"),L2.forEach(t),Qu=s(Ue,", this method moves one whole model at a time to the GPU when its "),Bl=l(Ue,"CODE",{});var A2=i(Bl);Yu=s(A2,"forward"),A2.forEach(t),Du=s(Ue,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Wl=l(Ue,"CODE",{});var O2=i(Wl);zu=s(O2,"enable_sequential_cpu_offload"),O2.forEach(t),Hu=s(Ue,", but performance is much better due to the iterative execution of the "),kl=l(Ue,"CODE",{});var K2=i(kl);qu=s(K2,"unet"),K2.forEach(t),Lu=s(Ue,"."),Ue.forEach(t),ic.forEach(t),Au=p(Rt),ue=l(Rt,"DIV",{class:!0});var ys=i(ue);u(Hn.$$.fragment,ys),Ou=p(ys),Gl=l(ys,"P",{});var eJ=i(Gl);Ku=s(eJ,"Encodes the prompt into text encoder hidden states."),eJ.forEach(t),eh=p(ys),I=l(ys,"P",{});var E=i(I);th=s(E,"device: ("),Cl=l(E,"CODE",{});var tJ=i(Cl);nh=s(tJ,"torch.device"),tJ.forEach(t),ah=s(E,", "),Rl=l(E,"EM",{});var nJ=i(Rl);sh=s(nJ,"optional"),nJ.forEach(t),oh=s(E,`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),Xl=l(E,"CODE",{});var aJ=i(Xl);lh=s(aJ,"int"),aJ.forEach(t),ih=s(E,", "),xl=l(E,"EM",{});var sJ=i(xl);rh=s(sJ,"optional"),sJ.forEach(t),ph=s(E,`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),Sl=l(E,"CODE",{});var oJ=i(Sl);dh=s(oJ,"bool"),oJ.forEach(t),ch=s(E,", "),Vl=l(E,"EM",{});var lJ=i(Vl);mh=s(lJ,"optional"),lJ.forEach(t),gh=s(E,", defaults to "),Nl=l(E,"CODE",{});var iJ=i(Nl);fh=s(iJ,"True"),iJ.forEach(t),uh=s(E,`):
whether to use classifier free guidance or not
negative_prompt (`),$l=l(E,"CODE",{});var rJ=i($l);hh=s(rJ,"str"),rJ.forEach(t),_h=s(E," or "),Pl=l(E,"CODE",{});var pJ=i(Pl);yh=s(pJ,"List[str]"),pJ.forEach(t),bh=s(E,", "),Ql=l(E,"EM",{});var dJ=i(Ql);Mh=s(dJ,"optional"),dJ.forEach(t),wh=s(E,`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),Yl=l(E,"CODE",{});var cJ=i(Yl);vh=s(cJ,"negative_prompt_embeds"),cJ.forEach(t),Ih=s(E,". instead. If not defined, one has to pass "),Dl=l(E,"CODE",{});var mJ=i(Dl);Jh=s(mJ,"negative_prompt_embeds"),mJ.forEach(t),Uh=s(E,`. instead.
Ignored when not using guidance (i.e., ignored if `),zl=l(E,"CODE",{});var gJ=i(zl);Th=s(gJ,"guidance_scale"),gJ.forEach(t),Zh=s(E," is less than "),Hl=l(E,"CODE",{});var fJ=i(Hl);jh=s(fJ,"1"),fJ.forEach(t),Eh=s(E,`).
prompt_embeds (`),ql=l(E,"CODE",{});var uJ=i(ql);Fh=s(uJ,"torch.FloatTensor"),uJ.forEach(t),Bh=s(E,", "),Ll=l(E,"EM",{});var hJ=i(Ll);Wh=s(hJ,"optional"),hJ.forEach(t),kh=s(E,`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),Al=l(E,"EM",{});var _J=i(Al);Gh=s(_J,"e.g."),_J.forEach(t),Ch=s(E,` prompt weighting. If not
provided, text embeddings will be generated from `),Ol=l(E,"CODE",{});var yJ=i(Ol);Rh=s(yJ,"prompt"),yJ.forEach(t),Xh=s(E,` input argument.
negative_prompt_embeds (`),Kl=l(E,"CODE",{});var bJ=i(Kl);xh=s(bJ,"torch.FloatTensor"),bJ.forEach(t),Sh=s(E,", "),ei=l(E,"EM",{});var MJ=i(ei);Vh=s(MJ,"optional"),MJ.forEach(t),Nh=s(E,`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),ti=l(E,"EM",{});var wJ=i(ti);$h=s(wJ,"e.g."),wJ.forEach(t),Ph=s(E,` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),ni=l(E,"CODE",{});var vJ=i(ni);Qh=s(vJ,"negative_prompt"),vJ.forEach(t),Yh=s(E,` input
argument.`),E.forEach(t),ys.forEach(t),Rt.forEach(t),Ud=p(n),qe=l(n,"H2",{class:!0});var rc=i(qe);It=l(rc,"A",{id:!0,class:!0,href:!0});var IJ=i(It);ai=l(IJ,"SPAN",{});var JJ=i(ai);u(qn.$$.fragment,JJ),JJ.forEach(t),IJ.forEach(t),Dh=p(rc),si=l(rc,"SPAN",{});var UJ=i(si);zh=s(UJ,"IFImg2ImgPipeline"),UJ.forEach(t),rc.forEach(t),Td=p(n),H=l(n,"DIV",{class:!0});var Xt=i(H);u(Ln.$$.fragment,Xt),Hh=p(Xt),he=l(Xt,"DIV",{class:!0});var bs=i(he);u(An.$$.fragment,bs),qh=p(bs),oi=l(bs,"P",{});var TJ=i(oi);Lh=s(TJ,"Function invoked when calling the pipeline for generation."),TJ.forEach(t),Ah=p(bs),u(Jt.$$.fragment,bs),bs.forEach(t),Oh=p(Xt),Ut=l(Xt,"DIV",{class:!0});var pc=i(Ut);u(On.$$.fragment,pc),Kh=p(pc),q=l(pc,"P",{});var Te=i(q);e_=s(Te,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),li=l(Te,"CODE",{});var ZJ=i(li);t_=s(ZJ,"enable_sequential_cpu_offload"),ZJ.forEach(t),n_=s(Te,", this method moves one whole model at a time to the GPU when its "),ii=l(Te,"CODE",{});var jJ=i(ii);a_=s(jJ,"forward"),jJ.forEach(t),s_=s(Te,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),ri=l(Te,"CODE",{});var EJ=i(ri);o_=s(EJ,"enable_sequential_cpu_offload"),EJ.forEach(t),l_=s(Te,", but performance is much better due to the iterative execution of the "),pi=l(Te,"CODE",{});var FJ=i(pi);i_=s(FJ,"unet"),FJ.forEach(t),r_=s(Te,"."),Te.forEach(t),pc.forEach(t),p_=p(Xt),_e=l(Xt,"DIV",{class:!0});var Ms=i(_e);u(Kn.$$.fragment,Ms),d_=p(Ms),di=l(Ms,"P",{});var BJ=i(di);c_=s(BJ,"Encodes the prompt into text encoder hidden states."),BJ.forEach(t),m_=p(Ms),J=l(Ms,"P",{});var F=i(J);g_=s(F,"device: ("),ci=l(F,"CODE",{});var WJ=i(ci);f_=s(WJ,"torch.device"),WJ.forEach(t),u_=s(F,", "),mi=l(F,"EM",{});var kJ=i(mi);h_=s(kJ,"optional"),kJ.forEach(t),__=s(F,`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),gi=l(F,"CODE",{});var GJ=i(gi);y_=s(GJ,"int"),GJ.forEach(t),b_=s(F,", "),fi=l(F,"EM",{});var CJ=i(fi);M_=s(CJ,"optional"),CJ.forEach(t),w_=s(F,`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),ui=l(F,"CODE",{});var RJ=i(ui);v_=s(RJ,"bool"),RJ.forEach(t),I_=s(F,", "),hi=l(F,"EM",{});var XJ=i(hi);J_=s(XJ,"optional"),XJ.forEach(t),U_=s(F,", defaults to "),_i=l(F,"CODE",{});var xJ=i(_i);T_=s(xJ,"True"),xJ.forEach(t),Z_=s(F,`):
whether to use classifier free guidance or not
negative_prompt (`),yi=l(F,"CODE",{});var SJ=i(yi);j_=s(SJ,"str"),SJ.forEach(t),E_=s(F," or "),bi=l(F,"CODE",{});var VJ=i(bi);F_=s(VJ,"List[str]"),VJ.forEach(t),B_=s(F,", "),Mi=l(F,"EM",{});var NJ=i(Mi);W_=s(NJ,"optional"),NJ.forEach(t),k_=s(F,`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),wi=l(F,"CODE",{});var $J=i(wi);G_=s($J,"negative_prompt_embeds"),$J.forEach(t),C_=s(F,". instead. If not defined, one has to pass "),vi=l(F,"CODE",{});var PJ=i(vi);R_=s(PJ,"negative_prompt_embeds"),PJ.forEach(t),X_=s(F,`. instead.
Ignored when not using guidance (i.e., ignored if `),Ii=l(F,"CODE",{});var QJ=i(Ii);x_=s(QJ,"guidance_scale"),QJ.forEach(t),S_=s(F," is less than "),Ji=l(F,"CODE",{});var YJ=i(Ji);V_=s(YJ,"1"),YJ.forEach(t),N_=s(F,`).
prompt_embeds (`),Ui=l(F,"CODE",{});var DJ=i(Ui);$_=s(DJ,"torch.FloatTensor"),DJ.forEach(t),P_=s(F,", "),Ti=l(F,"EM",{});var zJ=i(Ti);Q_=s(zJ,"optional"),zJ.forEach(t),Y_=s(F,`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),Zi=l(F,"EM",{});var HJ=i(Zi);D_=s(HJ,"e.g."),HJ.forEach(t),z_=s(F,` prompt weighting. If not
provided, text embeddings will be generated from `),ji=l(F,"CODE",{});var qJ=i(ji);H_=s(qJ,"prompt"),qJ.forEach(t),q_=s(F,` input argument.
negative_prompt_embeds (`),Ei=l(F,"CODE",{});var LJ=i(Ei);L_=s(LJ,"torch.FloatTensor"),LJ.forEach(t),A_=s(F,", "),Fi=l(F,"EM",{});var AJ=i(Fi);O_=s(AJ,"optional"),AJ.forEach(t),K_=s(F,`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),Bi=l(F,"EM",{});var OJ=i(Bi);ey=s(OJ,"e.g."),OJ.forEach(t),ty=s(F,` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),Wi=l(F,"CODE",{});var KJ=i(Wi);ny=s(KJ,"negative_prompt"),KJ.forEach(t),ay=s(F,` input
argument.`),F.forEach(t),Ms.forEach(t),Xt.forEach(t),Zd=p(n),Le=l(n,"H2",{class:!0});var dc=i(Le);Tt=l(dc,"A",{id:!0,class:!0,href:!0});var eU=i(Tt);ki=l(eU,"SPAN",{});var tU=i(ki);u(ea.$$.fragment,tU),tU.forEach(t),eU.forEach(t),sy=p(dc),Gi=l(dc,"SPAN",{});var nU=i(Gi);oy=s(nU,"IFImg2ImgSuperResolutionPipeline"),nU.forEach(t),dc.forEach(t),jd=p(n),L=l(n,"DIV",{class:!0});var xt=i(L);u(ta.$$.fragment,xt),ly=p(xt),ye=l(xt,"DIV",{class:!0});var ws=i(ye);u(na.$$.fragment,ws),iy=p(ws),Ci=l(ws,"P",{});var aU=i(Ci);ry=s(aU,"Function invoked when calling the pipeline for generation."),aU.forEach(t),py=p(ws),u(Zt.$$.fragment,ws),ws.forEach(t),dy=p(xt),jt=l(xt,"DIV",{class:!0});var cc=i(jt);u(aa.$$.fragment,cc),cy=p(cc),A=l(cc,"P",{});var Ze=i(A);my=s(Ze,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Ri=l(Ze,"CODE",{});var sU=i(Ri);gy=s(sU,"enable_sequential_cpu_offload"),sU.forEach(t),fy=s(Ze,", this method moves one whole model at a time to the GPU when its "),Xi=l(Ze,"CODE",{});var oU=i(Xi);uy=s(oU,"forward"),oU.forEach(t),hy=s(Ze,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),xi=l(Ze,"CODE",{});var lU=i(xi);_y=s(lU,"enable_sequential_cpu_offload"),lU.forEach(t),yy=s(Ze,", but performance is much better due to the iterative execution of the "),Si=l(Ze,"CODE",{});var iU=i(Si);by=s(iU,"unet"),iU.forEach(t),My=s(Ze,"."),Ze.forEach(t),cc.forEach(t),wy=p(xt),be=l(xt,"DIV",{class:!0});var vs=i(be);u(sa.$$.fragment,vs),vy=p(vs),Vi=l(vs,"P",{});var rU=i(Vi);Iy=s(rU,"Encodes the prompt into text encoder hidden states."),rU.forEach(t),Jy=p(vs),U=l(vs,"P",{});var B=i(U);Uy=s(B,"device: ("),Ni=l(B,"CODE",{});var pU=i(Ni);Ty=s(pU,"torch.device"),pU.forEach(t),Zy=s(B,", "),$i=l(B,"EM",{});var dU=i($i);jy=s(dU,"optional"),dU.forEach(t),Ey=s(B,`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),Pi=l(B,"CODE",{});var cU=i(Pi);Fy=s(cU,"int"),cU.forEach(t),By=s(B,", "),Qi=l(B,"EM",{});var mU=i(Qi);Wy=s(mU,"optional"),mU.forEach(t),ky=s(B,`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),Yi=l(B,"CODE",{});var gU=i(Yi);Gy=s(gU,"bool"),gU.forEach(t),Cy=s(B,", "),Di=l(B,"EM",{});var fU=i(Di);Ry=s(fU,"optional"),fU.forEach(t),Xy=s(B,", defaults to "),zi=l(B,"CODE",{});var uU=i(zi);xy=s(uU,"True"),uU.forEach(t),Sy=s(B,`):
whether to use classifier free guidance or not
negative_prompt (`),Hi=l(B,"CODE",{});var hU=i(Hi);Vy=s(hU,"str"),hU.forEach(t),Ny=s(B," or "),qi=l(B,"CODE",{});var _U=i(qi);$y=s(_U,"List[str]"),_U.forEach(t),Py=s(B,", "),Li=l(B,"EM",{});var yU=i(Li);Qy=s(yU,"optional"),yU.forEach(t),Yy=s(B,`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),Ai=l(B,"CODE",{});var bU=i(Ai);Dy=s(bU,"negative_prompt_embeds"),bU.forEach(t),zy=s(B,". instead. If not defined, one has to pass "),Oi=l(B,"CODE",{});var MU=i(Oi);Hy=s(MU,"negative_prompt_embeds"),MU.forEach(t),qy=s(B,`. instead.
Ignored when not using guidance (i.e., ignored if `),Ki=l(B,"CODE",{});var wU=i(Ki);Ly=s(wU,"guidance_scale"),wU.forEach(t),Ay=s(B," is less than "),er=l(B,"CODE",{});var vU=i(er);Oy=s(vU,"1"),vU.forEach(t),Ky=s(B,`).
prompt_embeds (`),tr=l(B,"CODE",{});var IU=i(tr);eb=s(IU,"torch.FloatTensor"),IU.forEach(t),tb=s(B,", "),nr=l(B,"EM",{});var JU=i(nr);nb=s(JU,"optional"),JU.forEach(t),ab=s(B,`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),ar=l(B,"EM",{});var UU=i(ar);sb=s(UU,"e.g."),UU.forEach(t),ob=s(B,` prompt weighting. If not
provided, text embeddings will be generated from `),sr=l(B,"CODE",{});var TU=i(sr);lb=s(TU,"prompt"),TU.forEach(t),ib=s(B,` input argument.
negative_prompt_embeds (`),or=l(B,"CODE",{});var ZU=i(or);rb=s(ZU,"torch.FloatTensor"),ZU.forEach(t),pb=s(B,", "),lr=l(B,"EM",{});var jU=i(lr);db=s(jU,"optional"),jU.forEach(t),cb=s(B,`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),ir=l(B,"EM",{});var EU=i(ir);mb=s(EU,"e.g."),EU.forEach(t),gb=s(B,` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),rr=l(B,"CODE",{});var FU=i(rr);fb=s(FU,"negative_prompt"),FU.forEach(t),ub=s(B,` input
argument.`),B.forEach(t),vs.forEach(t),xt.forEach(t),Ed=p(n),Ae=l(n,"H2",{class:!0});var mc=i(Ae);Et=l(mc,"A",{id:!0,class:!0,href:!0});var BU=i(Et);pr=l(BU,"SPAN",{});var WU=i(pr);u(oa.$$.fragment,WU),WU.forEach(t),BU.forEach(t),hb=p(mc),dr=l(mc,"SPAN",{});var kU=i(dr);_b=s(kU,"IFInpaintingPipeline"),kU.forEach(t),mc.forEach(t),Fd=p(n),O=l(n,"DIV",{class:!0});var St=i(O);u(la.$$.fragment,St),yb=p(St),Me=l(St,"DIV",{class:!0});var Is=i(Me);u(ia.$$.fragment,Is),bb=p(Is),cr=l(Is,"P",{});var GU=i(cr);Mb=s(GU,"Function invoked when calling the pipeline for generation."),GU.forEach(t),wb=p(Is),u(Ft.$$.fragment,Is),Is.forEach(t),vb=p(St),Bt=l(St,"DIV",{class:!0});var gc=i(Bt);u(ra.$$.fragment,gc),Ib=p(gc),K=l(gc,"P",{});var je=i(K);Jb=s(je,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),mr=l(je,"CODE",{});var CU=i(mr);Ub=s(CU,"enable_sequential_cpu_offload"),CU.forEach(t),Tb=s(je,", this method moves one whole model at a time to the GPU when its "),gr=l(je,"CODE",{});var RU=i(gr);Zb=s(RU,"forward"),RU.forEach(t),jb=s(je,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),fr=l(je,"CODE",{});var XU=i(fr);Eb=s(XU,"enable_sequential_cpu_offload"),XU.forEach(t),Fb=s(je,", but performance is much better due to the iterative execution of the "),ur=l(je,"CODE",{});var xU=i(ur);Bb=s(xU,"unet"),xU.forEach(t),Wb=s(je,"."),je.forEach(t),gc.forEach(t),kb=p(St),we=l(St,"DIV",{class:!0});var Js=i(we);u(pa.$$.fragment,Js),Gb=p(Js),hr=l(Js,"P",{});var SU=i(hr);Cb=s(SU,"Encodes the prompt into text encoder hidden states."),SU.forEach(t),Rb=p(Js),T=l(Js,"P",{});var W=i(T);Xb=s(W,"device: ("),_r=l(W,"CODE",{});var VU=i(_r);xb=s(VU,"torch.device"),VU.forEach(t),Sb=s(W,", "),yr=l(W,"EM",{});var NU=i(yr);Vb=s(NU,"optional"),NU.forEach(t),Nb=s(W,`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),br=l(W,"CODE",{});var $U=i(br);$b=s($U,"int"),$U.forEach(t),Pb=s(W,", "),Mr=l(W,"EM",{});var PU=i(Mr);Qb=s(PU,"optional"),PU.forEach(t),Yb=s(W,`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),wr=l(W,"CODE",{});var QU=i(wr);Db=s(QU,"bool"),QU.forEach(t),zb=s(W,", "),vr=l(W,"EM",{});var YU=i(vr);Hb=s(YU,"optional"),YU.forEach(t),qb=s(W,", defaults to "),Ir=l(W,"CODE",{});var DU=i(Ir);Lb=s(DU,"True"),DU.forEach(t),Ab=s(W,`):
whether to use classifier free guidance or not
negative_prompt (`),Jr=l(W,"CODE",{});var zU=i(Jr);Ob=s(zU,"str"),zU.forEach(t),Kb=s(W," or "),Ur=l(W,"CODE",{});var HU=i(Ur);eM=s(HU,"List[str]"),HU.forEach(t),tM=s(W,", "),Tr=l(W,"EM",{});var qU=i(Tr);nM=s(qU,"optional"),qU.forEach(t),aM=s(W,`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),Zr=l(W,"CODE",{});var LU=i(Zr);sM=s(LU,"negative_prompt_embeds"),LU.forEach(t),oM=s(W,". instead. If not defined, one has to pass "),jr=l(W,"CODE",{});var AU=i(jr);lM=s(AU,"negative_prompt_embeds"),AU.forEach(t),iM=s(W,`. instead.
Ignored when not using guidance (i.e., ignored if `),Er=l(W,"CODE",{});var OU=i(Er);rM=s(OU,"guidance_scale"),OU.forEach(t),pM=s(W," is less than "),Fr=l(W,"CODE",{});var KU=i(Fr);dM=s(KU,"1"),KU.forEach(t),cM=s(W,`).
prompt_embeds (`),Br=l(W,"CODE",{});var e1=i(Br);mM=s(e1,"torch.FloatTensor"),e1.forEach(t),gM=s(W,", "),Wr=l(W,"EM",{});var t1=i(Wr);fM=s(t1,"optional"),t1.forEach(t),uM=s(W,`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),kr=l(W,"EM",{});var n1=i(kr);hM=s(n1,"e.g."),n1.forEach(t),_M=s(W,` prompt weighting. If not
provided, text embeddings will be generated from `),Gr=l(W,"CODE",{});var a1=i(Gr);yM=s(a1,"prompt"),a1.forEach(t),bM=s(W,` input argument.
negative_prompt_embeds (`),Cr=l(W,"CODE",{});var s1=i(Cr);MM=s(s1,"torch.FloatTensor"),s1.forEach(t),wM=s(W,", "),Rr=l(W,"EM",{});var o1=i(Rr);vM=s(o1,"optional"),o1.forEach(t),IM=s(W,`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),Xr=l(W,"EM",{});var l1=i(Xr);JM=s(l1,"e.g."),l1.forEach(t),UM=s(W,` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),xr=l(W,"CODE",{});var i1=i(xr);TM=s(i1,"negative_prompt"),i1.forEach(t),ZM=s(W,` input
argument.`),W.forEach(t),Js.forEach(t),St.forEach(t),Bd=p(n),Oe=l(n,"H2",{class:!0});var fc=i(Oe);Wt=l(fc,"A",{id:!0,class:!0,href:!0});var r1=i(Wt);Sr=l(r1,"SPAN",{});var p1=i(Sr);u(da.$$.fragment,p1),p1.forEach(t),r1.forEach(t),jM=p(fc),Vr=l(fc,"SPAN",{});var d1=i(Vr);EM=s(d1,"IFInpaintingSuperResolutionPipeline"),d1.forEach(t),fc.forEach(t),Wd=p(n),ee=l(n,"DIV",{class:!0});var Vt=i(ee);u(ca.$$.fragment,Vt),FM=p(Vt),ve=l(Vt,"DIV",{class:!0});var Us=i(ve);u(ma.$$.fragment,Us),BM=p(Us),Nr=l(Us,"P",{});var c1=i(Nr);WM=s(c1,"Function invoked when calling the pipeline for generation."),c1.forEach(t),kM=p(Us),u(kt.$$.fragment,Us),Us.forEach(t),GM=p(Vt),Gt=l(Vt,"DIV",{class:!0});var uc=i(Gt);u(ga.$$.fragment,uc),CM=p(uc),te=l(uc,"P",{});var Ee=i(te);RM=s(Ee,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),$r=l(Ee,"CODE",{});var m1=i($r);XM=s(m1,"enable_sequential_cpu_offload"),m1.forEach(t),xM=s(Ee,", this method moves one whole model at a time to the GPU when its "),Pr=l(Ee,"CODE",{});var g1=i(Pr);SM=s(g1,"forward"),g1.forEach(t),VM=s(Ee,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Qr=l(Ee,"CODE",{});var f1=i(Qr);NM=s(f1,"enable_sequential_cpu_offload"),f1.forEach(t),$M=s(Ee,", but performance is much better due to the iterative execution of the "),Yr=l(Ee,"CODE",{});var u1=i(Yr);PM=s(u1,"unet"),u1.forEach(t),QM=s(Ee,"."),Ee.forEach(t),uc.forEach(t),YM=p(Vt),Ie=l(Vt,"DIV",{class:!0});var Ts=i(Ie);u(fa.$$.fragment,Ts),DM=p(Ts),Dr=l(Ts,"P",{});var h1=i(Dr);zM=s(h1,"Encodes the prompt into text encoder hidden states."),h1.forEach(t),HM=p(Ts),Z=l(Ts,"P",{});var k=i(Z);qM=s(k,"device: ("),zr=l(k,"CODE",{});var _1=i(zr);LM=s(_1,"torch.device"),_1.forEach(t),AM=s(k,", "),Hr=l(k,"EM",{});var y1=i(Hr);OM=s(y1,"optional"),y1.forEach(t),KM=s(k,`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),qr=l(k,"CODE",{});var b1=i(qr);ew=s(b1,"int"),b1.forEach(t),tw=s(k,", "),Lr=l(k,"EM",{});var M1=i(Lr);nw=s(M1,"optional"),M1.forEach(t),aw=s(k,`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),Ar=l(k,"CODE",{});var w1=i(Ar);sw=s(w1,"bool"),w1.forEach(t),ow=s(k,", "),Or=l(k,"EM",{});var v1=i(Or);lw=s(v1,"optional"),v1.forEach(t),iw=s(k,", defaults to "),Kr=l(k,"CODE",{});var I1=i(Kr);rw=s(I1,"True"),I1.forEach(t),pw=s(k,`):
whether to use classifier free guidance or not
negative_prompt (`),ep=l(k,"CODE",{});var J1=i(ep);dw=s(J1,"str"),J1.forEach(t),cw=s(k," or "),tp=l(k,"CODE",{});var U1=i(tp);mw=s(U1,"List[str]"),U1.forEach(t),gw=s(k,", "),np=l(k,"EM",{});var T1=i(np);fw=s(T1,"optional"),T1.forEach(t),uw=s(k,`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),ap=l(k,"CODE",{});var Z1=i(ap);hw=s(Z1,"negative_prompt_embeds"),Z1.forEach(t),_w=s(k,". instead. If not defined, one has to pass "),sp=l(k,"CODE",{});var j1=i(sp);yw=s(j1,"negative_prompt_embeds"),j1.forEach(t),bw=s(k,`. instead.
Ignored when not using guidance (i.e., ignored if `),op=l(k,"CODE",{});var E1=i(op);Mw=s(E1,"guidance_scale"),E1.forEach(t),ww=s(k," is less than "),lp=l(k,"CODE",{});var F1=i(lp);vw=s(F1,"1"),F1.forEach(t),Iw=s(k,`).
prompt_embeds (`),ip=l(k,"CODE",{});var B1=i(ip);Jw=s(B1,"torch.FloatTensor"),B1.forEach(t),Uw=s(k,", "),rp=l(k,"EM",{});var W1=i(rp);Tw=s(W1,"optional"),W1.forEach(t),Zw=s(k,`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),pp=l(k,"EM",{});var k1=i(pp);jw=s(k1,"e.g."),k1.forEach(t),Ew=s(k,` prompt weighting. If not
provided, text embeddings will be generated from `),dp=l(k,"CODE",{});var G1=i(dp);Fw=s(G1,"prompt"),G1.forEach(t),Bw=s(k,` input argument.
negative_prompt_embeds (`),cp=l(k,"CODE",{});var C1=i(cp);Ww=s(C1,"torch.FloatTensor"),C1.forEach(t),kw=s(k,", "),mp=l(k,"EM",{});var R1=i(mp);Gw=s(R1,"optional"),R1.forEach(t),Cw=s(k,`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),gp=l(k,"EM",{});var X1=i(gp);Rw=s(X1,"e.g."),X1.forEach(t),Xw=s(k,` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),fp=l(k,"CODE",{});var x1=i(fp);xw=s(x1,"negative_prompt"),x1.forEach(t),Sw=s(k,` input
argument.`),k.forEach(t),Ts.forEach(t),Vt.forEach(t),this.h()},h(){c(w,"name","hf:doc:metadata"),c(w,"content",JSON.stringify(O1)),c(M,"id","deepfloyd-if"),c(M,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(M,"href","#deepfloyd-if"),c(C,"class","relative group"),c(Ke,"id","overview"),c(Ke,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Ke,"href","#overview"),c(Fe,"class","relative group"),c(Pt,"href","https://huggingface.co/stabilityai/stable-diffusion-x4-upscaler"),c(Pt,"rel","nofollow"),c(et,"id","usage"),c(et,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(et,"href","#usage"),c(Be,"class","relative group"),c(Dt,"href","https://huggingface.co/join"),c(Dt,"rel","nofollow"),c(Ht,"href","https://huggingface.co/DeepFloyd/IF-I-XL-v1.0"),c(Ht,"rel","nofollow"),c(At,"href","https://huggingface.co/docs/hub/security-tokens#what-are-user-access-tokens"),c(At,"rel","nofollow"),c(Ja,"href","#text-to-image-generation"),c(Ua,"href","#text-guided-image-to-image-generation"),c(Ta,"href","#text-guided-inpainting-generation"),c(Za,"href","#converting-between-different-pipelines"),c(ja,"href","#optimizing-for-speed"),c(Ea,"href","#optimizing-for-memory"),c(en,"href","https://huggingface.co/DeepFloyd/IF-I-XL-v1.0"),c(en,"rel","nofollow"),c(tn,"href","https://huggingface.co/DeepFloyd/IF-I-L-v1.0"),c(tn,"rel","nofollow"),c(nn,"href","https://huggingface.co/DeepFloyd/IF-I-M-v1.0"),c(nn,"rel","nofollow"),c(on,"href","https://huggingface.co/DeepFloyd/IF-II-L-v1.0"),c(on,"rel","nofollow"),c(ln,"href","https://huggingface.co/DeepFloyd/IF-II-M-v1.0"),c(ln,"rel","nofollow"),c(pn,"href","https://huggingface.co/stabilityai/stable-diffusion-x4-upscaler"),c(pn,"rel","nofollow"),S1(Ba.src,Nw="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue")||c(Ba,"src",Nw),c(Ba,"alt","Hugging Face Spaces"),c(dn,"href","https://huggingface.co/spaces/DeepFloyd/IF"),c(dn,"rel","nofollow"),S1(Wa.src,$w="https://colab.research.google.com/assets/colab-badge.svg")||c(Wa,"src",$w),c(Wa,"alt","Open In Colab"),c(cn,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/deepfloyd_if_free_tier_google_colab.ipynb"),c(cn,"rel","nofollow"),c(ot,"id","texttoimage-generation"),c(ot,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ot,"href","#texttoimage-generation"),c(ke,"class","relative group"),c(gn,"href","https://huggingface.co/docs/diffusers/optimization/fp16#model-offloading-for-fast-inference-and-memory-savings"),c(gn,"rel","nofollow"),c(it,"id","text-guided-imagetoimage-generation"),c(it,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(it,"href","#text-guided-imagetoimage-generation"),c(Ge,"class","relative group"),c(ka,"href","/docs/diffusers/main/en/api/pipelines/deepfloyd_if#diffusers.IFInpaintingPipeline"),c(Ga,"href","/docs/diffusers/main/en/api/pipelines/deepfloyd_if#diffusers.IFInpaintingSuperResolutionPipeline"),c(Ca,"href","#converting-between-different-pipelines"),c(rt,"id","text-guided-inpainting-generation"),c(rt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(rt,"href","#text-guided-inpainting-generation"),c(Ce,"class","relative group"),c(Ra,"href","/docs/diffusers/main/en/api/pipelines/deepfloyd_if#diffusers.IFInpaintingPipeline"),c(Xa,"href","/docs/diffusers/main/en/api/pipelines/deepfloyd_if#diffusers.IFInpaintingSuperResolutionPipeline"),c(xa,"href","#converting-between-different-pipelines"),c(pt,"id","converting-between-different-pipelines"),c(pt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(pt,"href","#converting-between-different-pipelines"),c(Re,"class","relative group"),c(ct,"id","optimizing-for-speed"),c(ct,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ct,"href","#optimizing-for-speed"),c(Xe,"class","relative group"),c($a,"href","../../optimization/torch2.0"),c(ft,"id","optimizing-for-memory"),c(ft,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ft,"href","#optimizing-for-memory"),c(xe,"class","relative group"),c(ut,"id","available-pipelines"),c(ut,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ut,"href","#available-pipelines"),c(Se,"class","relative group"),c(Ha,"align","center"),c(kn,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if.py"),c(kn,"rel","nofollow"),c(qa,"align","center"),c(Gn,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if.py"),c(Gn,"rel","nofollow"),c(La,"align","center"),c(Cn,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py"),c(Cn,"rel","nofollow"),c(Aa,"align","center"),c(Rn,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py"),c(Rn,"rel","nofollow"),c(Oa,"align","center"),c(Xn,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py"),c(Xn,"rel","nofollow"),c(Ka,"align","center"),c(xn,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py"),c(xn,"rel","nofollow"),c(es,"align","center"),c(_t,"id","diffusers.IFPipeline"),c(_t,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(_t,"href","#diffusers.IFPipeline"),c(ze,"class","relative group"),c(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(bt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Mt,"id","diffusers.IFSuperResolutionPipeline"),c(Mt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Mt,"href","#diffusers.IFSuperResolutionPipeline"),c(He,"class","relative group"),c(fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(vt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(It,"id","diffusers.IFImg2ImgPipeline"),c(It,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(It,"href","#diffusers.IFImg2ImgPipeline"),c(qe,"class","relative group"),c(he,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ut,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(_e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Tt,"id","diffusers.IFImg2ImgSuperResolutionPipeline"),c(Tt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Tt,"href","#diffusers.IFImg2ImgSuperResolutionPipeline"),c(Le,"class","relative group"),c(ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(jt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Et,"id","diffusers.IFInpaintingPipeline"),c(Et,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Et,"href","#diffusers.IFInpaintingPipeline"),c(Ae,"class","relative group"),c(Me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Bt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(we,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Wt,"id","diffusers.IFInpaintingSuperResolutionPipeline"),c(Wt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Wt,"href","#diffusers.IFInpaintingSuperResolutionPipeline"),c(Oe,"class","relative group"),c(ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Gt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(n,d){e(document.head,w),m(n,X,d),m(n,C,d),e(C,M),e(M,R),h(g,R,null),e(C,G),e(C,Es),e(Es,hc),m(n,bp,d),m(n,Fe,d),e(Fe,Ke),e(Ke,Fs),h(Nt,Fs,null),e(Fe,_c),e(Fe,Bs),e(Bs,yc),m(n,Mp,d),m(n,ba,d),e(ba,bc),m(n,wp,d),m(n,le,d),e(le,Ws),e(Ws,Mc),e(le,wc),e(le,ks),e(ks,vc),e(le,Ic),e(le,$t),e($t,Jc),e($t,Pt),e(Pt,Uc),e($t,Tc),m(n,vp,d),m(n,Be,d),e(Be,et),e(et,Gs),h(Qt,Gs,null),e(Be,Zc),e(Be,Cs),e(Cs,jc),m(n,Ip,d),m(n,Ma,d),e(Ma,Ec),m(n,Jp,d),m(n,ie,d),e(ie,Yt),e(Yt,Fc),e(Yt,Dt),e(Dt,Bc),e(Yt,Wc),e(ie,kc),e(ie,zt),e(zt,Gc),e(zt,Ht),e(Ht,Cc),e(zt,Rc),e(ie,Xc),e(ie,wa),e(wa,xc),e(wa,Rs),e(Rs,Sc),m(n,Up,d),h(qt,n,d),m(n,Tp,d),m(n,va,d),e(va,Vc),m(n,Zp,d),h(Lt,n,d),m(n,jp,d),m(n,tt,d),e(tt,Nc),e(tt,At),e(At,$c),e(tt,Pc),m(n,Ep,d),m(n,nt,d),e(nt,Qc),e(nt,Xs),e(Xs,Yc),e(nt,Dc),m(n,Fp,d),h(Ot,n,d),m(n,Bp,d),m(n,Ia,d),e(Ia,zc),m(n,Wp,d),m(n,V,d),e(V,xs),e(xs,Ja),e(Ja,Hc),e(V,qc),e(V,Ss),e(Ss,Ua),e(Ua,Lc),e(V,Ac),e(V,Vs),e(Vs,Ta),e(Ta,Oc),e(V,Kc),e(V,Ns),e(Ns,Za),e(Za,em),e(V,tm),e(V,$s),e($s,ja),e(ja,nm),e(V,am),e(V,Ps),e(Ps,Ea),e(Ea,sm),m(n,kp,d),m(n,Fa,d),e(Fa,Qs),e(Qs,om),m(n,Gp,d),m(n,re,d),e(re,Kt),e(Kt,Ys),e(Ys,Ds),e(Ds,lm),e(Kt,im),e(Kt,We),e(We,zs),e(zs,en),e(en,rm),e(We,pm),e(We,Hs),e(Hs,tn),e(tn,dm),e(We,cm),e(We,qs),e(qs,nn),e(nn,mm),e(re,gm),e(re,an),e(an,Ls),e(Ls,As),e(As,fm),e(an,um),e(an,sn),e(sn,Os),e(Os,on),e(on,hm),e(sn,_m),e(sn,Ks),e(Ks,ln),e(ln,ym),e(re,bm),e(re,rn),e(rn,eo),e(eo,to),e(to,Mm),e(rn,wm),e(rn,no),e(no,ao),e(ao,pn),e(pn,vm),m(n,Cp,d),m(n,at,d),e(at,so),e(so,Im),e(at,Jm),e(at,dn),e(dn,Ba),m(n,Rp,d),m(n,st,d),e(st,oo),e(oo,Um),e(st,Tm),e(st,cn),e(cn,Wa),m(n,Xp,d),m(n,ke,d),e(ke,ot),e(ot,lo),h(mn,lo,null),e(ke,Zm),e(ke,io),e(io,jm),m(n,xp,d),m(n,lt,d),e(lt,Em),e(lt,gn),e(gn,Fm),e(lt,Bm),m(n,Sp,d),h(fn,n,d),m(n,Vp,d),m(n,Ge,d),e(Ge,it),e(it,ro),h(un,ro,null),e(Ge,Wm),e(Ge,po),e(po,km),m(n,Np,d),m(n,pe,d),e(pe,Gm),e(pe,ka),e(ka,Cm),e(pe,Rm),e(pe,Ga),e(Ga,Xm),e(pe,xm),m(n,$p,d),m(n,se,d),e(se,co),e(co,Sm),e(se,Vm),e(se,mo),e(mo,Nm),e(se,$m),e(se,Ca),e(Ca,Pm),e(se,Qm),m(n,Pp,d),h(hn,n,d),m(n,Qp,d),m(n,Ce,d),e(Ce,rt),e(rt,go),h(_n,go,null),e(Ce,Ym),e(Ce,fo),e(fo,Dm),m(n,Yp,d),m(n,de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ku),e(ue,eh),e(ue,I),e(I,th),e(I,Cl),e(Cl,nh),e(I,ah),e(I,Rl),e(Rl,sh),e(I,oh),e(I,Xl),e(Xl,lh),e(I,ih),e(I,xl),e(xl,rh),e(I,ph),e(I,Sl),e(Sl,dh),e(I,ch),e(I,Vl),e(Vl,mh),e(I,gh),e(I,Nl),e(Nl,fh),e(I,uh),e(I,$l),e($l,hh),e(I,_h),e(I,Pl),e(Pl,yh),e(I,bh),e(I,Ql),e(Ql,Mh),e(I,wh),e(I,Yl),e(Yl,vh),e(I,Ih),e(I,Dl),e(Dl,Jh),e(I,Uh),e(I,zl),e(zl,Th),e(I,Zh),e(I,Hl),e(Hl,jh),e(I,Eh),e(I,ql),e(ql,Fh),e(I,Bh),e(I,Ll),e(Ll,Wh),e(I,kh),e(I,Al),e(Al,Gh),e(I,Ch),e(I,Ol),e(Ol,Rh),e(I,Xh),e(I,Kl),e(Kl,xh),e(I,Sh),e(I,ei),e(ei,Vh),e(I,Nh),e(I,ti),e(ti,$h),e(I,Ph),e(I,ni),e(ni,Qh),e(I,Yh),m(n,Ud,d),m(n,qe,d),e(qe,It),e(It,ai),h(qn,ai,null),e(qe,Dh),e(qe,si),e(si,zh),m(n,Td,d),m(n,H,d),h(Ln,H,null),e(H,Hh),e(H,he),h(An,he,null),e(he,qh),e(he,oi),e(oi,Lh),e(he,Ah),h(Jt,he,null),e(H,Oh),e(H,Ut),h(On,Ut,null),e(Ut,Kh),e(Ut,q),e(q,e_),e(q,li),e(li,t_),e(q,n_),e(q,ii),e(ii,a_),e(q,s_),e(q,ri),e(ri,o_),e(q,l_),e(q,pi),e(pi,i_),e(q,r_),e(H,p_),e(H,_e),h(Kn,_e,null),e(_e,d_),e(_e,di),e(di,c_),e(_e,m_),e(_e,J),e(J,g_),e(J,ci),e(ci,f_),e(J,u_),e(J,mi),e(mi,h_),e(J,__),e(J,gi),e(gi,y_),e(J,b_),e(J,fi),e(fi,M_),e(J,w_),e(J,ui),e(ui,v_),e(J,I_),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(Z,Cw),e(Z,gp),e(gp,Rw),e(Z,Xw),e(Z,fp),e(fp,xw),e(Z,Sw),kd=!0},p(n,[d]){const ua={};d&2&&(ua.$$scope={dirty:d,ctx:n}),yt.$set(ua);const up={};d&2&&(up.$$scope={dirty:d,ctx:n}),wt.$set(up);const hp={};d&2&&(hp.$$scope={dirty:d,ctx:n}),Jt.$set(hp);const _p={};d&2&&(_p.$$scope={dirty:d,ctx:n}),Zt.$set(_p);const ha={};d&2&&(ha.$$scope={dirty:d,ctx:n}),Ft.$set(ha);const yp={};d&2&&(yp.$$scope={dirty:d,ctx:n}),kt.$set(yp)},i(n){kd||(_(g.$$.fragment,n),_(Nt.$$.fragment,n),_(Qt.$$.fragment,n),_(qt.$$.fragment,n),_(Lt.$$.fragment,n),_(Ot.$$.fragment,n),_(mn.$$.fragment,n),_(fn.$$.fragment,n),_(un.$$.fragment,n),_(hn.$$.fragment,n),_(_n.$$.fragment,n),_(yn.$$.fragment,n),_(bn.$$.fragment,n),_(Mn.$$.fragment,n),_(wn.$$.fragment,n),_(vn.$$.fragment,n),_(In.$$.fragment,n),_(Jn.$$.fragment,n),_(Un.$$.fragment,n),_(Tn.$$.fragment,n),_(Zn.$$.fragment,n),_(jn.$$.fragment,n),_(En.$$.fragment,n),_(Fn.$$.fragment,n),_(Bn.$$.fragment,n),_(Wn.$$.fragment,n),_(Sn.$$.fragment,n),_(Vn.$$.fragment,n),_(Nn.$$.fragment,n),_(yt.$$.fragment,n),_($n.$$.fragment,n),_(Pn.$$.fragment,n),_(Qn.$$.fragment,n),_(Yn.$$.fragment,n),_(Dn.$$.fragment,n),_(wt.$$.fragment,n),_(zn.$$.fragment,n),_(Hn.$$.fragment,n),_(qn.$$.fragment,n),_(Ln.$$.fragment,n),_(An.$$.fragment,n),_(Jt.$$.fragment,n),_(On.$$.fragment,n),_(Kn.$$.fragment,n),_(ea.$$.fragment,n),_(ta.$$.fragment,n),_(na.$$.fragment,n),_(Zt.$$.fragment,n),_(aa.$$.fragment,n),_(sa.$$.fragment,n),_(oa.$$.fragment,n),_(la.$$.fragment,n),_(ia.$$.fragment,n),_(Ft.$$.fragment,n),_(ra.$$.fragment,n),_(pa.$$.fragment,n),_(da.$$.fragment,n),_(ca.$$.fragment,n),_(ma.$$.fragment,n),_(kt.$$.fragment,n),_(ga.$$.fragment,n),_(fa.$$.fragment,n),kd=!0)},o(n){y(g.$$.fragment,n),y(Nt.$$.fragment,n),y(Qt.$$.fragment,n),y(qt.$$.fragment,n),y(Lt.$$.fragment,n),y(Ot.$$.fragment,n),y(mn.$$.fragment,n),y(fn.$$.fragment,n),y(un.$$.fragment,n),y(hn.$$.fragment,n),y(_n.$$.fragment,n),y(yn.$$.fragment,n),y(bn.$$.fragment,n),y(Mn.$$.fragment,n),y(wn.$$.fragment,n),y(vn.$$.fragment,n),y(In.$$.fragment,n),y(Jn.$$.fragment,n),y(Un.$$.fragment,n),y(Tn.$$.fragment,n),y(Zn.$$.fragment,n),y(jn.$$.fragment,n),y(En.$$.fragment,n),y(Fn.$$.fragment,n),y(Bn.$$.fragment,n),y(Wn.$$.fragment,n),y(Sn.$$.fragment,n),y(Vn.$$.fragment,n),y(Nn.$$.fragment,n),y(yt.$$.fragment,n),y($n.$$.fragment,n),y(Pn.$$.fragment,n),y(Qn.$$.fragment,n),y(Yn.$$.fragment,n),y(Dn.$$.fragment,n),y(wt.$$.fragment,n),y(zn.$$.fragment,n),y(Hn.$$.fragment,n),y(qn.$$.fragment,n),y(Ln.$$.fragment,n),y(An.$$.fragment,n),y(Jt.$$.fragment,n),y(On.$$.fragment,n),y(Kn.$$.fragment,n),y(ea.$$.fragment,n),y(ta.$$.fragment,n),y(na.$$.fragment,n),y(Zt.$$.fragment,n),y(aa.$$.fragment,n),y(sa.$$.fragment,n),y(oa.$$.fragment,n),y(la.$$.fragment,n),y(ia.$$.fragment,n),y(Ft.$$.fragment,n),y(ra.$$.fragment,n),y(pa.$$.fragment,n),y(da.$$.fragment,n),y(ca.$$.fragment,n),y(ma.$$.fragment,n),y(kt.$$.fragment,n),y(ga.$$.fragment,n),y(fa.$$.fragment,n),kd=!1},d(n){t(w),n&&t(X),n&&t(C),b(g),n&&t(bp),n&&t(Fe),b(Nt),n&&t(Mp),n&&t(ba),n&&t(wp),n&&t(le),n&&t(vp),n&&t(Be),b(Qt),n&&t(Ip),n&&t(Ma),n&&t(Jp),n&&t(ie),n&&t(Up),b(qt,n),n&&t(Tp),n&&t(va),n&&t(Zp),b(Lt,n),n&&t(jp),n&&t(tt),n&&t(Ep),n&&t(nt),n&&t(Fp),b(Ot,n),n&&t(Bp),n&&t(Ia),n&&t(Wp),n&&t(V),n&&t(kp),n&&t(Fa),n&&t(Gp),n&&t(re),n&&t(Cp),n&&t(at),n&&t(Rp),n&&t(st),n&&t(Xp),n&&t(ke),b(mn),n&&t(xp),n&&t(lt),n&&t(Sp),b(fn,n),n&&t(Vp),n&&t(Ge),b(un),n&&t(Np),n&&t(pe),n&&t($p),n&&t(se),n&&t(Pp),b(hn,n),n&&t(Qp),n&&t(Ce),b(_n),n&&t(Yp),n&&t(de),n&&t(Dp),n&&t(oe),n&&t(zp),b(yn,n),n&&t(Hp),n&&t(Re),b(bn),n&&t(qp),n&&t(dt),n&&t(Lp),b(Mn,n),n&&t(Ap),n&&t(Xe),b(wn),n&&t(Op),n&&t(Sa),n&&t(Kp),b(vn,n),n&&t(ed),n&&t(Va),n&&t(td),n&&t(mt),n&&t(nd),b(In,n),n&&t(ad),n&&t(gt),n&&t(sd),b(Jn,n),n&&t(od),n&&t(Na),n&&t(ld),b(Un,n),n&&t(id),n&&t(ce),n&&t(rd),b(Tn,n),n&&t(pd),n&&t(xe),b(Zn),n&&t(dd),n&&t(Pa),n&&t(cd),n&&t(Qa),n&&t(md),b(jn,n),n&&t(gd),n&&t(Ya),n&&t(fd),b(En,n),n&&t(ud),n&&t(Da),n&&t(hd),b(Fn,n),n&&t(_d),n&&t(za),n&&t(yd),b(Bn,n),n&&t(bd),n&&t(Se),b(Wn),n&&t(Md),n&&t(ht),n&&t(wd),n&&t(ze),b(Sn),n&&t(vd),n&&t(Q),b(Vn),b(Nn),b(yt),b($n),b(Pn),n&&t(Id),n&&t(He),b(Qn),n&&t(Jd),n&&t(D),b(Yn),b(Dn),b(wt),b(zn),b(Hn),n&&t(Ud),n&&t(qe),b(qn),n&&t(Td),n&&t(H),b(Ln),b(An),b(Jt),b(On),b(Kn),n&&t(Zd),n&&t(Le),b(ea),n&&t(jd),n&&t(L),b(ta),b(na),b(Zt),b(aa),b(sa),n&&t(Ed),n&&t(Ae),b(oa),n&&t(Fd),n&&t(O),b(la),b(ia),b(Ft),b(ra),b(pa),n&&t(Bd),n&&t(Oe),b(da),n&&t(Wd),n&&t(ee),b(ca),b(ma),b(kt),b(ga),b(fa)}}}const O1={local:"deepfloyd-if",sections:[{local:"overview",title:"Overview"},{local:"usage",sections:[{local:"texttoimage-generation",title:"Text-to-Image Generation"},{local:"text-guided-imagetoimage-generation",title:"Text Guided Image-to-Image Generation"},{local:"text-guided-inpainting-generation",title:"Text Guided Inpainting Generation"},{local:"converting-between-different-pipelines",title:"Converting between different pipelines"},{local:"optimizing-for-speed",title:"Optimizing for speed"},{local:"optimizing-for-memory",title:"Optimizing for memory"}],title:"Usage"},{local:"available-pipelines",title:"Available Pipelines:"},{local:"diffusers.IFPipeline",title:"IFPipeline"},{local:"diffusers.IFSuperResolutionPipeline",title:"IFSuperResolutionPipeline"},{local:"diffusers.IFImg2ImgPipeline",title:"IFImg2ImgPipeline"},{local:"diffusers.IFImg2ImgSuperResolutionPipeline",title:"IFImg2ImgSuperResolutionPipeline"},{local:"diffusers.IFInpaintingPipeline",title:"IFInpaintingPipeline"},{local:"diffusers.IFInpaintingSuperResolutionPipeline",title:"IFInpaintingSuperResolutionPipeline"}],title:"DeepFloyd IF "};function K1(P){return Q1(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class oT extends V1{constructor(w){super();N1(this,w,K1,A1,$1,{})}}export{oT as default,O1 as metadata};
