import{s as Va,o as Sa,n as At}from"../chunks/scheduler.182ea377.js";import{S as Ea,i as Na,g as i,s as a,r,A as $a,h as p,f as n,c as l,j as U,u as c,x as y,k as T,y as h,a as s,v as d,d as m,t as g,w as u}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 Dt}from"../chunks/ExampleCodeBlock.658f5cd6.js";import{H as v}from"../chunks/Heading.16916d63.js";function Qa(j){let f,w="Examples:",M,_,b;return _=new J({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGUGlwZWxpbmUlMkMlMjBJRlN1cGVyUmVzb2x1dGlvblBpcGVsaW5lJTJDJTIwRGlmZnVzaW9uUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwcHRfdG9fcGlsJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlJTIwJTNEJTIwSUZQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyRGVlcEZsb3lkJTJGSUYtSS1YTC12MS4wJTIyJTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQXByb21wdCUyMCUzRCUyMCdhJTIwcGhvdG8lMjBvZiUyMGElMjBrYW5nYXJvbyUyMHdlYXJpbmclMjBhbiUyMG9yYW5nZSUyMGhvb2RpZSUyMGFuZCUyMGJsdWUlMjBzdW5nbGFzc2VzJTIwc3RhbmRpbmclMjBpbiUyMGZyb250JTIwb2YlMjB0aGUlMjBlaWZmZWwlMjB0b3dlciUyMGhvbGRpbmclMjBhJTIwc2lnbiUyMHRoYXQlMjBzYXlzJTIwJTIydmVyeSUyMGRlZXAlMjBsZWFybmluZyUyMiclMEFwcm9tcHRfZW1iZWRzJTJDJ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RlJTIwaW1hZ2UlMEFwaWxfaW1hZ2UlMjAlM0QlMjBwdF90b19waWwoaW1hZ2UpJTBBcGlsX2ltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JLnBuZyUyMiklMEElMEFzYWZldHlfbW9kdWxlcyUyMCUzRCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMmZlYXR1cmVfZXh0cmFjdG9yJTIyJTNBJTIwcGlwZS5mZWF0dXJlX2V4dHJhY3RvciUyQyUwQSUyMCUyMCUyMCUyMCUyMnNhZmV0eV9jaGVja2VyJTIyJTNBJTIwcGlwZS5zYWZldHlfY2hlY2tlciUyQyUwQSUyMCUyMCUyMCUyMCUyMndhdGVybWFya2VyJTIyJTNBJTIwcGlwZS53YXRlcm1hcmtlciUyQyUwQSU3RCUwQXN1cGVyX3Jlc18yX3BpcGUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXg0LXVwc2NhbGVyJTIyJTJDJTIwKipzYWZldHlfbW9kdWxlcyUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEFzdXBlcl9yZXNfMl9waXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBaW1hZ2UlMjAlM0QlMjBzdXBlcl9yZXNfMl9waXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMGltYWdlJTNEaW1hZ2UlMkMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",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(){f=i("p"),f.textContent=w,M=a(),r(_.$$.fragment)},l(o){f=p(o,"P",{"data-svelte-h":!0}),y(f)!=="svelte-kvfsh7"&&(f.textContent=w),M=l(o),c(_.$$.fragment,o)},m(o,I){s(o,f,I),s(o,M,I),d(_,o,I),b=!0},p:At,i(o){b||(m(_.$$.fragment,o),b=!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zJTJDJTIwb3V0cHV0X3R5cGUlM0QlMjJwdCUyMikuaW1hZ2VzJTBBJTBBJTIzJTIwc2F2ZSUyMGludGVybWVkaWF0ZSUyMGltYWdlJTBBcGlsX2ltYWdlJTIwJTNEJTIwcHRfdG9fcGlsKGltYWdlKSUwQXBpbF9pbWFnZSU1QjAlNUQuc2F2ZSglMjIuJTJGaWZfc3RhZ2VfSS5wbmclMjIpJTBBJTBBc3VwZXJfcmVzXzFfcGlwZSUyMCUzRCUyMElGU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMkRlZXBGbG95ZCUyRklGLUlJLUwtdjEuMCUyMiUyQyUyMHRleHRfZW5jb2RlciUzRE5vbmUlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEFzdXBlcl9yZXNfMV9waXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBaW1hZ2UlMjAlM0QlMjBzdXBlcl9yZXNfMV9waXBlKCUwQSUyMCUyMCUyMCUyMGltYWdlJTNEaW1hZ2UlMkMlMjBwcm9tcHRfZW1iZWRzJTNEcHJvbXB0X2VtYmVkcyUyQyUyMG5lZ2F0aXZlX3Byb21wdF9lbWJlZHMlM0RuZWdhdGl2ZV9lbWJlZHMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",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(){f=i("p"),f.textContent=w,M=a(),r(_.$$.fragment)},l(o){f=p(o,"P",{"data-svelte-h":!0}),y(f)!=="svelte-kvfsh7"&&(f.textContent=w),M=l(o),c(_.$$.fragment,o)},m(o,I){s(o,f,I),s(o,M,I),d(_,o,I),b=!0},p:At,i(o){b||(m(_.$$.fragment,o),b=!0)},o(o){g(_.$$.fragment,o),b=!1},d(o){o&&(n(f),n(M)),u(_,o)}}}function Pa(j){let f,w="Examples:",M,_,b;return _=new J({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW1nMkltZ1BpcGVsaW5lJTJDJTIwSUZJbWcySW1nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUlMkMlMjBEaWZmdXNpb25QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBwdF90b19waWwlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSUyRkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uJTJGbWFpbiUyRmFzc2V0cyUyRnN0YWJsZS1zYW1wbGVzJTJGaW1nMmltZyUyRnNrZXRjaC1tb3VudGFpbnMtaW5wdXQuanBnJTIyJTBBcmVzcG9uc2UlMjAlM0QlMjByZXF1ZXN0cy5nZXQodXJsKSUwQW9yaWdpbmFsX2ltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihCeXRlc0lPKHJlc3BvbnNlLmNvbnRlbnQpKS5jb252ZXJ0KCUyMlJHQiUyMiklMEFvcmlnaW5hbF9pbWFnZSUyMCUzRCUyMG9yaWdpbm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JJbWdTdXBlclJlc29sdXRpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyRGVlcEZsb3lkJTJGSUYtSUktTC12MS4wJTIyJTJDJTBBJTIwJTIwJTIwJTIwdGV4dF9lbmNvZGVyJTNETm9uZSUyQyUwQSUyMCUyMCUyMCUyMHZhcmlhbnQlM0QlMjJmcDE2JTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTBBKSUwQXN1cGVyX3Jlc18xX3BpcGUuZW5hYmxlX21vZGVsX2NwdV9vZmZsb2FkKCklMEElMEFpbWFnZSUyMCUzRCUyMHN1cGVyX3Jlc18xX3BpcGUoJTBBJTIwJTIwJTIwJTIwaW1hZ2UlM0RpbWFnZSUyQyUwQSUyMCUyMCUyMCUyMG9yaWdpbmFsX2ltYWdlJTNEb3JpZ2luYWxfaW1hZ2UlMkMlMEElMjAlMjAlMjAlMjBwcm9tcHRfZW1iZWRzJTNEcHJvbXB0X2VtYmVkcyUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX3Byb21wdF9lbWJlZHMlM0RuZWdhdGl2ZV9lbWJlZHMlMkMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",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(){f=i("p"),f.textContent=w,M=a(),r(_.$$.fragment)},l(o){f=p(o,"P",{"data-svelte-h":!0}),y(f)!=="svelte-kvfsh7"&&(f.textContent=w),M=l(o),c(_.$$.fragment,o)},m(o,I){s(o,f,I),s(o,M,I),d(_,o,I),b=!0},p:At,i(o){b||(m(_.$$.fragment,o),b=!0)},o(o){g(_.$$.fragment,o),b=!1},d(o){o&&(n(f),n(M)),u(_,o)}}}function Ha(j){let f,w="Examples:",M,_,b;return _=new J({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW1nMkltZ1BpcGVsaW5lJTJDJTIwSUZJbWcySW1nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUlMkMlMjBEaWZ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hZ2UlM0RpbWFnZSUyQyUwQSUyMCUyMCUyMCUyMG9yaWdpbmFsX2ltYWdlJTNEb3JpZ2luYWxfaW1hZ2UlMkMlMEElMjAlMjAlMjAlMjBwcm9tcHRfZW1iZWRzJTNEcHJvbXB0X2VtYmVkcyUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX3Byb21wdF9lbWJlZHMlM0RuZWdhdGl2ZV9lbWJlZHMlMkMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",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(){f=i("p"),f.textContent=w,M=a(),r(_.$$.fragment)},l(o){f=p(o,"P",{"data-svelte-h":!0}),y(f)!=="svelte-kvfsh7"&&(f.textContent=w),M=l(o),c(_.$$.fragment,o)},m(o,I){s(o,f,I),s(o,M,I),d(_,o,I),b=!0},p:At,i(o){b||(m(_.$$.fragment,o),b=!0)},o(o){g(_.$$.fragment,o),b=!1},d(o){o&&(n(f),n(M)),u(_,o)}}}function za(j){let f,w="Examples:",M,_,b;return _=new J({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW5wYWludGluZ1BpcGVsaW5lJTJDJTIwSUZJbnBhaW50aW5nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUlMkMlMjBEaWZmdXNpb25QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBwdF90b19waWwlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmRpZmZ1c2VycyUyRmRvY3MtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZpZiUyRnBlcnNvbi5wbmclMjIlMEFyZXNwb25zZSUyMCUzRCUyMHJlcXVlc3RzLm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yMCUyMG5lZ2F0aXZlX3Byb21wdF9lbWJlZHMlM0RuZWdhdGl2ZV9lbWJlZHMlMkMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSS5wbmclMjIp",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(){f=i("p"),f.textContent=w,M=a(),r(_.$$.fragment)},l(o){f=p(o,"P",{"data-svelte-h":!0}),y(f)!=="svelte-kvfsh7"&&(f.textContent=w),M=l(o),c(_.$$.fragment,o)},m(o,I){s(o,f,I),s(o,M,I),d(_,o,I),b=!0},p:At,i(o){b||(m(_.$$.fragment,o),b=!0)},o(o){g(_.$$.fragment,o),b=!1},d(o){o&&(n(f),n(M)),u(_,o)}}}function La(j){let f,w="Examples:",M,_,b;return _=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(){f=i("p"),f.textContent=w,M=a(),r(_.$$.fragment)},l(o){f=p(o,"P",{"data-svelte-h":!0}),y(f)!=="svelte-kvfsh7"&&(f.textContent=w),M=l(o),c(_.$$.fragment,o)},m(o,I){s(o,f,I),s(o,M,I),d(_,o,I),b=!0},p:At,i(o){b||(m(_.$$.fragment,o),b=!0)},o(o){g(_.$$.fragment,o),b=!1},d(o){o&&(n(f),n(M)),u(_,o)}}}function qa(j){let f,w,M,_,b,o,I,Ot,se,qs=`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:`,en,ae,Ds=`<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>`,tn,le,nn,oe,As="Before you can use IF, you need to accept its usage conditions. To do so:",sn,ie,Ks='<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>',an,pe,ln,re,Os="run the login function in a Python shell",on,ce,pn,de,ea='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>.',rn,me,ta="Next we install <code>diffusers</code> and dependencies:",cn,ge,dn,ue,na="The following sections give more in-detail examples of how to use IF. Specifically:",mn,fe,sa='<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>',gn,he,aa="<strong>Available checkpoints</strong>",un,_e,la='<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>',fn,ye,oa='<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>',hn,be,ia='<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>',_n,Me,yn,Ie,pa=`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,we,Mn,Je,In,Ue,ra=`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/v0.22.1/en/api/pipelines/deepfloyd_if#diffusers.IFInpaintingPipeline">IFInpaintingPipeline</a> and <a href="/docs/diffusers/v0.22.1/en/api/pipelines/deepfloyd_if#diffusers.IFInpaintingSuperResolutionPipeline">IFInpaintingSuperResolutionPipeline</a> pipelines.`,wn,Te,ca=`<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>.`,Jn,Ze,Un,ve,Tn,je,da=`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/v0.22.1/en/api/pipelines/deepfloyd_if#diffusers.IFInpaintingPipeline">IFInpaintingPipeline</a> and <a href="/docs/diffusers/v0.22.1/en/api/pipelines/deepfloyd_if#diffusers.IFInpaintingSuperResolutionPipeline">IFInpaintingSuperResolutionPipeline</a> pipelines.`,Zn,Fe,ma=`<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>.`,vn,Be,jn,We,Fn,ke,ga="In addition to being loaded with <code>from_pretrained</code>, Pipelines can also be loaded directly from each other.",Bn,Ge,Wn,Xe,kn,Re,ua="The simplest optimization to run IF faster is to move all model components to the GPU.",Gn,Ce,Xn,xe,fa="You can also run the diffusion process for a shorter number of timesteps.",Rn,Ve,ha="This can either be done with the <code>num_inference_steps</code> argument",Cn,Se,xn,Ee,_a="Or with the <code>timesteps</code> argument",Vn,Ne,Sn,$e,ya=`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.`,En,Qe,Nn,Ye,ba=`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.`,$n,Pe,Qn,He,Yn,ze,Ma="When optimizing for GPU memory, we can use the standard diffusers cpu offloading APIs.",Pn,Le,Ia="Either the model based CPU offloading,",Hn,qe,zn,De,wa="or the more aggressive layer based CPU offloading.",Ln,Ae,qn,Ke,Ja="Additionally, T5 can be loaded in 8bit precision",Dn,Oe,An,et,Ua=`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.`,Kn,tt,On,nt,es,st,Ta='<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>',ts,at,ns,F,lt,bs,R,ot,Ms,Bt,Za="Function invoked when calling the pipeline for generation.",Is,P,ws,H,it,Js,Wt,va="Encodes the prompt into text encoder hidden states.",ss,pt,as,B,rt,Us,C,ct,Ts,kt,ja="Function invoked when calling the pipeline for generation.",Zs,z,vs,L,dt,js,Gt,Fa="Encodes the prompt into text encoder hidden states.",ls,mt,os,W,gt,Fs,x,ut,Bs,Xt,Ba="Function invoked when calling the pipeline for generation.",Ws,q,ks,D,ft,Gs,Rt,Wa="Encodes the prompt into text encoder hidden states.",is,ht,ps,k,_t,Xs,V,yt,Rs,Ct,ka="Function invoked when calling the pipeline for generation.",Cs,A,xs,K,bt,Vs,xt,Ga="Encodes the prompt into text encoder hidden states.",rs,Mt,cs,G,It,Ss,S,wt,Es,Vt,Xa="Function invoked when calling the pipeline for generation.",Ns,O,$s,ee,Jt,Qs,St,Ra="Encodes the prompt into text encoder hidden states.",ds,Ut,ms,X,Tt,Ys,E,Zt,Ps,Et,Ca="Function invoked when calling the pipeline for generation.",Hs,te,zs,ne,vt,Ls,Nt,xa="Encodes the prompt into text encoder hidden states.",gs,Kt,us;return b=new v({props:{title:"DeepFloyd IF",local:"deepfloyd-if",headingTag:"h1"}}),I=new v({props:{title:"Overview",local:"overview",headingTag:"h2"}}),le=new v({props:{title:"Usage",local:"usage",headingTag:"h2"}}),pe=new J({props:{code:"cGlwJTIwaW5zdGFsbCUyMGh1Z2dpbmdmYWNlX2h1YiUyMC0tdXBncmFkZQ==",highlighted:"pip install huggingface_hub --upgrade",wrap:!1}}),ce=new J({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGxvZ2luJTBBJTBBbG9naW4oKQ==",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> login

login()`,wrap:!1}}),ge=new J({props:{code:"cGlwJTIwaW5zdGFsbCUyMGRpZmZ1c2VycyUyMGFjY2VsZXJhdGUlMjB0cmFuc2Zvcm1lcnMlMjBzYWZldGVuc29ycw==",highlighted:"pip install diffusers accelerate transformers safetensors",wrap:!1}}),Me=new v({props:{title:"Text-to-Image Generation",local:"text-to-image-generation",headingTag:"h3"}}),we=new J({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMHB0X3RvX3BpbCUwQWltcG9ydCUyMHRvcmNoJTBBJTBBJTIzJTIwc3RhZ2UlMjAxJTBBc3RhZ2VfMSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJEZWVwRmxveWQlMkZJRi1JLVhMLXYxLjAlMjIlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFzdGFnZV8xLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBJTIzJTIwc3RhZ2UlMjAyJTBBc3RhZ2VfMiUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5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Quc2F2ZSglMjIuJTJGaWZfc3RhZ2VfSUkucG5nJTIyKSUwQSUwQSUyMyUyMHN0YWdlJTIwMyUwQWltYWdlJTIwJTNEJTIwc3RhZ2VfMyhwcm9tcHQlM0Rwcm9tcHQlMkMlMjBpbWFnZSUzRGltYWdlJTJDJTIwbm9pc2VfbGV2ZWwlM0QxMDAlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMi4lMkZpZl9zdGFnZV9JSUkucG5nJTIyKQ==",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}}),Je=new v({props:{title:"Text Guided Image-to-Image Generation",local:"text-guided-image-to-image-generation",headingTag:"h3"}}),Ze=new J({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW1nMkltZ1BpcGVsaW5lJTJDJTIwSUZJbWcySW1nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUlMkMlMjBEaWZmdXNpb25QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBwdF90b19waWwlMEElMEFpbXBvcnQlMjB0b3JjaCUwQSUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQSUwQSUyMyUyMGRvd25sb2FkJTIwaW1hZ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JTJGaWZfc3RhZ2VfSUlJLnBuZyUyMik=",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}}),ve=new v({props:{title:"Text Guided Inpainting Generation",local:"text-guided-inpainting-generation",headingTag:"h3"}}),Be=new J({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGSW5wYWludGluZ1BpcGVsaW5lJTJDJTIwSUZJbnBhaW50aW5nU3VwZXJSZXNvbHV0aW9uUGlwZWxpbmUlMkMlMjBEaWZmdXNpb25QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBwdF90b19waWwlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBZnJ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YXRpdmVfcHJvbXB0X2VtYmVkcyUzRG5lZ2F0aXZlX2VtYmVkcyUyQyUwQSUyMCUyMCUyMCUyMGdlbmVyYXRvciUzRGdlbmVyYXRvciUyQyUwQSUyMCUyMCUyMCUyMG91dHB1dF90eXBlJTNEJTIycHQlMjIlMkMlMEEpLmltYWdlcyUwQXB0X3RvX3BpbChpbWFnZSklNUIwJTVELnNhdmUoJTIyLiUyRmlmX3N0YWdlX0lJLnBuZyUyMiklMEElMEElMjMlMjBzdGFnZSUyMDMlMEFpbWFnZSUyMCUzRCUyMHN0YWdlXzMocHJvbXB0JTNEcHJvbXB0JTJDJTIwaW1hZ2UlM0RpbWFnZSUyQyUyMGdlbmVyYXRvciUzRGdlbmVyYXRvciUyQyUyMG5vaXNlX2xldmVsJTNEMTAwKS5pbWFnZXMlMEFpbWFnZSU1QjAlNUQuc2F2ZSglMjIuJTJGaWZfc3RhZ2VfSUlJLnBuZyUyMik=",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}}),We=new v({props:{title:"Converting between different pipelines",local:"converting-between-different-pipelines",headingTag:"h3"}}),Ge=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}}),Xe=new v({props:{title:"Optimizing for speed",local:"optimizing-for-speed",headingTag:"h3"}}),Ce=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}}),Se=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}}),Ne=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}}),Qe=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}}),Pe=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}}),He=new v({props:{title:"Optimizing for memory",local:"optimizing-for-memory",headingTag:"h3"}}),qe=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}}),Ae=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}}),Oe=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}}),tt=new J({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMElGUGlwZWxpbmUlMkMlMjBJRlN1cGVyUmVzb2x1dGlvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBnYyUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjB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JTVELnNhdmUoJTIyLiUyRmlmX3N0YWdlX0lJLnBuZyUyMik=",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}}),nt=new v({props:{title:"Available Pipelines:",local:"available-pipelines",headingTag:"h2"}}),at=new v({props:{title:"IFPipeline",local:"diffusers.IFPipeline",headingTag:"h2"}}),lt=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/v0.22.1/src/diffusers/pipelines/deepfloyd_if/pipeline_if.py#L88"}}),ot=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 100) &#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.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.IFPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.IFPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.IFPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.IFPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.IFPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/v0.22.1/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.IFPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.IFPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.IFPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.IFPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.IFPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.IFPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.IFPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.IFPipeline.__call__.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the caption before creating embeddings. Requires <code>beautifulsoup4</code> and <code>ftfy</code> to
be installed. If the dependencies are not installed, the embeddings will be created from the raw
prompt.`,name:"clean_caption"},{anchor:"diffusers.IFPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"}],source:"https://github.com/huggingface/diffusers/blob/v0.22.1/src/diffusers/pipelines/deepfloyd_if/pipeline_if.py#L543",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>
`}}),P=new Dt({props:{anchor:"diffusers.IFPipeline.__call__.example",$$slots:{default:[Qa]},$$scope:{ctx:j}}}),it=new Z({props:{name:"encode_prompt",anchor:"diffusers.IFPipeline.encode_prompt",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"do_classifier_free_guidance",val:": bool = True"},{name:"num_images_per_prompt",val:": int = 1"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = 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"},{anchor:"diffusers.IFPipeline.encode_prompt.do_classifier_free_guidance",description:`<strong>do_classifier_free_guidance</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
whether to use classifier free guidance or not`,name:"do_classifier_free_guidance"},{anchor:"diffusers.IFPipeline.encode_prompt.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
number of images that should be generated per prompt
device &#x2014; (<code>torch.device</code>, <em>optional</em>):
torch device to place the resulting embeddings on`,name:"num_images_per_prompt"},{anchor:"diffusers.IFPipeline.encode_prompt.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. 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.encode_prompt.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.encode_prompt.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.encode_prompt.clean_caption",description:`<strong>clean_caption</strong> (bool, defaults to <code>False</code>) &#x2014;
If <code>True</code>, the function will preprocess and clean the provided caption before encoding.`,name:"clean_caption"}],source:"https://github.com/huggingface/diffusers/blob/v0.22.1/src/diffusers/pipelines/deepfloyd_if/pipeline_if.py#L161"}}),pt=new v({props:{title:"IFSuperResolutionPipeline",local:"diffusers.IFSuperResolutionPipeline",headingTag:"h2"}}),rt=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/v0.22.1/src/diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py#L73"}}),ct=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 None) &#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 None) &#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>, defaults to None) &#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 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/v0.22.1/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.noise_level",description:`<strong>noise_level</strong> (<code>int</code>, <em>optional</em>, defaults to 250) &#x2014;
The amount of noise to add to the upscaled image. Must be in the range <code>[0, 1000)</code>`,name:"noise_level"},{anchor:"diffusers.IFSuperResolutionPipeline.__call__.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the caption before creating embeddings. Requires <code>beautifulsoup4</code> and <code>ftfy</code> to
be installed. If the dependencies are not installed, the embeddings will be created from the raw
prompt.`,name:"clean_caption"}],source:"https://github.com/huggingface/diffusers/blob/v0.22.1/src/diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py#L610",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>
`}}),z=new Dt({props:{anchor:"diffusers.IFSuperResolutionPipeline.__call__.example",$$slots:{default:[Ya]},$$scope:{ctx:j}}}),dt=new Z({props:{name:"encode_prompt",anchor:"diffusers.IFSuperResolutionPipeline.encode_prompt",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"do_classifier_free_guidance",val:": bool = True"},{name:"num_images_per_prompt",val:": int = 1"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = 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"},{anchor:"diffusers.IFSuperResolutionPipeline.encode_prompt.do_classifier_free_guidance",description:`<strong>do_classifier_free_guidance</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
whether to use classifier free guidance or not`,name:"do_classifier_free_guidance"},{anchor:"diffusers.IFSuperResolutionPipeline.encode_prompt.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
number of images that should be generated per prompt
device &#x2014; (<code>torch.device</code>, <em>optional</em>):
torch device to place the resulting embeddings on`,name:"num_images_per_prompt"},{anchor:"diffusers.IFSuperResolutionPipeline.encode_prompt.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. 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.encode_prompt.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.encode_prompt.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.encode_prompt.clean_caption",description:`<strong>clean_caption</strong> (bool, defaults to <code>False</code>) &#x2014;
If <code>True</code>, the function will preprocess and clean the provided caption before encoding.`,name:"clean_caption"}],source:"https://github.com/huggingface/diffusers/blob/v0.22.1/src/diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py#L295"}}),mt=new v({props:{title:"IFImg2ImgPipeline",local:"diffusers.IFImg2ImgPipeline",headingTag:"h2"}}),gt=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/v0.22.1/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py#L112"}}),ut=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.7) &#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 80) &#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 10.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/v0.22.1/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the caption before creating embeddings. Requires <code>beautifulsoup4</code> and <code>ftfy</code> to
be installed. If the dependencies are not installed, the embeddings will be created from the raw
prompt.`,name:"clean_caption"},{anchor:"diffusers.IFImg2ImgPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"}],source:"https://github.com/huggingface/diffusers/blob/v0.22.1/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py#L655",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>
`}}),q=new Dt({props:{anchor:"diffusers.IFImg2ImgPipeline.__call__.example",$$slots:{default:[Pa]},$$scope:{ctx:j}}}),ft=new Z({props:{name:"encode_prompt",anchor:"diffusers.IFImg2ImgPipeline.encode_prompt",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"do_classifier_free_guidance",val:": bool = True"},{name:"num_images_per_prompt",val:": int = 1"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = 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"},{anchor:"diffusers.IFImg2ImgPipeline.encode_prompt.do_classifier_free_guidance",description:`<strong>do_classifier_free_guidance</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
whether to use classifier free guidance or not`,name:"do_classifier_free_guidance"},{anchor:"diffusers.IFImg2ImgPipeline.encode_prompt.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
number of images that should be generated per prompt
device &#x2014; (<code>torch.device</code>, <em>optional</em>):
torch device to place the resulting embeddings on`,name:"num_images_per_prompt"},{anchor:"diffusers.IFImg2ImgPipeline.encode_prompt.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. 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.encode_prompt.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.encode_prompt.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.encode_prompt.clean_caption",description:`<strong>clean_caption</strong> (bool, defaults to <code>False</code>) &#x2014;
If <code>True</code>, the function will preprocess and clean the provided caption before encoding.`,name:"clean_caption"}],source:"https://github.com/huggingface/diffusers/blob/v0.22.1/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img.py#L186"}}),ht=new v({props:{title:"IFImg2ImgSuperResolutionPipeline",local:"diffusers.IFImg2ImgSuperResolutionPipeline",headingTag:"h2"}}),_t=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/v0.22.1/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py#L115"}}),yt=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 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/v0.22.1/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.noise_level",description:`<strong>noise_level</strong> (<code>int</code>, <em>optional</em>, defaults to 250) &#x2014;
The amount of noise to add to the upscaled image. Must be in the range <code>[0, 1000)</code>`,name:"noise_level"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the caption before creating embeddings. Requires <code>beautifulsoup4</code> and <code>ftfy</code> to
be installed. If the dependencies are not installed, the embeddings will be created from the raw
prompt.`,name:"clean_caption"}],source:"https://github.com/huggingface/diffusers/blob/v0.22.1/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py#L738",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>
`}}),A=new Dt({props:{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.__call__.example",$$slots:{default:[Ha]},$$scope:{ctx:j}}}),bt=new Z({props:{name:"encode_prompt",anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.encode_prompt",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"do_classifier_free_guidance",val:": bool = True"},{name:"num_images_per_prompt",val:": int = 1"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = 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"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.encode_prompt.do_classifier_free_guidance",description:`<strong>do_classifier_free_guidance</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
whether to use classifier free guidance or not`,name:"do_classifier_free_guidance"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.encode_prompt.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
number of images that should be generated per prompt
device &#x2014; (<code>torch.device</code>, <em>optional</em>):
torch device to place the resulting embeddings on`,name:"num_images_per_prompt"},{anchor:"diffusers.IFImg2ImgSuperResolutionPipeline.encode_prompt.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. 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.encode_prompt.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.encode_prompt.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.encode_prompt.clean_caption",description:`<strong>clean_caption</strong> (bool, defaults to <code>False</code>) &#x2014;
If <code>True</code>, the function will preprocess and clean the provided caption before encoding.`,name:"clean_caption"}],source:"https://github.com/huggingface/diffusers/blob/v0.22.1/src/diffusers/pipelines/deepfloyd_if/pipeline_if_img2img_superresolution.py#L337"}}),Mt=new v({props:{title:"IFInpaintingPipeline",local:"diffusers.IFInpaintingPipeline",headingTag:"h2"}}),It=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/v0.22.1/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py#L115"}}),wt=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 1.0) &#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.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.IFInpaintingPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.IFInpaintingPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.IFInpaintingPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/v0.22.1/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.IFInpaintingPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.IFInpaintingPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.IFInpaintingPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.IFInpaintingPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.IFInpaintingPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.IFInpaintingPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.IFInpaintingPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.IFInpaintingPipeline.__call__.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the caption before creating embeddings. Requires <code>beautifulsoup4</code> and <code>ftfy</code> to
be installed. If the dependencies are not installed, the embeddings will be created from the raw
prompt.`,name:"clean_caption"},{anchor:"diffusers.IFInpaintingPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"}],source:"https://github.com/huggingface/diffusers/blob/v0.22.1/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py#L748",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 Dt({props:{anchor:"diffusers.IFInpaintingPipeline.__call__.example",$$slots:{default:[za]},$$scope:{ctx:j}}}),Jt=new Z({props:{name:"encode_prompt",anchor:"diffusers.IFInpaintingPipeline.encode_prompt",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"do_classifier_free_guidance",val:": bool = True"},{name:"num_images_per_prompt",val:": int = 1"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = 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"},{anchor:"diffusers.IFInpaintingPipeline.encode_prompt.do_classifier_free_guidance",description:`<strong>do_classifier_free_guidance</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
whether to use classifier free guidance or not`,name:"do_classifier_free_guidance"},{anchor:"diffusers.IFInpaintingPipeline.encode_prompt.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
number of images that should be generated per prompt
device &#x2014; (<code>torch.device</code>, <em>optional</em>):
torch device to place the resulting embeddings on`,name:"num_images_per_prompt"},{anchor:"diffusers.IFInpaintingPipeline.encode_prompt.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. 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.encode_prompt.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.encode_prompt.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.encode_prompt.clean_caption",description:`<strong>clean_caption</strong> (bool, defaults to <code>False</code>) &#x2014;
If <code>True</code>, the function will preprocess and clean the provided caption before encoding.`,name:"clean_caption"}],source:"https://github.com/huggingface/diffusers/blob/v0.22.1/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting.py#L189"}}),Ut=new v({props:{title:"IFInpaintingSuperResolutionPipeline",local:"diffusers.IFInpaintingSuperResolutionPipeline",headingTag:"h2"}}),Tt=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/v0.22.1/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py#L117"}}),Zt=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 100) &#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 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/v0.22.1/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.noise_level",description:`<strong>noise_level</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The amount of noise to add to the upscaled image. Must be in the range <code>[0, 1000)</code>`,name:"noise_level"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the caption before creating embeddings. Requires <code>beautifulsoup4</code> and <code>ftfy</code> to
be installed. If the dependencies are not installed, the embeddings will be created from the raw
prompt.`,name:"clean_caption"}],source:"https://github.com/huggingface/diffusers/blob/v0.22.1/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py#L826",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 Dt({props:{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.__call__.example",$$slots:{default:[La]},$$scope:{ctx:j}}}),vt=new Z({props:{name:"encode_prompt",anchor:"diffusers.IFInpaintingSuperResolutionPipeline.encode_prompt",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"do_classifier_free_guidance",val:": bool = True"},{name:"num_images_per_prompt",val:": int = 1"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = 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"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.encode_prompt.do_classifier_free_guidance",description:`<strong>do_classifier_free_guidance</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
whether to use classifier free guidance or not`,name:"do_classifier_free_guidance"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.encode_prompt.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
number of images that should be generated per prompt
device &#x2014; (<code>torch.device</code>, <em>optional</em>):
torch device to place the resulting embeddings on`,name:"num_images_per_prompt"},{anchor:"diffusers.IFInpaintingSuperResolutionPipeline.encode_prompt.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. 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.encode_prompt.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.encode_prompt.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.encode_prompt.clean_caption",description:`<strong>clean_caption</strong> (bool, defaults to <code>False</code>) &#x2014;
If <code>True</code>, the function will preprocess and clean the provided caption before encoding.`,name:"clean_caption"}],source:"https://github.com/huggingface/diffusers/blob/v0.22.1/src/diffusers/pipelines/deepfloyd_if/pipeline_if_inpainting_superresolution.py#L339"}}),{c(){f=i("meta"),w=a(),M=i("p"),_=a(),r(b.$$.fragment),o=a(),r(I.$$.fragment),Ot=a(),se=i("p"),se.textContent=qs,en=a(),ae=i("ul"),ae.innerHTML=Ds,tn=a(),r(le.$$.fragment),nn=a(),oe=i("p"),oe.textContent=As,sn=a(),ie=i("ol"),ie.innerHTML=Ks,an=a(),r(pe.$$.fragment),ln=a(),re=i("p"),re.textContent=Os,on=a(),r(ce.$$.fragment),pn=a(),de=i("p"),de.innerHTML=ea,rn=a(),me=i("p"),me.innerHTML=ta,cn=a(),r(ge.$$.fragment),dn=a(),ue=i("p"),ue.textContent=na,mn=a(),fe=i("ul"),fe.innerHTML=sa,gn=a(),he=i("p"),he.innerHTML=aa,un=a(),_e=i("ul"),_e.innerHTML=la,fn=a(),ye=i("p"),ye.innerHTML=oa,hn=a(),be=i("p"),be.innerHTML=ia,_n=a(),r(Me.$$.fragment),yn=a(),Ie=i("p"),Ie.innerHTML=pa,bn=a(),r(we.$$.fragment),Mn=a(),r(Je.$$.fragment),In=a(),Ue=i("p"),Ue.innerHTML=ra,wn=a(),Te=i("p"),Te.innerHTML=ca,Jn=a(),r(Ze.$$.fragment),Un=a(),r(ve.$$.fragment),Tn=a(),je=i("p"),je.innerHTML=da,Zn=a(),Fe=i("p"),Fe.innerHTML=ma,vn=a(),r(Be.$$.fragment),jn=a(),r(We.$$.fragment),Fn=a(),ke=i("p"),ke.innerHTML=ga,Bn=a(),r(Ge.$$.fragment),Wn=a(),r(Xe.$$.fragment),kn=a(),Re=i("p"),Re.textContent=ua,Gn=a(),r(Ce.$$.fragment),Xn=a(),xe=i("p"),xe.textContent=fa,Rn=a(),Ve=i("p"),Ve.innerHTML=ha,Cn=a(),r(Se.$$.fragment),xn=a(),Ee=i("p"),Ee.innerHTML=_a,Vn=a(),r(Ne.$$.fragment),Sn=a(),$e=i("p"),$e.textContent=ya,En=a(),r(Qe.$$.fragment),Nn=a(),Ye=i("p"),Ye.innerHTML=ba,$n=a(),r(Pe.$$.fragment),Qn=a(),r(He.$$.fragment),Yn=a(),ze=i("p"),ze.textContent=Ma,Pn=a(),Le=i("p"),Le.textContent=Ia,Hn=a(),r(qe.$$.fragment),zn=a(),De=i("p"),De.textContent=wa,Ln=a(),r(Ae.$$.fragment),qn=a(),Ke=i("p"),Ke.textContent=Ja,Dn=a(),r(Oe.$$.fragment),An=a(),et=i("p"),et.textContent=Ua,Kn=a(),r(tt.$$.fragment),On=a(),r(nt.$$.fragment),es=a(),st=i("table"),st.innerHTML=Ta,ts=a(),r(at.$$.fragment),ns=a(),F=i("div"),r(lt.$$.fragment),bs=a(),R=i("div"),r(ot.$$.fragment),Ms=a(),Bt=i("p"),Bt.textContent=Za,Is=a(),r(P.$$.fragment),ws=a(),H=i("div"),r(it.$$.fragment),Js=a(),Wt=i("p"),Wt.textContent=va,ss=a(),r(pt.$$.fragment),as=a(),B=i("div"),r(rt.$$.fragment),Us=a(),C=i("div"),r(ct.$$.fragment),Ts=a(),kt=i("p"),kt.textContent=ja,Zs=a(),r(z.$$.fragment),vs=a(),L=i("div"),r(dt.$$.fragment),js=a(),Gt=i("p"),Gt.textContent=Fa,ls=a(),r(mt.$$.fragment),os=a(),W=i("div"),r(gt.$$.fragment),Fs=a(),x=i("div"),r(ut.$$.fragment),Bs=a(),Xt=i("p"),Xt.textContent=Ba,Ws=a(),r(q.$$.fragment),ks=a(),D=i("div"),r(ft.$$.fragment),Gs=a(),Rt=i("p"),Rt.textContent=Wa,is=a(),r(ht.$$.fragment),ps=a(),k=i("div"),r(_t.$$.fragment),Xs=a(),V=i("div"),r(yt.$$.fragment),Rs=a(),Ct=i("p"),Ct.textContent=ka,Cs=a(),r(A.$$.fragment),xs=a(),K=i("div"),r(bt.$$.fragment),Vs=a(),xt=i("p"),xt.textContent=Ga,rs=a(),r(Mt.$$.fragment),cs=a(),G=i("div"),r(It.$$.fragment),Ss=a(),S=i("div"),r(wt.$$.fragment),Es=a(),Vt=i("p"),Vt.textContent=Xa,Ns=a(),r(O.$$.fragment),$s=a(),ee=i("div"),r(Jt.$$.fragment),Qs=a(),St=i("p"),St.textContent=Ra,ds=a(),r(Ut.$$.fragment),ms=a(),X=i("div"),r(Tt.$$.fragment),Ys=a(),E=i("div"),r(Zt.$$.fragment),Ps=a(),Et=i("p"),Et.textContent=Ca,Hs=a(),r(te.$$.fragment),zs=a(),ne=i("div"),r(vt.$$.fragment),Ls=a(),Nt=i("p"),Nt.textContent=xa,gs=a(),Kt=i("p"),this.h()},l(e){const t=$a("svelte-u9bgzb",document.head);f=p(t,"META",{name:!0,content:!0}),t.forEach(n),w=l(e),M=p(e,"P",{}),U(M).forEach(n),_=l(e),c(b.$$.fragment,e),o=l(e),c(I.$$.fragment,e),Ot=l(e),se=p(e,"P",{"data-svelte-h":!0}),y(se)!=="svelte-c4me6q"&&(se.textContent=qs),en=l(e),ae=p(e,"UL",{"data-svelte-h":!0}),y(ae)!=="svelte-1h2dubh"&&(ae.innerHTML=Ds),tn=l(e),c(le.$$.fragment,e),nn=l(e),oe=p(e,"P",{"data-svelte-h":!0}),y(oe)!=="svelte-13gixbp"&&(oe.textContent=As),sn=l(e),ie=p(e,"OL",{"data-svelte-h":!0}),y(ie)!=="svelte-ncqy1d"&&(ie.innerHTML=Ks),an=l(e),c(pe.$$.fragment,e),ln=l(e),re=p(e,"P",{"data-svelte-h":!0}),y(re)!=="svelte-c23017"&&(re.textContent=Os),on=l(e),c(ce.$$.fragment,e),pn=l(e),de=p(e,"P",{"data-svelte-h":!0}),y(de)!=="svelte-1vhgvls"&&(de.innerHTML=ea),rn=l(e),me=p(e,"P",{"data-svelte-h":!0}),y(me)!=="svelte-13wvpdg"&&(me.innerHTML=ta),cn=l(e),c(ge.$$.fragment,e),dn=l(e),ue=p(e,"P",{"data-svelte-h":!0}),y(ue)!=="svelte-12efsp0"&&(ue.textContent=na),mn=l(e),fe=p(e,"UL",{"data-svelte-h":!0}),y(fe)!=="svelte-1j0zpko"&&(fe.innerHTML=sa),gn=l(e),he=p(e,"P",{"data-svelte-h":!0}),y(he)!=="svelte-6cosrd"&&(he.innerHTML=aa),un=l(e),_e=p(e,"UL",{"data-svelte-h":!0}),y(_e)!=="svelte-1bclroz"&&(_e.innerHTML=la),fn=l(e),ye=p(e,"P",{"data-svelte-h":!0}),y(ye)!=="svelte-nlmdc2"&&(ye.innerHTML=oa),hn=l(e),be=p(e,"P",{"data-svelte-h":!0}),y(be)!=="svelte-10fuv2z"&&(be.innerHTML=ia),_n=l(e),c(Me.$$.fragment,e),yn=l(e),Ie=p(e,"P",{"data-svelte-h":!0}),y(Ie)!=="svelte-1n32c9"&&(Ie.innerHTML=pa),bn=l(e),c(we.$$.fragment,e),Mn=l(e),c(Je.$$.fragment,e),In=l(e),Ue=p(e,"P",{"data-svelte-h":!0}),y(Ue)!=="svelte-df40eu"&&(Ue.innerHTML=ra),wn=l(e),Te=p(e,"P",{"data-svelte-h":!0}),y(Te)!=="svelte-8txrxq"&&(Te.innerHTML=ca),Jn=l(e),c(Ze.$$.fragment,e),Un=l(e),c(ve.$$.fragment,e),Tn=l(e),je=p(e,"P",{"data-svelte-h":!0}),y(je)!=="svelte-df40eu"&&(je.innerHTML=da),Zn=l(e),Fe=p(e,"P",{"data-svelte-h":!0}),y(Fe)!=="svelte-8txrxq"&&(Fe.innerHTML=ma),vn=l(e),c(Be.$$.fragment,e),jn=l(e),c(We.$$.fragment,e),Fn=l(e),ke=p(e,"P",{"data-svelte-h":!0}),y(ke)!=="svelte-yqwmip"&&(ke.innerHTML=ga),Bn=l(e),c(Ge.$$.fragment,e),Wn=l(e),c(Xe.$$.fragment,e),kn=l(e),Re=p(e,"P",{"data-svelte-h":!0}),y(Re)!=="svelte-15gngr3"&&(Re.textContent=ua),Gn=l(e),c(Ce.$$.fragment,e),Xn=l(e),xe=p(e,"P",{"data-svelte-h":!0}),y(xe)!=="svelte-12zfq1b"&&(xe.textContent=fa),Rn=l(e),Ve=p(e,"P",{"data-svelte-h":!0}),y(Ve)!=="svelte-l4rs7z"&&(Ve.innerHTML=ha),Cn=l(e),c(Se.$$.fragment,e),xn=l(e),Ee=p(e,"P",{"data-svelte-h":!0}),y(Ee)!=="svelte-qbsilq"&&(Ee.innerHTML=_a),Vn=l(e),c(Ne.$$.fragment,e),Sn=l(e),$e=p(e,"P",{"data-svelte-h":!0}),y($e)!=="svelte-vis4py"&&($e.textContent=ya),En=l(e),c(Qe.$$.fragment,e),Nn=l(e),Ye=p(e,"P",{"data-svelte-h":!0}),y(Ye)!=="svelte-zgpgf0"&&(Ye.innerHTML=ba),$n=l(e),c(Pe.$$.fragment,e),Qn=l(e),c(He.$$.fragment,e),Yn=l(e),ze=p(e,"P",{"data-svelte-h":!0}),y(ze)!=="svelte-moep0m"&&(ze.textContent=Ma),Pn=l(e),Le=p(e,"P",{"data-svelte-h":!0}),y(Le)!=="svelte-6d4mux"&&(Le.textContent=Ia),Hn=l(e),c(qe.$$.fragment,e),zn=l(e),De=p(e,"P",{"data-svelte-h":!0}),y(De)!=="svelte-mhfn46"&&(De.textContent=wa),Ln=l(e),c(Ae.$$.fragment,e),qn=l(e),Ke=p(e,"P",{"data-svelte-h":!0}),y(Ke)!=="svelte-b2fswh"&&(Ke.textContent=Ja),Dn=l(e),c(Oe.$$.fragment,e),An=l(e),et=p(e,"P",{"data-svelte-h":!0}),y(et)!=="svelte-5tea4"&&(et.textContent=Ua),Kn=l(e),c(tt.$$.fragment,e),On=l(e),c(nt.$$.fragment,e),es=l(e),st=p(e,"TABLE",{"data-svelte-h":!0}),y(st)!=="svelte-791aqo"&&(st.innerHTML=Ta),ts=l(e),c(at.$$.fragment,e),ns=l(e),F=p(e,"DIV",{class:!0});var N=U(F);c(lt.$$.fragment,N),bs=l(N),R=p(N,"DIV",{class:!0});var $=U(R);c(ot.$$.fragment,$),Ms=l($),Bt=p($,"P",{"data-svelte-h":!0}),y(Bt)!=="svelte-v78lg8"&&(Bt.textContent=Za),Is=l($),c(P.$$.fragment,$),$.forEach(n),ws=l(N),H=p(N,"DIV",{class:!0});var jt=U(H);c(it.$$.fragment,jt),Js=l(jt),Wt=p(jt,"P",{"data-svelte-h":!0}),y(Wt)!=="svelte-16q0ax1"&&(Wt.textContent=va),jt.forEach(n),N.forEach(n),ss=l(e),c(pt.$$.fragment,e),as=l(e),B=p(e,"DIV",{class:!0});var Q=U(B);c(rt.$$.fragment,Q),Us=l(Q),C=p(Q,"DIV",{class:!0});var Y=U(C);c(ct.$$.fragment,Y),Ts=l(Y),kt=p(Y,"P",{"data-svelte-h":!0}),y(kt)!=="svelte-v78lg8"&&(kt.textContent=ja),Zs=l(Y),c(z.$$.fragment,Y),Y.forEach(n),vs=l(Q),L=p(Q,"DIV",{class:!0});var Ft=U(L);c(dt.$$.fragment,Ft),js=l(Ft),Gt=p(Ft,"P",{"data-svelte-h":!0}),y(Gt)!=="svelte-16q0ax1"&&(Gt.textContent=Fa),Ft.forEach(n),Q.forEach(n),ls=l(e),c(mt.$$.fragment,e),os=l(e),W=p(e,"DIV",{class:!0});var $t=U(W);c(gt.$$.fragment,$t),Fs=l($t),x=p($t,"DIV",{class:!0});var Qt=U(x);c(ut.$$.fragment,Qt),Bs=l(Qt),Xt=p(Qt,"P",{"data-svelte-h":!0}),y(Xt)!=="svelte-v78lg8"&&(Xt.textContent=Ba),Ws=l(Qt),c(q.$$.fragment,Qt),Qt.forEach(n),ks=l($t),D=p($t,"DIV",{class:!0});var fs=U(D);c(ft.$$.fragment,fs),Gs=l(fs),Rt=p(fs,"P",{"data-svelte-h":!0}),y(Rt)!=="svelte-16q0ax1"&&(Rt.textContent=Wa),fs.forEach(n),$t.forEach(n),is=l(e),c(ht.$$.fragment,e),ps=l(e),k=p(e,"DIV",{class:!0});var Yt=U(k);c(_t.$$.fragment,Yt),Xs=l(Yt),V=p(Yt,"DIV",{class:!0});var Pt=U(V);c(yt.$$.fragment,Pt),Rs=l(Pt),Ct=p(Pt,"P",{"data-svelte-h":!0}),y(Ct)!=="svelte-v78lg8"&&(Ct.textContent=ka),Cs=l(Pt),c(A.$$.fragment,Pt),Pt.forEach(n),xs=l(Yt),K=p(Yt,"DIV",{class:!0});var hs=U(K);c(bt.$$.fragment,hs),Vs=l(hs),xt=p(hs,"P",{"data-svelte-h":!0}),y(xt)!=="svelte-16q0ax1"&&(xt.textContent=Ga),hs.forEach(n),Yt.forEach(n),rs=l(e),c(Mt.$$.fragment,e),cs=l(e),G=p(e,"DIV",{class:!0});var Ht=U(G);c(It.$$.fragment,Ht),Ss=l(Ht),S=p(Ht,"DIV",{class:!0});var zt=U(S);c(wt.$$.fragment,zt),Es=l(zt),Vt=p(zt,"P",{"data-svelte-h":!0}),y(Vt)!=="svelte-v78lg8"&&(Vt.textContent=Xa),Ns=l(zt),c(O.$$.fragment,zt),zt.forEach(n),$s=l(Ht),ee=p(Ht,"DIV",{class:!0});var _s=U(ee);c(Jt.$$.fragment,_s),Qs=l(_s),St=p(_s,"P",{"data-svelte-h":!0}),y(St)!=="svelte-16q0ax1"&&(St.textContent=Ra),_s.forEach(n),Ht.forEach(n),ds=l(e),c(Ut.$$.fragment,e),ms=l(e),X=p(e,"DIV",{class:!0});var Lt=U(X);c(Tt.$$.fragment,Lt),Ys=l(Lt),E=p(Lt,"DIV",{class:!0});var qt=U(E);c(Zt.$$.fragment,qt),Ps=l(qt),Et=p(qt,"P",{"data-svelte-h":!0}),y(Et)!=="svelte-v78lg8"&&(Et.textContent=Ca),Hs=l(qt),c(te.$$.fragment,qt),qt.forEach(n),zs=l(Lt),ne=p(Lt,"DIV",{class:!0});var ys=U(ne);c(vt.$$.fragment,ys),Ls=l(ys),Nt=p(ys,"P",{"data-svelte-h":!0}),y(Nt)!=="svelte-16q0ax1"&&(Nt.textContent=xa),ys.forEach(n),Lt.forEach(n),gs=l(e),Kt=p(e,"P",{}),U(Kt).forEach(n),this.h()},h(){T(f,"name","hf:doc:metadata"),T(f,"content",Da),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(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(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(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(L,"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(D,"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(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(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(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(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(ee,"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(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(ne,"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){h(document.head,f),s(e,w,t),s(e,M,t),s(e,_,t),d(b,e,t),s(e,o,t),d(I,e,t),s(e,Ot,t),s(e,se,t),s(e,en,t),s(e,ae,t),s(e,tn,t),d(le,e,t),s(e,nn,t),s(e,oe,t),s(e,sn,t),s(e,ie,t),s(e,an,t),d(pe,e,t),s(e,ln,t),s(e,re,t),s(e,on,t),d(ce,e,t),s(e,pn,t),s(e,de,t),s(e,rn,t),s(e,me,t),s(e,cn,t),d(ge,e,t),s(e,dn,t),s(e,ue,t),s(e,mn,t),s(e,fe,t),s(e,gn,t),s(e,he,t),s(e,un,t),s(e,_e,t),s(e,fn,t),s(e,ye,t),s(e,hn,t),s(e,be,t),s(e,_n,t),d(Me,e,t),s(e,yn,t),s(e,Ie,t),s(e,bn,t),d(we,e,t),s(e,Mn,t),d(Je,e,t),s(e,In,t),s(e,Ue,t),s(e,wn,t),s(e,Te,t),s(e,Jn,t),d(Ze,e,t),s(e,Un,t),d(ve,e,t),s(e,Tn,t),s(e,je,t),s(e,Zn,t),s(e,Fe,t),s(e,vn,t),d(Be,e,t),s(e,jn,t),d(We,e,t),s(e,Fn,t),s(e,ke,t),s(e,Bn,t),d(Ge,e,t),s(e,Wn,t),d(Xe,e,t),s(e,kn,t),s(e,Re,t),s(e,Gn,t),d(Ce,e,t),s(e,Xn,t),s(e,xe,t),s(e,Rn,t),s(e,Ve,t),s(e,Cn,t),d(Se,e,t),s(e,xn,t),s(e,Ee,t),s(e,Vn,t),d(Ne,e,t),s(e,Sn,t),s(e,$e,t),s(e,En,t),d(Qe,e,t),s(e,Nn,t),s(e,Ye,t),s(e,$n,t),d(Pe,e,t),s(e,Qn,t),d(He,e,t),s(e,Yn,t),s(e,ze,t),s(e,Pn,t),s(e,Le,t),s(e,Hn,t),d(qe,e,t),s(e,zn,t),s(e,De,t),s(e,Ln,t),d(Ae,e,t),s(e,qn,t),s(e,Ke,t),s(e,Dn,t),d(Oe,e,t),s(e,An,t),s(e,et,t),s(e,Kn,t),d(tt,e,t),s(e,On,t),d(nt,e,t),s(e,es,t),s(e,st,t),s(e,ts,t),d(at,e,t),s(e,ns,t),s(e,F,t),d(lt,F,null),h(F,bs),h(F,R),d(ot,R,null),h(R,Ms),h(R,Bt),h(R,Is),d(P,R,null),h(F,ws),h(F,H),d(it,H,null),h(H,Js),h(H,Wt),s(e,ss,t),d(pt,e,t),s(e,as,t),s(e,B,t),d(rt,B,null),h(B,Us),h(B,C),d(ct,C,null),h(C,Ts),h(C,kt),h(C,Zs),d(z,C,null),h(B,vs),h(B,L),d(dt,L,null),h(L,js),h(L,Gt),s(e,ls,t),d(mt,e,t),s(e,os,t),s(e,W,t),d(gt,W,null),h(W,Fs),h(W,x),d(ut,x,null),h(x,Bs),h(x,Xt),h(x,Ws),d(q,x,null),h(W,ks),h(W,D),d(ft,D,null),h(D,Gs),h(D,Rt),s(e,is,t),d(ht,e,t),s(e,ps,t),s(e,k,t),d(_t,k,null),h(k,Xs),h(k,V),d(yt,V,null),h(V,Rs),h(V,Ct),h(V,Cs),d(A,V,null),h(k,xs),h(k,K),d(bt,K,null),h(K,Vs),h(K,xt),s(e,rs,t),d(Mt,e,t),s(e,cs,t),s(e,G,t),d(It,G,null),h(G,Ss),h(G,S),d(wt,S,null),h(S,Es),h(S,Vt),h(S,Ns),d(O,S,null),h(G,$s),h(G,ee),d(Jt,ee,null),h(ee,Qs),h(ee,St),s(e,ds,t),d(Ut,e,t),s(e,ms,t),s(e,X,t),d(Tt,X,null),h(X,Ys),h(X,E),d(Zt,E,null),h(E,Ps),h(E,Et),h(E,Hs),d(te,E,null),h(X,zs),h(X,ne),d(vt,ne,null),h(ne,Ls),h(ne,Nt),s(e,gs,t),s(e,Kt,t),us=!0},p(e,[t]){const N={};t&2&&(N.$$scope={dirty:t,ctx:e}),P.$set(N);const $={};t&2&&($.$$scope={dirty:t,ctx:e}),z.$set($);const jt={};t&2&&(jt.$$scope={dirty:t,ctx:e}),q.$set(jt);const Q={};t&2&&(Q.$$scope={dirty:t,ctx:e}),A.$set(Q);const Y={};t&2&&(Y.$$scope={dirty:t,ctx:e}),O.$set(Y);const Ft={};t&2&&(Ft.$$scope={dirty:t,ctx:e}),te.$set(Ft)},i(e){us||(m(b.$$.fragment,e),m(I.$$.fragment,e),m(le.$$.fragment,e),m(pe.$$.fragment,e),m(ce.$$.fragment,e),m(ge.$$.fragment,e),m(Me.$$.fragment,e),m(we.$$.fragment,e),m(Je.$$.fragment,e),m(Ze.$$.fragment,e),m(ve.$$.fragment,e),m(Be.$$.fragment,e),m(We.$$.fragment,e),m(Ge.$$.fragment,e),m(Xe.$$.fragment,e),m(Ce.$$.fragment,e),m(Se.$$.fragment,e),m(Ne.$$.fragment,e),m(Qe.$$.fragment,e),m(Pe.$$.fragment,e),m(He.$$.fragment,e),m(qe.$$.fragment,e),m(Ae.$$.fragment,e),m(Oe.$$.fragment,e),m(tt.$$.fragment,e),m(nt.$$.fragment,e),m(at.$$.fragment,e),m(lt.$$.fragment,e),m(ot.$$.fragment,e),m(P.$$.fragment,e),m(it.$$.fragment,e),m(pt.$$.fragment,e),m(rt.$$.fragment,e),m(ct.$$.fragment,e),m(z.$$.fragment,e),m(dt.$$.fragment,e),m(mt.$$.fragment,e),m(gt.$$.fragment,e),m(ut.$$.fragment,e),m(q.$$.fragment,e),m(ft.$$.fragment,e),m(ht.$$.fragment,e),m(_t.$$.fragment,e),m(yt.$$.fragment,e),m(A.$$.fragment,e),m(bt.$$.fragment,e),m(Mt.$$.fragment,e),m(It.$$.fragment,e),m(wt.$$.fragment,e),m(O.$$.fragment,e),m(Jt.$$.fragment,e),m(Ut.$$.fragment,e),m(Tt.$$.fragment,e),m(Zt.$$.fragment,e),m(te.$$.fragment,e),m(vt.$$.fragment,e),us=!0)},o(e){g(b.$$.fragment,e),g(I.$$.fragment,e),g(le.$$.fragment,e),g(pe.$$.fragment,e),g(ce.$$.fragment,e),g(ge.$$.fragment,e),g(Me.$$.fragment,e),g(we.$$.fragment,e),g(Je.$$.fragment,e),g(Ze.$$.fragment,e),g(ve.$$.fragment,e),g(Be.$$.fragment,e),g(We.$$.fragment,e),g(Ge.$$.fragment,e),g(Xe.$$.fragment,e),g(Ce.$$.fragment,e),g(Se.$$.fragment,e),g(Ne.$$.fragment,e),g(Qe.$$.fragment,e),g(Pe.$$.fragment,e),g(He.$$.fragment,e),g(qe.$$.fragment,e),g(Ae.$$.fragment,e),g(Oe.$$.fragment,e),g(tt.$$.fragment,e),g(nt.$$.fragment,e),g(at.$$.fragment,e),g(lt.$$.fragment,e),g(ot.$$.fragment,e),g(P.$$.fragment,e),g(it.$$.fragment,e),g(pt.$$.fragment,e),g(rt.$$.fragment,e),g(ct.$$.fragment,e),g(z.$$.fragment,e),g(dt.$$.fragment,e),g(mt.$$.fragment,e),g(gt.$$.fragment,e),g(ut.$$.fragment,e),g(q.$$.fragment,e),g(ft.$$.fragment,e),g(ht.$$.fragment,e),g(_t.$$.fragment,e),g(yt.$$.fragment,e),g(A.$$.fragment,e),g(bt.$$.fragment,e),g(Mt.$$.fragment,e),g(It.$$.fragment,e),g(wt.$$.fragment,e),g(O.$$.fragment,e),g(Jt.$$.fragment,e),g(Ut.$$.fragment,e),g(Tt.$$.fragment,e),g(Zt.$$.fragment,e),g(te.$$.fragment,e),g(vt.$$.fragment,e),us=!1},d(e){e&&(n(w),n(M),n(_),n(o),n(Ot),n(se),n(en),n(ae),n(tn),n(nn),n(oe),n(sn),n(ie),n(an),n(ln),n(re),n(on),n(pn),n(de),n(rn),n(me),n(cn),n(dn),n(ue),n(mn),n(fe),n(gn),n(he),n(un),n(_e),n(fn),n(ye),n(hn),n(be),n(_n),n(yn),n(Ie),n(bn),n(Mn),n(In),n(Ue),n(wn),n(Te),n(Jn),n(Un),n(Tn),n(je),n(Zn),n(Fe),n(vn),n(jn),n(Fn),n(ke),n(Bn),n(Wn),n(kn),n(Re),n(Gn),n(Xn),n(xe),n(Rn),n(Ve),n(Cn),n(xn),n(Ee),n(Vn),n(Sn),n($e),n(En),n(Nn),n(Ye),n($n),n(Qn),n(Yn),n(ze),n(Pn),n(Le),n(Hn),n(zn),n(De),n(Ln),n(qn),n(Ke),n(Dn),n(An),n(et),n(Kn),n(On),n(es),n(st),n(ts),n(ns),n(F),n(ss),n(as),n(B),n(ls),n(os),n(W),n(is),n(ps),n(k),n(rs),n(cs),n(G),n(ds),n(ms),n(X),n(gs),n(Kt)),n(f),u(b,e),u(I,e),u(le,e),u(pe,e),u(ce,e),u(ge,e),u(Me,e),u(we,e),u(Je,e),u(Ze,e),u(ve,e),u(Be,e),u(We,e),u(Ge,e),u(Xe,e),u(Ce,e),u(Se,e),u(Ne,e),u(Qe,e),u(Pe,e),u(He,e),u(qe,e),u(Ae,e),u(Oe,e),u(tt,e),u(nt,e),u(at,e),u(lt),u(ot),u(P),u(it),u(pt,e),u(rt),u(ct),u(z),u(dt),u(mt,e),u(gt),u(ut),u(q),u(ft),u(ht,e),u(_t),u(yt),u(A),u(bt),u(Mt,e),u(It),u(wt),u(O),u(Jt),u(Ut,e),u(Tt),u(Zt),u(te),u(vt)}}}const Da='{"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 Aa(j){return Sa(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class al extends Ea{constructor(f){super(),Na(this,f,Aa,qa,Va,{})}}export{al as component};
