import{S as sJ,i as oJ,s as lJ,e as o,k as r,w as f,t as a,M as iJ,c as l,d as n,m as p,a as i,x as u,h as s,b as d,N as aJ,G as e,g as m,y as h,q as _,o as y,B as b,v as rJ,L as ss}from"../../../chunks/vendor-hf-doc-builder.js";import{D as V}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 as}from"../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function pJ(P){let w,C,R,M,X;return M=new S({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGUGlwZWxpbmUlMkMlMjBJRlN1cGVyUmVzb2x1dGlvblBpcGVsaW5lJTJDJTIwRGlmZnVzaW9uUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwcHRfdG9fcGlsJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlJTIwJTNEJTIwSUZQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyRGVlcEZsb3lkJTJGSUYtSS1YTC12MS4wJTIyJTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQXByb21wdCUyMCUzRCUyMCdhJTIwcGhvdG8lMjBvZiUyMGElMjBrYW5nYXJvbyUyMHdlYXJpbmclMjBhbiUyMG9yYW5nZSUyMGhvb2RpZSUyMGFuZCUyMGJsdWUlMjBzdW5nbGFzc2VzJTIwc3RhbmRpbmclMjBpbiUyMGZyb250JTIwb2YlMjB0aGUlMjBlaWZmZWwlMjB0b3dlciUyMGhvbGRpbmclMjBhJTIwc2lnbiUyMHRoYXQlMjBzYXlzJTIwJTIydmVyeSUyMGRlZXAlMjBsZWFybmluZyUyMiclMEFwcm9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JTIwaW50ZXJtZWRpYXRlJTIwaW1hZ2UlMEFwaWxfaW1hZ2UlMjAlM0QlMjBwdF90b19waWwoaW1hZ2UpJTBBcGlsX2ltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JLnBuZyUyMiklMEElMEFzYWZldHlfbW9kdWxlcyUyMCUzRCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMmZlYXR1cmVfZXh0cmFjdG9yJTIyJTNBJTIwcGlwZS5mZWF0dXJlX2V4dHJhY3RvciUyQyUwQSUyMCUyMCUyMCUyMCUyMnNhZmV0eV9jaGVja2VyJTIyJTNBJTIwcGlwZS5zYWZldHlfY2hlY2tlciUyQyUwQSUyMCUyMCUyMCUyMCUyMndhdGVybWFya2VyJTIyJTNBJTIwcGlwZS53YXRlcm1hcmtlciUyQyUwQSU3RCUwQXN1cGVyX3Jlc18yX3BpcGUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXg0LXVwc2NhbGVyJTIyJTJDJTIwKipzYWZldHlfbW9kdWxlcyUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEFzdXBlcl9yZXNfMl9waXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBaW1hZ2UlMjAlM0QlMjBzdXBlcl9yZXNfMl9waXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMGltYWdlJTNEaW1hZ2UlMkMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",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"),C=a("Examples:"),R=r(),f(M.$$.fragment)},l(g){w=l(g,"P",{});var G=i(w);C=s(G,"Examples:"),G.forEach(n),R=p(g),u(M.$$.fragment,g)},m(g,G){m(g,w,G),e(w,C),m(g,R,G),h(M,g,G),X=!0},p:ss,i(g){X||(_(M.$$.frag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ZWRzJTJDJTIwb3V0cHV0X3R5cGUlM0QlMjJwdCUyMikuaW1hZ2VzJTBBJTBBJTIzJTIwc2F2ZSUyMGludGVybWVkaWF0ZSUyMGltYWdlJTBBcGlsX2ltYWdlJTIwJTNEJTIwcHRfdG9fcGlsKGltYWdlKSUwQXBpbF9pbWFnZSU1QjAlNUQuc2F2ZSglMjIuJTJGaWZfc3RhZ2VfSS5wbmclMjIpJTBBJTBBc3VwZXJfcmVzXzFfcGlwZSUyMCUzRCUyMElGU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMkRlZXBGbG95ZCUyRklGLUlJLUwtdjEuMCUyMiUyQyUyMHRleHRfZW5jb2RlciUzRE5vbmUlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEFzdXBlcl9yZXNfMV9waXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBaW1hZ2UlMjAlM0QlMjBzdXBlcl9yZXNfMV9waXBlKCUwQSUyMCUyMCUyMCUyMGltYWdlJTNEaW1hZ2UlMkMlMjBwcm9tcHRfZW1iZWRzJTNEcHJvbXB0X2VtYmVkcyUyQyUyMG5lZ2F0aXZlX3Byb21wdF9lbWJlZHMlM0RuZWdhdGl2ZV9lbWJlZHMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",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"),C=a("Examples:"),R=r(),f(M.$$.fragment)},l(g){w=l(g,"P",{});var G=i(w);C=s(G,"Examples:"),G.forEach(n),R=p(g),u(M.$$.fragment,g)},m(g,G){m(g,w,G),e(w,C),m(g,R,G),h(M,g,G),X=!0},p:ss,i(g){X||(_(M.$$.fragment,g),X=!0)},o(g){y(M.$$.fragment,g),X=!1},d(g){g&&n(w),g&&n(R),b(M,g)}}}function dJ(P){let w,C,R,M,X;return M=new S({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW1nMkltZ1BpcGVsaW5lJTJDJTIwSUZJbWcySW1nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUlMkMlMjBEaWZmdXNpb25QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBwdF90b19waWwlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSUyRkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uJTJGbWFpbiUyRmFzc2V0cyUyRnN0YWJsZS1zYW1wbGVzJTJGaW1nMmltZyUyRnNrZXRjaC1tb3VudGFpbnMtaW5wdXQuanBnJTIyJTBBcmVzcG9uc2UlMjAlM0QlMjByZXF1ZXN0cy5nZXQodXJsKSUwQW9yaWdpbmFsX2ltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihCeXRlc0lPKHJlc3BvbnNlLmNvbnRlbnQpKS5jb252ZXJ0KCUyMlJHQiUyMiklMEFvcmlnaW5hbF9pbWFnZSUyMCUzRCUyMG9yaWdpbmFsX2ltYWdlLn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lc29sdXRpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyRGVlcEZsb3lkJTJGSUYtSUktTC12MS4wJTIyJTJDJTBBJTIwJTIwJTIwJTIwdGV4dF9lbmNvZGVyJTNETm9uZSUyQyUwQSUyMCUyMCUyMCUyMHZhcmlhbnQlM0QlMjJmcDE2JTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTBBKSUwQXN1cGVyX3Jlc18xX3BpcGUuZW5hYmxlX21vZGVsX2NwdV9vZmZsb2FkKCklMEElMEFpbWFnZSUyMCUzRCUyMHN1cGVyX3Jlc18xX3BpcGUoJTBBJTIwJTIwJTIwJTIwaW1hZ2UlM0RpbWFnZSUyQyUwQSUyMCUyMCUyMCUyMG9yaWdpbmFsX2ltYWdlJTNEb3JpZ2luYWxfaW1hZ2UlMkMlMEElMjAlMjAlMjAlMjBwcm9tcHRfZW1iZWRzJTNEcHJvbXB0X2VtYmVkcyUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX3Byb21wdF9lbWJlZHMlM0RuZWdhdGl2ZV9lbWJlZHMlMkMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",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"),C=a("Examples:"),R=r(),f(M.$$.fragment)},l(g){w=l(g,"P",{});var G=i(w);C=s(G,"Examples:"),G.forEach(n),R=p(g),u(M.$$.fragment,g)},m(g,G){m(g,w,G),e(w,C),m(g,R,G),h(M,g,G),X=!0},p:ss,i(g){X||(_(M.$$.fragment,g),X=!0)},o(g){y(M.$$.fragment,g),X=!1},d(g){g&&n(w),g&&n(R),b(M,g)}}}function mJ(P){let w,C,R,M,X;return M=new S({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW1nMkltZ1BpcGVsaW5lJTJDJTIwSUZJbWcySW1nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUlMkMlMjBEaWZmdXNpb25QaXBlbGluZSUwQWZyb20lM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CUyMCUyMCUyMG9yaWdpbmFsX2ltYWdlJTNEb3JpZ2luYWxfaW1hZ2UlMkMlMEElMjAlMjAlMjAlMjBwcm9tcHRfZW1iZWRzJTNEcHJvbXB0X2VtYmVkcyUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX3Byb21wdF9lbWJlZHMlM0RuZWdhdGl2ZV9lbWJlZHMlMkMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",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"),C=a("Examples:"),R=r(),f(M.$$.fragment)},l(g){w=l(g,"P",{});var G=i(w);C=s(G,"Examples:"),G.forEach(n),R=p(g),u(M.$$.fragment,g)},m(g,G){m(g,w,G),e(w,C),m(g,R,G),h(M,g,G),X=!0},p:ss,i(g){X||(_(M.$$.fragment,g),X=!0)},o(g){y(M.$$.fragment,g),X=!1},d(g){g&&n(w),g&&n(R),b(M,g)}}}function gJ(P){let w,C,R,M,X;return M=new S({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW5wYWludGluZ1BpcGVsaW5lJTJDJTIwSUZJbnBhaW50aW5nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUlMkMlMjBEaWZmdXNpb25QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBwdF90b19waWwlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmRpZmZ1c2VycyUyRmRvY3MtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZpZiUyRnBlcnNvbi5wbmclMjIlMEFyZXNwb25zZSUyMCUzRCUyMHJlcXVlc3RzLmdldCh1cmwpJTBBb3JpZ2luYWxfaW1hZ2UlMjAlM0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uZWdhdGl2ZV9lbWJlZHMlMkMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",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"),C=a("Examples:"),R=r(),f(M.$$.fragment)},l(g){w=l(g,"P",{});var G=i(w);C=s(G,"Examples:"),G.forEach(n),R=p(g),u(M.$$.fragment,g)},m(g,G){m(g,w,G),e(w,C),m(g,R,G),h(M,g,G),X=!0},p:ss,i(g){X||(_(M.$$.fragment,g),X=!0)},o(g){y(M.$$.fragment,g),X=!1},d(g){g&&n(w),g&&n(R),b(M,g)}}}function fJ(P){let w,C,R,M,X;return M=new S({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW5wYWludGluZ1BpcGVsaW5lJTJDJTIwSUZJbnBhaW50aW5nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUlMkMlMjBEaWZmdXNpb25QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBwdF90b19waWwlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmRpZmZ1c2VycyUyRmRvY3MtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZpZiUyRnBlcnNvbi5wbmclMjIlMEFyZXNwb25zZSUyMCUzRCUyMHJlcXVlc3RzLmdldCh1cmwpJTBBb3JpZ2luYWxfaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKEJ5dGVzSU8ocmVzcG9uc2UuY29udGVudC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VCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",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"),C=a("Examples:"),R=r(),f(M.$$.fragment)},l(g){w=l(g,"P",{});var G=i(w);C=s(G,"Examples:"),G.forEach(n),R=p(g),u(M.$$.fragment,g)},m(g,G){m(g,w,G),e(w,C),m(g,R,G),h(M,g,G),X=!0},p:ss,i(g){X||(_(M.$$.fragment,g),X=!0)},o(g){y(M.$$.fragment,g),X=!1},d(g){g&&n(w),g&&n(R),b(M,g)}}}function uJ(P){let w,C,R,M,X,g,G,os,hc,Ur,ye,Ne,ls,_t,_c,is,yc,Tr,Pn,bc,Zr,ee,rs,Mc,wc,ps,Ic,vc,yt,Jc,bt,Uc,Tc,jr,be,$e,cs,Mt,Zc,ds,jc,Er,Qn,Ec,Fr,te,wt,Fc,It,Bc,Wc,kc,vt,Gc,Jt,Rc,Xc,Cc,Yn,Sc,ms,Vc,Br,Ut,Wr,zn,xc,kr,Tt,Gr,Pe,Nc,Zt,$c,Pc,Rr,Qe,Qc,gs,Yc,zc,Xr,jt,Cr,Hn,Hc,Sr,x,fs,Dn,Dc,Lc,us,Ln,qc,Ac,hs,qn,Oc,Kc,_s,An,ed,td,ys,On,nd,ad,bs,Kn,sd,Vr,ea,Ms,od,xr,ne,Et,ws,Is,ld,id,Me,vs,Ft,rd,pd,Js,Bt,cd,dd,Us,Wt,md,gd,kt,Ts,Zs,fd,ud,Gt,js,Rt,hd,_d,Es,Xt,yd,bd,Ct,Fs,Bs,Md,wd,Ws,ks,St,Id,Nr,Ye,Gs,vd,Jd,Vt,ta,Eb,$r,ze,Rs,Ud,Td,xt,na,Fb,Pr,we,He,Xs,Nt,Zd,Cs,jd,Qr,De,Ed,$t,Fd,Bd,Yr,Pt,zr,Ie,Le,Ss,Qt,Wd,Vs,kd,Hr,ae,Gd,aa,Rd,Xd,sa,Cd,Sd,Dr,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,R_,T,X_,Zi,C_,S_,ji,V_,x_,Ei,N_,$_,Fi,P_,Q_,Bi,Y_,z_,Wi,H_,D_,ki,L_,q_,Gi,A_,O_,Ri,K_,ey,Xi,ty,ny,Ci,ay,sy,Si,oy,ly,Vi,iy,ry,xi,py,cy,Ni,dy,my,$i,gy,fy,Pi,uy,hy,Qi,_y,yy,Yi,by,My,zi,wy,Iy,Hi,vy,Jy,Di,Uy,Ty,Cp,xe,ut,Li,Rn,Zy,qi,jy,Sp,K,Xn,Ey,he,Cn,Fy,Ai,By,Wy,ht,ky,_e,Sn,Gy,Oi,Ry,Xy,Z,Cy,Ki,Sy,Vy,er,xy,Ny,tr,$y,Py,nr,Qy,Yy,ar,zy,Hy,sr,Dy,Ly,or,qy,Ay,lr,Oy,Ky,ir,eb,tb,rr,nb,ab,pr,sb,ob,cr,lb,ib,dr,rb,pb,mr,cb,db,gr,mb,gb,fr,fb,ub,ur,hb,_b,hr,yb,bb,_r,Mb,wb,yr,Ib,vb,br,Jb,Ub,Mr,Tb,Zb,Vp;return g=new N({}),_t=new N({}),Mt=new N({}),Ut=new S({props:{code:"cGlwJTIwaW5zdGFsbCUyMGh1Z2dpbmdmYWNlX2h1YiUyMC0tdXBncmFkZQ==",highlighted:"pip install huggingface_hub --upgrade"}}),Tt=new S({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGxvZ2luJTBBJTBBbG9naW4oKQ==",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> login

login()`}}),jt=new S({props:{code:"cGlwJTIwaW5zdGFsbCUyMGRpZmZ1c2VycyUyMGFjY2VsZXJhdGUlMjB0cmFuc2Zvcm1lcnMlMjBzYWZldGVuc29ycw==",highlighted:"pip install diffusers accelerate transformers safetensors"}}),Nt=new N({}),Pt=new S({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBZnJvbSU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oJTIyLiUyRmlmX3N0YWdlX0kucG5nJTIyKSUwQSUwQSUyMyUyMHN0YWdlJTIwMiUwQWltYWdlJTIwJTNEJTIwc3RhZ2VfMiglMEElMjAlMjAlMjAlMjBpbWFnZSUzRGltYWdlJTJDJTBBJTIwJTIwJTIwJTIwcHJvbXB0X2VtYmVkcyUzRHByb21wdF9lbWJlZHMlMkMlMEElMjAlMjAlMjAlMjBuZWdhdGl2ZV9wcm9tcHRfZW1iZWRzJTNEbmVnYXRpdmVfZW1iZWRzJTJDJTBBJTIwJTIwJTIwJTIwZ2VuZXJhdG9yJTNEZ2VuZXJhdG9yJTJDJTBBJTIwJTIwJTIwJTIwb3V0cHV0X3R5cGUlM0QlMjJwdCUyMiUyQyUwQSkuaW1hZ2VzJTBBcHRfdG9fcGlsKGltYWdlKSU1QjAlNUQuc2F2ZSglMjIuJTJGaWZfc3RhZ2VfSUkucG5nJTIyKSUwQSUwQSUyMyUyMHN0YWdlJTIwMyUwQWltYWdlJTIwJTNEJTIwc3RhZ2VfMyhwcm9tcHQlM0Rwcm9tcHQlMkMlMjBpbWFnZSUzRGltYWdlJTJDJTIwbm9pc2VfbGV2ZWwlM0QxMDAlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSUkucG5nJTIyKQ==",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>)`}}),Qt=new N({}),Yt=new S({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XRvciUzRGdlbmVyYXRvciUyQyUwQSUyMCUyMCUyMCUyMG91dHB1dF90eXBlJTNEJTIycHQlMjIlMkMlMEEpLmltYWdlcyUwQXB0X3RvX3BpbChpbWFnZSklNUIwJTVELnNhdmUoJTIyLiUyRmlmX3N0YWdlX0lJLnBuZyUyMiklMEElMEElMjMlMjBzdGFnZSUyMDMlMEFpbWFnZSUyMCUzRCUyMHN0YWdlXzMocHJvbXB0JTNEcHJvbXB0JTJDJTIwaW1hZ2UlM0RpbWFnZSUyQyUyMGdlbmVyYXRvciUzRGdlbmVyYXRvciUyQyUyMG5vaXNlX2xldmVsJTNEMTAwKS5pbWFnZXMlMEFpbWFnZSU1QjAlNUQuc2F2ZSglMjIuJTJGaWZfc3RhZ2VfSUlJLnBuZyUyMik=",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>)`}}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nZV9JLnBuZyUyMiklMEElMEElMjMlMjBzdGFnZSUyMDIlMEFpbWFnZSUyMCUzRCUyMHN0YWdlXzIoJTBBJTIwJTIwJTIwJTIwaW1hZ2UlM0RpbWFnZSUyQyUwQSUyMCUyMCUyMCUyMG9yaWdpbmFsX2ltYWdlJTNEb3JpZ2luYWxfaW1hZ2UlMkMlMEElMjAlMjAlMjAlMjBtYXNrX2ltYWdlJTNEbWFza19pbWFnZSUyQyUwQSUyMCUyMCUyMCUyMHByb21wdF9lbWJlZHMlM0Rwcm9tcHRfZW1iZWRzJTJDJTBBJTIwJTIwJTIwJTIwbmVnYXRpdmVfcHJvbXB0X2VtYmVkcyUzRG5lZ2F0aXZlX2VtYmVkcyUyQyUwQSUyMCUyMCUyMCUyMGdlbmVyYXRvciUzRGdlbmVyYXRvciUyQyUwQSUyMCUyMCUyMCUyMG91dHB1dF90eXBlJTNEJTIycHQlMjIlMkMlMEEpLmltYWdlcyUwQXB0X3RvX3BpbChpbWFnZSklNUIwJTVELnNhdmUoJTIyLiUyRmlmX3N0YWdlX0lJLnBuZyUyMiklMEElMEElMjMlMjBzdGFnZSUyMDMlMEFpbWFnZSUyMCUzRCUyMHN0YWdlXzMocHJvbXB0JTNEcHJvbXB0JTJDJTIwaW1hZ2UlM0RpbWFnZSUyQyUyMGdlbmVyYXRvciUzRGdlbmVyYXRvciUyQyUyMG5vaXNlX2xldmVsJTNEMTAwKS5pbWFnZXMlMEFpbWFnZSU1QjAlNUQuc2F2ZSglMjIuJTJGaWZfc3RhZ2VfSUlJLnBuZyUyMik=",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>)`}}),Dt=new N({}),Lt=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)`}}),qt=new N({}),At=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>)`}}),Ot=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>)'}}),Kt=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)`}}),en=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)`}}),nn=new N({}),an=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()`}}),sn=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()`}}),on=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>)`}}),ln=new S({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGUGlwZWxpb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G91dHB1dF90eXBlJTNEJTIycHQlMjIlMkMlMEElMjAlMjAlMjAlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IlMkMlMEEpLmltYWdlcyUwQSUwQXB0X3RvX3BpbChpbWFnZSklNUIwJTVELnNhdmUoJTIyLiUyRmlmX3N0YWdlX0lJLnBuZyUyMik=",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>)`}}),rn=new N({}),un=new N({}),hn=new V({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/v0.21.0/src/diffusers/pipelines/deepfloyd_if/pipeline_if.py#L88"}}),_n=new V({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/v0.21.0/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/v0.21.0/src/diffusers/pipelines/deepfloyd_if/pipeline_if.py#L541",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>
`}}),lt=new as({props:{anchor:"diffusers.IFPipeline.__call__.example",$$slots:{default:[pJ]},$$scope:{ctx:P}}}),yn=new V({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/v0.21.0/src/diffusers/pipelines/deepfloyd_if/pipeline_if.py#L161"}}),bn=new N({}),Mn=new V({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/v0.21.0/src/diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py#L73"}}),wn=new V({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/v0.21.0/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/v0.21.0/src/diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py#L608",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>
`}}),rt=new as({props:{anchor:"diffusers.IFSuperResolutionPipeline.__call__.example",$$slots:{default:[cJ]},$$scope:{ctx:P}}}),In=new V({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/v0.21.0/src/diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py#L295"}}),vn=new N({}),Jn=new V({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/v0.21.0/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py#L112"}}),Un=new V({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/v0.21.0/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/v0.21.0/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py#L654",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>
`}}),ct=new as({props:{anchor:"diffusers.IFImg2ImgPipeline.__call__.example",$$slots:{default:[dJ]},$$scope:{ctx:P}}}),Tn=new V({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/v0.21.0/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py#L186"}}),Zn=new N({}),jn=new V({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/v0.21.0/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py#L115"}}),En=new V({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/v0.21.0/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/v0.21.0/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py#L736",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>
`}}),mt=new as({props:{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.example",$$slots:{default:[mJ]},$$scope:{ctx:P}}}),Fn=new V({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/v0.21.0/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py#L337"}}),Bn=new N({}),Wn=new V({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/v0.21.0/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py#L115"}}),kn=new V({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/v0.21.0/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/v0.21.0/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py#L746",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 as({props:{anchor:"diffusers.IFInpaintingPipeline.__call__.example",$$slots:{default:[gJ]},$$scope:{ctx:P}}}),Gn=new V({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/v0.21.0/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py#L189"}}),Rn=new N({}),Xn=new V({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/v0.21.0/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py#L117"}}),Cn=new V({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/v0.21.0/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/v0.21.0/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py#L824",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>
`}}),ht=new as({props:{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.example",$$slots:{default:[fJ]},$$scope:{ctx:P}}}),Sn=new V({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/v0.21.0/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py#L339"}}),{c(){w=o("meta"),C=r(),R=o("h1"),M=o("a"),X=o("span"),f(g.$$.fragment),G=r(),os=o("span"),hc=a("DeepFloyd IF"),Ur=r(),ye=o("h2"),Ne=o("a"),ls=o("span"),f(_t.$$.fragment),_c=r(),is=o("span"),yc=a("Overview"),Tr=r(),Pn=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:`),Zr=r(),ee=o("ul"),rs=o("li"),Mc=a("Stage 1: a base model that generates 64x64 px image based on text prompt,"),wc=r(),ps=o("li"),Ic=a("Stage 2: a 64x64 px => 256x256 px super-resolution model, and a"),vc=r(),yt=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 `),bt=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.`),jr=r(),be=o("h2"),$e=o("a"),cs=o("span"),f(Mt.$$.fragment),Zc=r(),ds=o("span"),jc=a("Usage"),Er=r(),Qn=o("p"),Ec=a("Before you can use IF, you need to accept its usage conditions. To do so:"),Fr=r(),te=o("ol"),wt=o("li"),Fc=a("Make sure to have a "),It=o("a"),Bc=a("Hugging Face account"),Wc=a(" and be logged in"),kc=r(),vt=o("li"),Gc=a("Accept the license on the model card of "),Jt=o("a"),Rc=a("DeepFloyd/IF-I-XL-v1.0"),Xc=a(". Accepting the license on the stage I model card will auto accept for the other IF models."),Cc=r(),Yn=o("li"),Sc=a("Make sure to login locally. Install "),ms=o("code"),Vc=a("huggingface_hub"),Br=r(),f(Ut.$$.fragment),Wr=r(),zn=o("p"),xc=a("run the login function in a Python shell"),kr=r(),f(Tt.$$.fragment),Gr=r(),Pe=o("p"),Nc=a("and enter your "),Zt=o("a"),$c=a("Hugging Face Hub access token"),Pc=a("."),Rr=r(),Qe=o("p"),Qc=a("Next we install "),gs=o("code"),Yc=a("diffusers"),zc=a(" and dependencies:"),Xr=r(),f(jt.$$.fragment),Cr=r(),Hn=o("p"),Hc=a("The following sections give more in-detail examples of how to use IF. Specifically:"),Sr=r(),x=o("ul"),fs=o("li"),Dn=o("a"),Dc=a("Text-to-Image Generation"),Lc=r(),us=o("li"),Ln=o("a"),qc=a("Image-to-Image Generation"),Ac=r(),hs=o("li"),qn=o("a"),Oc=a("Inpainting"),Kc=r(),_s=o("li"),An=o("a"),ed=a("Reusing model weights"),td=r(),ys=o("li"),On=o("a"),nd=a("Speed optimization"),ad=r(),bs=o("li"),Kn=o("a"),sd=a("Memory optimization"),Vr=r(),ea=o("p"),Ms=o("strong"),od=a("Available checkpoints"),xr=r(),ne=o("ul"),Et=o("li"),ws=o("p"),Is=o("em"),ld=a("Stage-1"),id=r(),Me=o("ul"),vs=o("li"),Ft=o("a"),rd=a("DeepFloyd/IF-I-XL-v1.0"),pd=r(),Js=o("li"),Bt=o("a"),cd=a("DeepFloyd/IF-I-L-v1.0"),dd=r(),Us=o("li"),Wt=o("a"),md=a("DeepFloyd/IF-I-M-v1.0"),gd=r(),kt=o("li"),Ts=o("p"),Zs=o("em"),fd=a("Stage-2"),ud=r(),Gt=o("ul"),js=o("li"),Rt=o("a"),hd=a("DeepFloyd/IF-II-L-v1.0"),_d=r(),Es=o("li"),Xt=o("a"),yd=a("DeepFloyd/IF-II-M-v1.0"),bd=r(),Ct=o("li"),Fs=o("p"),Bs=o("em"),Md=a("Stage-3"),wd=r(),Ws=o("ul"),ks=o("li"),St=o("a"),Id=a("stabilityai/stable-diffusion-x4-upscaler"),Nr=r(),Ye=o("p"),Gs=o("strong"),vd=a("Demo"),Jd=r(),Vt=o("a"),ta=o("img"),$r=r(),ze=o("p"),Rs=o("strong"),Ud=a("Google Colab"),Td=r(),xt=o("a"),na=o("img"),Pr=r(),we=o("h3"),He=o("a"),Xs=o("span"),f(Nt.$$.fragment),Zd=r(),Cs=o("span"),jd=a("Text-to-Image Generation"),Qr=r(),De=o("p"),Ed=a("By default diffusers makes use of "),$t=o("a"),Fd=a("model cpu offloading"),Bd=a(`
to run the whole IF pipeline with as little as 14 GB of VRAM.`),Yr=r(),f(Pt.$$.fragment),zr=r(),Ie=o("h3"),Le=o("a"),Ss=o("span"),f(Qt.$$.fragment),Wd=r(),Vs=o("span"),kd=a("Text Guided Image-to-Image Generation"),Hr=r(),ae=o("p"),Gd=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 `),aa=o("a"),Rd=a("IFInpaintingPipeline"),Xd=a(" and "),sa=o("a"),Cd=a("IFInpaintingSuperResolutionPipeline"),Sd=a(" pipelines."),Dr=r(),z=o("p"),xs=o("strong"),Vd=a("Note"),xd=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 `),Ns=o("code"),Nd=a("~DiffusionPipeline.components()"),$d=a(" function as explained "),oa=o("a"),Pd=a("here"),Qd=a("."),Lr=r(),f(Yt.$$.fragment),qr=r(),ve=o("h3"),qe=o("a"),$s=o("span"),f(zt.$$.fragment),Yd=r(),Ps=o("span"),zd=a("Text Guided Inpainting Generation"),Ar=r(),se=o("p"),Hd=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 `),la=o("a"),Dd=a("IFInpaintingPipeline"),Ld=a(" and "),ia=o("a"),qd=a("IFInpaintingSuperResolutionPipeline"),Ad=a(" pipelines."),Or=r(),H=o("p"),Qs=o("strong"),Od=a("Note"),Kd=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 `),Ys=o("code"),em=a("~DiffusionPipeline.components()"),tm=a(" function as explained "),ra=o("a"),nm=a("here"),am=a("."),Kr=r(),f(Ht.$$.fragment),ep=r(),Je=o("h3"),Ae=o("a"),zs=o("span"),f(Dt.$$.fragment),sm=r(),Hs=o("span"),om=a("Converting between different pipelines"),tp=r(),Oe=o("p"),lm=a("In addition to being loaded with "),Ds=o("code"),im=a("from_pretrained"),rm=a(", Pipelines can also be loaded directly from each other."),np=r(),f(Lt.$$.fragment),ap=r(),Ue=o("h3"),Ke=o("a"),Ls=o("span"),f(qt.$$.fragment),pm=r(),qs=o("span"),cm=a("Optimizing for speed"),sp=r(),pa=o("p"),dm=a("The simplest optimization to run IF faster is to move all model components to the GPU."),op=r(),f(At.$$.fragment),lp=r(),ca=o("p"),mm=a("You can also run the diffusion process for a shorter number of timesteps."),ip=r(),et=o("p"),gm=a("This can either be done with the "),As=o("code"),fm=a("num_inference_steps"),um=a(" argument"),rp=r(),f(Ot.$$.fragment),pp=r(),tt=o("p"),hm=a("Or with the "),Os=o("code"),_m=a("timesteps"),ym=a(" argument"),cp=r(),f(Kt.$$.fragment),dp=r(),da=o("p"),bm=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.`),mp=r(),f(en.$$.fragment),gp=r(),oe=o("p"),Mm=a("You can also use "),ma=o("a"),Ks=o("code"),wm=a("torch.compile"),Im=a(". Note that we have not exhaustively tested "),eo=o("code"),vm=a("torch.compile"),Jm=a(`
with IF and it might not give expected results.`),fp=r(),f(tn.$$.fragment),up=r(),Te=o("h3"),nt=o("a"),to=o("span"),f(nn.$$.fragment),Um=r(),no=o("span"),Tm=a("Optimizing for memory"),hp=r(),ga=o("p"),Zm=a("When optimizing for GPU memory, we can use the standard diffusers cpu offloading APIs."),_p=r(),fa=o("p"),jm=a("Either the model based CPU offloading,"),yp=r(),f(an.$$.fragment),bp=r(),ua=o("p"),Em=a("or the more aggressive layer based CPU offloading."),Mp=r(),f(sn.$$.fragment),wp=r(),ha=o("p"),Fm=a("Additionally, T5 can be loaded in 8bit precision"),Ip=r(),f(on.$$.fragment),vp=r(),_a=o("p"),Bm=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.`),Jp=r(),f(ln.$$.fragment),Up=r(),Ze=o("h2"),at=o("a"),ao=o("span"),f(rn.$$.fragment),Wm=r(),so=o("span"),km=a("Available Pipelines:"),Tp=r(),st=o("table"),oo=o("thead"),je=o("tr"),lo=o("th"),Gm=a("Pipeline"),Rm=r(),io=o("th"),Xm=a("Tasks"),Cm=r(),ya=o("th"),Sm=a("Colab"),Vm=r(),$=o("tbody"),Ee=o("tr"),ro=o("td"),pn=o("a"),xm=a("pipeline_if.py"),Nm=r(),po=o("td"),co=o("em"),$m=a("Text-to-Image Generation"),Pm=r(),ba=o("td"),Qm=a("-"),Ym=r(),Fe=o("tr"),mo=o("td"),cn=o("a"),zm=a("pipeline_if_superresolution.py"),Hm=r(),go=o("td"),fo=o("em"),Dm=a("Text-to-Image Generation"),Lm=r(),Ma=o("td"),qm=a("-"),Am=r(),Be=o("tr"),uo=o("td"),dn=o("a"),Om=a("pipeline_if_img2img.py"),Km=r(),ho=o("td"),_o=o("em"),eg=a("Image-to-Image Generation"),tg=r(),wa=o("td"),ng=a("-"),ag=r(),We=o("tr"),yo=o("td"),mn=o("a"),sg=a("pipeline_if_img2img_superresolution.py"),og=r(),bo=o("td"),Mo=o("em"),lg=a("Image-to-Image Generation"),ig=r(),Ia=o("td"),rg=a("-"),pg=r(),ke=o("tr"),wo=o("td"),gn=o("a"),cg=a("pipeline_if_inpainting.py"),dg=r(),Io=o("td"),vo=o("em"),mg=a("Image-to-Image Generation"),gg=r(),va=o("td"),fg=a("-"),ug=r(),Ge=o("tr"),Jo=o("td"),fn=o("a"),hg=a("pipeline_if_inpainting_superresolution.py"),_g=r(),Uo=o("td"),To=o("em"),yg=a("Image-to-Image Generation"),bg=r(),Ja=o("td"),Mg=a("-"),Zp=r(),Re=o("h2"),ot=o("a"),Zo=o("span"),f(un.$$.fragment),wg=r(),jo=o("span"),Ig=a("IFPipeline"),jp=r(),D=o("div"),f(hn.$$.fragment),vg=r(),le=o("div"),f(_n.$$.fragment),Jg=r(),Eo=o("p"),Ug=a("Function invoked when calling the pipeline for generation."),Tg=r(),f(lt.$$.fragment),Zg=r(),ie=o("div"),f(yn.$$.fragment),jg=r(),Fo=o("p"),Eg=a("Encodes the prompt into text encoder hidden states."),Fg=r(),I=o("p"),Bg=a("device: ("),Bo=o("code"),Wg=a("torch.device"),kg=a(", "),Wo=o("em"),Gg=a("optional"),Rg=a(`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),ko=o("code"),Xg=a("int"),Cg=a(", "),Go=o("em"),Sg=a("optional"),Vg=a(`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),Ro=o("code"),xg=a("bool"),Ng=a(", "),Xo=o("em"),$g=a("optional"),Pg=a(", defaults to "),Co=o("code"),Qg=a("True"),Yg=a(`):
whether to use classifier free guidance or not
negative_prompt (`),So=o("code"),zg=a("str"),Hg=a(" or "),Vo=o("code"),Dg=a("List[str]"),Lg=a(", "),xo=o("em"),qg=a("optional"),Ag=a(`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),No=o("code"),Og=a("negative_prompt_embeds"),Kg=a(". instead. If not defined, one has to pass "),$o=o("code"),ef=a("negative_prompt_embeds"),tf=a(`. instead.
Ignored when not using guidance (i.e., ignored if `),Po=o("code"),nf=a("guidance_scale"),af=a(" is less than "),Qo=o("code"),sf=a("1"),of=a(`).
prompt_embeds (`),Yo=o("code"),lf=a("torch.FloatTensor"),rf=a(", "),zo=o("em"),pf=a("optional"),cf=a(`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),Ho=o("em"),df=a("e.g."),mf=a(` prompt weighting. If not
provided, text embeddings will be generated from `),Do=o("code"),gf=a("prompt"),ff=a(` input argument.
negative_prompt_embeds (`),Lo=o("code"),uf=a("torch.FloatTensor"),hf=a(", "),qo=o("em"),_f=a("optional"),yf=a(`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),Ao=o("em"),bf=a("e.g."),Mf=a(` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),Oo=o("code"),wf=a("negative_prompt"),If=a(` input
argument.`),Ep=r(),Xe=o("h2"),it=o("a"),Ko=o("span"),f(bn.$$.fragment),vf=r(),el=o("span"),Jf=a("IFSuperResolutionPipeline"),Fp=r(),L=o("div"),f(Mn.$$.fragment),Uf=r(),re=o("div"),f(wn.$$.fragment),Tf=r(),tl=o("p"),Zf=a("Function invoked when calling the pipeline for generation."),jf=r(),f(rt.$$.fragment),Ef=r(),pe=o("div"),f(In.$$.fragment),Ff=r(),nl=o("p"),Bf=a("Encodes the prompt into text encoder hidden states."),Wf=r(),v=o("p"),kf=a("device: ("),al=o("code"),Gf=a("torch.device"),Rf=a(", "),sl=o("em"),Xf=a("optional"),Cf=a(`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),ol=o("code"),Sf=a("int"),Vf=a(", "),ll=o("em"),xf=a("optional"),Nf=a(`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),il=o("code"),$f=a("bool"),Pf=a(", "),rl=o("em"),Qf=a("optional"),Yf=a(", defaults to "),pl=o("code"),zf=a("True"),Hf=a(`):
whether to use classifier free guidance or not
negative_prompt (`),cl=o("code"),Df=a("str"),Lf=a(" or "),dl=o("code"),qf=a("List[str]"),Af=a(", "),ml=o("em"),Of=a("optional"),Kf=a(`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),gl=o("code"),eu=a("negative_prompt_embeds"),tu=a(". instead. If not defined, one has to pass "),fl=o("code"),nu=a("negative_prompt_embeds"),au=a(`. instead.
Ignored when not using guidance (i.e., ignored if `),ul=o("code"),su=a("guidance_scale"),ou=a(" is less than "),hl=o("code"),lu=a("1"),iu=a(`).
prompt_embeds (`),_l=o("code"),ru=a("torch.FloatTensor"),pu=a(", "),yl=o("em"),cu=a("optional"),du=a(`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),bl=o("em"),mu=a("e.g."),gu=a(` prompt weighting. If not
provided, text embeddings will be generated from `),Ml=o("code"),fu=a("prompt"),uu=a(` input argument.
negative_prompt_embeds (`),wl=o("code"),hu=a("torch.FloatTensor"),_u=a(", "),Il=o("em"),yu=a("optional"),bu=a(`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),vl=o("em"),Mu=a("e.g."),wu=a(` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),Jl=o("code"),Iu=a("negative_prompt"),vu=a(` input
argument.`),Bp=r(),Ce=o("h2"),pt=o("a"),Ul=o("span"),f(vn.$$.fragment),Ju=r(),Tl=o("span"),Uu=a("IFImg2ImgPipeline"),Wp=r(),q=o("div"),f(Jn.$$.fragment),Tu=r(),ce=o("div"),f(Un.$$.fragment),Zu=r(),Zl=o("p"),ju=a("Function invoked when calling the pipeline for generation."),Eu=r(),f(ct.$$.fragment),Fu=r(),de=o("div"),f(Tn.$$.fragment),Bu=r(),jl=o("p"),Wu=a("Encodes the prompt into text encoder hidden states."),ku=r(),J=o("p"),Gu=a("device: ("),El=o("code"),Ru=a("torch.device"),Xu=a(", "),Fl=o("em"),Cu=a("optional"),Su=a(`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),Bl=o("code"),Vu=a("int"),xu=a(", "),Wl=o("em"),Nu=a("optional"),$u=a(`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),kl=o("code"),Pu=a("bool"),Qu=a(", "),Gl=o("em"),Yu=a("optional"),zu=a(", defaults to "),Rl=o("code"),Hu=a("True"),Du=a(`):
whether to use classifier free guidance or not
negative_prompt (`),Xl=o("code"),Lu=a("str"),qu=a(" or "),Cl=o("code"),Au=a("List[str]"),Ou=a(", "),Sl=o("em"),Ku=a("optional"),eh=a(`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),Vl=o("code"),th=a("negative_prompt_embeds"),nh=a(". instead. If not defined, one has to pass "),xl=o("code"),ah=a("negative_prompt_embeds"),sh=a(`. instead.
Ignored when not using guidance (i.e., ignored if `),Nl=o("code"),oh=a("guidance_scale"),lh=a(" is less than "),$l=o("code"),ih=a("1"),rh=a(`).
prompt_embeds (`),Pl=o("code"),ph=a("torch.FloatTensor"),ch=a(", "),Ql=o("em"),dh=a("optional"),mh=a(`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),Yl=o("em"),gh=a("e.g."),fh=a(` prompt weighting. If not
provided, text embeddings will be generated from `),zl=o("code"),uh=a("prompt"),hh=a(` input argument.
negative_prompt_embeds (`),Hl=o("code"),_h=a("torch.FloatTensor"),yh=a(", "),Dl=o("em"),bh=a("optional"),Mh=a(`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),Ll=o("em"),wh=a("e.g."),Ih=a(` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),ql=o("code"),vh=a("negative_prompt"),Jh=a(` input
argument.`),kp=r(),Se=o("h2"),dt=o("a"),Al=o("span"),f(Zn.$$.fragment),Uh=r(),Ol=o("span"),Th=a("IFImg2ImgSuperResolutionPipeline"),Gp=r(),A=o("div"),f(jn.$$.fragment),Zh=r(),me=o("div"),f(En.$$.fragment),jh=r(),Kl=o("p"),Eh=a("Function invoked when calling the pipeline for generation."),Fh=r(),f(mt.$$.fragment),Bh=r(),ge=o("div"),f(Fn.$$.fragment),Wh=r(),ei=o("p"),kh=a("Encodes the prompt into text encoder hidden states."),Gh=r(),U=o("p"),Rh=a("device: ("),ti=o("code"),Xh=a("torch.device"),Ch=a(", "),ni=o("em"),Sh=a("optional"),Vh=a(`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),ai=o("code"),xh=a("int"),Nh=a(", "),si=o("em"),$h=a("optional"),Ph=a(`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),oi=o("code"),Qh=a("bool"),Yh=a(", "),li=o("em"),zh=a("optional"),Hh=a(", defaults to "),ii=o("code"),Dh=a("True"),Lh=a(`):
whether to use classifier free guidance or not
negative_prompt (`),ri=o("code"),qh=a("str"),Ah=a(" or "),pi=o("code"),Oh=a("List[str]"),Kh=a(", "),ci=o("em"),e_=a("optional"),t_=a(`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),di=o("code"),n_=a("negative_prompt_embeds"),a_=a(". instead. If not defined, one has to pass "),mi=o("code"),s_=a("negative_prompt_embeds"),o_=a(`. instead.
Ignored when not using guidance (i.e., ignored if `),gi=o("code"),l_=a("guidance_scale"),i_=a(" is less than "),fi=o("code"),r_=a("1"),p_=a(`).
prompt_embeds (`),ui=o("code"),c_=a("torch.FloatTensor"),d_=a(", "),hi=o("em"),m_=a("optional"),g_=a(`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),_i=o("em"),f_=a("e.g."),u_=a(` prompt weighting. If not
provided, text embeddings will be generated from `),yi=o("code"),h_=a("prompt"),__=a(` input argument.
negative_prompt_embeds (`),bi=o("code"),y_=a("torch.FloatTensor"),b_=a(", "),Mi=o("em"),M_=a("optional"),w_=a(`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),wi=o("em"),I_=a("e.g."),v_=a(` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),Ii=o("code"),J_=a("negative_prompt"),U_=a(` input
argument.`),Rp=r(),Ve=o("h2"),gt=o("a"),vi=o("span"),f(Bn.$$.fragment),T_=r(),Ji=o("span"),Z_=a("IFInpaintingPipeline"),Xp=r(),O=o("div"),f(Wn.$$.fragment),j_=r(),fe=o("div"),f(kn.$$.fragment),E_=r(),Ui=o("p"),F_=a("Function invoked when calling the pipeline for generation."),B_=r(),f(ft.$$.fragment),W_=r(),ue=o("div"),f(Gn.$$.fragment),k_=r(),Ti=o("p"),G_=a("Encodes the prompt into text encoder hidden states."),R_=r(),T=o("p"),X_=a("device: ("),Zi=o("code"),C_=a("torch.device"),S_=a(", "),ji=o("em"),V_=a("optional"),x_=a(`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),Ei=o("code"),N_=a("int"),$_=a(", "),Fi=o("em"),P_=a("optional"),Q_=a(`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),Bi=o("code"),Y_=a("bool"),z_=a(", "),Wi=o("em"),H_=a("optional"),D_=a(", defaults to "),ki=o("code"),L_=a("True"),q_=a(`):
whether to use classifier free guidance or not
negative_prompt (`),Gi=o("code"),A_=a("str"),O_=a(" or "),Ri=o("code"),K_=a("List[str]"),ey=a(", "),Xi=o("em"),ty=a("optional"),ny=a(`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),Ci=o("code"),ay=a("negative_prompt_embeds"),sy=a(". instead. If not defined, one has to pass "),Si=o("code"),oy=a("negative_prompt_embeds"),ly=a(`. instead.
Ignored when not using guidance (i.e., ignored if `),Vi=o("code"),iy=a("guidance_scale"),ry=a(" is less than "),xi=o("code"),py=a("1"),cy=a(`).
prompt_embeds (`),Ni=o("code"),dy=a("torch.FloatTensor"),my=a(", "),$i=o("em"),gy=a("optional"),fy=a(`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),Pi=o("em"),uy=a("e.g."),hy=a(` prompt weighting. If not
provided, text embeddings will be generated from `),Qi=o("code"),_y=a("prompt"),yy=a(` input argument.
negative_prompt_embeds (`),Yi=o("code"),by=a("torch.FloatTensor"),My=a(", "),zi=o("em"),wy=a("optional"),Iy=a(`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),Hi=o("em"),vy=a("e.g."),Jy=a(` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),Di=o("code"),Uy=a("negative_prompt"),Ty=a(` input
argument.`),Cp=r(),xe=o("h2"),ut=o("a"),Li=o("span"),f(Rn.$$.fragment),Zy=r(),qi=o("span"),jy=a("IFInpaintingSuperResolutionPipeline"),Sp=r(),K=o("div"),f(Xn.$$.fragment),Ey=r(),he=o("div"),f(Cn.$$.fragment),Fy=r(),Ai=o("p"),By=a("Function invoked when calling the pipeline for generation."),Wy=r(),f(ht.$$.fragment),ky=r(),_e=o("div"),f(Sn.$$.fragment),Gy=r(),Oi=o("p"),Ry=a("Encodes the prompt into text encoder hidden states."),Xy=r(),Z=o("p"),Cy=a("device: ("),Ki=o("code"),Sy=a("torch.device"),Vy=a(", "),er=o("em"),xy=a("optional"),Ny=a(`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),tr=o("code"),$y=a("int"),Py=a(", "),nr=o("em"),Qy=a("optional"),Yy=a(`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),ar=o("code"),zy=a("bool"),Hy=a(", "),sr=o("em"),Dy=a("optional"),Ly=a(", defaults to "),or=o("code"),qy=a("True"),Ay=a(`):
whether to use classifier free guidance or not
negative_prompt (`),lr=o("code"),Oy=a("str"),Ky=a(" or "),ir=o("code"),eb=a("List[str]"),tb=a(", "),rr=o("em"),nb=a("optional"),ab=a(`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),pr=o("code"),sb=a("negative_prompt_embeds"),ob=a(". instead. If not defined, one has to pass "),cr=o("code"),lb=a("negative_prompt_embeds"),ib=a(`. instead.
Ignored when not using guidance (i.e., ignored if `),dr=o("code"),rb=a("guidance_scale"),pb=a(" is less than "),mr=o("code"),cb=a("1"),db=a(`).
prompt_embeds (`),gr=o("code"),mb=a("torch.FloatTensor"),gb=a(", "),fr=o("em"),fb=a("optional"),ub=a(`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),ur=o("em"),hb=a("e.g."),_b=a(` prompt weighting. If not
provided, text embeddings will be generated from `),hr=o("code"),yb=a("prompt"),bb=a(` input argument.
negative_prompt_embeds (`),_r=o("code"),Mb=a("torch.FloatTensor"),wb=a(", "),yr=o("em"),Ib=a("optional"),vb=a(`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),br=o("em"),Jb=a("e.g."),Ub=a(` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),Mr=o("code"),Tb=a("negative_prompt"),Zb=a(` input
argument.`),this.h()},l(t){const c=iJ('[data-svelte="svelte-1phssyn"]',document.head);w=l(c,"META",{name:!0,content:!0}),c.forEach(n),C=p(t),R=l(t,"H1",{class:!0});var Vn=i(R);M=l(Vn,"A",{id:!0,class:!0,href:!0});var wr=i(M);X=l(wr,"SPAN",{});var Ir=i(X);u(g.$$.fragment,Ir),Ir.forEach(n),wr.forEach(n),G=p(Vn),os=l(Vn,"SPAN",{});var vr=i(os);hc=s(vr,"DeepFloyd IF"),vr.forEach(n),Vn.forEach(n),Ur=p(t),ye=l(t,"H2",{class:!0});var xn=i(ye);Ne=l(xn,"A",{id:!0,class:!0,href:!0});var Jr=i(Ne);ls=l(Jr,"SPAN",{});var Bb=i(ls);u(_t.$$.fragment,Bb),Bb.forEach(n),Jr.forEach(n),_c=p(xn),is=l(xn,"SPAN",{});var Wb=i(is);yc=s(Wb,"Overview"),Wb.forEach(n),xn.forEach(n),Tr=p(t),Pn=l(t,"P",{});var kb=i(Pn);bc=s(kb,`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:`),kb.forEach(n),Zr=p(t),ee=l(t,"UL",{});var Ua=i(ee);rs=l(Ua,"LI",{});var Gb=i(rs);Mc=s(Gb,"Stage 1: a base model that generates 64x64 px image based on text prompt,"),Gb.forEach(n),wc=p(Ua),ps=l(Ua,"LI",{});var Rb=i(ps);Ic=s(Rb,"Stage 2: a 64x64 px => 256x256 px super-resolution model, and a"),Rb.forEach(n),vc=p(Ua),yt=l(Ua,"LI",{});var xp=i(yt);Jc=s(xp,`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 `),bt=l(xp,"A",{href:!0,rel:!0});var Xb=i(bt);Uc=s(Xb,"Stability\u2019s x4 Upscaling model"),Xb.forEach(n),Tc=s(xp,`.
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.`),xp.forEach(n),Ua.forEach(n),jr=p(t),be=l(t,"H2",{class:!0});var Np=i(be);$e=l(Np,"A",{id:!0,class:!0,href:!0});var Cb=i($e);cs=l(Cb,"SPAN",{});var Sb=i(cs);u(Mt.$$.fragment,Sb),Sb.forEach(n),Cb.forEach(n),Zc=p(Np),ds=l(Np,"SPAN",{});var Vb=i(ds);jc=s(Vb,"Usage"),Vb.forEach(n),Np.forEach(n),Er=p(t),Qn=l(t,"P",{});var xb=i(Qn);Ec=s(xb,"Before you can use IF, you need to accept its usage conditions. To do so:"),xb.forEach(n),Fr=p(t),te=l(t,"OL",{});var Ta=i(te);wt=l(Ta,"LI",{});var $p=i(wt);Fc=s($p,"Make sure to have a "),It=l($p,"A",{href:!0,rel:!0});var Nb=i(It);Bc=s(Nb,"Hugging Face account"),Nb.forEach(n),Wc=s($p," and be logged in"),$p.forEach(n),kc=p(Ta),vt=l(Ta,"LI",{});var Pp=i(vt);Gc=s(Pp,"Accept the license on the model card of "),Jt=l(Pp,"A",{href:!0,rel:!0});var $b=i(Jt);Rc=s($b,"DeepFloyd/IF-I-XL-v1.0"),$b.forEach(n),Xc=s(Pp,". Accepting the license on the stage I model card will auto accept for the other IF models."),Pp.forEach(n),Cc=p(Ta),Yn=l(Ta,"LI",{});var jb=i(Yn);Sc=s(jb,"Make sure to login locally. Install "),ms=l(jb,"CODE",{});var Pb=i(ms);Vc=s(Pb,"huggingface_hub"),Pb.forEach(n),jb.forEach(n),Ta.forEach(n),Br=p(t),u(Ut.$$.fragment,t),Wr=p(t),zn=l(t,"P",{});var Qb=i(zn);xc=s(Qb,"run the login function in a Python shell"),Qb.forEach(n),kr=p(t),u(Tt.$$.fragment,t),Gr=p(t),Pe=l(t,"P",{});var Qp=i(Pe);Nc=s(Qp,"and enter your "),Zt=l(Qp,"A",{href:!0,rel:!0});var Yb=i(Zt);$c=s(Yb,"Hugging Face Hub access token"),Yb.forEach(n),Pc=s(Qp,"."),Qp.forEach(n),Rr=p(t),Qe=l(t,"P",{});var Yp=i(Qe);Qc=s(Yp,"Next we install "),gs=l(Yp,"CODE",{});var zb=i(gs);Yc=s(zb,"diffusers"),zb.forEach(n),zc=s(Yp," and dependencies:"),Yp.forEach(n),Xr=p(t),u(jt.$$.fragment,t),Cr=p(t),Hn=l(t,"P",{});var Hb=i(Hn);Hc=s(Hb,"The following sections give more in-detail examples of how to use IF. Specifically:"),Hb.forEach(n),Sr=p(t),x=l(t,"UL",{});var Q=i(x);fs=l(Q,"LI",{});var Db=i(fs);Dn=l(Db,"A",{href:!0});var Lb=i(Dn);Dc=s(Lb,"Text-to-Image Generation"),Lb.forEach(n),Db.forEach(n),Lc=p(Q),us=l(Q,"LI",{});var qb=i(us);Ln=l(qb,"A",{href:!0});var Ab=i(Ln);qc=s(Ab,"Image-to-Image Generation"),Ab.forEach(n),qb.forEach(n),Ac=p(Q),hs=l(Q,"LI",{});var Ob=i(hs);qn=l(Ob,"A",{href:!0});var Kb=i(qn);Oc=s(Kb,"Inpainting"),Kb.forEach(n),Ob.forEach(n),Kc=p(Q),_s=l(Q,"LI",{});var eM=i(_s);An=l(eM,"A",{href:!0});var tM=i(An);ed=s(tM,"Reusing model weights"),tM.forEach(n),eM.forEach(n),td=p(Q),ys=l(Q,"LI",{});var nM=i(ys);On=l(nM,"A",{href:!0});var aM=i(On);nd=s(aM,"Speed optimization"),aM.forEach(n),nM.forEach(n),ad=p(Q),bs=l(Q,"LI",{});var sM=i(bs);Kn=l(sM,"A",{href:!0});var oM=i(Kn);sd=s(oM,"Memory optimization"),oM.forEach(n),sM.forEach(n),Q.forEach(n),Vr=p(t),ea=l(t,"P",{});var lM=i(ea);Ms=l(lM,"STRONG",{});var iM=i(Ms);od=s(iM,"Available checkpoints"),iM.forEach(n),lM.forEach(n),xr=p(t),ne=l(t,"UL",{});var Za=i(ne);Et=l(Za,"LI",{});var zp=i(Et);ws=l(zp,"P",{});var rM=i(ws);Is=l(rM,"EM",{});var pM=i(Is);ld=s(pM,"Stage-1"),pM.forEach(n),rM.forEach(n),id=p(zp),Me=l(zp,"UL",{});var ja=i(Me);vs=l(ja,"LI",{});var cM=i(vs);Ft=l(cM,"A",{href:!0,rel:!0});var dM=i(Ft);rd=s(dM,"DeepFloyd/IF-I-XL-v1.0"),dM.forEach(n),cM.forEach(n),pd=p(ja),Js=l(ja,"LI",{});var mM=i(Js);Bt=l(mM,"A",{href:!0,rel:!0});var gM=i(Bt);cd=s(gM,"DeepFloyd/IF-I-L-v1.0"),gM.forEach(n),mM.forEach(n),dd=p(ja),Us=l(ja,"LI",{});var fM=i(Us);Wt=l(fM,"A",{href:!0,rel:!0});var uM=i(Wt);md=s(uM,"DeepFloyd/IF-I-M-v1.0"),uM.forEach(n),fM.forEach(n),ja.forEach(n),zp.forEach(n),gd=p(Za),kt=l(Za,"LI",{});var Hp=i(kt);Ts=l(Hp,"P",{});var hM=i(Ts);Zs=l(hM,"EM",{});var _M=i(Zs);fd=s(_M,"Stage-2"),_M.forEach(n),hM.forEach(n),ud=p(Hp),Gt=l(Hp,"UL",{});var Dp=i(Gt);js=l(Dp,"LI",{});var yM=i(js);Rt=l(yM,"A",{href:!0,rel:!0});var bM=i(Rt);hd=s(bM,"DeepFloyd/IF-II-L-v1.0"),bM.forEach(n),yM.forEach(n),_d=p(Dp),Es=l(Dp,"LI",{});var MM=i(Es);Xt=l(MM,"A",{href:!0,rel:!0});var wM=i(Xt);yd=s(wM,"DeepFloyd/IF-II-M-v1.0"),wM.forEach(n),MM.forEach(n),Dp.forEach(n),Hp.forEach(n),bd=p(Za),Ct=l(Za,"LI",{});var Lp=i(Ct);Fs=l(Lp,"P",{});var IM=i(Fs);Bs=l(IM,"EM",{});var vM=i(Bs);Md=s(vM,"Stage-3"),vM.forEach(n),IM.forEach(n),wd=p(Lp),Ws=l(Lp,"UL",{});var JM=i(Ws);ks=l(JM,"LI",{});var UM=i(ks);St=l(UM,"A",{href:!0,rel:!0});var TM=i(St);Id=s(TM,"stabilityai/stable-diffusion-x4-upscaler"),TM.forEach(n),UM.forEach(n),JM.forEach(n),Lp.forEach(n),Za.forEach(n),Nr=p(t),Ye=l(t,"P",{});var qp=i(Ye);Gs=l(qp,"STRONG",{});var ZM=i(Gs);vd=s(ZM,"Demo"),ZM.forEach(n),Jd=p(qp),Vt=l(qp,"A",{href:!0,rel:!0});var jM=i(Vt);ta=l(jM,"IMG",{src:!0,alt:!0}),jM.forEach(n),qp.forEach(n),$r=p(t),ze=l(t,"P",{});var Ap=i(ze);Rs=l(Ap,"STRONG",{});var EM=i(Rs);Ud=s(EM,"Google Colab"),EM.forEach(n),Td=p(Ap),xt=l(Ap,"A",{href:!0,rel:!0});var FM=i(xt);na=l(FM,"IMG",{src:!0,alt:!0}),FM.forEach(n),Ap.forEach(n),Pr=p(t),we=l(t,"H3",{class:!0});var Op=i(we);He=l(Op,"A",{id:!0,class:!0,href:!0});var BM=i(He);Xs=l(BM,"SPAN",{});var WM=i(Xs);u(Nt.$$.fragment,WM),WM.forEach(n),BM.forEach(n),Zd=p(Op),Cs=l(Op,"SPAN",{});var kM=i(Cs);jd=s(kM,"Text-to-Image Generation"),kM.forEach(n),Op.forEach(n),Qr=p(t),De=l(t,"P",{});var Kp=i(De);Ed=s(Kp,"By default diffusers makes use of "),$t=l(Kp,"A",{href:!0,rel:!0});var GM=i($t);Fd=s(GM,"model cpu offloading"),GM.forEach(n),Bd=s(Kp,`
to run the whole IF pipeline with as little as 14 GB of VRAM.`),Kp.forEach(n),Yr=p(t),u(Pt.$$.fragment,t),zr=p(t),Ie=l(t,"H3",{class:!0});var ec=i(Ie);Le=l(ec,"A",{id:!0,class:!0,href:!0});var RM=i(Le);Ss=l(RM,"SPAN",{});var XM=i(Ss);u(Qt.$$.fragment,XM),XM.forEach(n),RM.forEach(n),Wd=p(ec),Vs=l(ec,"SPAN",{});var CM=i(Vs);kd=s(CM,"Text Guided Image-to-Image Generation"),CM.forEach(n),ec.forEach(n),Hr=p(t),ae=l(t,"P",{});var Ea=i(ae);Gd=s(Ea,`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 `),aa=l(Ea,"A",{href:!0});var SM=i(aa);Rd=s(SM,"IFInpaintingPipeline"),SM.forEach(n),Xd=s(Ea," and "),sa=l(Ea,"A",{href:!0});var VM=i(sa);Cd=s(VM,"IFInpaintingSuperResolutionPipeline"),VM.forEach(n),Sd=s(Ea," pipelines."),Ea.forEach(n),Dr=p(t),z=l(t,"P",{});var Nn=i(z);xs=l(Nn,"STRONG",{});var xM=i(xs);Vd=s(xM,"Note"),xM.forEach(n),xd=s(Nn,`: 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 `),Ns=l(Nn,"CODE",{});var NM=i(Ns);Nd=s(NM,"~DiffusionPipeline.components()"),NM.forEach(n),$d=s(Nn," function as explained "),oa=l(Nn,"A",{href:!0});var $M=i(oa);Pd=s($M,"here"),$M.forEach(n),Qd=s(Nn,"."),Nn.forEach(n),Lr=p(t),u(Yt.$$.fragment,t),qr=p(t),ve=l(t,"H3",{class:!0});var tc=i(ve);qe=l(tc,"A",{id:!0,class:!0,href:!0});var PM=i(qe);$s=l(PM,"SPAN",{});var QM=i($s);u(zt.$$.fragment,QM),QM.forEach(n),PM.forEach(n),Yd=p(tc),Ps=l(tc,"SPAN",{});var YM=i(Ps);zd=s(YM,"Text Guided Inpainting Generation"),YM.forEach(n),tc.forEach(n),Ar=p(t),se=l(t,"P",{});var Fa=i(se);Hd=s(Fa,`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 `),la=l(Fa,"A",{href:!0});var zM=i(la);Dd=s(zM,"IFInpaintingPipeline"),zM.forEach(n),Ld=s(Fa," and "),ia=l(Fa,"A",{href:!0});var HM=i(ia);qd=s(HM,"IFInpaintingSuperResolutionPipeline"),HM.forEach(n),Ad=s(Fa," pipelines."),Fa.forEach(n),Or=p(t),H=l(t,"P",{});var $n=i(H);Qs=l($n,"STRONG",{});var DM=i(Qs);Od=s(DM,"Note"),DM.forEach(n),Kd=s($n,`: 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 `),Ys=l($n,"CODE",{});var LM=i(Ys);em=s(LM,"~DiffusionPipeline.components()"),LM.forEach(n),tm=s($n," function as explained "),ra=l($n,"A",{href:!0});var qM=i(ra);nm=s(qM,"here"),qM.forEach(n),am=s($n,"."),$n.forEach(n),Kr=p(t),u(Ht.$$.fragment,t),ep=p(t),Je=l(t,"H3",{class:!0});var nc=i(Je);Ae=l(nc,"A",{id:!0,class:!0,href:!0});var AM=i(Ae);zs=l(AM,"SPAN",{});var OM=i(zs);u(Dt.$$.fragment,OM),OM.forEach(n),AM.forEach(n),sm=p(nc),Hs=l(nc,"SPAN",{});var KM=i(Hs);om=s(KM,"Converting between different pipelines"),KM.forEach(n),nc.forEach(n),tp=p(t),Oe=l(t,"P",{});var ac=i(Oe);lm=s(ac,"In addition to being loaded with "),Ds=l(ac,"CODE",{});var ew=i(Ds);im=s(ew,"from_pretrained"),ew.forEach(n),rm=s(ac,", Pipelines can also be loaded directly from each other."),ac.forEach(n),np=p(t),u(Lt.$$.fragment,t),ap=p(t),Ue=l(t,"H3",{class:!0});var sc=i(Ue);Ke=l(sc,"A",{id:!0,class:!0,href:!0});var tw=i(Ke);Ls=l(tw,"SPAN",{});var nw=i(Ls);u(qt.$$.fragment,nw),nw.forEach(n),tw.forEach(n),pm=p(sc),qs=l(sc,"SPAN",{});var aw=i(qs);cm=s(aw,"Optimizing for speed"),aw.forEach(n),sc.forEach(n),sp=p(t),pa=l(t,"P",{});var sw=i(pa);dm=s(sw,"The simplest optimization to run IF faster is to move all model components to the GPU."),sw.forEach(n),op=p(t),u(At.$$.fragment,t),lp=p(t),ca=l(t,"P",{});var ow=i(ca);mm=s(ow,"You can also run the diffusion process for a shorter number of timesteps."),ow.forEach(n),ip=p(t),et=l(t,"P",{});var oc=i(et);gm=s(oc,"This can either be done with the "),As=l(oc,"CODE",{});var lw=i(As);fm=s(lw,"num_inference_steps"),lw.forEach(n),um=s(oc," argument"),oc.forEach(n),rp=p(t),u(Ot.$$.fragment,t),pp=p(t),tt=l(t,"P",{});var lc=i(tt);hm=s(lc,"Or with the "),Os=l(lc,"CODE",{});var iw=i(Os);_m=s(iw,"timesteps"),iw.forEach(n),ym=s(lc," argument"),lc.forEach(n),cp=p(t),u(Kt.$$.fragment,t),dp=p(t),da=l(t,"P",{});var rw=i(da);bm=s(rw,`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.`),rw.forEach(n),mp=p(t),u(en.$$.fragment,t),gp=p(t),oe=l(t,"P",{});var Ba=i(oe);Mm=s(Ba,"You can also use "),ma=l(Ba,"A",{href:!0});var pw=i(ma);Ks=l(pw,"CODE",{});var cw=i(Ks);wm=s(cw,"torch.compile"),cw.forEach(n),pw.forEach(n),Im=s(Ba,". Note that we have not exhaustively tested "),eo=l(Ba,"CODE",{});var dw=i(eo);vm=s(dw,"torch.compile"),dw.forEach(n),Jm=s(Ba,`
with IF and it might not give expected results.`),Ba.forEach(n),fp=p(t),u(tn.$$.fragment,t),up=p(t),Te=l(t,"H3",{class:!0});var ic=i(Te);nt=l(ic,"A",{id:!0,class:!0,href:!0});var mw=i(nt);to=l(mw,"SPAN",{});var gw=i(to);u(nn.$$.fragment,gw),gw.forEach(n),mw.forEach(n),Um=p(ic),no=l(ic,"SPAN",{});var fw=i(no);Tm=s(fw,"Optimizing for memory"),fw.forEach(n),ic.forEach(n),hp=p(t),ga=l(t,"P",{});var uw=i(ga);Zm=s(uw,"When optimizing for GPU memory, we can use the standard diffusers cpu offloading APIs."),uw.forEach(n),_p=p(t),fa=l(t,"P",{});var hw=i(fa);jm=s(hw,"Either the model based CPU offloading,"),hw.forEach(n),yp=p(t),u(an.$$.fragment,t),bp=p(t),ua=l(t,"P",{});var _w=i(ua);Em=s(_w,"or the more aggressive layer based CPU offloading."),_w.forEach(n),Mp=p(t),u(sn.$$.fragment,t),wp=p(t),ha=l(t,"P",{});var yw=i(ha);Fm=s(yw,"Additionally, T5 can be loaded in 8bit precision"),yw.forEach(n),Ip=p(t),u(on.$$.fragment,t),vp=p(t),_a=l(t,"P",{});var bw=i(_a);Bm=s(bw,`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.`),bw.forEach(n),Jp=p(t),u(ln.$$.fragment,t),Up=p(t),Ze=l(t,"H2",{class:!0});var rc=i(Ze);at=l(rc,"A",{id:!0,class:!0,href:!0});var Mw=i(at);ao=l(Mw,"SPAN",{});var ww=i(ao);u(rn.$$.fragment,ww),ww.forEach(n),Mw.forEach(n),Wm=p(rc),so=l(rc,"SPAN",{});var Iw=i(so);km=s(Iw,"Available Pipelines:"),Iw.forEach(n),rc.forEach(n),Tp=p(t),st=l(t,"TABLE",{});var pc=i(st);oo=l(pc,"THEAD",{});var vw=i(oo);je=l(vw,"TR",{});var Wa=i(je);lo=l(Wa,"TH",{});var Jw=i(lo);Gm=s(Jw,"Pipeline"),Jw.forEach(n),Rm=p(Wa),io=l(Wa,"TH",{});var Uw=i(io);Xm=s(Uw,"Tasks"),Uw.forEach(n),Cm=p(Wa),ya=l(Wa,"TH",{align:!0});var Tw=i(ya);Sm=s(Tw,"Colab"),Tw.forEach(n),Wa.forEach(n),vw.forEach(n),Vm=p(pc),$=l(pc,"TBODY",{});var Y=i($);Ee=l(Y,"TR",{});var ka=i(Ee);ro=l(ka,"TD",{});var Zw=i(ro);pn=l(Zw,"A",{href:!0,rel:!0});var jw=i(pn);xm=s(jw,"pipeline_if.py"),jw.forEach(n),Zw.forEach(n),Nm=p(ka),po=l(ka,"TD",{});var Ew=i(po);co=l(Ew,"EM",{});var Fw=i(co);$m=s(Fw,"Text-to-Image Generation"),Fw.forEach(n),Ew.forEach(n),Pm=p(ka),ba=l(ka,"TD",{align:!0});var Bw=i(ba);Qm=s(Bw,"-"),Bw.forEach(n),ka.forEach(n),Ym=p(Y),Fe=l(Y,"TR",{});var Ga=i(Fe);mo=l(Ga,"TD",{});var Ww=i(mo);cn=l(Ww,"A",{href:!0,rel:!0});var kw=i(cn);zm=s(kw,"pipeline_if_superresolution.py"),kw.forEach(n),Ww.forEach(n),Hm=p(Ga),go=l(Ga,"TD",{});var Gw=i(go);fo=l(Gw,"EM",{});var Rw=i(fo);Dm=s(Rw,"Text-to-Image Generation"),Rw.forEach(n),Gw.forEach(n),Lm=p(Ga),Ma=l(Ga,"TD",{align:!0});var Xw=i(Ma);qm=s(Xw,"-"),Xw.forEach(n),Ga.forEach(n),Am=p(Y),Be=l(Y,"TR",{});var Ra=i(Be);uo=l(Ra,"TD",{});var Cw=i(uo);dn=l(Cw,"A",{href:!0,rel:!0});var Sw=i(dn);Om=s(Sw,"pipeline_if_img2img.py"),Sw.forEach(n),Cw.forEach(n),Km=p(Ra),ho=l(Ra,"TD",{});var Vw=i(ho);_o=l(Vw,"EM",{});var xw=i(_o);eg=s(xw,"Image-to-Image Generation"),xw.forEach(n),Vw.forEach(n),tg=p(Ra),wa=l(Ra,"TD",{align:!0});var Nw=i(wa);ng=s(Nw,"-"),Nw.forEach(n),Ra.forEach(n),ag=p(Y),We=l(Y,"TR",{});var Xa=i(We);yo=l(Xa,"TD",{});var $w=i(yo);mn=l($w,"A",{href:!0,rel:!0});var Pw=i(mn);sg=s(Pw,"pipeline_if_img2img_superresolution.py"),Pw.forEach(n),$w.forEach(n),og=p(Xa),bo=l(Xa,"TD",{});var Qw=i(bo);Mo=l(Qw,"EM",{});var Yw=i(Mo);lg=s(Yw,"Image-to-Image Generation"),Yw.forEach(n),Qw.forEach(n),ig=p(Xa),Ia=l(Xa,"TD",{align:!0});var zw=i(Ia);rg=s(zw,"-"),zw.forEach(n),Xa.forEach(n),pg=p(Y),ke=l(Y,"TR",{});var Ca=i(ke);wo=l(Ca,"TD",{});var Hw=i(wo);gn=l(Hw,"A",{href:!0,rel:!0});var Dw=i(gn);cg=s(Dw,"pipeline_if_inpainting.py"),Dw.forEach(n),Hw.forEach(n),dg=p(Ca),Io=l(Ca,"TD",{});var Lw=i(Io);vo=l(Lw,"EM",{});var qw=i(vo);mg=s(qw,"Image-to-Image Generation"),qw.forEach(n),Lw.forEach(n),gg=p(Ca),va=l(Ca,"TD",{align:!0});var Aw=i(va);fg=s(Aw,"-"),Aw.forEach(n),Ca.forEach(n),ug=p(Y),Ge=l(Y,"TR",{});var Sa=i(Ge);Jo=l(Sa,"TD",{});var Ow=i(Jo);fn=l(Ow,"A",{href:!0,rel:!0});var Kw=i(fn);hg=s(Kw,"pipeline_if_inpainting_superresolution.py"),Kw.forEach(n),Ow.forEach(n),_g=p(Sa),Uo=l(Sa,"TD",{});var eI=i(Uo);To=l(eI,"EM",{});var tI=i(To);yg=s(tI,"Image-to-Image Generation"),tI.forEach(n),eI.forEach(n),bg=p(Sa),Ja=l(Sa,"TD",{align:!0});var nI=i(Ja);Mg=s(nI,"-"),nI.forEach(n),Sa.forEach(n),Y.forEach(n),pc.forEach(n),Zp=p(t),Re=l(t,"H2",{class:!0});var cc=i(Re);ot=l(cc,"A",{id:!0,class:!0,href:!0});var aI=i(ot);Zo=l(aI,"SPAN",{});var sI=i(Zo);u(un.$$.fragment,sI),sI.forEach(n),aI.forEach(n),wg=p(cc),jo=l(cc,"SPAN",{});var oI=i(jo);Ig=s(oI,"IFPipeline"),oI.forEach(n),cc.forEach(n),jp=p(t),D=l(t,"DIV",{class:!0});var Va=i(D);u(hn.$$.fragment,Va),vg=p(Va),le=l(Va,"DIV",{class:!0});var xa=i(le);u(_n.$$.fragment,xa),Jg=p(xa),Eo=l(xa,"P",{});var lI=i(Eo);Ug=s(lI,"Function invoked when calling the pipeline for generation."),lI.forEach(n),Tg=p(xa),u(lt.$$.fragment,xa),xa.forEach(n),Zg=p(Va),ie=l(Va,"DIV",{class:!0});var Na=i(ie);u(yn.$$.fragment,Na),jg=p(Na),Fo=l(Na,"P",{});var iI=i(Fo);Eg=s(iI,"Encodes the prompt into text encoder hidden states."),iI.forEach(n),Fg=p(Na),I=l(Na,"P",{});var j=i(I);Bg=s(j,"device: ("),Bo=l(j,"CODE",{});var rI=i(Bo);Wg=s(rI,"torch.device"),rI.forEach(n),kg=s(j,", "),Wo=l(j,"EM",{});var pI=i(Wo);Gg=s(pI,"optional"),pI.forEach(n),Rg=s(j,`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),ko=l(j,"CODE",{});var cI=i(ko);Xg=s(cI,"int"),cI.forEach(n),Cg=s(j,", "),Go=l(j,"EM",{});var dI=i(Go);Sg=s(dI,"optional"),dI.forEach(n),Vg=s(j,`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),Ro=l(j,"CODE",{});var mI=i(Ro);xg=s(mI,"bool"),mI.forEach(n),Ng=s(j,", "),Xo=l(j,"EM",{});var gI=i(Xo);$g=s(gI,"optional"),gI.forEach(n),Pg=s(j,", defaults to "),Co=l(j,"CODE",{});var fI=i(Co);Qg=s(fI,"True"),fI.forEach(n),Yg=s(j,`):
whether to use classifier free guidance or not
negative_prompt (`),So=l(j,"CODE",{});var uI=i(So);zg=s(uI,"str"),uI.forEach(n),Hg=s(j," or "),Vo=l(j,"CODE",{});var hI=i(Vo);Dg=s(hI,"List[str]"),hI.forEach(n),Lg=s(j,", "),xo=l(j,"EM",{});var _I=i(xo);qg=s(_I,"optional"),_I.forEach(n),Ag=s(j,`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),No=l(j,"CODE",{});var yI=i(No);Og=s(yI,"negative_prompt_embeds"),yI.forEach(n),Kg=s(j,". instead. If not defined, one has to pass "),$o=l(j,"CODE",{});var bI=i($o);ef=s(bI,"negative_prompt_embeds"),bI.forEach(n),tf=s(j,`. instead.
Ignored when not using guidance (i.e., ignored if `),Po=l(j,"CODE",{});var MI=i(Po);nf=s(MI,"guidance_scale"),MI.forEach(n),af=s(j," is less than "),Qo=l(j,"CODE",{});var wI=i(Qo);sf=s(wI,"1"),wI.forEach(n),of=s(j,`).
prompt_embeds (`),Yo=l(j,"CODE",{});var II=i(Yo);lf=s(II,"torch.FloatTensor"),II.forEach(n),rf=s(j,", "),zo=l(j,"EM",{});var vI=i(zo);pf=s(vI,"optional"),vI.forEach(n),cf=s(j,`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),Ho=l(j,"EM",{});var JI=i(Ho);df=s(JI,"e.g."),JI.forEach(n),mf=s(j,` prompt weighting. If not
provided, text embeddings will be generated from `),Do=l(j,"CODE",{});var UI=i(Do);gf=s(UI,"prompt"),UI.forEach(n),ff=s(j,` input argument.
negative_prompt_embeds (`),Lo=l(j,"CODE",{});var TI=i(Lo);uf=s(TI,"torch.FloatTensor"),TI.forEach(n),hf=s(j,", "),qo=l(j,"EM",{});var ZI=i(qo);_f=s(ZI,"optional"),ZI.forEach(n),yf=s(j,`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),Ao=l(j,"EM",{});var jI=i(Ao);bf=s(jI,"e.g."),jI.forEach(n),Mf=s(j,` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),Oo=l(j,"CODE",{});var EI=i(Oo);wf=s(EI,"negative_prompt"),EI.forEach(n),If=s(j,` input
argument.`),j.forEach(n),Na.forEach(n),Va.forEach(n),Ep=p(t),Xe=l(t,"H2",{class:!0});var dc=i(Xe);it=l(dc,"A",{id:!0,class:!0,href:!0});var FI=i(it);Ko=l(FI,"SPAN",{});var BI=i(Ko);u(bn.$$.fragment,BI),BI.forEach(n),FI.forEach(n),vf=p(dc),el=l(dc,"SPAN",{});var WI=i(el);Jf=s(WI,"IFSuperResolutionPipeline"),WI.forEach(n),dc.forEach(n),Fp=p(t),L=l(t,"DIV",{class:!0});var $a=i(L);u(Mn.$$.fragment,$a),Uf=p($a),re=l($a,"DIV",{class:!0});var Pa=i(re);u(wn.$$.fragment,Pa),Tf=p(Pa),tl=l(Pa,"P",{});var kI=i(tl);Zf=s(kI,"Function invoked when calling the pipeline for generation."),kI.forEach(n),jf=p(Pa),u(rt.$$.fragment,Pa),Pa.forEach(n),Ef=p($a),pe=l($a,"DIV",{class:!0});var Qa=i(pe);u(In.$$.fragment,Qa),Ff=p(Qa),nl=l(Qa,"P",{});var GI=i(nl);Bf=s(GI,"Encodes the prompt into text encoder hidden states."),GI.forEach(n),Wf=p(Qa),v=l(Qa,"P",{});var E=i(v);kf=s(E,"device: ("),al=l(E,"CODE",{});var RI=i(al);Gf=s(RI,"torch.device"),RI.forEach(n),Rf=s(E,", "),sl=l(E,"EM",{});var XI=i(sl);Xf=s(XI,"optional"),XI.forEach(n),Cf=s(E,`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),ol=l(E,"CODE",{});var CI=i(ol);Sf=s(CI,"int"),CI.forEach(n),Vf=s(E,", "),ll=l(E,"EM",{});var SI=i(ll);xf=s(SI,"optional"),SI.forEach(n),Nf=s(E,`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),il=l(E,"CODE",{});var VI=i(il);$f=s(VI,"bool"),VI.forEach(n),Pf=s(E,", "),rl=l(E,"EM",{});var xI=i(rl);Qf=s(xI,"optional"),xI.forEach(n),Yf=s(E,", defaults to "),pl=l(E,"CODE",{});var NI=i(pl);zf=s(NI,"True"),NI.forEach(n),Hf=s(E,`):
whether to use classifier free guidance or not
negative_prompt (`),cl=l(E,"CODE",{});var $I=i(cl);Df=s($I,"str"),$I.forEach(n),Lf=s(E," or "),dl=l(E,"CODE",{});var PI=i(dl);qf=s(PI,"List[str]"),PI.forEach(n),Af=s(E,", "),ml=l(E,"EM",{});var QI=i(ml);Of=s(QI,"optional"),QI.forEach(n),Kf=s(E,`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),gl=l(E,"CODE",{});var YI=i(gl);eu=s(YI,"negative_prompt_embeds"),YI.forEach(n),tu=s(E,". instead. If not defined, one has to pass "),fl=l(E,"CODE",{});var zI=i(fl);nu=s(zI,"negative_prompt_embeds"),zI.forEach(n),au=s(E,`. instead.
Ignored when not using guidance (i.e., ignored if `),ul=l(E,"CODE",{});var HI=i(ul);su=s(HI,"guidance_scale"),HI.forEach(n),ou=s(E," is less than "),hl=l(E,"CODE",{});var DI=i(hl);lu=s(DI,"1"),DI.forEach(n),iu=s(E,`).
prompt_embeds (`),_l=l(E,"CODE",{});var LI=i(_l);ru=s(LI,"torch.FloatTensor"),LI.forEach(n),pu=s(E,", "),yl=l(E,"EM",{});var qI=i(yl);cu=s(qI,"optional"),qI.forEach(n),du=s(E,`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),bl=l(E,"EM",{});var AI=i(bl);mu=s(AI,"e.g."),AI.forEach(n),gu=s(E,` prompt weighting. If not
provided, text embeddings will be generated from `),Ml=l(E,"CODE",{});var OI=i(Ml);fu=s(OI,"prompt"),OI.forEach(n),uu=s(E,` input argument.
negative_prompt_embeds (`),wl=l(E,"CODE",{});var KI=i(wl);hu=s(KI,"torch.FloatTensor"),KI.forEach(n),_u=s(E,", "),Il=l(E,"EM",{});var ev=i(Il);yu=s(ev,"optional"),ev.forEach(n),bu=s(E,`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),vl=l(E,"EM",{});var tv=i(vl);Mu=s(tv,"e.g."),tv.forEach(n),wu=s(E,` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),Jl=l(E,"CODE",{});var nv=i(Jl);Iu=s(nv,"negative_prompt"),nv.forEach(n),vu=s(E,` input
argument.`),E.forEach(n),Qa.forEach(n),$a.forEach(n),Bp=p(t),Ce=l(t,"H2",{class:!0});var mc=i(Ce);pt=l(mc,"A",{id:!0,class:!0,href:!0});var av=i(pt);Ul=l(av,"SPAN",{});var sv=i(Ul);u(vn.$$.fragment,sv),sv.forEach(n),av.forEach(n),Ju=p(mc),Tl=l(mc,"SPAN",{});var ov=i(Tl);Uu=s(ov,"IFImg2ImgPipeline"),ov.forEach(n),mc.forEach(n),Wp=p(t),q=l(t,"DIV",{class:!0});var Ya=i(q);u(Jn.$$.fragment,Ya),Tu=p(Ya),ce=l(Ya,"DIV",{class:!0});var za=i(ce);u(Un.$$.fragment,za),Zu=p(za),Zl=l(za,"P",{});var lv=i(Zl);ju=s(lv,"Function invoked when calling the pipeline for generation."),lv.forEach(n),Eu=p(za),u(ct.$$.fragment,za),za.forEach(n),Fu=p(Ya),de=l(Ya,"DIV",{class:!0});var Ha=i(de);u(Tn.$$.fragment,Ha),Bu=p(Ha),jl=l(Ha,"P",{});var iv=i(jl);Wu=s(iv,"Encodes the prompt into text encoder hidden states."),iv.forEach(n),ku=p(Ha),J=l(Ha,"P",{});var F=i(J);Gu=s(F,"device: ("),El=l(F,"CODE",{});var rv=i(El);Ru=s(rv,"torch.device"),rv.forEach(n),Xu=s(F,", "),Fl=l(F,"EM",{});var pv=i(Fl);Cu=s(pv,"optional"),pv.forEach(n),Su=s(F,`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),Bl=l(F,"CODE",{});var cv=i(Bl);Vu=s(cv,"int"),cv.forEach(n),xu=s(F,", "),Wl=l(F,"EM",{});var dv=i(Wl);Nu=s(dv,"optional"),dv.forEach(n),$u=s(F,`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),kl=l(F,"CODE",{});var mv=i(kl);Pu=s(mv,"bool"),mv.forEach(n),Qu=s(F,", "),Gl=l(F,"EM",{});var gv=i(Gl);Yu=s(gv,"optional"),gv.forEach(n),zu=s(F,", defaults to "),Rl=l(F,"CODE",{});var fv=i(Rl);Hu=s(fv,"True"),fv.forEach(n),Du=s(F,`):
whether to use classifier free guidance or not
negative_prompt (`),Xl=l(F,"CODE",{});var uv=i(Xl);Lu=s(uv,"str"),uv.forEach(n),qu=s(F," or "),Cl=l(F,"CODE",{});var hv=i(Cl);Au=s(hv,"List[str]"),hv.forEach(n),Ou=s(F,", "),Sl=l(F,"EM",{});var _v=i(Sl);Ku=s(_v,"optional"),_v.forEach(n),eh=s(F,`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),Vl=l(F,"CODE",{});var yv=i(Vl);th=s(yv,"negative_prompt_embeds"),yv.forEach(n),nh=s(F,". instead. If not defined, one has to pass "),xl=l(F,"CODE",{});var bv=i(xl);ah=s(bv,"negative_prompt_embeds"),bv.forEach(n),sh=s(F,`. instead.
Ignored when not using guidance (i.e., ignored if `),Nl=l(F,"CODE",{});var Mv=i(Nl);oh=s(Mv,"guidance_scale"),Mv.forEach(n),lh=s(F," is less than "),$l=l(F,"CODE",{});var wv=i($l);ih=s(wv,"1"),wv.forEach(n),rh=s(F,`).
prompt_embeds (`),Pl=l(F,"CODE",{});var Iv=i(Pl);ph=s(Iv,"torch.FloatTensor"),Iv.forEach(n),ch=s(F,", "),Ql=l(F,"EM",{});var vv=i(Ql);dh=s(vv,"optional"),vv.forEach(n),mh=s(F,`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),Yl=l(F,"EM",{});var Jv=i(Yl);gh=s(Jv,"e.g."),Jv.forEach(n),fh=s(F,` prompt weighting. If not
provided, text embeddings will be generated from `),zl=l(F,"CODE",{});var Uv=i(zl);uh=s(Uv,"prompt"),Uv.forEach(n),hh=s(F,` input argument.
negative_prompt_embeds (`),Hl=l(F,"CODE",{});var Tv=i(Hl);_h=s(Tv,"torch.FloatTensor"),Tv.forEach(n),yh=s(F,", "),Dl=l(F,"EM",{});var Zv=i(Dl);bh=s(Zv,"optional"),Zv.forEach(n),Mh=s(F,`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),Ll=l(F,"EM",{});var jv=i(Ll);wh=s(jv,"e.g."),jv.forEach(n),Ih=s(F,` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),ql=l(F,"CODE",{});var Ev=i(ql);vh=s(Ev,"negative_prompt"),Ev.forEach(n),Jh=s(F,` input
argument.`),F.forEach(n),Ha.forEach(n),Ya.forEach(n),kp=p(t),Se=l(t,"H2",{class:!0});var gc=i(Se);dt=l(gc,"A",{id:!0,class:!0,href:!0});var Fv=i(dt);Al=l(Fv,"SPAN",{});var Bv=i(Al);u(Zn.$$.fragment,Bv),Bv.forEach(n),Fv.forEach(n),Uh=p(gc),Ol=l(gc,"SPAN",{});var Wv=i(Ol);Th=s(Wv,"IFImg2ImgSuperResolutionPipeline"),Wv.forEach(n),gc.forEach(n),Gp=p(t),A=l(t,"DIV",{class:!0});var Da=i(A);u(jn.$$.fragment,Da),Zh=p(Da),me=l(Da,"DIV",{class:!0});var La=i(me);u(En.$$.fragment,La),jh=p(La),Kl=l(La,"P",{});var kv=i(Kl);Eh=s(kv,"Function invoked when calling the pipeline for generation."),kv.forEach(n),Fh=p(La),u(mt.$$.fragment,La),La.forEach(n),Bh=p(Da),ge=l(Da,"DIV",{class:!0});var qa=i(ge);u(Fn.$$.fragment,qa),Wh=p(qa),ei=l(qa,"P",{});var Gv=i(ei);kh=s(Gv,"Encodes the prompt into text encoder hidden states."),Gv.forEach(n),Gh=p(qa),U=l(qa,"P",{});var B=i(U);Rh=s(B,"device: ("),ti=l(B,"CODE",{});var Rv=i(ti);Xh=s(Rv,"torch.device"),Rv.forEach(n),Ch=s(B,", "),ni=l(B,"EM",{});var Xv=i(ni);Sh=s(Xv,"optional"),Xv.forEach(n),Vh=s(B,`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),ai=l(B,"CODE",{});var Cv=i(ai);xh=s(Cv,"int"),Cv.forEach(n),Nh=s(B,", "),si=l(B,"EM",{});var Sv=i(si);$h=s(Sv,"optional"),Sv.forEach(n),Ph=s(B,`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),oi=l(B,"CODE",{});var Vv=i(oi);Qh=s(Vv,"bool"),Vv.forEach(n),Yh=s(B,", "),li=l(B,"EM",{});var xv=i(li);zh=s(xv,"optional"),xv.forEach(n),Hh=s(B,", defaults to "),ii=l(B,"CODE",{});var Nv=i(ii);Dh=s(Nv,"True"),Nv.forEach(n),Lh=s(B,`):
whether to use classifier free guidance or not
negative_prompt (`),ri=l(B,"CODE",{});var $v=i(ri);qh=s($v,"str"),$v.forEach(n),Ah=s(B," or "),pi=l(B,"CODE",{});var Pv=i(pi);Oh=s(Pv,"List[str]"),Pv.forEach(n),Kh=s(B,", "),ci=l(B,"EM",{});var Qv=i(ci);e_=s(Qv,"optional"),Qv.forEach(n),t_=s(B,`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),di=l(B,"CODE",{});var Yv=i(di);n_=s(Yv,"negative_prompt_embeds"),Yv.forEach(n),a_=s(B,". instead. If not defined, one has to pass "),mi=l(B,"CODE",{});var zv=i(mi);s_=s(zv,"negative_prompt_embeds"),zv.forEach(n),o_=s(B,`. instead.
Ignored when not using guidance (i.e., ignored if `),gi=l(B,"CODE",{});var Hv=i(gi);l_=s(Hv,"guidance_scale"),Hv.forEach(n),i_=s(B," is less than "),fi=l(B,"CODE",{});var Dv=i(fi);r_=s(Dv,"1"),Dv.forEach(n),p_=s(B,`).
prompt_embeds (`),ui=l(B,"CODE",{});var Lv=i(ui);c_=s(Lv,"torch.FloatTensor"),Lv.forEach(n),d_=s(B,", "),hi=l(B,"EM",{});var qv=i(hi);m_=s(qv,"optional"),qv.forEach(n),g_=s(B,`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),_i=l(B,"EM",{});var Av=i(_i);f_=s(Av,"e.g."),Av.forEach(n),u_=s(B,` prompt weighting. If not
provided, text embeddings will be generated from `),yi=l(B,"CODE",{});var Ov=i(yi);h_=s(Ov,"prompt"),Ov.forEach(n),__=s(B,` input argument.
negative_prompt_embeds (`),bi=l(B,"CODE",{});var Kv=i(bi);y_=s(Kv,"torch.FloatTensor"),Kv.forEach(n),b_=s(B,", "),Mi=l(B,"EM",{});var e2=i(Mi);M_=s(e2,"optional"),e2.forEach(n),w_=s(B,`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),wi=l(B,"EM",{});var t2=i(wi);I_=s(t2,"e.g."),t2.forEach(n),v_=s(B,` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),Ii=l(B,"CODE",{});var n2=i(Ii);J_=s(n2,"negative_prompt"),n2.forEach(n),U_=s(B,` input
argument.`),B.forEach(n),qa.forEach(n),Da.forEach(n),Rp=p(t),Ve=l(t,"H2",{class:!0});var fc=i(Ve);gt=l(fc,"A",{id:!0,class:!0,href:!0});var a2=i(gt);vi=l(a2,"SPAN",{});var s2=i(vi);u(Bn.$$.fragment,s2),s2.forEach(n),a2.forEach(n),T_=p(fc),Ji=l(fc,"SPAN",{});var o2=i(Ji);Z_=s(o2,"IFInpaintingPipeline"),o2.forEach(n),fc.forEach(n),Xp=p(t),O=l(t,"DIV",{class:!0});var Aa=i(O);u(Wn.$$.fragment,Aa),j_=p(Aa),fe=l(Aa,"DIV",{class:!0});var Oa=i(fe);u(kn.$$.fragment,Oa),E_=p(Oa),Ui=l(Oa,"P",{});var l2=i(Ui);F_=s(l2,"Function invoked when calling the pipeline for generation."),l2.forEach(n),B_=p(Oa),u(ft.$$.fragment,Oa),Oa.forEach(n),W_=p(Aa),ue=l(Aa,"DIV",{class:!0});var Ka=i(ue);u(Gn.$$.fragment,Ka),k_=p(Ka),Ti=l(Ka,"P",{});var i2=i(Ti);G_=s(i2,"Encodes the prompt into text encoder hidden states."),i2.forEach(n),R_=p(Ka),T=l(Ka,"P",{});var W=i(T);X_=s(W,"device: ("),Zi=l(W,"CODE",{});var r2=i(Zi);C_=s(r2,"torch.device"),r2.forEach(n),S_=s(W,", "),ji=l(W,"EM",{});var p2=i(ji);V_=s(p2,"optional"),p2.forEach(n),x_=s(W,`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),Ei=l(W,"CODE",{});var c2=i(Ei);N_=s(c2,"int"),c2.forEach(n),$_=s(W,", "),Fi=l(W,"EM",{});var d2=i(Fi);P_=s(d2,"optional"),d2.forEach(n),Q_=s(W,`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),Bi=l(W,"CODE",{});var m2=i(Bi);Y_=s(m2,"bool"),m2.forEach(n),z_=s(W,", "),Wi=l(W,"EM",{});var g2=i(Wi);H_=s(g2,"optional"),g2.forEach(n),D_=s(W,", defaults to "),ki=l(W,"CODE",{});var f2=i(ki);L_=s(f2,"True"),f2.forEach(n),q_=s(W,`):
whether to use classifier free guidance or not
negative_prompt (`),Gi=l(W,"CODE",{});var u2=i(Gi);A_=s(u2,"str"),u2.forEach(n),O_=s(W," or "),Ri=l(W,"CODE",{});var h2=i(Ri);K_=s(h2,"List[str]"),h2.forEach(n),ey=s(W,", "),Xi=l(W,"EM",{});var _2=i(Xi);ty=s(_2,"optional"),_2.forEach(n),ny=s(W,`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),Ci=l(W,"CODE",{});var y2=i(Ci);ay=s(y2,"negative_prompt_embeds"),y2.forEach(n),sy=s(W,". instead. If not defined, one has to pass "),Si=l(W,"CODE",{});var b2=i(Si);oy=s(b2,"negative_prompt_embeds"),b2.forEach(n),ly=s(W,`. instead.
Ignored when not using guidance (i.e., ignored if `),Vi=l(W,"CODE",{});var M2=i(Vi);iy=s(M2,"guidance_scale"),M2.forEach(n),ry=s(W," is less than "),xi=l(W,"CODE",{});var w2=i(xi);py=s(w2,"1"),w2.forEach(n),cy=s(W,`).
prompt_embeds (`),Ni=l(W,"CODE",{});var I2=i(Ni);dy=s(I2,"torch.FloatTensor"),I2.forEach(n),my=s(W,", "),$i=l(W,"EM",{});var v2=i($i);gy=s(v2,"optional"),v2.forEach(n),fy=s(W,`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),Pi=l(W,"EM",{});var J2=i(Pi);uy=s(J2,"e.g."),J2.forEach(n),hy=s(W,` prompt weighting. If not
provided, text embeddings will be generated from `),Qi=l(W,"CODE",{});var U2=i(Qi);_y=s(U2,"prompt"),U2.forEach(n),yy=s(W,` input argument.
negative_prompt_embeds (`),Yi=l(W,"CODE",{});var T2=i(Yi);by=s(T2,"torch.FloatTensor"),T2.forEach(n),My=s(W,", "),zi=l(W,"EM",{});var Z2=i(zi);wy=s(Z2,"optional"),Z2.forEach(n),Iy=s(W,`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),Hi=l(W,"EM",{});var j2=i(Hi);vy=s(j2,"e.g."),j2.forEach(n),Jy=s(W,` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),Di=l(W,"CODE",{});var E2=i(Di);Uy=s(E2,"negative_prompt"),E2.forEach(n),Ty=s(W,` input
argument.`),W.forEach(n),Ka.forEach(n),Aa.forEach(n),Cp=p(t),xe=l(t,"H2",{class:!0});var uc=i(xe);ut=l(uc,"A",{id:!0,class:!0,href:!0});var F2=i(ut);Li=l(F2,"SPAN",{});var B2=i(Li);u(Rn.$$.fragment,B2),B2.forEach(n),F2.forEach(n),Zy=p(uc),qi=l(uc,"SPAN",{});var W2=i(qi);jy=s(W2,"IFInpaintingSuperResolutionPipeline"),W2.forEach(n),uc.forEach(n),Sp=p(t),K=l(t,"DIV",{class:!0});var es=i(K);u(Xn.$$.fragment,es),Ey=p(es),he=l(es,"DIV",{class:!0});var ts=i(he);u(Cn.$$.fragment,ts),Fy=p(ts),Ai=l(ts,"P",{});var k2=i(Ai);By=s(k2,"Function invoked when calling the pipeline for generation."),k2.forEach(n),Wy=p(ts),u(ht.$$.fragment,ts),ts.forEach(n),ky=p(es),_e=l(es,"DIV",{class:!0});var ns=i(_e);u(Sn.$$.fragment,ns),Gy=p(ns),Oi=l(ns,"P",{});var G2=i(Oi);Ry=s(G2,"Encodes the prompt into text encoder hidden states."),G2.forEach(n),Xy=p(ns),Z=l(ns,"P",{});var k=i(Z);Cy=s(k,"device: ("),Ki=l(k,"CODE",{});var R2=i(Ki);Sy=s(R2,"torch.device"),R2.forEach(n),Vy=s(k,", "),er=l(k,"EM",{});var X2=i(er);xy=s(X2,"optional"),X2.forEach(n),Ny=s(k,`):
torch device to place the resulting embeddings on
num_images_per_prompt (`),tr=l(k,"CODE",{});var C2=i(tr);$y=s(C2,"int"),C2.forEach(n),Py=s(k,", "),nr=l(k,"EM",{});var S2=i(nr);Qy=s(S2,"optional"),S2.forEach(n),Yy=s(k,`, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (`),ar=l(k,"CODE",{});var V2=i(ar);zy=s(V2,"bool"),V2.forEach(n),Hy=s(k,", "),sr=l(k,"EM",{});var x2=i(sr);Dy=s(x2,"optional"),x2.forEach(n),Ly=s(k,", defaults to "),or=l(k,"CODE",{});var N2=i(or);qy=s(N2,"True"),N2.forEach(n),Ay=s(k,`):
whether to use classifier free guidance or not
negative_prompt (`),lr=l(k,"CODE",{});var $2=i(lr);Oy=s($2,"str"),$2.forEach(n),Ky=s(k," or "),ir=l(k,"CODE",{});var P2=i(ir);eb=s(P2,"List[str]"),P2.forEach(n),tb=s(k,", "),rr=l(k,"EM",{});var Q2=i(rr);nb=s(Q2,"optional"),Q2.forEach(n),ab=s(k,`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),pr=l(k,"CODE",{});var Y2=i(pr);sb=s(Y2,"negative_prompt_embeds"),Y2.forEach(n),ob=s(k,". instead. If not defined, one has to pass "),cr=l(k,"CODE",{});var z2=i(cr);lb=s(z2,"negative_prompt_embeds"),z2.forEach(n),ib=s(k,`. instead.
Ignored when not using guidance (i.e., ignored if `),dr=l(k,"CODE",{});var H2=i(dr);rb=s(H2,"guidance_scale"),H2.forEach(n),pb=s(k," is less than "),mr=l(k,"CODE",{});var D2=i(mr);cb=s(D2,"1"),D2.forEach(n),db=s(k,`).
prompt_embeds (`),gr=l(k,"CODE",{});var L2=i(gr);mb=s(L2,"torch.FloatTensor"),L2.forEach(n),gb=s(k,", "),fr=l(k,"EM",{});var q2=i(fr);fb=s(q2,"optional"),q2.forEach(n),ub=s(k,`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),ur=l(k,"EM",{});var A2=i(ur);hb=s(A2,"e.g."),A2.forEach(n),_b=s(k,` prompt weighting. If not
provided, text embeddings will be generated from `),hr=l(k,"CODE",{});var O2=i(hr);yb=s(O2,"prompt"),O2.forEach(n),bb=s(k,` input argument.
negative_prompt_embeds (`),_r=l(k,"CODE",{});var K2=i(_r);Mb=s(K2,"torch.FloatTensor"),K2.forEach(n),wb=s(k,", "),yr=l(k,"EM",{});var eJ=i(yr);Ib=s(eJ,"optional"),eJ.forEach(n),vb=s(k,`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),br=l(k,"EM",{});var tJ=i(br);Jb=s(tJ,"e.g."),tJ.forEach(n),Ub=s(k,` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),Mr=l(k,"CODE",{});var nJ=i(Mr);Tb=s(nJ,"negative_prompt"),nJ.forEach(n),Zb=s(k,` input
argument.`),k.forEach(n),ns.forEach(n),es.forEach(n),this.h()},h(){d(w,"name","hf:doc:metadata"),d(w,"content",JSON.stringify(hJ)),d(M,"id","deepfloyd-if"),d(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"),d(M,"href","#deepfloyd-if"),d(R,"class","relative group"),d(Ne,"id","overview"),d(Ne,"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"),d(Ne,"href","#overview"),d(ye,"class","relative group"),d(bt,"href","https://huggingface.co/stabilityai/stable-diffusion-x4-upscaler"),d(bt,"rel","nofollow"),d($e,"id","usage"),d($e,"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"),d($e,"href","#usage"),d(be,"class","relative group"),d(It,"href","https://huggingface.co/join"),d(It,"rel","nofollow"),d(Jt,"href","https://huggingface.co/DeepFloyd/IF-I-XL-v1.0"),d(Jt,"rel","nofollow"),d(Zt,"href","https://huggingface.co/docs/hub/security-tokens#what-are-user-access-tokens"),d(Zt,"rel","nofollow"),d(Dn,"href","#text-to-image-generation"),d(Ln,"href","#text-guided-image-to-image-generation"),d(qn,"href","#text-guided-inpainting-generation"),d(An,"href","#converting-between-different-pipelines"),d(On,"href","#optimizing-for-speed"),d(Kn,"href","#optimizing-for-memory"),d(Ft,"href","https://huggingface.co/DeepFloyd/IF-I-XL-v1.0"),d(Ft,"rel","nofollow"),d(Bt,"href","https://huggingface.co/DeepFloyd/IF-I-L-v1.0"),d(Bt,"rel","nofollow"),d(Wt,"href","https://huggingface.co/DeepFloyd/IF-I-M-v1.0"),d(Wt,"rel","nofollow"),d(Rt,"href","https://huggingface.co/DeepFloyd/IF-II-L-v1.0"),d(Rt,"rel","nofollow"),d(Xt,"href","https://huggingface.co/DeepFloyd/IF-II-M-v1.0"),d(Xt,"rel","nofollow"),d(St,"href","https://huggingface.co/stabilityai/stable-diffusion-x4-upscaler"),d(St,"rel","nofollow"),aJ(ta.src,Eb="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue")||d(ta,"src",Eb),d(ta,"alt","Hugging Face Spaces"),d(Vt,"href","https://huggingface.co/spaces/DeepFloyd/IF"),d(Vt,"rel","nofollow"),aJ(na.src,Fb="https://colab.research.google.com/assets/colab-badge.svg")||d(na,"src",Fb),d(na,"alt","Open In Colab"),d(xt,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/deepfloyd_if_free_tier_google_colab.ipynb"),d(xt,"rel","nofollow"),d(He,"id","texttoimage-generation"),d(He,"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"),d(He,"href","#texttoimage-generation"),d(we,"class","relative group"),d($t,"href","https://huggingface.co/docs/diffusers/optimization/fp16#model-offloading-for-fast-inference-and-memory-savings"),d($t,"rel","nofollow"),d(Le,"id","text-guided-imagetoimage-generation"),d(Le,"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"),d(Le,"href","#text-guided-imagetoimage-generation"),d(Ie,"class","relative group"),d(aa,"href","/docs/diffusers/v0.21.0/en/api/pipelines/deepfloyd_if#diffusers.IFInpaintingPipeline"),d(sa,"href","/docs/diffusers/v0.21.0/en/api/pipelines/deepfloyd_if#diffusers.IFInpaintingSuperResolutionPipeline"),d(oa,"href","#converting-between-different-pipelines"),d(qe,"id","text-guided-inpainting-generation"),d(qe,"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"),d(qe,"href","#text-guided-inpainting-generation"),d(ve,"class","relative group"),d(la,"href","/docs/diffusers/v0.21.0/en/api/pipelines/deepfloyd_if#diffusers.IFInpaintingPipeline"),d(ia,"href","/docs/diffusers/v0.21.0/en/api/pipelines/deepfloyd_if#diffusers.IFInpaintingSuperResolutionPipeline"),d(ra,"href","#converting-between-different-pipelines"),d(Ae,"id","converting-between-different-pipelines"),d(Ae,"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"),d(Ae,"href","#converting-between-different-pipelines"),d(Je,"class","relative group"),d(Ke,"id","optimizing-for-speed"),d(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"),d(Ke,"href","#optimizing-for-speed"),d(Ue,"class","relative group"),d(ma,"href","../../optimization/torch2.0"),d(nt,"id","optimizing-for-memory"),d(nt,"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"),d(nt,"href","#optimizing-for-memory"),d(Te,"class","relative group"),d(at,"id","available-pipelines"),d(at,"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"),d(at,"href","#available-pipelines"),d(Ze,"class","relative group"),d(ya,"align","center"),d(pn,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if.py"),d(pn,"rel","nofollow"),d(ba,"align","center"),d(cn,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if.py"),d(cn,"rel","nofollow"),d(Ma,"align","center"),d(dn,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py"),d(dn,"rel","nofollow"),d(wa,"align","center"),d(mn,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py"),d(mn,"rel","nofollow"),d(Ia,"align","center"),d(gn,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py"),d(gn,"rel","nofollow"),d(va,"align","center"),d(fn,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py"),d(fn,"rel","nofollow"),d(Ja,"align","center"),d(ot,"id","diffusers.IFPipeline"),d(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"),d(ot,"href","#diffusers.IFPipeline"),d(Re,"class","relative group"),d(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(it,"id","diffusers.IFSuperResolutionPipeline"),d(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"),d(it,"href","#diffusers.IFSuperResolutionPipeline"),d(Xe,"class","relative group"),d(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(pt,"id","diffusers.IFImg2ImgPipeline"),d(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"),d(pt,"href","#diffusers.IFImg2ImgPipeline"),d(Ce,"class","relative group"),d(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(dt,"id","diffusers.IFImg2ImgSuperResolutionPipeline"),d(dt,"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"),d(dt,"href","#diffusers.IFImg2ImgSuperResolutionPipeline"),d(Se,"class","relative group"),d(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(gt,"id","diffusers.IFInpaintingPipeline"),d(gt,"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"),d(gt,"href","#diffusers.IFInpaintingPipeline"),d(Ve,"class","relative group"),d(fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ut,"id","diffusers.IFInpaintingSuperResolutionPipeline"),d(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"),d(ut,"href","#diffusers.IFInpaintingSuperResolutionPipeline"),d(xe,"class","relative group"),d(he,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(_e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,c){e(document.head,w),m(t,C,c),m(t,R,c),e(R,M),e(M,X),h(g,X,null),e(R,G),e(R,os),e(os,hc),m(t,Ur,c),m(t,ye,c),e(ye,Ne),e(Ne,ls),h(_t,ls,null),e(ye,_c),e(ye,is),e(is,yc),m(t,Tr,c),m(t,Pn,c),e(Pn,bc),m(t,Zr,c),m(t,ee,c),e(ee,rs),e(rs,Mc),e(ee,wc),e(ee,ps),e(ps,Ic),e(ee,vc),e(ee,yt),e(yt,Jc),e(yt,bt),e(bt,Uc),e(yt,Tc),m(t,jr,c),m(t,be,c),e(be,$e),e($e,cs),h(Mt,cs,null),e(be,Zc),e(be,ds),e(ds,jc),m(t,Er,c),m(t,Qn,c),e(Qn,Ec),m(t,Fr,c),m(t,te,c),e(te,wt),e(wt,Fc),e(wt,It),e(It,Bc),e(wt,Wc),e(te,kc),e(te,vt),e(vt,Gc),e(vt,Jt),e(Jt,Rc),e(vt,Xc),e(te,Cc),e(te,Yn),e(Yn,Sc),e(Yn,ms),e(ms,Vc),m(t,Br,c),h(Ut,t,c),m(t,Wr,c),m(t,zn,c),e(zn,xc),m(t,kr,c),h(Tt,t,c),m(t,Gr,c),m(t,Pe,c),e(Pe,Nc),e(Pe,Zt),e(Zt,$c),e(Pe,Pc),m(t,Rr,c),m(t,Qe,c),e(Qe,Qc),e(Qe,gs),e(gs,Yc),e(Qe,zc),m(t,Xr,c),h(jt,t,c),m(t,Cr,c),m(t,Hn,c),e(Hn,Hc),m(t,Sr,c),m(t,x,c),e(x,fs),e(fs,Dn),e(Dn,Dc),e(x,Lc),e(x,us),e(us,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),e(z,oa),e(oa,Pd),e(z,Qd),m(t,Lr,c),h(Yt,t,c),m(t,qr,c),m(t,ve,c),e(ve,qe),e(qe,$s),h(zt,$s,null),e(ve,Yd),e(ve,Ps),e(Ps,zd),m(t,Ar,c),m(t,se,c),e(se,Hd),e(se,la),e(la,Dd),e(se,Ld),e(se,ia),e(ia,qd),e(se,Ad),m(t,Or,c),m(t,H,c),e(H,Qs),e(Qs,Od),e(H,Kd),e(H,Ys),e(Ys,em),e(H,tm),e(H,ra),e(ra,nm),e(H,am),m(t,Kr,c),h(Ht,t,c),m(t,ep,c),m(t,Je,c),e(Je,Ae),e(Ae,zs),h(Dt,zs,null),e(Je,sm),e(Je,Hs),e(Hs,om),m(t,tp,c),m(t,Oe,c),e(Oe,lm),e(Oe,Ds),e(Ds,im),e(Oe,rm),m(t,np,c),h(Lt,t,c),m(t,ap,c),m(t,Ue,c),e(Ue,Ke),e(Ke,Ls),h(qt,Ls,null),e(Ue,pm),e(Ue,qs),e(qs,cm),m(t,sp,c),m(t,pa,c),e(pa,dm),m(t,op,c),h(At,t,c),m(t,lp,c),m(t,ca,c),e(ca,mm),m(t,ip,c),m(t,et,c),e(et,gm),e(et,As),e(As,fm),e(et,um),m(t,rp,c),h(Ot,t,c),m(t,pp,c),m(t,tt,c),e(tt,hm),e(tt,Os),e(Os,_m),e(tt,ym),m(t,cp,c),h(Kt,t,c),m(t,dp,c),m(t,da,c),e(da,bm),m(t,mp,c),h(en,t,c),m(t,gp,c),m(t,oe,c),e(oe,Mm),e(oe,ma),e(ma,Ks),e(Ks,wm),e(oe,Im),e(oe,eo),e(eo,vm),e(oe,Jm),m(t,fp,c),h(tn,t,c),m(t,up,c),m(t,Te,c),e(Te,nt),e(nt,to),h(nn,to,null),e(Te,Um),e(Te,no),e(no,Tm),m(t,hp,c),m(t,ga,c),e(ga,Zm),m(t,_p,c),m(t,fa,c),e(fa,jm),m(t,yp,c),h(an,t,c),m(t,bp,c),m(t,ua,c),e(ua,Em),m(t,Mp,c),h(sn,t,c),m(t,wp,c),m(t,ha,c),e(ha,Fm),m(t,Ip,c),h(on,t,c),m(t,vp,c),m(t,_a,c),e(_a,Bm),m(t,Jp,c),h(ln,t,c),m(t,Up,c),m(t,Ze,c),e(Ze,at),e(at,ao),h(rn,ao,null),e(Ze,Wm),e(Ze,so),e(so,km),m(t,Tp,c),m(t,st,c),e(st,oo),e(oo,je),e(je,lo),e(lo,Gm),e(je,Rm),e(je,io),e(io,Xm),e(je,Cm),e(je,ya),e(ya,Sm),e(st,Vm),e(st,$),e($,Ee),e(Ee,ro),e(ro,pn),e(pn,xm),e(Ee,Nm),e(Ee,po),e(po,co),e(co,$m),e(Ee,Pm),e(Ee,ba),e(ba,Qm),e($,Ym),e($,Fe),e(Fe,mo),e(mo,cn),e(cn,zm),e(Fe,Hm),e(Fe,go),e(go,fo),e(fo,Dm),e(Fe,Lm),e(Fe,Ma),e(Ma,qm),e($,Am),e($,Be),e(Be,uo),e(uo,dn),e(dn,Om),e(Be,Km),e(Be,ho),e(ho,_o),e(_o,eg),e(Be,tg),e(Be,wa),e(wa,ng),e($,ag),e($,We),e(We,yo),e(yo,mn),e(mn,sg),e(We,og),e(We,bo),e(bo,Mo),e(Mo,lg),e(We,ig),e(We,Ia),e(Ia,rg),e($,pg),e($,ke),e(ke,wo),e(wo,gn),e(gn,cg),e(ke,dg),e(ke,Io),e(Io,vo),e(vo,mg),e(ke,gg),e(ke,va),e(va,fg),e($,ug),e($,Ge),e(Ge,Jo),e(Jo,fn),e(fn,hg),e(Ge,_g),e(Ge,Uo),e(Uo,To),e(To,yg),e(Ge,bg),e(Ge,Ja),e(Ja,Mg),m(t,Zp,c),m(t,Re,c),e(Re,ot),e(ot,Zo),h(un,Zo,null),e(Re,wg),e(Re,jo),e(jo,Ig),m(t,jp,c),m(t,D,c),h(hn,D,null),e(D,vg),e(D,le),h(_n,le,null),e(le,Jg),e(le,Eo),e(Eo,Ug),e(le,Tg),h(lt,le,null),e(D,Zg),e(D,ie),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h),e(J,Ih),e(J,ql),e(ql,vh),e(J,Jh),m(t,kp,c),m(t,Se,c),e(Se,dt),e(dt,Al),h(Zn,Al,null),e(Se,Uh),e(Se,Ol),e(Ol,Th),m(t,Gp,c),m(t,A,c),h(jn,A,null),e(A,Zh),e(A,me),h(En,me,null),e(me,jh),e(me,Kl),e(Kl,Eh),e(me,Fh),h(mt,me,null),e(A,Bh),e(A,ge),h(Fn,ge,null),e(ge,Wh),e(ge,ei),e(ei,kh),e(ge,Gh),e(ge,U),e(U,Rh),e(U,ti),e(ti,Xh),e(U,Ch),e(U,ni),e(ni,Sh),e(U,Vh),e(U,ai),e(ai,xh),e(U,Nh),e(U,si),e(si,$h),e(U,Ph),e(U,oi),e(oi,Qh),e(U,Yh),e(U,li),e(li,zh),e(U,Hh),e(U,ii),e(ii,Dh),e(U,Lh),e(U,ri),e(ri,qh),e(U,Ah),e(U,pi),e(pi,Oh),e(U,Kh),e(U,ci),e(ci,e_),e(U,t_),e(U,di),e(di,n_),e(U,a_),e(U,mi),e(mi,s_),e(U,o_),e(U,gi),e(gi,l_),e(U,i_),e(U,fi),e(fi,r_),e(U,p_),e(U,ui),e(ui,c_),e(U,d_),e(U,hi),e(hi,m_),e(U,g_),e(U,_i),e(_i,f_),e(U,u_),e(U,yi),e(yi,h_),e(U,__),e(U,bi),e(bi,y_),e(U,b_),e(U,Mi),e(Mi,M_),e(U,w_),e(U,wi),e(wi,I_),e(U,v_),e(U,Ii),e(Ii,J_),e(U,U_),m(t,Rp,c),m(t,Ve,c),e(Ve,gt),e(gt,vi),h(Bn,vi,null),e(Ve,T_),e(Ve,Ji),e(Ji,Z_),m(t,Xp,c),m(t,O,c),h(Wn,O,null),e(O,j_),e(O,fe),h(kn,fe,null),e(fe,E_),e(fe,Ui),e(Ui,F_),e(fe,B_),h(ft,fe,null),e(O,W_),e(O,ue),h(Gn,ue,null),e(ue,k_),e(ue,Ti),e(Ti,G_),e(ue,R_),e(ue,T),e(T,X_),e(T,Zi),e(Z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cr),e(cr,lb),e(Z,ib),e(Z,dr),e(dr,rb),e(Z,pb),e(Z,mr),e(mr,cb),e(Z,db),e(Z,gr),e(gr,mb),e(Z,gb),e(Z,fr),e(fr,fb),e(Z,ub),e(Z,ur),e(ur,hb),e(Z,_b),e(Z,hr),e(hr,yb),e(Z,bb),e(Z,_r),e(_r,Mb),e(Z,wb),e(Z,yr),e(yr,Ib),e(Z,vb),e(Z,br),e(br,Jb),e(Z,Ub),e(Z,Mr),e(Mr,Tb),e(Z,Zb),Vp=!0},p(t,[c]){const Vn={};c&2&&(Vn.$$scope={dirty:c,ctx:t}),lt.$set(Vn);const wr={};c&2&&(wr.$$scope={dirty:c,ctx:t}),rt.$set(wr);const Ir={};c&2&&(Ir.$$scope={dirty:c,ctx:t}),ct.$set(Ir);const vr={};c&2&&(vr.$$scope={dirty:c,ctx:t}),mt.$set(vr);const xn={};c&2&&(xn.$$scope={dirty:c,ctx:t}),ft.$set(xn);const Jr={};c&2&&(Jr.$$scope={dirty:c,ctx:t}),ht.$set(Jr)},i(t){Vp||(_(g.$$.fragment,t),_(_t.$$.fragment,t),_(Mt.$$.fragment,t),_(Ut.$$.fragment,t),_(Tt.$$.fragment,t),_(jt.$$.fragment,t),_(Nt.$$.fragment,t),_(Pt.$$.fragment,t),_(Qt.$$.fragment,t),_(Yt.$$.fragment,t),_(zt.$$.fragment,t),_(Ht.$$.fragment,t),_(Dt.$$.fragment,t),_(Lt.$$.fragment,t),_(qt.$$.fragment,t),_(At.$$.fragment,t),_(Ot.$$.fragment,t),_(Kt.$$.fragment,t),_(en.$$.fragment,t),_(tn.$$.fragment,t),_(nn.$$.fragment,t),_(an.$$.fragment,t),_(sn.$$.fragment,t),_(on.$$.fragment,t),_(ln.$$.fragment,t),_(rn.$$.fragment,t),_(un.$$.fragment,t),_(hn.$$.fragment,t),_(_n.$$.fragment,t),_(lt.$$.fragment,t),_(yn.$$.fragment,t),_(bn.$$.fragment,t),_(Mn.$$.fragment,t),_(wn.$$.fragment,t),_(rt.$$.fragment,t),_(In.$$.fragment,t),_(vn.$$.fragment,t),_(Jn.$$.fragment,t),_(Un.$$.fragment,t),_(ct.$$.fragment,t),_(Tn.$$.fragment,t),_(Zn.$$.fragment,t),_(jn.$$.fragment,t),_(En.$$.fragment,t),_(mt.$$.fragment,t),_(Fn.$$.fragment,t),_(Bn.$$.fragment,t),_(Wn.$$.fragment,t),_(kn.$$.fragment,t),_(ft.$$.fragment,t),_(Gn.$$.fragment,t),_(Rn.$$.fragment,t),_(Xn.$$.fragment,t),_(Cn.$$.fragment,t),_(ht.$$.fragment,t),_(Sn.$$.fragment,t),Vp=!0)},o(t){y(g.$$.fragment,t),y(_t.$$.fragment,t),y(Mt.$$.fragment,t),y(Ut.$$.fragment,t),y(Tt.$$.fragment,t),y(jt.$$.fragment,t),y(Nt.$$.fragment,t),y(Pt.$$.fragment,t),y(Qt.$$.fragment,t),y(Yt.$$.fragment,t),y(zt.$$.fragment,t),y(Ht.$$.fragment,t),y(Dt.$$.fragment,t),y(Lt.$$.fragment,t),y(qt.$$.fragment,t),y(At.$$.fragment,t),y(Ot.$$.fragment,t),y(Kt.$$.fragment,t),y(en.$$.fragment,t),y(tn.$$.fragment,t),y(nn.$$.fragment,t),y(an.$$.fragment,t),y(sn.$$.fragment,t),y(on.$$.fragment,t),y(ln.$$.fragment,t),y(rn.$$.fragment,t),y(un.$$.fragment,t),y(hn.$$.fragment,t),y(_n.$$.fragment,t),y(lt.$$.fragment,t),y(yn.$$.fragment,t),y(bn.$$.fragment,t),y(Mn.$$.fragment,t),y(wn.$$.fragment,t),y(rt.$$.fragment,t),y(In.$$.fragment,t),y(vn.$$.fragment,t),y(Jn.$$.fragment,t),y(Un.$$.fragment,t),y(ct.$$.fragment,t),y(Tn.$$.fragment,t),y(Zn.$$.fragment,t),y(jn.$$.fragment,t),y(En.$$.fragment,t),y(mt.$$.fragment,t),y(Fn.$$.fragment,t),y(Bn.$$.fragment,t),y(Wn.$$.fragment,t),y(kn.$$.fragment,t),y(ft.$$.fragment,t),y(Gn.$$.fragment,t),y(Rn.$$.fragment,t),y(Xn.$$.fragment,t),y(Cn.$$.fragment,t),y(ht.$$.fragment,t),y(Sn.$$.fragment,t),Vp=!1},d(t){n(w),t&&n(C),t&&n(R),b(g),t&&n(Ur),t&&n(ye),b(_t),t&&n(Tr),t&&n(Pn),t&&n(Zr),t&&n(ee),t&&n(jr),t&&n(be),b(Mt),t&&n(Er),t&&n(Qn),t&&n(Fr),t&&n(te),t&&n(Br),b(Ut,t),t&&n(Wr),t&&n(zn),t&&n(kr),b(Tt,t),t&&n(Gr),t&&n(Pe),t&&n(Rr),t&&n(Qe),t&&n(Xr),b(jt,t),t&&n(Cr),t&&n(Hn),t&&n(Sr),t&&n(x),t&&n(Vr),t&&n(ea),t&&n(xr),t&&n(ne),t&&n(Nr),t&&n(Ye),t&&n($r),t&&n(ze),t&&n(Pr),t&&n(we),b(Nt),t&&n(Qr),t&&n(De),t&&n(Yr),b(Pt,t),t&&n(zr),t&&n(Ie),b(Qt),t&&n(Hr),t&&n(ae),t&&n(Dr),t&&n(z),t&&n(Lr),b(Yt,t),t&&n(qr),t&&n(ve),b(zt),t&&n(Ar),t&&n(se),t&&n(Or),t&&n(H),t&&n(Kr),b(Ht,t),t&&n(ep),t&&n(Je),b(Dt),t&&n(tp),t&&n(Oe),t&&n(np),b(Lt,t),t&&n(ap),t&&n(Ue),b(qt),t&&n(sp),t&&n(pa),t&&n(op),b(At,t),t&&n(lp),t&&n(ca),t&&n(ip),t&&n(et),t&&n(rp),b(Ot,t),t&&n(pp),t&&n(tt),t&&n(cp),b(Kt,t),t&&n(dp),t&&n(da),t&&n(mp),b(en,t),t&&n(gp),t&&n(oe),t&&n(fp),b(tn,t),t&&n(up),t&&n(Te),b(nn),t&&n(hp),t&&n(ga),t&&n(_p),t&&n(fa),t&&n(yp),b(an,t),t&&n(bp),t&&n(ua),t&&n(Mp),b(sn,t),t&&n(wp),t&&n(ha),t&&n(Ip),b(on,t),t&&n(vp),t&&n(_a),t&&n(Jp),b(ln,t),t&&n(Up),t&&n(Ze),b(rn),t&&n(Tp),t&&n(st),t&&n(Zp),t&&n(Re),b(un),t&&n(jp),t&&n(D),b(hn),b(_n),b(lt),b(yn),t&&n(Ep),t&&n(Xe),b(bn),t&&n(Fp),t&&n(L),b(Mn),b(wn),b(rt),b(In),t&&n(Bp),t&&n(Ce),b(vn),t&&n(Wp),t&&n(q),b(Jn),b(Un),b(ct),b(Tn),t&&n(kp),t&&n(Se),b(Zn),t&&n(Gp),t&&n(A),b(jn),b(En),b(mt),b(Fn),t&&n(Rp),t&&n(Ve),b(Bn),t&&n(Xp),t&&n(O),b(Wn),b(kn),b(ft),b(Gn),t&&n(Cp),t&&n(xe),b(Rn),t&&n(Sp),t&&n(K),b(Xn),b(Cn),b(ht),b(Sn)}}}const hJ={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 _J(P){return rJ(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class vJ extends sJ{constructor(w){super();oJ(this,w,_J,uJ,lJ,{})}}export{vJ as default,hJ as metadata};
