import{s as nl,o as sl,n as pn}from"../chunks/scheduler.182ea377.js";import{S as al,i as ll,g as i,s as a,r as c,A as ol,h as p,f as n,c as l,j as U,u as m,x as _,k as T,y as r,a as s,v as d,d as g,t as u,w as f}from"../chunks/index.abf12888.js";import{D as Z}from"../chunks/Docstring.93f6f462.js";import{C as J}from"../chunks/CodeBlock.57fe6e13.js";import{E as on}from"../chunks/ExampleCodeBlock.658f5cd6.js";import{H as j}from"../chunks/Heading.16916d63.js";function il(v){let h,I="Examples:",b,y,M;return y=new J({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGUGlwZWxpbmUlMkMlMjBJRlN1cGVyUmVzb2x1dGlvblBpcGVsaW5lJTJDJTIwRGlmZnVzaW9uUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwcHRfdG9fcGlsJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlJTIwJTNEJTIwSUZQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyRGVlcEZsb3lkJTJGSUYtSS1YTC12MS4wJTIyJTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQXByb21wdCUyMCUzRCUyMCdhJTIwcGhvdG8lMjBvZiUyMGElMjBrYW5nYXJvbyUyMHdlYXJpbmclMjBhbiUyMG9yYW5nZSUyMGhvb2RpZSUyMGFuZCUyMGJsdWUlMjBzdW5nbGFzc2VzJTIwc3RhbmRpbmclMjBpbiUyMGZyb250JTIwb2YlMjB0aGUlMjBlaWZmZWwlMjB0b3dlciUyMGhvbGRpbmclMjBhJTIwc2lnbiUyMHRoYXQlMjBzYXlzJTIwJTIydmVyeSUyMGRlZXAlMjBsZWFybmluZyUyMiclMEFwcm9tcHRfZW1iZWRzJTJDJTIwb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IwaW1hZ2UlMEFwaWxfaW1hZ2UlMjAlM0QlMjBwdF90b19waWwoaW1hZ2UpJTBBcGlsX2ltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JLnBuZyUyMiklMEElMEFzYWZldHlfbW9kdWxlcyUyMCUzRCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMmZlYXR1cmVfZXh0cmFjdG9yJTIyJTNBJTIwcGlwZS5mZWF0dXJlX2V4dHJhY3RvciUyQyUwQSUyMCUyMCUyMCUyMCUyMnNhZmV0eV9jaGVja2VyJTIyJTNBJTIwcGlwZS5zYWZldHlfY2hlY2tlciUyQyUwQSUyMCUyMCUyMCUyMCUyMndhdGVybWFya2VyJTIyJTNBJTIwcGlwZS53YXRlcm1hcmtlciUyQyUwQSU3RCUwQXN1cGVyX3Jlc18yX3BpcGUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXg0LXVwc2NhbGVyJTIyJTJDJTIwKipzYWZldHlfbW9kdWxlcyUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEFzdXBlcl9yZXNfMl9waXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBaW1hZ2UlMjAlM0QlMjBzdXBlcl9yZXNfMl9waXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMGltYWdlJTNEaW1hZ2UlMkMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",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>)`,wrap:!1}}),{c(){h=i("p"),h.textContent=I,b=a(),c(y.$$.fragment)},l(o){h=p(o,"P",{"data-svelte-h":!0}),_(h)!=="svelte-kvfsh7"&&(h.textContent=I),b=l(o),m(y.$$.fragment,o)},m(o,w){s(o,h,w),s(o,b,w),d(y,o,w),M=!0},p:pn,i(o){M||(g(y.$$.fragment,o),M=!0)},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DJTIwb3V0cHV0X3R5cGUlM0QlMjJwdCUyMikuaW1hZ2VzJTBBJTBBJTIzJTIwc2F2ZSUyMGludGVybWVkaWF0ZSUyMGltYWdlJTBBcGlsX2ltYWdlJTIwJTNEJTIwcHRfdG9fcGlsKGltYWdlKSUwQXBpbF9pbWFnZSU1QjAlNUQuc2F2ZSglMjIuJTJGaWZfc3RhZ2VfSS5wbmclMjIpJTBBJTBBc3VwZXJfcmVzXzFfcGlwZSUyMCUzRCUyMElGU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMkRlZXBGbG95ZCUyRklGLUlJLUwtdjEuMCUyMiUyQyUyMHRleHRfZW5jb2RlciUzRE5vbmUlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEFzdXBlcl9yZXNfMV9waXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBaW1hZ2UlMjAlM0QlMjBzdXBlcl9yZXNfMV9waXBlKCUwQSUyMCUyMCUyMCUyMGltYWdlJTNEaW1hZ2UlMkMlMjBwcm9tcHRfZW1iZWRzJTNEcHJvbXB0X2VtYmVkcyUyQyUyMG5lZ2F0aXZlX3Byb21wdF9lbWJlZHMlM0RuZWdhdGl2ZV9lbWJlZHMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",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>)`,wrap:!1}}),{c(){h=i("p"),h.textContent=I,b=a(),c(y.$$.fragment)},l(o){h=p(o,"P",{"data-svelte-h":!0}),_(h)!=="svelte-kvfsh7"&&(h.textContent=I),b=l(o),m(y.$$.fragment,o)},m(o,w){s(o,h,w),s(o,b,w),d(y,o,w),M=!0},p:pn,i(o){M||(g(y.$$.fragment,o),M=!0)},o(o){u(y.$$.fragment,o),M=!1},d(o){o&&(n(h),n(b)),f(y,o)}}}function rl(v){let h,I="Examples:",b,y,M;return y=new J({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW1nMkltZ1BpcGVsaW5lJTJDJTIwSUZJbWcySW1nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUlMkMlMjBEaWZmdXNpb25QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBwdF90b19waWwlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSUyRkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uJTJGbWFpbiUyRmFzc2V0cyUyRnN0YWJsZS1zYW1wbGVzJTJGaW1nMmltZyUyRnNrZXRjaC1tb3VudGFpbnMtaW5wdXQuanBnJTIyJTBBcmVzcG9uc2UlMjAlM0QlMjByZXF1ZXN0cy5nZXQodXJsKSUwQW9yaWdpbmFsX2ltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihCeXRlc0lPKHJlc3BvbnNlLmNvbnRlbnQpKS5jb252ZXJ0KCUyMlJHQiUyMiklMEFvcmlnaW5hbF9pbWFnZSUyMCUzRCUyMG9yaWdpbmFsX2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dTdXBlclJlc29sdXRpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyRGVlcEZsb3lkJTJGSUYtSUktTC12MS4wJTIyJTJDJTBBJTIwJTIwJTIwJTIwdGV4dF9lbmNvZGVyJTNETm9uZSUyQyUwQSUyMCUyMCUyMCUyMHZhcmlhbnQlM0QlMjJmcDE2JTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTBBKSUwQXN1cGVyX3Jlc18xX3BpcGUuZW5hYmxlX21vZGVsX2NwdV9vZmZsb2FkKCklMEElMEFpbWFnZSUyMCUzRCUyMHN1cGVyX3Jlc18xX3BpcGUoJTBBJTIwJTIwJTIwJTIwaW1hZ2UlM0RpbWFnZSUyQyUwQSUyMCUyMCUyMCUyMG9yaWdpbmFsX2ltYWdlJTNEb3JpZ2luYWxfaW1hZ2UlMkMlMEElMjAlMjAlMjAlMjBwcm9tcHRfZW1iZWRzJTNEcHJvbXB0X2VtYmVkcyUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX3Byb21wdF9lbWJlZHMlM0RuZWdhdGl2ZV9lbWJlZHMlMkMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",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>)`,wrap:!1}}),{c(){h=i("p"),h.textContent=I,b=a(),c(y.$$.fragment)},l(o){h=p(o,"P",{"data-svelte-h":!0}),_(h)!=="svelte-kvfsh7"&&(h.textContent=I),b=l(o),m(y.$$.fragment,o)},m(o,w){s(o,h,w),s(o,b,w),d(y,o,w),M=!0},p:pn,i(o){M||(g(y.$$.fragment,o),M=!0)},o(o){u(y.$$.fragment,o),M=!1},d(o){o&&(n(h),n(b)),f(y,o)}}}function cl(v){let h,I="Examples:",b,y,M;return y=new J({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW1nMkltZ1BpcGVsaW5lJTJDJTIwSUZJbWcySW1nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUlMkMlMjBEaWZmdXN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UlM0RpbWFnZSUyQyUwQSUyMCUyMCUyMCUyMG9yaWdpbmFsX2ltYWdlJTNEb3JpZ2luYWxfaW1hZ2UlMkMlMEElMjAlMjAlMjAlMjBwcm9tcHRfZW1iZWRzJTNEcHJvbXB0X2VtYmVkcyUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX3Byb21wdF9lbWJlZHMlM0RuZWdhdGl2ZV9lbWJlZHMlMkMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",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>)`,wrap:!1}}),{c(){h=i("p"),h.textContent=I,b=a(),c(y.$$.fragment)},l(o){h=p(o,"P",{"data-svelte-h":!0}),_(h)!=="svelte-kvfsh7"&&(h.textContent=I),b=l(o),m(y.$$.fragment,o)},m(o,w){s(o,h,w),s(o,b,w),d(y,o,w),M=!0},p:pn,i(o){M||(g(y.$$.fragment,o),M=!0)},o(o){u(y.$$.fragment,o),M=!1},d(o){o&&(n(h),n(b)),f(y,o)}}}function ml(v){let h,I="Examples:",b,y,M;return y=new J({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW5wYWludGluZ1BpcGVsaW5lJTJDJTIwSUZJbnBhaW50aW5nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUlMkMlMjBEaWZmdXNpb25QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBwdF90b19waWwlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmRpZmZ1c2VycyUyRmRvY3MtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZpZiUyRnBlcnNvbi5wbmclMjIlMEFyZXNwb25zZSUyMCUzRCUyMHJlcXVlc3RzLmdld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CUyMG5lZ2F0aXZlX3Byb21wdF9lbWJlZHMlM0RuZWdhdGl2ZV9lbWJlZHMlMkMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",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>)`,wrap:!1}}),{c(){h=i("p"),h.textContent=I,b=a(),c(y.$$.fragment)},l(o){h=p(o,"P",{"data-svelte-h":!0}),_(h)!=="svelte-kvfsh7"&&(h.textContent=I),b=l(o),m(y.$$.fragment,o)},m(o,w){s(o,h,w),s(o,b,w),d(y,o,w),M=!0},p:pn,i(o){M||(g(y.$$.fragment,o),M=!0)},o(o){u(y.$$.fragment,o),M=!1},d(o){o&&(n(h),n(b)),f(y,o)}}}function dl(v){let h,I="Examples:",b,y,M;return y=new J({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW5wYWludGluZ1BpcGVsaW5lJTJDJTIwSUZJbnBhaW50aW5nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUlMkMlMjBEaWZmdXNpb25QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBwdF90b19waWwlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmRpZmZ1c2VycyUyRmRvY3MtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZpZiUyRnBlcnNvbi5wbmclMjIlMEFyZXNwb25zZSUyMCUzRCUyMHJlcXVlc3RzLmdldCh1cmwpJTBBb3JpZ2luYWxfaW1hZ2UlMjA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M0RuZWdhdGl2ZV9lbWJlZHMlMkMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",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>)`,wrap:!1}}),{c(){h=i("p"),h.textContent=I,b=a(),c(y.$$.fragment)},l(o){h=p(o,"P",{"data-svelte-h":!0}),_(h)!=="svelte-kvfsh7"&&(h.textContent=I),b=l(o),m(y.$$.fragment,o)},m(o,w){s(o,h,w),s(o,b,w),d(y,o,w),M=!0},p:pn,i(o){M||(g(y.$$.fragment,o),M=!0)},o(o){u(y.$$.fragment,o),M=!1},d(o){o&&(n(h),n(b)),f(y,o)}}}function gl(v){let h,I,b,y,M,o,w,cn,le,ia=`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:`,mn,oe,pa=`<li>Stage 1: a base model that generates 64x64 px image based on text prompt,</li> <li>Stage 2: a 64x64 px =&gt; 256x256 px super-resolution model, and a</li> <li>Stage 3: a 256x256 px =&gt; 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 <a href="https://huggingface.co/stabilityai/stable-diffusion-x4-upscaler" rel="nofollow">Stability’s x4 Upscaling model</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.</li>`,dn,ie,gn,pe,ra="Before you can use IF, you need to accept its usage conditions. To do so:",un,re,ca='<li>Make sure to have a <a href="https://huggingface.co/join" rel="nofollow">Hugging Face account</a> and be logged in</li> <li>Accept the license on the model card of <a href="https://huggingface.co/DeepFloyd/IF-I-XL-v1.0" rel="nofollow">DeepFloyd/IF-I-XL-v1.0</a>. Accepting the license on the stage I model card will auto accept for the other IF models.</li> <li>Make sure to login locally. Install <code>huggingface_hub</code></li>',fn,ce,hn,me,ma="run the login function in a Python shell",_n,de,yn,ge,da='and enter your <a href="https://huggingface.co/docs/hub/security-tokens#what-are-user-access-tokens" rel="nofollow">Hugging Face Hub access token</a>.',Mn,ue,ga="Next we install <code>diffusers</code> and dependencies:",bn,fe,wn,he,ua="The following sections give more in-detail examples of how to use IF. Specifically:",In,_e,fa='<li><a href="#text-to-image-generation">Text-to-Image Generation</a></li> <li><a href="#text-guided-image-to-image-generation">Image-to-Image Generation</a></li> <li><a href="#text-guided-inpainting-generation">Inpainting</a></li> <li><a href="#converting-between-different-pipelines">Reusing model weights</a></li> <li><a href="#optimizing-for-speed">Speed optimization</a></li> <li><a href="#optimizing-for-memory">Memory optimization</a></li>',Jn,ye,ha="<strong>Available checkpoints</strong>",Un,Me,_a='<li><p><em>Stage-1</em></p> <ul><li><a href="https://huggingface.co/DeepFloyd/IF-I-XL-v1.0" rel="nofollow">DeepFloyd/IF-I-XL-v1.0</a></li> <li><a href="https://huggingface.co/DeepFloyd/IF-I-L-v1.0" rel="nofollow">DeepFloyd/IF-I-L-v1.0</a></li> <li><a href="https://huggingface.co/DeepFloyd/IF-I-M-v1.0" rel="nofollow">DeepFloyd/IF-I-M-v1.0</a></li></ul></li> <li><p><em>Stage-2</em></p> <ul><li><a href="https://huggingface.co/DeepFloyd/IF-II-L-v1.0" rel="nofollow">DeepFloyd/IF-II-L-v1.0</a></li> <li><a href="https://huggingface.co/DeepFloyd/IF-II-M-v1.0" rel="nofollow">DeepFloyd/IF-II-M-v1.0</a></li></ul></li> <li><p><em>Stage-3</em></p> <ul><li><a href="https://huggingface.co/stabilityai/stable-diffusion-x4-upscaler" rel="nofollow">stabilityai/stable-diffusion-x4-upscaler</a></li></ul></li>',Tn,be,ya='<strong>Demo</strong> <a href="https://huggingface.co/spaces/DeepFloyd/IF" rel="nofollow"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue" alt="Hugging Face Spaces"/></a>',Zn,we,Ma='<strong>Google Colab</strong> <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/deepfloyd_if_free_tier_google_colab.ipynb" rel="nofollow"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>',jn,Ie,vn,Je,ba=`By default diffusers makes use of <a href="https://huggingface.co/docs/diffusers/optimization/fp16#model-offloading-for-fast-inference-and-memory-savings" rel="nofollow">model cpu offloading</a>
to run the whole IF pipeline with as little as 14 GB of VRAM.`,Bn,Ue,Wn,Te,Fn,Ze,wa=`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 <a href="/docs/diffusers/main/en/api/pipelines/deepfloyd_if#diffusers.IFInpaintingPipeline">IFInpaintingPipeline</a> and <a href="/docs/diffusers/main/en/api/pipelines/deepfloyd_if#diffusers.IFInpaintingSuperResolutionPipeline">IFInpaintingSuperResolutionPipeline</a> pipelines.`,kn,je,Ia=`<strong>Note</strong>: 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 <code>~DiffusionPipeline.components()</code> function as explained <a href="#converting-between-different-pipelines">here</a>.`,Gn,ve,Xn,Be,Rn,We,Ja=`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 <a href="/docs/diffusers/main/en/api/pipelines/deepfloyd_if#diffusers.IFInpaintingPipeline">IFInpaintingPipeline</a> and <a href="/docs/diffusers/main/en/api/pipelines/deepfloyd_if#diffusers.IFInpaintingSuperResolutionPipeline">IFInpaintingSuperResolutionPipeline</a> pipelines.`,Cn,Fe,Ua=`<strong>Note</strong>: 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 <code>~DiffusionPipeline.components()</code> function as explained <a href="#converting-between-different-pipelines">here</a>.`,xn,ke,Vn,Ge,Sn,Xe,Ta="In addition to being loaded with <code>from_pretrained</code>, Pipelines can also be loaded directly from each other.",En,Re,Nn,Ce,$n,xe,Za="The simplest optimization to run IF faster is to move all model components to the GPU.",Qn,Ve,Yn,Se,ja="You can also run the diffusion process for a shorter number of timesteps.",Hn,Ee,va="This can either be done with the <code>num_inference_steps</code> argument",Pn,Ne,zn,$e,Ba="Or with the <code>timesteps</code> argument",Ln,Qe,qn,Ye,Wa=`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.`,Dn,He,An,Pe,Fa=`You can also use <a href="../../optimization/torch2.0"><code>torch.compile</code></a>. Note that we have not exhaustively tested <code>torch.compile</code>
with IF and it might not give expected results.`,Kn,ze,On,Le,es,qe,ka="When optimizing for GPU memory, we can use the standard diffusers cpu offloading APIs.",ts,De,Ga="Either the model based CPU offloading,",ns,Ae,ss,Ke,Xa="or the more aggressive layer based CPU offloading.",as,Oe,ls,et,Ra="Additionally, T5 can be loaded in 8bit precision",os,tt,is,nt,Ca=`For CPU RAM constrained machines like google colab free tier where we can’t 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.`,ps,st,rs,at,cs,lt,xa='<thead><tr><th>Pipeline</th> <th>Tasks</th> <th align="center">Colab</th></tr></thead> <tbody><tr><td><a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if.py" rel="nofollow">pipeline_if.py</a></td> <td><em>Text-to-Image Generation</em></td> <td align="center">-</td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if.py" rel="nofollow">pipeline_if_superresolution.py</a></td> <td><em>Text-to-Image Generation</em></td> <td align="center">-</td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py" rel="nofollow">pipeline_if_img2img.py</a></td> <td><em>Image-to-Image Generation</em></td> <td align="center">-</td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py" rel="nofollow">pipeline_if_img2img_superresolution.py</a></td> <td><em>Image-to-Image Generation</em></td> <td align="center">-</td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py" rel="nofollow">pipeline_if_inpainting.py</a></td> <td><em>Image-to-Image Generation</em></td> <td align="center">-</td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py" rel="nofollow">pipeline_if_inpainting_superresolution.py</a></td> <td><em>Image-to-Image Generation</em></td> <td align="center">-</td></tr></tbody>',ms,ot,ds,B,it,Ts,R,pt,Zs,Wt,Va="Function invoked when calling the pipeline for generation.",js,O,vs,C,rt,Bs,Ft,Sa="Encodes the prompt into text encoder hidden states.",Ws,kt,Ea=`device: (<code>torch.device</code>, <em>optional</em>):
torch device to place the resulting embeddings on
num_images_per_prompt (<code>int</code>, <em>optional</em>, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>):
whether to use classifier free guidance or not
negative_prompt (<code>str</code> or <code>List[str]</code>, <em>optional</em>):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code>. instead. 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>).
prompt_embeds (<code>torch.FloatTensor</code>, <em>optional</em>):
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.
negative_prompt_embeds (<code>torch.FloatTensor</code>, <em>optional</em>):
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.`,gs,ct,us,W,mt,Fs,x,dt,ks,Gt,Na="Function invoked when calling the pipeline for generation.",Gs,ee,Xs,V,gt,Rs,Xt,$a="Encodes the prompt into text encoder hidden states.",Cs,Rt,Qa=`device: (<code>torch.device</code>, <em>optional</em>):
torch device to place the resulting embeddings on
num_images_per_prompt (<code>int</code>, <em>optional</em>, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>):
whether to use classifier free guidance or not
negative_prompt (<code>str</code> or <code>List[str]</code>, <em>optional</em>):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code>. instead. 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>).
prompt_embeds (<code>torch.FloatTensor</code>, <em>optional</em>):
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.
negative_prompt_embeds (<code>torch.FloatTensor</code>, <em>optional</em>):
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.`,fs,ut,hs,F,ft,xs,S,ht,Vs,Ct,Ya="Function invoked when calling the pipeline for generation.",Ss,te,Es,E,_t,Ns,xt,Ha="Encodes the prompt into text encoder hidden states.",$s,Vt,Pa=`device: (<code>torch.device</code>, <em>optional</em>):
torch device to place the resulting embeddings on
num_images_per_prompt (<code>int</code>, <em>optional</em>, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>):
whether to use classifier free guidance or not
negative_prompt (<code>str</code> or <code>List[str]</code>, <em>optional</em>):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code>. instead. 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>).
prompt_embeds (<code>torch.FloatTensor</code>, <em>optional</em>):
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.
negative_prompt_embeds (<code>torch.FloatTensor</code>, <em>optional</em>):
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.`,_s,yt,ys,k,Mt,Qs,N,bt,Ys,St,za="Function invoked when calling the pipeline for generation.",Hs,ne,Ps,$,wt,zs,Et,La="Encodes the prompt into text encoder hidden states.",Ls,Nt,qa=`device: (<code>torch.device</code>, <em>optional</em>):
torch device to place the resulting embeddings on
num_images_per_prompt (<code>int</code>, <em>optional</em>, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>):
whether to use classifier free guidance or not
negative_prompt (<code>str</code> or <code>List[str]</code>, <em>optional</em>):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code>. instead. 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>).
prompt_embeds (<code>torch.FloatTensor</code>, <em>optional</em>):
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.
negative_prompt_embeds (<code>torch.FloatTensor</code>, <em>optional</em>):
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.`,Ms,It,bs,G,Jt,qs,Q,Ut,Ds,$t,Da="Function invoked when calling the pipeline for generation.",As,se,Ks,Y,Tt,Os,Qt,Aa="Encodes the prompt into text encoder hidden states.",ea,Yt,Ka=`device: (<code>torch.device</code>, <em>optional</em>):
torch device to place the resulting embeddings on
num_images_per_prompt (<code>int</code>, <em>optional</em>, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>):
whether to use classifier free guidance or not
negative_prompt (<code>str</code> or <code>List[str]</code>, <em>optional</em>):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code>. instead. 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>).
prompt_embeds (<code>torch.FloatTensor</code>, <em>optional</em>):
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.
negative_prompt_embeds (<code>torch.FloatTensor</code>, <em>optional</em>):
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.`,ws,Zt,Is,X,jt,ta,H,vt,na,Ht,Oa="Function invoked when calling the pipeline for generation.",sa,ae,aa,P,Bt,la,Pt,el="Encodes the prompt into text encoder hidden states.",oa,zt,tl=`device: (<code>torch.device</code>, <em>optional</em>):
torch device to place the resulting embeddings on
num_images_per_prompt (<code>int</code>, <em>optional</em>, defaults to 1):
number of images that should be generated per prompt
do_classifier_free_guidance (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>):
whether to use classifier free guidance or not
negative_prompt (<code>str</code> or <code>List[str]</code>, <em>optional</em>):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code>. instead. 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>).
prompt_embeds (<code>torch.FloatTensor</code>, <em>optional</em>):
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.
negative_prompt_embeds (<code>torch.FloatTensor</code>, <em>optional</em>):
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.`,Js,rn,Us;return M=new j({props:{title:"DeepFloyd IF",local:"deepfloyd-if",headingTag:"h1"}}),w=new j({props:{title:"Overview",local:"overview",headingTag:"h2"}}),ie=new j({props:{title:"Usage",local:"usage",headingTag:"h2"}}),ce=new J({props:{code:"cGlwJTIwaW5zdGFsbCUyMGh1Z2dpbmdmYWNlX2h1YiUyMC0tdXBncmFkZQ==",highlighted:"pip install huggingface_hub --upgrade",wrap:!1}}),de=new J({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGxvZ2luJTBBJTBBbG9naW4oKQ==",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> login

login()`,wrap:!1}}),fe=new J({props:{code:"cGlwJTIwaW5zdGFsbCUyMGRpZmZ1c2VycyUyMGFjY2VsZXJhdGUlMjB0cmFuc2Zvcm1lcnMlMjBzYWZldGVuc29ycw==",highlighted:"pip install diffusers accelerate transformers safetensors",wrap:!1}}),Ie=new j({props:{title:"Text-to-Image Generation",local:"text-to-image-generation",headingTag:"h3"}}),Ue=new J({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMHB0X3RvX3BpbCUwQWltcG9ydCUyMHRvcmNoJTBBJTBBJTIzJTIwc3RhZ2UlMjAxJTBBc3RhZ2VfMSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJEZWVwRmxveWQlMkZJRi1JLVhMLXYxLjAlMjIlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiU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RzJTNEbmVnYXRpdmVfZW1iZWRzJTJDJTBBJTIwJTIwJTIwJTIwZ2VuZXJhdG9yJTNEZ2VuZXJhdG9yJTJDJTBBJTIwJTIwJTIwJTIwb3V0cHV0X3R5cGUlM0QlMjJwdCUyMiUyQyUwQSkuaW1hZ2VzJTBBcHRfdG9fcGlsKGltYWdlKSU1QjAlNUQuc2F2ZSglMjIuJTJGaWZfc3RhZ2VfSUkucG5nJTIyKSUwQSUwQSUyMyUyMHN0YWdlJTIwMyUwQWltYWdlJTIwJTNEJTIwc3RhZ2VfMyhwcm9tcHQlM0Rwcm9tcHQlMkMlMjBpbWFnZSUzRGltYWdlJTJDJTIwbm9pc2VfbGV2ZWwlM0QxMDAlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSUkucG5nJTIyKQ==",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>)`,wrap:!1}}),Te=new j({props:{title:"Text Guided Image-to-Image Generation",local:"text-guided-image-to-image-generation",headingTag:"h3"}}),ve=new J({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW1nMkltZ1BpcGVsaW5lJTJDJTIwSUZJbWcySW1nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUlMkMlMjBEaWZmdXNpb25QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQ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MEFpbWFnZSUyMCUzRCUyMHN0YWdlXzMocHJvbXB0JTNEcHJvbXB0JTJDJTIwaW1hZ2UlM0RpbWFnZSUyQyUyMGdlbmVyYXRvciUzRGdlbmVyYXRvciUyQyUyMG5vaXNlX2xldmVsJTNEMTAwKS5pbWFnZXMlMEFpbWFnZSU1QjAlNUQuc2F2ZSglMjIuJTJGaWZfc3RhZ2VfSUlJLnBuZyUyMik=",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>)`,wrap:!1}}),Be=new j({props:{title:"Text Guided Inpainting Generation",local:"text-guided-inpainting-generation",headingTag:"h3"}}),ke=new J({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW5wYWludGluZ1BpcGVsaW5lJTJDJTIwSUZJbnBhaW50aW5nU3VwZXJSZXNvbHV0aW9uUGlwZWxpb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MG9yaWdpbmFsX2ltYWdlJTNEb3JpZ2luYWxfaW1hZ2UlMkMlMEElMjAlMjAlMjAlMjBtYXNrX2ltYWdlJTNEbWFza19pbWFnZSUyQyUwQSUyMCUyMCUyMCUyMHByb21wdF9lbWJlZHMlM0Rwcm9tcHRfZW1iZWRzJTJDJTBBJTIwJTIwJTIwJTIwbmVnYXRpdmVfcHJvbXB0X2VtYmVkcyUzRG5lZ2F0aXZlX2VtYmVkcyUyQyUwQSUyMCUyMCUyMCUyMGdlbmVyYXRvciUzRGdlbmVyYXRvciUyQyUwQSUyMCUyMCUyMCUyMG91dHB1dF90eXBlJTNEJTIycHQlMjIlMkMlMEEpLmltYWdlcyUwQXB0X3RvX3BpbChpbWFnZSklNUIwJTVELnNhdmUoJTIyLiUyRmlmX3N0YWdlX0lJLnBuZyUyMiklMEElMEElMjMlMjBzdGFnZSUyMDMlMEFpbWFnZSUyMCUzRCUyMHN0YWdlXzMocHJvbXB0JTNEcHJvbXB0JTJDJTIwaW1hZ2UlM0RpbWFnZSUyQyUyMGdlbmVyYXRvciUzRGdlbmVyYXRvciUyQyUyMG5vaXNlX2xldmVsJTNEMTAwKS5pbWFnZXMlMEFpbWFnZSU1QjAlNUQuc2F2ZSglMjIuJTJGaWZfc3RhZ2VfSUlJLnBuZyUyMik=",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>)`,wrap:!1}}),Ge=new j({props:{title:"Converting between different pipelines",local:"converting-between-different-pipelines",headingTag:"h3"}}),Re=new J({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)`,wrap:!1}}),Ce=new j({props:{title:"Optimizing for speed",local:"optimizing-for-speed",headingTag:"h3"}}),Ve=new J({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>)`,wrap:!1}}),Ne=new J({props:{code:"cGlwZSglMjIlM0Nwcm9tcHQlM0UlMjIlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMzAp",highlighted:'pipe(<span class="hljs-string">&quot;&lt;prompt&gt;&quot;</span>, num_inference_steps=<span class="hljs-number">30</span>)',wrap:!1}}),Qe=new J({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)`,wrap:!1}}),He=new J({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`,wrap:!1}}),ze=new J({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)`,wrap:!1}}),Le=new j({props:{title:"Optimizing for memory",local:"optimizing-for-memory",headingTag:"h3"}}),Ae=new J({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()`,wrap:!1}}),Oe=new J({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()`,wrap:!1}}),tt=new J({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>)`,wrap:!1}}),st=new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VtYmVkcyUzRG5lZ2F0aXZlX2VtYmVkcyUyQyUwQSUyMCUyMCUyMCUyMG91dHB1dF90eXBlJTNEJTIycHQlMjIlMkMlMEElMjAlMjAlMjAlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IlMkMlMEEpLmltYWdlcyUwQSUwQXB0X3RvX3BpbChpbWFnZSklNUIwJTVELnNhdmUoJTIyLiUyRmlmX3N0YWdlX0lJLnBuZyUyMik=",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>)`,wrap:!1}}),at=new j({props:{title:"Available Pipelines:",local:"available-pipelines",headingTag:"h2"}}),ot=new j({props:{title:"IFPipeline",local:"diffusers.IFPipeline",headingTag:"h2"}}),it=new Z({props:{name:"class diffusers.IFPipeline",anchor:"diffusers.IFPipeline",parameters:[{name:"tokenizer",val:": T5Tokenizer"},{name:"text_encoder",val:": T5EncoderModel"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDPMScheduler"},{name:"safety_checker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.safety_checker.IFSafetyChecker]"},{name:"feature_extractor",val:": typing.Optional[transformers.models.clip.image_processing_clip.CLIPImageProcessor]"},{name:"watermarker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.watermark.IFWatermarker]"},{name:"requires_safety_checker",val:": bool = True"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if.py#L88"}}),pt=new Z({props:{name:"__call__",anchor:"diffusers.IFPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"num_inference_steps",val:": int = 100"},{name:"timesteps",val:": typing.List[int] = None"},{name:"guidance_scale",val:": float = 7.0"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": int = 1"},{name:"clean_caption",val:": bool = True"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"}],parametersDescription:[{anchor:"diffusers.IFPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.IFPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.IFPipeline.__call__.timesteps",description:`<strong>timesteps</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Custom timesteps to use for the denoising process. If not defined, equal spaced <code>num_inference_steps</code>
timesteps are used. Must be in descending order.`,name:"timesteps"},{anchor:"diffusers.IFPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.IFPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.IFPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.IFPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.IFPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.IFPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.IFPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.IFPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.IFPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.IFPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.IFPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.IFPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.IFPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.IFPipeline.__call__.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the caption before creating embeddings. Requires <code>beautifulsoup4</code> and <code>ftfy</code> to
be installed. If the dependencies are not installed, the embeddings will be created from the raw
prompt.`,name:"clean_caption"},{anchor:"diffusers.IFPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if.py#L541",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>~pipelines.stable_diffusion.IFPipelineOutput</code> or <code>tuple</code></p>
`}}),O=new on({props:{anchor:"diffusers.IFPipeline.__call__.example",$$slots:{default:[il]},$$scope:{ctx:v}}}),rt=new Z({props:{name:"encode_prompt",anchor:"diffusers.IFPipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"do_classifier_free_guidance",val:" = True"},{name:"num_images_per_prompt",val:" = 1"},{name:"device",val:" = None"},{name:"negative_prompt",val:" = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"clean_caption",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.IFPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if.py#L161"}}),ct=new j({props:{title:"IFSuperResolutionPipeline",local:"diffusers.IFSuperResolutionPipeline",headingTag:"h2"}}),mt=new Z({props:{name:"class diffusers.IFSuperResolutionPipeline",anchor:"diffusers.IFSuperResolutionPipeline",parameters:[{name:"tokenizer",val:": T5Tokenizer"},{name:"text_encoder",val:": T5EncoderModel"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDPMScheduler"},{name:"image_noising_scheduler",val:": DDPMScheduler"},{name:"safety_checker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.safety_checker.IFSafetyChecker]"},{name:"feature_extractor",val:": typing.Optional[transformers.models.clip.image_processing_clip.CLIPImageProcessor]"},{name:"watermarker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.watermark.IFWatermarker]"},{name:"requires_safety_checker",val:": bool = True"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py#L73"}}),dt=new Z({props:{name:"__call__",anchor:"diffusers.IFSuperResolutionPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"height",val:": int = None"},{name:"width",val:": int = None"},{name:"image",val:": typing.Union[PIL.Image.Image, numpy.ndarray, torch.FloatTensor] = None"},{name:"num_inference_steps",val:": int = 50"},{name:"timesteps",val:": typing.List[int] = None"},{name:"guidance_scale",val:": float = 4.0"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": int = 1"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"noise_level",val:": int = 250"},{name:"clean_caption",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.IFSuperResolutionPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code>, <code>np.ndarray</code>, <code>torch.FloatTensor</code>) &#x2014;
The image to be upscaled.`,name:"image"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.timesteps",description:`<strong>timesteps</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Custom timesteps to use for the denoising process. If not defined, equal spaced <code>num_inference_steps</code>
timesteps are used. Must be in descending order.`,name:"timesteps"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.noise_level",description:`<strong>noise_level</strong> (<code>int</code>, <em>optional</em>, defaults to 250) &#x2014;
The amount of noise to add to the upscaled image. Must be in the range <code>[0, 1000)</code>`,name:"noise_level"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the caption before creating embeddings. Requires <code>beautifulsoup4</code> and <code>ftfy</code> to
be installed. If the dependencies are not installed, the embeddings will be created from the raw
prompt.`,name:"clean_caption"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py#L608",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>~pipelines.stable_diffusion.IFPipelineOutput</code> or <code>tuple</code></p>
`}}),ee=new on({props:{anchor:"diffusers.IFSuperResolutionPipeline.__call__.example",$$slots:{default:[pl]},$$scope:{ctx:v}}}),gt=new Z({props:{name:"encode_prompt",anchor:"diffusers.IFSuperResolutionPipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"do_classifier_free_guidance",val:" = True"},{name:"num_images_per_prompt",val:" = 1"},{name:"device",val:" = None"},{name:"negative_prompt",val:" = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"clean_caption",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.IFSuperResolutionPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py#L295"}}),ut=new j({props:{title:"IFImg2ImgPipeline",local:"diffusers.IFImg2ImgPipeline",headingTag:"h2"}}),ft=new Z({props:{name:"class diffusers.IFImg2ImgPipeline",anchor:"diffusers.IFImg2ImgPipeline",parameters:[{name:"tokenizer",val:": T5Tokenizer"},{name:"text_encoder",val:": T5EncoderModel"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDPMScheduler"},{name:"safety_checker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.safety_checker.IFSafetyChecker]"},{name:"feature_extractor",val:": typing.Optional[transformers.models.clip.image_processing_clip.CLIPImageProcessor]"},{name:"watermarker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.watermark.IFWatermarker]"},{name:"requires_safety_checker",val:": bool = True"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py#L112"}}),ht=new Z({props:{name:"__call__",anchor:"diffusers.IFImg2ImgPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"image",val:": typing.Union[PIL.Image.Image, torch.Tensor, numpy.ndarray, typing.List[PIL.Image.Image], typing.List[torch.Tensor], typing.List[numpy.ndarray]] = None"},{name:"strength",val:": float = 0.7"},{name:"num_inference_steps",val:": int = 80"},{name:"timesteps",val:": typing.List[int] = None"},{name:"guidance_scale",val:": float = 10.0"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": int = 1"},{name:"clean_caption",val:": bool = True"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"}],parametersDescription:[{anchor:"diffusers.IFImg2ImgPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code> or <code>PIL.Image.Image</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch, that will be used as the starting point for the
process.`,name:"image"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.strength",description:`<strong>strength</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
Conceptually, indicates how much to transform the reference <code>image</code>. Must be between 0 and 1. <code>image</code>
will be used as a starting point, adding more noise to it the larger the <code>strength</code>. The number of
denoising steps depends on the amount of noise initially added. When <code>strength</code> is 1, added noise will
be maximum and the denoising process will run for the full number of iterations specified in
<code>num_inference_steps</code>. A value of 1, therefore, essentially ignores <code>image</code>.`,name:"strength"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.timesteps",description:`<strong>timesteps</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Custom timesteps to use for the denoising process. If not defined, equal spaced <code>num_inference_steps</code>
timesteps are used. Must be in descending order.`,name:"timesteps"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the caption before creating embeddings. Requires <code>beautifulsoup4</code> and <code>ftfy</code> to
be installed. If the dependencies are not installed, the embeddings will be created from the raw
prompt.`,name:"clean_caption"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py#L654",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>~pipelines.stable_diffusion.IFPipelineOutput</code> or <code>tuple</code></p>
`}}),te=new on({props:{anchor:"diffusers.IFImg2ImgPipeline.__call__.example",$$slots:{default:[rl]},$$scope:{ctx:v}}}),_t=new Z({props:{name:"encode_prompt",anchor:"diffusers.IFImg2ImgPipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"do_classifier_free_guidance",val:" = True"},{name:"num_images_per_prompt",val:" = 1"},{name:"device",val:" = None"},{name:"negative_prompt",val:" = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"clean_caption",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.IFImg2ImgPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py#L186"}}),yt=new j({props:{title:"IFImg2ImgSuperResolutionPipeline",local:"diffusers.IFImg2ImgSuperResolutionPipeline",headingTag:"h2"}}),Mt=new Z({props:{name:"class diffusers.IFImg2ImgSuperResolutionPipeline",anchor:"diffusers.IFImg2ImgSuperResolutionPipeline",parameters:[{name:"tokenizer",val:": T5Tokenizer"},{name:"text_encoder",val:": T5EncoderModel"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDPMScheduler"},{name:"image_noising_scheduler",val:": DDPMScheduler"},{name:"safety_checker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.safety_checker.IFSafetyChecker]"},{name:"feature_extractor",val:": typing.Optional[transformers.models.clip.image_processing_clip.CLIPImageProcessor]"},{name:"watermarker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.watermark.IFWatermarker]"},{name:"requires_safety_checker",val:": bool = True"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py#L115"}}),bt=new Z({props:{name:"__call__",anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__",parameters:[{name:"image",val:": typing.Union[PIL.Image.Image, numpy.ndarray, torch.FloatTensor]"},{name:"original_image",val:": typing.Union[PIL.Image.Image, torch.Tensor, numpy.ndarray, typing.List[PIL.Image.Image], typing.List[torch.Tensor], typing.List[numpy.ndarray]] = None"},{name:"strength",val:": float = 0.8"},{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"num_inference_steps",val:": int = 50"},{name:"timesteps",val:": typing.List[int] = None"},{name:"guidance_scale",val:": float = 4.0"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": int = 1"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"noise_level",val:": int = 250"},{name:"clean_caption",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code> or <code>PIL.Image.Image</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch, that will be used as the starting point for the
process.`,name:"image"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.original_image",description:`<strong>original_image</strong> (<code>torch.FloatTensor</code> or <code>PIL.Image.Image</code>) &#x2014;
The original image that <code>image</code> was varied from.`,name:"original_image"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.strength",description:`<strong>strength</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
Conceptually, indicates how much to transform the reference <code>image</code>. Must be between 0 and 1. <code>image</code>
will be used as a starting point, adding more noise to it the larger the <code>strength</code>. The number of
denoising steps depends on the amount of noise initially added. When <code>strength</code> is 1, added noise will
be maximum and the denoising process will run for the full number of iterations specified in
<code>num_inference_steps</code>. A value of 1, therefore, essentially ignores <code>image</code>.`,name:"strength"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.timesteps",description:`<strong>timesteps</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Custom timesteps to use for the denoising process. If not defined, equal spaced <code>num_inference_steps</code>
timesteps are used. Must be in descending order.`,name:"timesteps"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.noise_level",description:`<strong>noise_level</strong> (<code>int</code>, <em>optional</em>, defaults to 250) &#x2014;
The amount of noise to add to the upscaled image. Must be in the range <code>[0, 1000)</code>`,name:"noise_level"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the caption before creating embeddings. Requires <code>beautifulsoup4</code> and <code>ftfy</code> to
be installed. If the dependencies are not installed, the embeddings will be created from the raw
prompt.`,name:"clean_caption"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py#L736",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>~pipelines.stable_diffusion.IFPipelineOutput</code> or <code>tuple</code></p>
`}}),ne=new on({props:{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.example",$$slots:{default:[cl]},$$scope:{ctx:v}}}),wt=new Z({props:{name:"encode_prompt",anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"do_classifier_free_guidance",val:" = True"},{name:"num_images_per_prompt",val:" = 1"},{name:"device",val:" = None"},{name:"negative_prompt",val:" = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"clean_caption",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py#L337"}}),It=new j({props:{title:"IFInpaintingPipeline",local:"diffusers.IFInpaintingPipeline",headingTag:"h2"}}),Jt=new Z({props:{name:"class diffusers.IFInpaintingPipeline",anchor:"diffusers.IFInpaintingPipeline",parameters:[{name:"tokenizer",val:": T5Tokenizer"},{name:"text_encoder",val:": T5EncoderModel"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDPMScheduler"},{name:"safety_checker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.safety_checker.IFSafetyChecker]"},{name:"feature_extractor",val:": typing.Optional[transformers.models.clip.image_processing_clip.CLIPImageProcessor]"},{name:"watermarker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.watermark.IFWatermarker]"},{name:"requires_safety_checker",val:": bool = True"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py#L115"}}),Ut=new Z({props:{name:"__call__",anchor:"diffusers.IFInpaintingPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"image",val:": typing.Union[PIL.Image.Image, torch.Tensor, numpy.ndarray, typing.List[PIL.Image.Image], typing.List[torch.Tensor], typing.List[numpy.ndarray]] = None"},{name:"mask_image",val:": typing.Union[PIL.Image.Image, torch.Tensor, numpy.ndarray, typing.List[PIL.Image.Image], typing.List[torch.Tensor], typing.List[numpy.ndarray]] = None"},{name:"strength",val:": float = 1.0"},{name:"num_inference_steps",val:": int = 50"},{name:"timesteps",val:": typing.List[int] = None"},{name:"guidance_scale",val:": float = 7.0"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": int = 1"},{name:"clean_caption",val:": bool = True"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"}],parametersDescription:[{anchor:"diffusers.IFInpaintingPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.IFInpaintingPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code> or <code>PIL.Image.Image</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch, that will be used as the starting point for the
process.`,name:"image"},{anchor:"diffusers.IFInpaintingPipeline.__call__.mask_image",description:`<strong>mask_image</strong> (<code>PIL.Image.Image</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch, to mask <code>image</code>. White pixels in the mask will be
repainted, while black pixels will be preserved. If <code>mask_image</code> is a PIL image, it will be converted
to a single channel (luminance) before use. If it&#x2019;s a tensor, it should contain one color channel (L)
instead of 3, so the expected shape would be <code>(B, H, W, 1)</code>.`,name:"mask_image"},{anchor:"diffusers.IFInpaintingPipeline.__call__.strength",description:`<strong>strength</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
Conceptually, indicates how much to transform the reference <code>image</code>. Must be between 0 and 1. <code>image</code>
will be used as a starting point, adding more noise to it the larger the <code>strength</code>. The number of
denoising steps depends on the amount of noise initially added. When <code>strength</code> is 1, added noise will
be maximum and the denoising process will run for the full number of iterations specified in
<code>num_inference_steps</code>. A value of 1, therefore, essentially ignores <code>image</code>.`,name:"strength"},{anchor:"diffusers.IFInpaintingPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.IFInpaintingPipeline.__call__.timesteps",description:`<strong>timesteps</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Custom timesteps to use for the denoising process. If not defined, equal spaced <code>num_inference_steps</code>
timesteps are used. Must be in descending order.`,name:"timesteps"},{anchor:"diffusers.IFInpaintingPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.IFInpaintingPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.IFInpaintingPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.IFInpaintingPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.IFInpaintingPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.IFInpaintingPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.IFInpaintingPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.IFInpaintingPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.IFInpaintingPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.IFInpaintingPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.IFInpaintingPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.IFInpaintingPipeline.__call__.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the caption before creating embeddings. Requires <code>beautifulsoup4</code> and <code>ftfy</code> to
be installed. If the dependencies are not installed, the embeddings will be created from the raw
prompt.`,name:"clean_caption"},{anchor:"diffusers.IFInpaintingPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py#L746",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>~pipelines.stable_diffusion.IFPipelineOutput</code> or <code>tuple</code></p>
`}}),se=new on({props:{anchor:"diffusers.IFInpaintingPipeline.__call__.example",$$slots:{default:[ml]},$$scope:{ctx:v}}}),Tt=new Z({props:{name:"encode_prompt",anchor:"diffusers.IFInpaintingPipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"do_classifier_free_guidance",val:" = True"},{name:"num_images_per_prompt",val:" = 1"},{name:"device",val:" = None"},{name:"negative_prompt",val:" = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"clean_caption",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.IFInpaintingPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py#L189"}}),Zt=new j({props:{title:"IFInpaintingSuperResolutionPipeline",local:"diffusers.IFInpaintingSuperResolutionPipeline",headingTag:"h2"}}),jt=new Z({props:{name:"class diffusers.IFInpaintingSuperResolutionPipeline",anchor:"diffusers.IFInpaintingSuperResolutionPipeline",parameters:[{name:"tokenizer",val:": T5Tokenizer"},{name:"text_encoder",val:": T5EncoderModel"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDPMScheduler"},{name:"image_noising_scheduler",val:": DDPMScheduler"},{name:"safety_checker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.safety_checker.IFSafetyChecker]"},{name:"feature_extractor",val:": typing.Optional[transformers.models.clip.image_processing_clip.CLIPImageProcessor]"},{name:"watermarker",val:": typing.Optional[diffusers.pipelines.deepfloyd_if.watermark.IFWatermarker]"},{name:"requires_safety_checker",val:": bool = True"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py#L117"}}),vt=new Z({props:{name:"__call__",anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__",parameters:[{name:"image",val:": typing.Union[PIL.Image.Image, numpy.ndarray, torch.FloatTensor]"},{name:"original_image",val:": typing.Union[PIL.Image.Image, torch.Tensor, numpy.ndarray, typing.List[PIL.Image.Image], typing.List[torch.Tensor], typing.List[numpy.ndarray]] = None"},{name:"mask_image",val:": typing.Union[PIL.Image.Image, torch.Tensor, numpy.ndarray, typing.List[PIL.Image.Image], typing.List[torch.Tensor], typing.List[numpy.ndarray]] = None"},{name:"strength",val:": float = 0.8"},{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"num_inference_steps",val:": int = 100"},{name:"timesteps",val:": typing.List[int] = None"},{name:"guidance_scale",val:": float = 4.0"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": int = 1"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"noise_level",val:": int = 0"},{name:"clean_caption",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code> or <code>PIL.Image.Image</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch, that will be used as the starting point for the
process.`,name:"image"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.original_image",description:`<strong>original_image</strong> (<code>torch.FloatTensor</code> or <code>PIL.Image.Image</code>) &#x2014;
The original image that <code>image</code> was varied from.`,name:"original_image"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.mask_image",description:`<strong>mask_image</strong> (<code>PIL.Image.Image</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch, to mask <code>image</code>. White pixels in the mask will be
repainted, while black pixels will be preserved. If <code>mask_image</code> is a PIL image, it will be converted
to a single channel (luminance) before use. If it&#x2019;s a tensor, it should contain one color channel (L)
instead of 3, so the expected shape would be <code>(B, H, W, 1)</code>.`,name:"mask_image"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.strength",description:`<strong>strength</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
Conceptually, indicates how much to transform the reference <code>image</code>. Must be between 0 and 1. <code>image</code>
will be used as a starting point, adding more noise to it the larger the <code>strength</code>. The number of
denoising steps depends on the amount of noise initially added. When <code>strength</code> is 1, added noise will
be maximum and the denoising process will run for the full number of iterations specified in
<code>num_inference_steps</code>. A value of 1, therefore, essentially ignores <code>image</code>.`,name:"strength"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.timesteps",description:`<strong>timesteps</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Custom timesteps to use for the denoising process. If not defined, equal spaced <code>num_inference_steps</code>
timesteps are used. Must be in descending order.`,name:"timesteps"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.noise_level",description:`<strong>noise_level</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The amount of noise to add to the upscaled image. Must be in the range <code>[0, 1000)</code>`,name:"noise_level"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the caption before creating embeddings. Requires <code>beautifulsoup4</code> and <code>ftfy</code> to
be installed. If the dependencies are not installed, the embeddings will be created from the raw
prompt.`,name:"clean_caption"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py#L824",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>~pipelines.stable_diffusion.IFPipelineOutput</code> or <code>tuple</code></p>
`}}),ae=new on({props:{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.example",$$slots:{default:[dl]},$$scope:{ctx:v}}}),Bt=new Z({props:{name:"encode_prompt",anchor:"diffusers.IFInpaintingSuperResolutionPipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"do_classifier_free_guidance",val:" = True"},{name:"num_images_per_prompt",val:" = 1"},{name:"device",val:" = None"},{name:"negative_prompt",val:" = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"clean_caption",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py#L339"}}),{c(){h=i("meta"),I=a(),b=i("p"),y=a(),c(M.$$.fragment),o=a(),c(w.$$.fragment),cn=a(),le=i("p"),le.textContent=ia,mn=a(),oe=i("ul"),oe.innerHTML=pa,dn=a(),c(ie.$$.fragment),gn=a(),pe=i("p"),pe.textContent=ra,un=a(),re=i("ol"),re.innerHTML=ca,fn=a(),c(ce.$$.fragment),hn=a(),me=i("p"),me.textContent=ma,_n=a(),c(de.$$.fragment),yn=a(),ge=i("p"),ge.innerHTML=da,Mn=a(),ue=i("p"),ue.innerHTML=ga,bn=a(),c(fe.$$.fragment),wn=a(),he=i("p"),he.textContent=ua,In=a(),_e=i("ul"),_e.innerHTML=fa,Jn=a(),ye=i("p"),ye.innerHTML=ha,Un=a(),Me=i("ul"),Me.innerHTML=_a,Tn=a(),be=i("p"),be.innerHTML=ya,Zn=a(),we=i("p"),we.innerHTML=Ma,jn=a(),c(Ie.$$.fragment),vn=a(),Je=i("p"),Je.innerHTML=ba,Bn=a(),c(Ue.$$.fragment),Wn=a(),c(Te.$$.fragment),Fn=a(),Ze=i("p"),Ze.innerHTML=wa,kn=a(),je=i("p"),je.innerHTML=Ia,Gn=a(),c(ve.$$.fragment),Xn=a(),c(Be.$$.fragment),Rn=a(),We=i("p"),We.innerHTML=Ja,Cn=a(),Fe=i("p"),Fe.innerHTML=Ua,xn=a(),c(ke.$$.fragment),Vn=a(),c(Ge.$$.fragment),Sn=a(),Xe=i("p"),Xe.innerHTML=Ta,En=a(),c(Re.$$.fragment),Nn=a(),c(Ce.$$.fragment),$n=a(),xe=i("p"),xe.textContent=Za,Qn=a(),c(Ve.$$.fragment),Yn=a(),Se=i("p"),Se.textContent=ja,Hn=a(),Ee=i("p"),Ee.innerHTML=va,Pn=a(),c(Ne.$$.fragment),zn=a(),$e=i("p"),$e.innerHTML=Ba,Ln=a(),c(Qe.$$.fragment),qn=a(),Ye=i("p"),Ye.textContent=Wa,Dn=a(),c(He.$$.fragment),An=a(),Pe=i("p"),Pe.innerHTML=Fa,Kn=a(),c(ze.$$.fragment),On=a(),c(Le.$$.fragment),es=a(),qe=i("p"),qe.textContent=ka,ts=a(),De=i("p"),De.textContent=Ga,ns=a(),c(Ae.$$.fragment),ss=a(),Ke=i("p"),Ke.textContent=Xa,as=a(),c(Oe.$$.fragment),ls=a(),et=i("p"),et.textContent=Ra,os=a(),c(tt.$$.fragment),is=a(),nt=i("p"),nt.textContent=Ca,ps=a(),c(st.$$.fragment),rs=a(),c(at.$$.fragment),cs=a(),lt=i("table"),lt.innerHTML=xa,ms=a(),c(ot.$$.fragment),ds=a(),B=i("div"),c(it.$$.fragment),Ts=a(),R=i("div"),c(pt.$$.fragment),Zs=a(),Wt=i("p"),Wt.textContent=Va,js=a(),c(O.$$.fragment),vs=a(),C=i("div"),c(rt.$$.fragment),Bs=a(),Ft=i("p"),Ft.textContent=Sa,Ws=a(),kt=i("p"),kt.innerHTML=Ea,gs=a(),c(ct.$$.fragment),us=a(),W=i("div"),c(mt.$$.fragment),Fs=a(),x=i("div"),c(dt.$$.fragment),ks=a(),Gt=i("p"),Gt.textContent=Na,Gs=a(),c(ee.$$.fragment),Xs=a(),V=i("div"),c(gt.$$.fragment),Rs=a(),Xt=i("p"),Xt.textContent=$a,Cs=a(),Rt=i("p"),Rt.innerHTML=Qa,fs=a(),c(ut.$$.fragment),hs=a(),F=i("div"),c(ft.$$.fragment),xs=a(),S=i("div"),c(ht.$$.fragment),Vs=a(),Ct=i("p"),Ct.textContent=Ya,Ss=a(),c(te.$$.fragment),Es=a(),E=i("div"),c(_t.$$.fragment),Ns=a(),xt=i("p"),xt.textContent=Ha,$s=a(),Vt=i("p"),Vt.innerHTML=Pa,_s=a(),c(yt.$$.fragment),ys=a(),k=i("div"),c(Mt.$$.fragment),Qs=a(),N=i("div"),c(bt.$$.fragment),Ys=a(),St=i("p"),St.textContent=za,Hs=a(),c(ne.$$.fragment),Ps=a(),$=i("div"),c(wt.$$.fragment),zs=a(),Et=i("p"),Et.textContent=La,Ls=a(),Nt=i("p"),Nt.innerHTML=qa,Ms=a(),c(It.$$.fragment),bs=a(),G=i("div"),c(Jt.$$.fragment),qs=a(),Q=i("div"),c(Ut.$$.fragment),Ds=a(),$t=i("p"),$t.textContent=Da,As=a(),c(se.$$.fragment),Ks=a(),Y=i("div"),c(Tt.$$.fragment),Os=a(),Qt=i("p"),Qt.textContent=Aa,ea=a(),Yt=i("p"),Yt.innerHTML=Ka,ws=a(),c(Zt.$$.fragment),Is=a(),X=i("div"),c(jt.$$.fragment),ta=a(),H=i("div"),c(vt.$$.fragment),na=a(),Ht=i("p"),Ht.textContent=Oa,sa=a(),c(ae.$$.fragment),aa=a(),P=i("div"),c(Bt.$$.fragment),la=a(),Pt=i("p"),Pt.textContent=el,oa=a(),zt=i("p"),zt.innerHTML=tl,Js=a(),rn=i("p"),this.h()},l(e){const t=ol("svelte-u9bgzb",document.head);h=p(t,"META",{name:!0,content:!0}),t.forEach(n),I=l(e),b=p(e,"P",{}),U(b).forEach(n),y=l(e),m(M.$$.fragment,e),o=l(e),m(w.$$.fragment,e),cn=l(e),le=p(e,"P",{"data-svelte-h":!0}),_(le)!=="svelte-c4me6q"&&(le.textContent=ia),mn=l(e),oe=p(e,"UL",{"data-svelte-h":!0}),_(oe)!=="svelte-1h2dubh"&&(oe.innerHTML=pa),dn=l(e),m(ie.$$.fragment,e),gn=l(e),pe=p(e,"P",{"data-svelte-h":!0}),_(pe)!=="svelte-13gixbp"&&(pe.textContent=ra),un=l(e),re=p(e,"OL",{"data-svelte-h":!0}),_(re)!=="svelte-ncqy1d"&&(re.innerHTML=ca),fn=l(e),m(ce.$$.fragment,e),hn=l(e),me=p(e,"P",{"data-svelte-h":!0}),_(me)!=="svelte-c23017"&&(me.textContent=ma),_n=l(e),m(de.$$.fragment,e),yn=l(e),ge=p(e,"P",{"data-svelte-h":!0}),_(ge)!=="svelte-1vhgvls"&&(ge.innerHTML=da),Mn=l(e),ue=p(e,"P",{"data-svelte-h":!0}),_(ue)!=="svelte-13wvpdg"&&(ue.innerHTML=ga),bn=l(e),m(fe.$$.fragment,e),wn=l(e),he=p(e,"P",{"data-svelte-h":!0}),_(he)!=="svelte-12efsp0"&&(he.textContent=ua),In=l(e),_e=p(e,"UL",{"data-svelte-h":!0}),_(_e)!=="svelte-1j0zpko"&&(_e.innerHTML=fa),Jn=l(e),ye=p(e,"P",{"data-svelte-h":!0}),_(ye)!=="svelte-6cosrd"&&(ye.innerHTML=ha),Un=l(e),Me=p(e,"UL",{"data-svelte-h":!0}),_(Me)!=="svelte-1bclroz"&&(Me.innerHTML=_a),Tn=l(e),be=p(e,"P",{"data-svelte-h":!0}),_(be)!=="svelte-nlmdc2"&&(be.innerHTML=ya),Zn=l(e),we=p(e,"P",{"data-svelte-h":!0}),_(we)!=="svelte-10fuv2z"&&(we.innerHTML=Ma),jn=l(e),m(Ie.$$.fragment,e),vn=l(e),Je=p(e,"P",{"data-svelte-h":!0}),_(Je)!=="svelte-1n32c9"&&(Je.innerHTML=ba),Bn=l(e),m(Ue.$$.fragment,e),Wn=l(e),m(Te.$$.fragment,e),Fn=l(e),Ze=p(e,"P",{"data-svelte-h":!0}),_(Ze)!=="svelte-1mcqcae"&&(Ze.innerHTML=wa),kn=l(e),je=p(e,"P",{"data-svelte-h":!0}),_(je)!=="svelte-8txrxq"&&(je.innerHTML=Ia),Gn=l(e),m(ve.$$.fragment,e),Xn=l(e),m(Be.$$.fragment,e),Rn=l(e),We=p(e,"P",{"data-svelte-h":!0}),_(We)!=="svelte-1mcqcae"&&(We.innerHTML=Ja),Cn=l(e),Fe=p(e,"P",{"data-svelte-h":!0}),_(Fe)!=="svelte-8txrxq"&&(Fe.innerHTML=Ua),xn=l(e),m(ke.$$.fragment,e),Vn=l(e),m(Ge.$$.fragment,e),Sn=l(e),Xe=p(e,"P",{"data-svelte-h":!0}),_(Xe)!=="svelte-yqwmip"&&(Xe.innerHTML=Ta),En=l(e),m(Re.$$.fragment,e),Nn=l(e),m(Ce.$$.fragment,e),$n=l(e),xe=p(e,"P",{"data-svelte-h":!0}),_(xe)!=="svelte-15gngr3"&&(xe.textContent=Za),Qn=l(e),m(Ve.$$.fragment,e),Yn=l(e),Se=p(e,"P",{"data-svelte-h":!0}),_(Se)!=="svelte-12zfq1b"&&(Se.textContent=ja),Hn=l(e),Ee=p(e,"P",{"data-svelte-h":!0}),_(Ee)!=="svelte-l4rs7z"&&(Ee.innerHTML=va),Pn=l(e),m(Ne.$$.fragment,e),zn=l(e),$e=p(e,"P",{"data-svelte-h":!0}),_($e)!=="svelte-qbsilq"&&($e.innerHTML=Ba),Ln=l(e),m(Qe.$$.fragment,e),qn=l(e),Ye=p(e,"P",{"data-svelte-h":!0}),_(Ye)!=="svelte-vis4py"&&(Ye.textContent=Wa),Dn=l(e),m(He.$$.fragment,e),An=l(e),Pe=p(e,"P",{"data-svelte-h":!0}),_(Pe)!=="svelte-zgpgf0"&&(Pe.innerHTML=Fa),Kn=l(e),m(ze.$$.fragment,e),On=l(e),m(Le.$$.fragment,e),es=l(e),qe=p(e,"P",{"data-svelte-h":!0}),_(qe)!=="svelte-moep0m"&&(qe.textContent=ka),ts=l(e),De=p(e,"P",{"data-svelte-h":!0}),_(De)!=="svelte-6d4mux"&&(De.textContent=Ga),ns=l(e),m(Ae.$$.fragment,e),ss=l(e),Ke=p(e,"P",{"data-svelte-h":!0}),_(Ke)!=="svelte-mhfn46"&&(Ke.textContent=Xa),as=l(e),m(Oe.$$.fragment,e),ls=l(e),et=p(e,"P",{"data-svelte-h":!0}),_(et)!=="svelte-b2fswh"&&(et.textContent=Ra),os=l(e),m(tt.$$.fragment,e),is=l(e),nt=p(e,"P",{"data-svelte-h":!0}),_(nt)!=="svelte-5tea4"&&(nt.textContent=Ca),ps=l(e),m(st.$$.fragment,e),rs=l(e),m(at.$$.fragment,e),cs=l(e),lt=p(e,"TABLE",{"data-svelte-h":!0}),_(lt)!=="svelte-791aqo"&&(lt.innerHTML=xa),ms=l(e),m(ot.$$.fragment,e),ds=l(e),B=p(e,"DIV",{class:!0});var z=U(B);m(it.$$.fragment,z),Ts=l(z),R=p(z,"DIV",{class:!0});var L=U(R);m(pt.$$.fragment,L),Zs=l(L),Wt=p(L,"P",{"data-svelte-h":!0}),_(Wt)!=="svelte-v78lg8"&&(Wt.textContent=Va),js=l(L),m(O.$$.fragment,L),L.forEach(n),vs=l(z),C=p(z,"DIV",{class:!0});var q=U(C);m(rt.$$.fragment,q),Bs=l(q),Ft=p(q,"P",{"data-svelte-h":!0}),_(Ft)!=="svelte-16q0ax1"&&(Ft.textContent=Sa),Ws=l(q),kt=p(q,"P",{"data-svelte-h":!0}),_(kt)!=="svelte-35bhdv"&&(kt.innerHTML=Ea),q.forEach(n),z.forEach(n),gs=l(e),m(ct.$$.fragment,e),us=l(e),W=p(e,"DIV",{class:!0});var D=U(W);m(mt.$$.fragment,D),Fs=l(D),x=p(D,"DIV",{class:!0});var A=U(x);m(dt.$$.fragment,A),ks=l(A),Gt=p(A,"P",{"data-svelte-h":!0}),_(Gt)!=="svelte-v78lg8"&&(Gt.textContent=Na),Gs=l(A),m(ee.$$.fragment,A),A.forEach(n),Xs=l(D),V=p(D,"DIV",{class:!0});var K=U(V);m(gt.$$.fragment,K),Rs=l(K),Xt=p(K,"P",{"data-svelte-h":!0}),_(Xt)!=="svelte-16q0ax1"&&(Xt.textContent=$a),Cs=l(K),Rt=p(K,"P",{"data-svelte-h":!0}),_(Rt)!=="svelte-35bhdv"&&(Rt.innerHTML=Qa),K.forEach(n),D.forEach(n),fs=l(e),m(ut.$$.fragment,e),hs=l(e),F=p(e,"DIV",{class:!0});var Lt=U(F);m(ft.$$.fragment,Lt),xs=l(Lt),S=p(Lt,"DIV",{class:!0});var qt=U(S);m(ht.$$.fragment,qt),Vs=l(qt),Ct=p(qt,"P",{"data-svelte-h":!0}),_(Ct)!=="svelte-v78lg8"&&(Ct.textContent=Ya),Ss=l(qt),m(te.$$.fragment,qt),qt.forEach(n),Es=l(Lt),E=p(Lt,"DIV",{class:!0});var Dt=U(E);m(_t.$$.fragment,Dt),Ns=l(Dt),xt=p(Dt,"P",{"data-svelte-h":!0}),_(xt)!=="svelte-16q0ax1"&&(xt.textContent=Ha),$s=l(Dt),Vt=p(Dt,"P",{"data-svelte-h":!0}),_(Vt)!=="svelte-35bhdv"&&(Vt.innerHTML=Pa),Dt.forEach(n),Lt.forEach(n),_s=l(e),m(yt.$$.fragment,e),ys=l(e),k=p(e,"DIV",{class:!0});var At=U(k);m(Mt.$$.fragment,At),Qs=l(At),N=p(At,"DIV",{class:!0});var Kt=U(N);m(bt.$$.fragment,Kt),Ys=l(Kt),St=p(Kt,"P",{"data-svelte-h":!0}),_(St)!=="svelte-v78lg8"&&(St.textContent=za),Hs=l(Kt),m(ne.$$.fragment,Kt),Kt.forEach(n),Ps=l(At),$=p(At,"DIV",{class:!0});var Ot=U($);m(wt.$$.fragment,Ot),zs=l(Ot),Et=p(Ot,"P",{"data-svelte-h":!0}),_(Et)!=="svelte-16q0ax1"&&(Et.textContent=La),Ls=l(Ot),Nt=p(Ot,"P",{"data-svelte-h":!0}),_(Nt)!=="svelte-35bhdv"&&(Nt.innerHTML=qa),Ot.forEach(n),At.forEach(n),Ms=l(e),m(It.$$.fragment,e),bs=l(e),G=p(e,"DIV",{class:!0});var en=U(G);m(Jt.$$.fragment,en),qs=l(en),Q=p(en,"DIV",{class:!0});var tn=U(Q);m(Ut.$$.fragment,tn),Ds=l(tn),$t=p(tn,"P",{"data-svelte-h":!0}),_($t)!=="svelte-v78lg8"&&($t.textContent=Da),As=l(tn),m(se.$$.fragment,tn),tn.forEach(n),Ks=l(en),Y=p(en,"DIV",{class:!0});var nn=U(Y);m(Tt.$$.fragment,nn),Os=l(nn),Qt=p(nn,"P",{"data-svelte-h":!0}),_(Qt)!=="svelte-16q0ax1"&&(Qt.textContent=Aa),ea=l(nn),Yt=p(nn,"P",{"data-svelte-h":!0}),_(Yt)!=="svelte-35bhdv"&&(Yt.innerHTML=Ka),nn.forEach(n),en.forEach(n),ws=l(e),m(Zt.$$.fragment,e),Is=l(e),X=p(e,"DIV",{class:!0});var sn=U(X);m(jt.$$.fragment,sn),ta=l(sn),H=p(sn,"DIV",{class:!0});var an=U(H);m(vt.$$.fragment,an),na=l(an),Ht=p(an,"P",{"data-svelte-h":!0}),_(Ht)!=="svelte-v78lg8"&&(Ht.textContent=Oa),sa=l(an),m(ae.$$.fragment,an),an.forEach(n),aa=l(sn),P=p(sn,"DIV",{class:!0});var ln=U(P);m(Bt.$$.fragment,ln),la=l(ln),Pt=p(ln,"P",{"data-svelte-h":!0}),_(Pt)!=="svelte-16q0ax1"&&(Pt.textContent=el),oa=l(ln),zt=p(ln,"P",{"data-svelte-h":!0}),_(zt)!=="svelte-35bhdv"&&(zt.innerHTML=tl),ln.forEach(n),sn.forEach(n),Js=l(e),rn=p(e,"P",{}),U(rn).forEach(n),this.h()},h(){T(h,"name","hf:doc:metadata"),T(h,"content",ul),T(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){r(document.head,h),s(e,I,t),s(e,b,t),s(e,y,t),d(M,e,t),s(e,o,t),d(w,e,t),s(e,cn,t),s(e,le,t),s(e,mn,t),s(e,oe,t),s(e,dn,t),d(ie,e,t),s(e,gn,t),s(e,pe,t),s(e,un,t),s(e,re,t),s(e,fn,t),d(ce,e,t),s(e,hn,t),s(e,me,t),s(e,_n,t),d(de,e,t),s(e,yn,t),s(e,ge,t),s(e,Mn,t),s(e,ue,t),s(e,bn,t),d(fe,e,t),s(e,wn,t),s(e,he,t),s(e,In,t),s(e,_e,t),s(e,Jn,t),s(e,ye,t),s(e,Un,t),s(e,Me,t),s(e,Tn,t),s(e,be,t),s(e,Zn,t),s(e,we,t),s(e,jn,t),d(Ie,e,t),s(e,vn,t),s(e,Je,t),s(e,Bn,t),d(Ue,e,t),s(e,Wn,t),d(Te,e,t),s(e,Fn,t),s(e,Ze,t),s(e,kn,t),s(e,je,t),s(e,Gn,t),d(ve,e,t),s(e,Xn,t),d(Be,e,t),s(e,Rn,t),s(e,We,t),s(e,Cn,t),s(e,Fe,t),s(e,xn,t),d(ke,e,t),s(e,Vn,t),d(Ge,e,t),s(e,Sn,t),s(e,Xe,t),s(e,En,t),d(Re,e,t),s(e,Nn,t),d(Ce,e,t),s(e,$n,t),s(e,xe,t),s(e,Qn,t),d(Ve,e,t),s(e,Yn,t),s(e,Se,t),s(e,Hn,t),s(e,Ee,t),s(e,Pn,t),d(Ne,e,t),s(e,zn,t),s(e,$e,t),s(e,Ln,t),d(Qe,e,t),s(e,qn,t),s(e,Ye,t),s(e,Dn,t),d(He,e,t),s(e,An,t),s(e,Pe,t),s(e,Kn,t),d(ze,e,t),s(e,On,t),d(Le,e,t),s(e,es,t),s(e,qe,t),s(e,ts,t),s(e,De,t),s(e,ns,t),d(Ae,e,t),s(e,ss,t),s(e,Ke,t),s(e,as,t),d(Oe,e,t),s(e,ls,t),s(e,et,t),s(e,os,t),d(tt,e,t),s(e,is,t),s(e,nt,t),s(e,ps,t),d(st,e,t),s(e,rs,t),d(at,e,t),s(e,cs,t),s(e,lt,t),s(e,ms,t),d(ot,e,t),s(e,ds,t),s(e,B,t),d(it,B,null),r(B,Ts),r(B,R),d(pt,R,null),r(R,Zs),r(R,Wt),r(R,js),d(O,R,null),r(B,vs),r(B,C),d(rt,C,null),r(C,Bs),r(C,Ft),r(C,Ws),r(C,kt),s(e,gs,t),d(ct,e,t),s(e,us,t),s(e,W,t),d(mt,W,null),r(W,Fs),r(W,x),d(dt,x,null),r(x,ks),r(x,Gt),r(x,Gs),d(ee,x,null),r(W,Xs),r(W,V),d(gt,V,null),r(V,Rs),r(V,Xt),r(V,Cs),r(V,Rt),s(e,fs,t),d(ut,e,t),s(e,hs,t),s(e,F,t),d(ft,F,null),r(F,xs),r(F,S),d(ht,S,null),r(S,Vs),r(S,Ct),r(S,Ss),d(te,S,null),r(F,Es),r(F,E),d(_t,E,null),r(E,Ns),r(E,xt),r(E,$s),r(E,Vt),s(e,_s,t),d(yt,e,t),s(e,ys,t),s(e,k,t),d(Mt,k,null),r(k,Qs),r(k,N),d(bt,N,null),r(N,Ys),r(N,St),r(N,Hs),d(ne,N,null),r(k,Ps),r(k,$),d(wt,$,null),r($,zs),r($,Et),r($,Ls),r($,Nt),s(e,Ms,t),d(It,e,t),s(e,bs,t),s(e,G,t),d(Jt,G,null),r(G,qs),r(G,Q),d(Ut,Q,null),r(Q,Ds),r(Q,$t),r(Q,As),d(se,Q,null),r(G,Ks),r(G,Y),d(Tt,Y,null),r(Y,Os),r(Y,Qt),r(Y,ea),r(Y,Yt),s(e,ws,t),d(Zt,e,t),s(e,Is,t),s(e,X,t),d(jt,X,null),r(X,ta),r(X,H),d(vt,H,null),r(H,na),r(H,Ht),r(H,sa),d(ae,H,null),r(X,aa),r(X,P),d(Bt,P,null),r(P,la),r(P,Pt),r(P,oa),r(P,zt),s(e,Js,t),s(e,rn,t),Us=!0},p(e,[t]){const z={};t&2&&(z.$$scope={dirty:t,ctx:e}),O.$set(z);const L={};t&2&&(L.$$scope={dirty:t,ctx:e}),ee.$set(L);const q={};t&2&&(q.$$scope={dirty:t,ctx:e}),te.$set(q);const D={};t&2&&(D.$$scope={dirty:t,ctx:e}),ne.$set(D);const A={};t&2&&(A.$$scope={dirty:t,ctx:e}),se.$set(A);const K={};t&2&&(K.$$scope={dirty:t,ctx:e}),ae.$set(K)},i(e){Us||(g(M.$$.fragment,e),g(w.$$.fragment,e),g(ie.$$.fragment,e),g(ce.$$.fragment,e),g(de.$$.fragment,e),g(fe.$$.fragment,e),g(Ie.$$.fragment,e),g(Ue.$$.fragment,e),g(Te.$$.fragment,e),g(ve.$$.fragment,e),g(Be.$$.fragment,e),g(ke.$$.fragment,e),g(Ge.$$.fragment,e),g(Re.$$.fragment,e),g(Ce.$$.fragment,e),g(Ve.$$.fragment,e),g(Ne.$$.fragment,e),g(Qe.$$.fragment,e),g(He.$$.fragment,e),g(ze.$$.fragment,e),g(Le.$$.fragment,e),g(Ae.$$.fragment,e),g(Oe.$$.fragment,e),g(tt.$$.fragment,e),g(st.$$.fragment,e),g(at.$$.fragment,e),g(ot.$$.fragment,e),g(it.$$.fragment,e),g(pt.$$.fragment,e),g(O.$$.fragment,e),g(rt.$$.fragment,e),g(ct.$$.fragment,e),g(mt.$$.fragment,e),g(dt.$$.fragment,e),g(ee.$$.fragment,e),g(gt.$$.fragment,e),g(ut.$$.fragment,e),g(ft.$$.fragment,e),g(ht.$$.fragment,e),g(te.$$.fragment,e),g(_t.$$.fragment,e),g(yt.$$.fragment,e),g(Mt.$$.fragment,e),g(bt.$$.fragment,e),g(ne.$$.fragment,e),g(wt.$$.fragment,e),g(It.$$.fragment,e),g(Jt.$$.fragment,e),g(Ut.$$.fragment,e),g(se.$$.fragment,e),g(Tt.$$.fragment,e),g(Zt.$$.fragment,e),g(jt.$$.fragment,e),g(vt.$$.fragment,e),g(ae.$$.fragment,e),g(Bt.$$.fragment,e),Us=!0)},o(e){u(M.$$.fragment,e),u(w.$$.fragment,e),u(ie.$$.fragment,e),u(ce.$$.fragment,e),u(de.$$.fragment,e),u(fe.$$.fragment,e),u(Ie.$$.fragment,e),u(Ue.$$.fragment,e),u(Te.$$.fragment,e),u(ve.$$.fragment,e),u(Be.$$.fragment,e),u(ke.$$.fragment,e),u(Ge.$$.fragment,e),u(Re.$$.fragment,e),u(Ce.$$.fragment,e),u(Ve.$$.fragment,e),u(Ne.$$.fragment,e),u(Qe.$$.fragment,e),u(He.$$.fragment,e),u(ze.$$.fragment,e),u(Le.$$.fragment,e),u(Ae.$$.fragment,e),u(Oe.$$.fragment,e),u(tt.$$.fragment,e),u(st.$$.fragment,e),u(at.$$.fragment,e),u(ot.$$.fragment,e),u(it.$$.fragment,e),u(pt.$$.fragment,e),u(O.$$.fragment,e),u(rt.$$.fragment,e),u(ct.$$.fragment,e),u(mt.$$.fragment,e),u(dt.$$.fragment,e),u(ee.$$.fragment,e),u(gt.$$.fragment,e),u(ut.$$.fragment,e),u(ft.$$.fragment,e),u(ht.$$.fragment,e),u(te.$$.fragment,e),u(_t.$$.fragment,e),u(yt.$$.fragment,e),u(Mt.$$.fragment,e),u(bt.$$.fragment,e),u(ne.$$.fragment,e),u(wt.$$.fragment,e),u(It.$$.fragment,e),u(Jt.$$.fragment,e),u(Ut.$$.fragment,e),u(se.$$.fragment,e),u(Tt.$$.fragment,e),u(Zt.$$.fragment,e),u(jt.$$.fragment,e),u(vt.$$.fragment,e),u(ae.$$.fragment,e),u(Bt.$$.fragment,e),Us=!1},d(e){e&&(n(I),n(b),n(y),n(o),n(cn),n(le),n(mn),n(oe),n(dn),n(gn),n(pe),n(un),n(re),n(fn),n(hn),n(me),n(_n),n(yn),n(ge),n(Mn),n(ue),n(bn),n(wn),n(he),n(In),n(_e),n(Jn),n(ye),n(Un),n(Me),n(Tn),n(be),n(Zn),n(we),n(jn),n(vn),n(Je),n(Bn),n(Wn),n(Fn),n(Ze),n(kn),n(je),n(Gn),n(Xn),n(Rn),n(We),n(Cn),n(Fe),n(xn),n(Vn),n(Sn),n(Xe),n(En),n(Nn),n($n),n(xe),n(Qn),n(Yn),n(Se),n(Hn),n(Ee),n(Pn),n(zn),n($e),n(Ln),n(qn),n(Ye),n(Dn),n(An),n(Pe),n(Kn),n(On),n(es),n(qe),n(ts),n(De),n(ns),n(ss),n(Ke),n(as),n(ls),n(et),n(os),n(is),n(nt),n(ps),n(rs),n(cs),n(lt),n(ms),n(ds),n(B),n(gs),n(us),n(W),n(fs),n(hs),n(F),n(_s),n(ys),n(k),n(Ms),n(bs),n(G),n(ws),n(Is),n(X),n(Js),n(rn)),n(h),f(M,e),f(w,e),f(ie,e),f(ce,e),f(de,e),f(fe,e),f(Ie,e),f(Ue,e),f(Te,e),f(ve,e),f(Be,e),f(ke,e),f(Ge,e),f(Re,e),f(Ce,e),f(Ve,e),f(Ne,e),f(Qe,e),f(He,e),f(ze,e),f(Le,e),f(Ae,e),f(Oe,e),f(tt,e),f(st,e),f(at,e),f(ot,e),f(it),f(pt),f(O),f(rt),f(ct,e),f(mt),f(dt),f(ee),f(gt),f(ut,e),f(ft),f(ht),f(te),f(_t),f(yt,e),f(Mt),f(bt),f(ne),f(wt),f(It,e),f(Jt),f(Ut),f(se),f(Tt),f(Zt,e),f(jt),f(vt),f(ae),f(Bt)}}}const ul='{"title":"DeepFloyd IF","local":"deepfloyd-if","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage","local":"usage","sections":[{"title":"Text-to-Image Generation","local":"text-to-image-generation","sections":[],"depth":3},{"title":"Text Guided Image-to-Image Generation","local":"text-guided-image-to-image-generation","sections":[],"depth":3},{"title":"Text Guided Inpainting Generation","local":"text-guided-inpainting-generation","sections":[],"depth":3},{"title":"Converting between different pipelines","local":"converting-between-different-pipelines","sections":[],"depth":3},{"title":"Optimizing for speed","local":"optimizing-for-speed","sections":[],"depth":3},{"title":"Optimizing for memory","local":"optimizing-for-memory","sections":[],"depth":3}],"depth":2},{"title":"Available Pipelines:","local":"available-pipelines","sections":[],"depth":2},{"title":"IFPipeline","local":"diffusers.IFPipeline","sections":[],"depth":2},{"title":"IFSuperResolutionPipeline","local":"diffusers.IFSuperResolutionPipeline","sections":[],"depth":2},{"title":"IFImg2ImgPipeline","local":"diffusers.IFImg2ImgPipeline","sections":[],"depth":2},{"title":"IFImg2ImgSuperResolutionPipeline","local":"diffusers.IFImg2ImgSuperResolutionPipeline","sections":[],"depth":2},{"title":"IFInpaintingPipeline","local":"diffusers.IFInpaintingPipeline","sections":[],"depth":2},{"title":"IFInpaintingSuperResolutionPipeline","local":"diffusers.IFInpaintingSuperResolutionPipeline","sections":[],"depth":2}],"depth":1}';function fl(v){return sl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Il extends al{constructor(h){super(),ll(this,h,fl,gl,nl,{})}}export{Il as component};
