import{S as nr,i as or,s as sr,e as s,k as c,w,t as r,M as ar,c as a,d as n,m as p,a as i,x as v,h as l,b as g,G as e,g as y,y as I,q as x,o as M,B as T,v as ir,L as pt}from"../../../../chunks/vendor-hf-doc-builder.js";import{T as ni}from"../../../../chunks/Tip-hf-doc-builder.js";import{D as $}from"../../../../chunks/Docstring-hf-doc-builder.js";import{C as ft}from"../../../../chunks/CodeBlock-hf-doc-builder.js";import{I as jn}from"../../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ct}from"../../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function rr(j){let d,b,u,f,_;return{c(){d=s("p"),b=r("Make sure to check out the Stable Diffusion "),u=s("a"),f=r("Tips"),_=r(" section to learn how to explore the tradeoff between scheduler speed and quality, and how to reuse pipeline components efficiently!"),this.h()},l(o){d=a(o,"P",{});var m=i(d);b=l(m,"Make sure to check out the Stable Diffusion "),u=a(m,"A",{href:!0});var B=i(u);f=l(B,"Tips"),B.forEach(n),_=l(m," section to learn how to explore the tradeoff between scheduler speed and quality, and how to reuse pipeline components efficiently!"),m.forEach(n),this.h()},h(){g(u,"href","overview#tips")},m(o,m){y(o,d,m),e(d,b),e(d,u),e(u,f),e(d,_)},d(o){o&&n(d)}}}function lr(j){let d,b,u,f,_;return f=new ft({props:{code:"aW1wb3J0JTIwcmVxdWVzdHMlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWZyb20lMjBpbyUyMGltcG9ydCUyMEJ5dGVzSU8lMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uSW1nMkltZ1BpcGVsaW5lJTBBJTBBZGV2aWNlJTIwJTNEJTIwJTIyY3VkYSUyMiUwQW1vZGVsX2lkX29yX3BhdGglMjAlM0QlMjAlMjJydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUwQXBpcGUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25JbWcySW1nUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkX29yX3BhdGglMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZSUyMCUzRCUyMHBpcGUudG8oZGV2aWNlKSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSUyRkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uJTJGbWFpbiUyRmFzc2V0cyUyRnN0YWJsZS1zYW1wbGVzJTJGaW1nMmltZyUyRnNrZXRjaC1tb3VudGFpbnMtaW5wdXQuanBnJTIyJTBBJTBBcmVzcG9uc2UlMjAlM0QlMjByZXF1ZXN0cy5nZXQodXJsKSUwQWluaXRfaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKEJ5dGVzSU8ocmVzcG9uc2UuY29udGVudCkpLmNvbnZlcnQoJTIyUkdCJTIyKSUwQWluaXRfaW1hZ2UlMjAlM0QlMjBpbml0X2ltYWdlLnJlc2l6ZSgoNzY4JTJDJTIwNTEyKSklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJBJTIwZmFudGFzeSUyMGxhbmRzY2FwZSUyQyUyMHRyZW5kaW5nJTIwb24lMjBhcnRzdGF0aW9uJTIyJTBBJTBBaW1hZ2VzJTIwJTNEJTIwcGlwZShwcm9tcHQlM0Rwcm9tcHQlMkMlMjBpbWFnZSUzRGluaXRfaW1hZ2UlMkMlMjBzdHJlbmd0aCUzRDAuNzUlMkMlMjBndWlkYW5jZV9zY2FsZSUzRDcuNSkuaW1hZ2VzJTBBaW1hZ2VzJTVCMCU1RC5zYXZlKCUyMmZhbnRhc3lfbGFuZHNjYXBlLnBuZyUyMik=",highlighted:`<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">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">from</span> io <span class="hljs-keyword">import</span> BytesIO

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionImg2ImgPipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>device = <span class="hljs-string">&quot;cuda&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model_id_or_path = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = StableDiffusionImg2ImgPipeline.from_pretrained(model_id_or_path, torch_dtype=torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(device)

<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>init_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>init_image = init_image.resize((<span class="hljs-number">768</span>, <span class="hljs-number">512</span>))

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;A fantasy landscape, trending on artstation&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>images = pipe(prompt=prompt, image=init_image, strength=<span class="hljs-number">0.75</span>, guidance_scale=<span class="hljs-number">7.5</span>).images
<span class="hljs-meta">&gt;&gt;&gt; </span>images[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;fantasy_landscape.png&quot;</span>)`}}),{c(){d=s("p"),b=r("Examples:"),u=c(),w(f.$$.fragment)},l(o){d=a(o,"P",{});var m=i(d);b=l(m,"Examples:"),m.forEach(n),u=p(o),v(f.$$.fragment,o)},m(o,m){y(o,d,m),e(d,b),y(o,u,m),I(f,o,m),_=!0},p:pt,i(o){_||(x(f.$$.fragment,o),_=!0)},o(o){M(f.$$.fragment,o),_=!1},d(o){o&&n(d),o&&n(u),T(f,o)}}}function dr(j){let d,b,u,f,_;return{c(){d=s("p"),b=r("\u26A0\uFE0F Don\u2019t enable attention slicing if you\u2019re already using "),u=s("code"),f=r("scaled_dot_product_attention"),_=r(` (SDPA) from PyTorch
2.0 or xFormers. These attention computations are already very memory efficient so you won\u2019t need to enable
this function. If you enable attention slicing with SDPA or xFormers, it can lead to serious slow downs!`)},l(o){d=a(o,"P",{});var m=i(d);b=l(m,"\u26A0\uFE0F Don\u2019t enable attention slicing if you\u2019re already using "),u=a(m,"CODE",{});var B=i(u);f=l(B,"scaled_dot_product_attention"),B.forEach(n),_=l(m,` (SDPA) from PyTorch
2.0 or xFormers. These attention computations are already very memory efficient so you won\u2019t need to enable
this function. If you enable attention slicing with SDPA or xFormers, it can lead to serious slow downs!`),m.forEach(n)},m(o,m){y(o,d,m),e(d,b),e(d,u),e(u,f),e(d,_)},d(o){o&&n(d)}}}function cr(j){let d,b,u,f,_;return f=new ft({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFwaXBlJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTBBJTIwJTIwJTIwJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSUyQyUwQSklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJhJTIwcGhvdG8lMjBvZiUyMGFuJTIwYXN0cm9uYXV0JTIwcmlkaW5nJTIwYSUyMGhvcnNlJTIwb24lMjBtYXJzJTIyJTBBcGlwZS5lbmFibGVfYXR0ZW50aW9uX3NsaWNpbmcoKSUwQWltYWdlJTIwJTNEJTIwcGlwZShwcm9tcHQpLmltYWdlcyU1QjAlNUQ=",highlighted:`<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> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = StableDiffusionPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>,
<span class="hljs-meta">... </span>    torch_dtype=torch.float16,
<span class="hljs-meta">... </span>    use_safetensors=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;a photo of an astronaut riding a horse on mars&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.enable_attention_slicing()
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(prompt).images[<span class="hljs-number">0</span>]`}}),{c(){d=s("p"),b=r("Examples:"),u=c(),w(f.$$.fragment)},l(o){d=a(o,"P",{});var m=i(d);b=l(m,"Examples:"),m.forEach(n),u=p(o),v(f.$$.fragment,o)},m(o,m){y(o,d,m),e(d,b),y(o,u,m),I(f,o,m),_=!0},p:pt,i(o){_||(x(f.$$.fragment,o),_=!0)},o(o){M(f.$$.fragment,o),_=!1},d(o){o&&n(d),o&&n(u),T(f,o)}}}function pr(j){let d,b;return{c(){d=s("p"),b=r(`\u26A0\uFE0F When memory efficient attention and sliced attention are both enabled, memory efficient attention takes
precedent.`)},l(u){d=a(u,"P",{});var f=i(d);b=l(f,`\u26A0\uFE0F When memory efficient attention and sliced attention are both enabled, memory efficient attention takes
precedent.`),f.forEach(n)},m(u,f){y(u,d,f),e(d,b)},d(u){u&&n(d)}}}function fr(j){let d,b,u,f,_;return f=new ft({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEFmcm9tJTIweGZvcm1lcnMub3BzJTIwaW1wb3J0JTIwTWVtb3J5RWZmaWNpZW50QXR0ZW50aW9uRmxhc2hBdHRlbnRpb25PcCUwQSUwQXBpcGUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLTItMSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlJTIwJTNEJTIwcGlwZS50byglMjJjdWRhJTIyKSUwQXBpcGUuZW5hYmxlX3hmb3JtZXJzX21lbW9yeV9lZmZpY2llbnRfYXR0ZW50aW9uKGF0dGVudGlvbl9vcCUzRE1lbW9yeUVmZmljaWVudEF0dGVudGlvbkZsYXNoQXR0ZW50aW9uT3ApJTBBJTIzJTIwV29ya2Fyb3VuZCUyMGZvciUyMG5vdCUyMGFjY2VwdGluZyUyMGF0dGVudGlvbiUyMHNoYXBlJTIwdXNpbmclMjBWQUUlMjBmb3IlMjBGbGFzaCUyMEF0dGVudGlvbiUwQXBpcGUudmFlLmVuYWJsZV94Zm9ybWVyc19tZW1vcnlfZWZmaWNpZW50X2F0dGVudGlvbihhdHRlbnRpb25fb3AlM0ROb25lKQ==",highlighted:`<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> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> xformers.ops <span class="hljs-keyword">import</span> MemoryEfficientAttentionFlashAttentionOp

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;stabilityai/stable-diffusion-2-1&quot;</span>, torch_dtype=torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.enable_xformers_memory_efficient_attention(attention_op=MemoryEfficientAttentionFlashAttentionOp)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Workaround for not accepting attention shape using VAE for Flash Attention</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.vae.enable_xformers_memory_efficient_attention(attention_op=<span class="hljs-literal">None</span>)`}}),{c(){d=s("p"),b=r("Examples:"),u=c(),w(f.$$.fragment)},l(o){d=a(o,"P",{});var m=i(d);b=l(m,"Examples:"),m.forEach(n),u=p(o),v(f.$$.fragment,o)},m(o,m){y(o,d,m),e(d,b),y(o,u,m),I(f,o,m),_=!0},p:pt,i(o){_||(x(f.$$.fragment,o),_=!0)},o(o){M(f.$$.fragment,o),_=!1},d(o){o&&n(d),o&&n(u),T(f,o)}}}function mr(j){let d,b,u,f,_;return f=new ft({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFtb2RlbF9pZCUyMCUzRCUyMCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMiklMEElMEFwaXBlLmxvYWRfdGV4dHVhbF9pbnZlcnNpb24oJTIyc2QtY29uY2VwdHMtbGlicmFyeSUyRmNhdC10b3klMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyQSUyMCUzQ2NhdC10b3klM0UlMjBiYWNrcGFjayUyMiUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZShwcm9tcHQlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENTApLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMmNhdC1iYWNrcGFjay5wbmclMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline
<span class="hljs-keyword">import</span> torch

model_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)

pipe.load_textual_inversion(<span class="hljs-string">&quot;sd-concepts-library/cat-toy&quot;</span>)

prompt = <span class="hljs-string">&quot;A &lt;cat-toy&gt; backpack&quot;</span>

image = pipe(prompt, num_inference_steps=<span class="hljs-number">50</span>).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;cat-backpack.png&quot;</span>)`}}),{c(){d=s("p"),b=r("To load a textual inversion embedding vector in \u{1F917} Diffusers format:"),u=c(),w(f.$$.fragment)},l(o){d=a(o,"P",{});var m=i(d);b=l(m,"To load a textual inversion embedding vector in \u{1F917} Diffusers format:"),m.forEach(n),u=p(o),v(f.$$.fragment,o)},m(o,m){y(o,d,m),e(d,b),y(o,u,m),I(f,o,m),_=!0},p:pt,i(o){_||(x(f.$$.fragment,o),_=!0)},o(o){M(f.$$.fragment,o),_=!1},d(o){o&&n(d),o&&n(u),T(f,o)}}}function ur(j){let d,b,u,f,_;return f=new ft({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFtb2RlbF9pZCUyMCUzRCUyMCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMiklMEElMEFwaXBlLmxvYWRfdGV4dHVhbF9pbnZlcnNpb24oJTIyLiUyRmNoYXJ0dXJuZXJ2Mi5wdCUyMiUyQyUyMHRva2VuJTNEJTIyY2hhcnR1cm5lcnYyJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMmNoYXJ0dXJuZXJ2MiUyQyUyMG11bHRpcGxlJTIwdmlld3MlMjBvZiUyMHRoZSUyMHNhbWUlMjBjaGFyYWN0ZXIlMjBpbiUyMHRoZSUyMHNhbWUlMjBvdXRmaXQlMkMlMjBhJTIwY2hhcmFjdGVyJTIwdHVybmFyb3VuZCUyMG9mJTIwYSUyMHdvbWFuJTIwd2VhcmluZyUyMGElMjBibGFjayUyMGphY2tldCUyMGFuZCUyMHJlZCUyMHNoaXJ0JTJDJTIwYmVzdCUyMHF1YWxpdHklMkMlMjBpbnRyaWNhdGUlMjBkZXRhaWxzLiUyMiUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZShwcm9tcHQlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENTApLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMmNoYXJhY3Rlci5wbmclMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline
<span class="hljs-keyword">import</span> torch

model_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)

pipe.load_textual_inversion(<span class="hljs-string">&quot;./charturnerv2.pt&quot;</span>, token=<span class="hljs-string">&quot;charturnerv2&quot;</span>)

prompt = <span class="hljs-string">&quot;charturnerv2, multiple views of the same character in the same outfit, a character turnaround of a woman wearing a black jacket and red shirt, best quality, intricate details.&quot;</span>

image = pipe(prompt, num_inference_steps=<span class="hljs-number">50</span>).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;character.png&quot;</span>)`}}),{c(){d=s("p"),b=r("locally:"),u=c(),w(f.$$.fragment)},l(o){d=a(o,"P",{});var m=i(d);b=l(m,"locally:"),m.forEach(n),u=p(o),v(f.$$.fragment,o)},m(o,m){y(o,d,m),e(d,b),y(o,u,m),I(f,o,m),_=!0},p:pt,i(o){_||(x(f.$$.fragment,o),_=!0)},o(o){M(f.$$.fragment,o),_=!1},d(o){o&&n(d),o&&n(u),T(f,o)}}}function gr(j){let d,b,u,f,_;return f=new ft({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBJTBBJTIzJTIwRG93bmxvYWQlMjBwaXBlbGluZSUyMGZyb20lMjBodWdnaW5nZmFjZS5jbyUyMGFuZCUyMGNhY2hlLiUwQXBpcGVsaW5lJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9zaW5nbGVfZmlsZSglMEElMjAlMjAlMjAlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGV2Fycmlvck1hbWE3NzclMkZPcmFuZ2VNaXhzJTJGYmxvYiUyRm1haW4lMkZNb2RlbHMlMkZBYnlzc09yYW5nZU1peCUyRkFieXNzT3JhbmdlTWl4LnNhZmV0ZW5zb3JzJTIyJTBBKSUwQSUwQSUyMyUyMERvd25sb2FkJTIwcGlwZWxpbmUlMjBmcm9tJTIwbG9jYWwlMjBmaWxlJTBBJTIzJTIwZmlsZSUyMGlzJTIwZG93bmxvYWRlZCUyMHVuZGVyJTIwLiUyRnYxLTUtcHJ1bmVkLWVtYW9ubHkuY2twdCUwQXBpcGVsaW5lJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9zaW5nbGVfZmlsZSglMjIuJTJGdjEtNS1wcnVuZWQtZW1hb25seSUyMiklMEElMEElMjMlMjBFbmFibGUlMjBmbG9hdDE2JTIwYW5kJTIwbW92ZSUyMHRvJTIwR1BVJTBBcGlwZWxpbmUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25QaXBlbGluZS5mcm9tX3NpbmdsZV9maWxlKCUwQSUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyRmJsb2IlMkZtYWluJTJGdjEtNS1wcnVuZWQtZW1hb25seS5ja3B0JTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTBBKSUwQXBpcGVsaW5lLnRvKCUyMmN1ZGElMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Download pipeline from huggingface.co and cache.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline = StableDiffusionPipeline.from_single_file(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/WarriorMama777/OrangeMixs/blob/main/Models/AbyssOrangeMix/AbyssOrangeMix.safetensors&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Download pipeline from local file</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># file is downloaded under ./v1-5-pruned-emaonly.ckpt</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline = StableDiffusionPipeline.from_single_file(<span class="hljs-string">&quot;./v1-5-pruned-emaonly&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Enable float16 and move to GPU</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline = StableDiffusionPipeline.from_single_file(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/runwayml/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.ckpt&quot;</span>,
<span class="hljs-meta">... </span>    torch_dtype=torch.float16,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline.to(<span class="hljs-string">&quot;cuda&quot;</span>)`}}),{c(){d=s("p"),b=r("Examples:"),u=c(),w(f.$$.fragment)},l(o){d=a(o,"P",{});var m=i(d);b=l(m,"Examples:"),m.forEach(n),u=p(o),v(f.$$.fragment,o)},m(o,m){y(o,d,m),e(d,b),y(o,u,m),I(f,o,m),_=!0},p:pt,i(o){_||(x(f.$$.fragment,o),_=!0)},o(o){M(f.$$.fragment,o),_=!1},d(o){o&&n(d),o&&n(u),T(f,o)}}}function hr(j){let d,b,u,f,_;return f=new ft({props:{code:"aW1wb3J0JTIwamF4JTBBaW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBaW1wb3J0JTIwamF4Lm51bXB5JTIwYXMlMjBqbnAlMEFmcm9tJTIwZmxheC5qYXhfdXRpbHMlMjBpbXBvcnQlMjByZXBsaWNhdGUlMEFmcm9tJTIwZmxheC50cmFpbmluZy5jb21tb25fdXRpbHMlMjBpbXBvcnQlMjBzaGFyZCUwQWltcG9ydCUyMHJlcXVlc3RzJTBBZnJvbSUyMGlvJTIwaW1wb3J0JTIwQnl0ZXNJTyUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBGbGF4U3RhYmxlRGlmZnVzaW9uSW1nMkltZ1BpcGVsaW5lJTBBJTBBJTBBZGVmJTIwY3JlYXRlX2tleShzZWVkJTNEMCklM0ElMEElMjAlMjAlMjAlMjByZXR1cm4lMjBqYXgucmFuZG9tLlBSTkdLZXkoc2VlZCklMEElMEElMEFybmclMjAlM0QlMjBjcmVhdGVfa2V5KDApJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZyYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tJTJGQ29tcFZpcyUyRnN0YWJsZS1kaWZmdXNpb24lMkZtYWluJTJGYXNzZXRzJTJGc3RhYmxlLXNhbXBsZXMlMkZpbWcyaW1nJTJGc2tldGNoLW1vdW50YWlucy1pbnB1dC5qcGclMjIlMEFyZXNwb25zZSUyMCUzRCUyMHJlcXVlc3RzLmdldCh1cmwpJTBBaW5pdF9pbWclMjAlM0QlMjBJbWFnZS5vcGVuKEJ5dGVzSU8ocmVzcG9uc2UuY29udGVudCkpLmNvbnZlcnQoJTIyUkdCJTIyKSUwQWluaXRfaW1nJTIwJTNEJTIwaW5pdF9pbWcucmVzaXplKCg3NjglMkMlMjA1MTIpKSUwQSUwQXByb21wdHMlMjAlM0QlMjAlMjJBJTIwZmFudGFzeSUyMGxhbmRzY2FwZSUyQyUyMHRyZW5kaW5nJTIwb24lMjBhcnRzdGF0aW9uJTIyJTBBJTBBcGlwZWxpbmUlMkMlMjBwYXJhbXMlMjAlM0QlMjBGbGF4U3RhYmxlRGlmZnVzaW9uSW1nMkltZ1BpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJDb21wVmlzJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS00JTIyJTJDJTBBJTIwJTIwJTIwJTIwcmV2aXNpb24lM0QlMjJmbGF4JTIyJTJDJTBBJTIwJTIwJTIwJTIwZHR5cGUlM0RqbnAuYmZsb2F0MTYlMkMlMEEpJTBBJTBBbnVtX3NhbXBsZXMlMjAlM0QlMjBqYXguZGV2aWNlX2NvdW50KCklMEFybmclMjAlM0QlMjBqYXgucmFuZG9tLnNwbGl0KHJuZyUyQyUyMGpheC5kZXZpY2VfY291bnQoKSklMEFwcm9tcHRfaWRzJTJDJTIwcHJvY2Vzc2VkX2ltYWdlJTIwJTNEJTIwcGlwZWxpbmUucHJlcGFyZV9pbnB1dHMoJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTNEJTVCcHJvbXB0cyU1RCUyMColMjBudW1fc2FtcGxlcyUyQyUyMGltYWdlJTNEJTVCaW5pdF9pbWclNUQlMjAqJTIwbnVtX3NhbXBsZXMlMEEpJTBBcF9wYXJhbXMlMjAlM0QlMjByZXBsaWNhdGUocGFyYW1zKSUwQXByb21wdF9pZHMlMjAlM0QlMjBzaGFyZChwcm9tcHRfaWRzKSUwQXByb2Nlc3NlZF9pbWFnZSUyMCUzRCUyMHNoYXJkKHByb2Nlc3NlZF9pbWFnZSklMEElMEFvdXRwdXQlMjAlM0QlMjBwaXBlbGluZSglMEElMjAlMjAlMjAlMjBwcm9tcHRfaWRzJTNEcHJvbXB0X2lkcyUyQyUwQSUyMCUyMCUyMCUyMGltYWdlJTNEcHJvY2Vzc2VkX2ltYWdlJTJDJTBBJTIwJTIwJTIwJTIwcGFyYW1zJTNEcF9wYXJhbXMlMkMlMEElMjAlMjAlMjAlMjBwcm5nX3NlZWQlM0RybmclMkMlMEElMjAlMjAlMjAlMjBzdHJlbmd0aCUzRDAuNzUlMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENTAlMkMlMEElMjAlMjAlMjAlMjBqaXQlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwaGVpZ2h0JTNENTEyJTJDJTBBJTIwJTIwJTIwJTIwd2lkdGglM0Q3NjglMkMlMEEpLmltYWdlcyUwQSUwQW91dHB1dF9pbWFnZXMlMjAlM0QlMjBwaXBlbGluZS5udW1weV90b19waWwobnAuYXNhcnJheShvdXRwdXQucmVzaGFwZSgobnVtX3NhbXBsZXMlMkMpJTIwJTJCJTIwb3V0cHV0LnNoYXBlJTVCLTMlM0ElNUQpKSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> jax
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> jax.numpy <span class="hljs-keyword">as</span> jnp
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> flax.jax_utils <span class="hljs-keyword">import</span> replicate
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> flax.training.common_utils <span class="hljs-keyword">import</span> shard
<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><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">from</span> diffusers <span class="hljs-keyword">import</span> FlaxStableDiffusionImg2ImgPipeline


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">create_key</span>(<span class="hljs-params">seed=<span class="hljs-number">0</span></span>):
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> jax.random.PRNGKey(seed)


<span class="hljs-meta">&gt;&gt;&gt; </span>rng = create_key(<span class="hljs-number">0</span>)

<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>init_img = 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>init_img = init_img.resize((<span class="hljs-number">768</span>, <span class="hljs-number">512</span>))

<span class="hljs-meta">&gt;&gt;&gt; </span>prompts = <span class="hljs-string">&quot;A fantasy landscape, trending on artstation&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline, params = FlaxStableDiffusionImg2ImgPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>,
<span class="hljs-meta">... </span>    revision=<span class="hljs-string">&quot;flax&quot;</span>,
<span class="hljs-meta">... </span>    dtype=jnp.bfloat16,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>num_samples = jax.device_count()
<span class="hljs-meta">&gt;&gt;&gt; </span>rng = jax.random.split(rng, jax.device_count())
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt_ids, processed_image = pipeline.prepare_inputs(
<span class="hljs-meta">... </span>    prompt=[prompts] * num_samples, image=[init_img] * num_samples
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>p_params = replicate(params)
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt_ids = shard(prompt_ids)
<span class="hljs-meta">&gt;&gt;&gt; </span>processed_image = shard(processed_image)

<span class="hljs-meta">&gt;&gt;&gt; </span>output = pipeline(
<span class="hljs-meta">... </span>    prompt_ids=prompt_ids,
<span class="hljs-meta">... </span>    image=processed_image,
<span class="hljs-meta">... </span>    params=p_params,
<span class="hljs-meta">... </span>    prng_seed=rng,
<span class="hljs-meta">... </span>    strength=<span class="hljs-number">0.75</span>,
<span class="hljs-meta">... </span>    num_inference_steps=<span class="hljs-number">50</span>,
<span class="hljs-meta">... </span>    jit=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    height=<span class="hljs-number">512</span>,
<span class="hljs-meta">... </span>    width=<span class="hljs-number">768</span>,
<span class="hljs-meta">... </span>).images

<span class="hljs-meta">&gt;&gt;&gt; </span>output_images = pipeline.numpy_to_pil(np.asarray(output.reshape((num_samples,) + output.shape[-<span class="hljs-number">3</span>:])))`}}),{c(){d=s("p"),b=r("Examples:"),u=c(),w(f.$$.fragment)},l(o){d=a(o,"P",{});var m=i(d);b=l(m,"Examples:"),m.forEach(n),u=p(o),v(f.$$.fragment,o)},m(o,m){y(o,d,m),e(d,b),y(o,u,m),I(f,o,m),_=!0},p:pt,i(o){_||(x(f.$$.fragment,o),_=!0)},o(o){M(f.$$.fragment,o),_=!1},d(o){o&&n(d),o&&n(u),T(f,o)}}}function _r(j){let d,b,u,f,_,o,m,B,co,$n,mt,po,Dn,L,fo,ut,mo,uo,$e,go,ho,Pn,gt,_o,kn,ht,Gt,bo,En,ne,Un,Y,oe,Bt,De,yo,Ft,wo,Zn,S,Pe,vo,Nt,Io,xo,ke,Mo,_t,To,So,Jo,Ct,jo,$o,F,bt,yt,Do,Po,ko,wt,vt,Eo,Uo,Zo,It,xt,Wo,Go,Bo,se,Mt,Fo,No,At,Co,Ao,Lo,X,Ee,Xo,Lt,Vo,Ro,ae,zo,U,Ue,Yo,Xt,qo,Qo,ie,Ho,re,Oo,le,Ze,Ko,We,es,Vt,ts,ns,os,Z,Ge,ss,Be,as,Fe,is,rs,ls,de,ds,ce,cs,pe,Ne,ps,Ce,fs,Ae,ms,us,gs,D,Le,hs,Xe,_s,Tt,bs,ys,ws,Rt,vs,Is,fe,xs,Ve,Ms,Re,Ts,Ss,Js,me,js,V,ze,$s,k,Ds,St,Ps,ks,zt,Es,Us,Yt,Zs,Ws,qt,Gs,Bs,Fs,ue,Ns,P,Ye,Cs,N,As,Qt,Ls,Xs,Ht,Vs,Rs,Ot,zs,Ys,qs,qe,Qs,Kt,Hs,Os,Ks,Qe,ea,Jt,ta,na,oa,q,sa,jt,aa,ia,en,ra,la,da,Q,ca,$t,pa,fa,tn,ma,ua,ga,ge,He,ha,nn,_a,ba,he,Oe,ya,C,wa,on,va,Ia,sn,xa,Ma,an,Ta,Sa,Ja,_e,Ke,ja,rn,$a,Wn,H,be,ln,et,Da,dn,Pa,Gn,O,tt,ka,cn,Ea,Bn,K,ye,pn,nt,Ua,fn,Za,Fn,E,ot,Wa,mn,Ga,Ba,st,Fa,Dt,Na,Ca,Aa,R,at,La,un,Xa,Va,we,Nn,ee,ve,gn,it,Ra,hn,za,Cn,A,rt,Ya,_n,qa,Qa,Ie,lt,Ha,bn,Oa,An;return o=new jn({}),ne=new ni({props:{$$slots:{default:[rr]},$$scope:{ctx:j}}}),De=new jn({}),Pe=new $({props:{name:"class diffusers.StableDiffusionImg2ImgPipeline",anchor:"diffusers.StableDiffusionImg2ImgPipeline",parameters:[{name:"vae",val:": AutoencoderKL"},{name:"text_encoder",val:": CLIPTextModel"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": KarrasDiffusionSchedulers"},{name:"safety_checker",val:": StableDiffusionSafetyChecker"},{name:"feature_extractor",val:": CLIPImageProcessor"},{name:"requires_safety_checker",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.StableDiffusionImg2ImgPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/main/en/api/models/autoencoderkl#diffusers.AutoencoderKL">AutoencoderKL</a>) &#x2014;
Variational Auto-Encoder (VAE) model to encode and decode images to and from latent representations.`,name:"vae"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.text_encoder",description:`<strong>text_encoder</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPTextModel" rel="nofollow">CLIPTextModel</a>) &#x2014;
Frozen text-encoder (<a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a>).`,name:"text_encoder"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.tokenizer",description:`<strong>tokenizer</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>) &#x2014;
A <code>CLIPTokenizer</code> to tokenize text.`,name:"tokenizer"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/main/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
A <code>UNet2DConditionModel</code> to denoise the encoded image latents.`,name:"unet"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to denoise the encoded image latents. Can be one of
<a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/main/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/main/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.safety_checker",description:`<strong>safety_checker</strong> (<code>StableDiffusionSafetyChecker</code>) &#x2014;
Classification module that estimates whether generated images could be considered offensive or harmful.
Please refer to the <a href="https://huggingface.co/runwayml/stable-diffusion-v1-5" rel="nofollow">model card</a> for more details
about a model&#x2019;s potential harms.`,name:"safety_checker"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.feature_extractor",description:`<strong>feature_extractor</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPImageProcessor" rel="nofollow">CLIPImageProcessor</a>) &#x2014;
A <code>CLIPImageProcessor</code> to extract features from generated images; used as inputs to the <code>safety_checker</code>.`,name:"feature_extractor"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py#L101"}}),Ee=new $({props:{name:"__call__",anchor:"diffusers.StableDiffusionImg2ImgPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"image",val:": typing.Union[PIL.Image.Image, numpy.ndarray, torch.FloatTensor, typing.List[PIL.Image.Image], typing.List[numpy.ndarray], typing.List[torch.FloatTensor]] = None"},{name:"strength",val:": float = 0.8"},{name:"num_inference_steps",val:": typing.Optional[int] = 50"},{name:"guidance_scale",val:": typing.Optional[float] = 7.5"},{name:"negative_prompt",val:": typing.Union[typing.List[str], str, NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"eta",val:": typing.Optional[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"}],parametersDescription:[{anchor:"diffusers.StableDiffusionImg2ImgPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide image generation. If not defined, you need to pass <code>prompt_embeds</code>.`,name:"prompt"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code>, <code>PIL.Image.Image</code>, <code>np.ndarray</code>, <code>List[torch.FloatTensor]</code>, <code>List[PIL.Image.Image]</code>, or <code>List[np.ndarray]</code>) &#x2014;
<code>Image</code>, numpy array or tensor representing an image batch to be used as the starting point. For both
numpy array and pytorch tensor, the expected value range is between <code>[0, 1]</code> If it&#x2019;s a tensor or a list
or tensors, the expected shape should be <code>(B, C, H, W)</code> or <code>(C, H, W)</code>. If it is a numpy array or a
list of arrays, the expected shape should be <code>(B, H, W, C)</code> or <code>(H, W, C)</code> It can also accept image
latents as <code>image</code>, but if passing latents directly it is not encoded again.`,name:"image"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.__call__.strength",description:`<strong>strength</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
Indicates extent to transform the reference <code>image</code>. Must be between 0 and 1. <code>image</code> is used as a
starting point and more noise is added the higher 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 is maximum and the denoising
process runs for the full number of iterations specified in <code>num_inference_steps</code>. A value of 1
essentially ignores <code>image</code>.`,name:"strength"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.__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. This parameter is modulated by <code>strength</code>.`,name:"num_inference_steps"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
A higher guidance scale value encourages the model to generate images closely linked to the text
<code>prompt</code> at the expense of lower image quality. Guidance scale is enabled when <code>guidance_scale &gt; 1</code>.`,name:"guidance_scale"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide what to not include in image generation. If not defined, you need to
pass <code>negative_prompt_embeds</code> instead. Ignored when not using guidance (<code>guidance_scale &lt; 1</code>).`,name:"negative_prompt"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.__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.StableDiffusionImg2ImgPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) from the <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">DDIM</a> paper. Only applies
to the <a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, and is ignored in other schedulers.`,name:"eta"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> to make
generation deterministic.`,name:"generator"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.__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 (prompt weighting). If not
provided, text embeddings are generated from the <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.__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 (prompt weighting). If
not provided, <code>negative_prompt_embeds</code> are generated from the <code>negative_prompt</code> input argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.__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 generated image. Choose between <code>PIL.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.__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 <a href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput">StableDiffusionPipelineOutput</a> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that calls every <code>callback_steps</code> steps during inference. The function is called with the
following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.__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 is called. If not specified, the callback is called at
every step.`,name:"callback_steps"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.__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 in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow"><code>self.processor</code></a>.`,name:"cross_attention_kwargs"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py#L597",returnDescription:`
<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> is returned,
otherwise a <code>tuple</code> is returned where the first element is a list with the generated images and the
second element is a list of <code>bool</code>s indicating whether the corresponding generated image contains
\u201Cnot-safe-for-work\u201D (nsfw) content.</p>
`,returnType:`
<p><a
  href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),ae=new ct({props:{anchor:"diffusers.StableDiffusionImg2ImgPipeline.__call__.example",$$slots:{default:[lr]},$$scope:{ctx:j}}}),Ue=new $({props:{name:"enable_attention_slicing",anchor:"diffusers.StableDiffusionImg2ImgPipeline.enable_attention_slicing",parameters:[{name:"slice_size",val:": typing.Union[str, int, NoneType] = 'auto'"}],parametersDescription:[{anchor:"diffusers.StableDiffusionImg2ImgPipeline.enable_attention_slicing.slice_size",description:`<strong>slice_size</strong> (<code>str</code> or <code>int</code>, <em>optional</em>, defaults to <code>&quot;auto&quot;</code>) &#x2014;
When <code>&quot;auto&quot;</code>, halves the input to the attention heads, so attention will be computed in two steps. If
<code>&quot;max&quot;</code>, maximum amount of memory will be saved by running only one slice at a time. If a number is
provided, uses as many slices as <code>attention_head_dim // slice_size</code>. In this case, <code>attention_head_dim</code>
must be a multiple of <code>slice_size</code>.`,name:"slice_size"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L1694"}}),ie=new ni({props:{warning:!0,$$slots:{default:[dr]},$$scope:{ctx:j}}}),re=new ct({props:{anchor:"diffusers.StableDiffusionImg2ImgPipeline.enable_attention_slicing.example",$$slots:{default:[cr]},$$scope:{ctx:j}}}),Ze=new $({props:{name:"disable_attention_slicing",anchor:"diffusers.StableDiffusionImg2ImgPipeline.disable_attention_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L1734"}}),Ge=new $({props:{name:"enable_xformers_memory_efficient_attention",anchor:"diffusers.StableDiffusionImg2ImgPipeline.enable_xformers_memory_efficient_attention",parameters:[{name:"attention_op",val:": typing.Optional[typing.Callable] = None"}],parametersDescription:[{anchor:"diffusers.StableDiffusionImg2ImgPipeline.enable_xformers_memory_efficient_attention.attention_op",description:`<strong>attention_op</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
Override the default <code>None</code> operator for use as <code>op</code> argument to the
<a href="https://facebookresearch.github.io/xformers/components/ops.html#xformers.ops.memory_efficient_attention" rel="nofollow"><code>memory_efficient_attention()</code></a>
function of xFormers.`,name:"attention_op"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L1633"}}),de=new ni({props:{warning:!0,$$slots:{default:[pr]},$$scope:{ctx:j}}}),ce=new ct({props:{anchor:"diffusers.StableDiffusionImg2ImgPipeline.enable_xformers_memory_efficient_attention.example",$$slots:{default:[fr]},$$scope:{ctx:j}}}),Ne=new $({props:{name:"disable_xformers_memory_efficient_attention",anchor:"diffusers.StableDiffusionImg2ImgPipeline.disable_xformers_memory_efficient_attention",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L1668"}}),Le=new $({props:{name:"load_textual_inversion",anchor:"diffusers.StableDiffusionImg2ImgPipeline.load_textual_inversion",parameters:[{name:"pretrained_model_name_or_path",val:": typing.Union[str, typing.List[str], typing.Dict[str, torch.Tensor], typing.List[typing.Dict[str, torch.Tensor]]]"},{name:"token",val:": typing.Union[typing.List[str], str, NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.StableDiffusionImg2ImgPipeline.load_textual_inversion.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code> or <code>os.PathLike</code> or <code>List[str or os.PathLike]</code> or <code>Dict</code> or <code>List[Dict]</code>) &#x2014;
Can be either one of the following or a list of them:</p>
<ul>
<li>A string, the <em>model id</em> (for example <code>sd-concepts-library/low-poly-hd-logos-icons</code>) of a
pretrained model hosted on the Hub.</li>
<li>A path to a <em>directory</em> (for example <code>./my_text_inversion_directory/</code>) containing the textual
inversion weights.</li>
<li>A path to a <em>file</em> (for example <code>./my_text_inversions.pt</code>) containing textual inversion weights.</li>
<li>A <a href="https://pytorch.org/tutorials/beginner/saving_loading_models.html#what-is-a-state-dict" rel="nofollow">torch state
dict</a>.</li>
</ul>`,name:"pretrained_model_name_or_path"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.load_textual_inversion.token",description:`<strong>token</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
Override the token to use for the textual inversion weights. If <code>pretrained_model_name_or_path</code> is a
list, then <code>token</code> must also be a list of equal length.`,name:"token"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.load_textual_inversion.weight_name",description:`<strong>weight_name</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Name of a custom weight file. This should be used when:</p>
<ul>
<li>The saved textual inversion file is in &#x1F917; Diffusers format, but was saved under a specific weight
name such as <code>text_inv.bin</code>.</li>
<li>The saved textual inversion file is in the Automatic1111 format.</li>
</ul>`,name:"weight_name"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.load_textual_inversion.cache_dir",description:`<strong>cache_dir</strong> (<code>Union[str, os.PathLike]</code>, <em>optional</em>) &#x2014;
Path to a directory where a downloaded pretrained model configuration is cached if the standard cache
is not used.`,name:"cache_dir"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.load_textual_inversion.force_download",description:`<strong>force_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.`,name:"force_download"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.load_textual_inversion.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to resume downloading the model weights and configuration files. If set to <code>False</code>, any
incompletely downloaded files are deleted.`,name:"resume_download"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.load_textual_inversion.proxies",description:`<strong>proxies</strong> (<code>Dict[str, str]</code>, <em>optional</em>) &#x2014;
A dictionary of proxy servers to use by protocol or endpoint, for example, <code>{&apos;http&apos;: &apos;foo.bar:3128&apos;, &apos;http://hostname&apos;: &apos;foo.bar:4012&apos;}</code>. The proxies are used on each request.`,name:"proxies"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.load_textual_inversion.local_files_only",description:`<strong>local_files_only</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to only load local model weights and configuration files or not. If set to <code>True</code>, the model
won&#x2019;t be downloaded from the Hub.`,name:"local_files_only"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.load_textual_inversion.use_auth_token",description:`<strong>use_auth_token</strong> (<code>str</code> or <em>bool</em>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, the token generated from
<code>diffusers-cli login</code> (stored in <code>~/.huggingface</code>) is used.`,name:"use_auth_token"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.load_textual_inversion.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;main&quot;</code>) &#x2014;
The specific model version to use. It can be a branch name, a tag name, a commit id, or any identifier
allowed by Git.`,name:"revision"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.load_textual_inversion.subfolder",description:`<strong>subfolder</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&quot;</code>) &#x2014;
The subfolder location of a model file within a larger model repository on the Hub or locally.`,name:"subfolder"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.load_textual_inversion.mirror",description:`<strong>mirror</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Mirror source to resolve accessibility issues if you&#x2019;re downloading a model in China. We do not
guarantee the timeliness or safety of the source, and you should refer to the mirror site for more
information.`,name:"mirror"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders.py#L656"}}),fe=new ct({props:{anchor:"diffusers.StableDiffusionImg2ImgPipeline.load_textual_inversion.example",$$slots:{default:[mr]},$$scope:{ctx:j}}}),me=new ct({props:{anchor:"diffusers.StableDiffusionImg2ImgPipeline.load_textual_inversion.example-2",$$slots:{default:[ur]},$$scope:{ctx:j}}}),ze=new $({props:{name:"from_single_file",anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file",parameters:[{name:"pretrained_model_link_or_path",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.pretrained_model_link_or_path",description:`<strong>pretrained_model_link_or_path</strong> (<code>str</code> or <code>os.PathLike</code>, <em>optional</em>) &#x2014;
Can be either:<ul>
<li>A link to the <code>.ckpt</code> file (for example
<code>&quot;https://huggingface.co/&lt;repo_id&gt;/blob/main/&lt;path_to_file&gt;.ckpt&quot;</code>) on the Hub.</li>
<li>A path to a <em>file</em> containing all pipeline weights.</li>
</ul>`,name:"pretrained_model_link_or_path"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.torch_dtype",description:`<strong>torch_dtype</strong> (<code>str</code> or <code>torch.dtype</code>, <em>optional</em>) &#x2014;
Override the default <code>torch.dtype</code> and load the model with another dtype. If <code>&quot;auto&quot;</code> is passed, the
dtype is automatically derived from the model&#x2019;s weights.`,name:"torch_dtype"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.force_download",description:`<strong>force_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.`,name:"force_download"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.cache_dir",description:`<strong>cache_dir</strong> (<code>Union[str, os.PathLike]</code>, <em>optional</em>) &#x2014;
Path to a directory where a downloaded pretrained model configuration is cached if the standard cache
is not used.`,name:"cache_dir"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to resume downloading the model weights and configuration files. If set to <code>False</code>, any
incompletely downloaded files are deleted.`,name:"resume_download"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.proxies",description:`<strong>proxies</strong> (<code>Dict[str, str]</code>, <em>optional</em>) &#x2014;
A dictionary of proxy servers to use by protocol or endpoint, for example, <code>{&apos;http&apos;: &apos;foo.bar:3128&apos;, &apos;http://hostname&apos;: &apos;foo.bar:4012&apos;}</code>. The proxies are used on each request.`,name:"proxies"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.local_files_only",description:`<strong>local_files_only</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to only load local model weights and configuration files or not. If set to <code>True</code>, the model
won&#x2019;t be downloaded from the Hub.`,name:"local_files_only"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.use_auth_token",description:`<strong>use_auth_token</strong> (<code>str</code> or <em>bool</em>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, the token generated from
<code>diffusers-cli login</code> (stored in <code>~/.huggingface</code>) is used.`,name:"use_auth_token"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;main&quot;</code>) &#x2014;
The specific model version to use. It can be a branch name, a tag name, a commit id, or any identifier
allowed by Git.`,name:"revision"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.use_safetensors",description:`<strong>use_safetensors</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
If set to <code>None</code>, the safetensors weights are downloaded if they&#x2019;re available <strong>and</strong> if the
safetensors library is installed. If set to <code>True</code>, the model is forcibly loaded from safetensors
weights. If set to <code>False</code>, safetensors weights are not loaded.`,name:"use_safetensors"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.extract_ema",description:`<strong>extract_ema</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to extract the EMA weights or not. Pass <code>True</code> to extract the EMA weights which usually yield
higher quality images for inference. Non-EMA weights are usually better for continuing finetuning.`,name:"extract_ema"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.upcast_attention",description:`<strong>upcast_attention</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Whether the attention computation should always be upcasted.`,name:"upcast_attention"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The image size the model was trained on. Use 512 for all Stable Diffusion v1 models and the Stable
Diffusion v2 base model. Use 768 for Stable Diffusion v2.`,name:"image_size"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.prediction_type",description:`<strong>prediction_type</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The prediction type the model was trained on. Use <code>&apos;epsilon&apos;</code> for all Stable Diffusion v1 models and
the Stable Diffusion v2 base model. Use <code>&apos;v_prediction&apos;</code> for Stable Diffusion v2.`,name:"prediction_type"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.num_in_channels",description:`<strong>num_in_channels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
The number of input channels. If <code>None</code>, it is automatically inferred.`,name:"num_in_channels"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.scheduler_type",description:`<strong>scheduler_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pndm&quot;</code>) &#x2014;
Type of scheduler to use. Should be one of <code>[&quot;pndm&quot;, &quot;lms&quot;, &quot;heun&quot;, &quot;euler&quot;, &quot;euler-ancestral&quot;, &quot;dpm&quot;, &quot;ddim&quot;]</code>.`,name:"scheduler_type"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.load_safety_checker",description:`<strong>load_safety_checker</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to load the safety checker or not.`,name:"load_safety_checker"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.text_encoder",description:`<strong>text_encoder</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPTextModel" rel="nofollow">CLIPTextModel</a>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
An instance of <code>CLIPTextModel</code> to use, specifically the
<a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a> variant. If this
parameter is <code>None</code>, the function loads a new instance of <code>CLIPTextModel</code> by itself if needed.`,name:"text_encoder"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.vae",description:`<strong>vae</strong> (<code>AutoencoderKL</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations. If
this parameter is <code>None</code>, the function will load a new instance of [CLIP] by itself, if needed.`,name:"vae"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.tokenizer",description:`<strong>tokenizer</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
An instance of <code>CLIPTokenizer</code> to use. If this parameter is <code>None</code>, the function loads a new instance
of <code>CLIPTokenizer</code> by itself if needed.`,name:"tokenizer"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.original_config_file",description:`<strong>original_config_file</strong> (<code>str</code>) &#x2014;
Path to <code>.yaml</code> config file corresponding to the original architecture. If <code>None</code>, will be
automatically inferred by looking for a key that only exists in SD2.0 models.`,name:"original_config_file"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.kwargs",description:`<strong>kwargs</strong> (remaining dictionary of keyword arguments, <em>optional</em>) &#x2014;
Can be used to overwrite load and saveable variables (for example the pipeline components of the
specific pipeline class). The overwritten components are directly passed to the pipelines <code>__init__</code>
method. See example below for more information.`,name:"kwargs"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders.py#L1899"}}),ue=new ct({props:{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.example",$$slots:{default:[gr]},$$scope:{ctx:j}}}),Ye=new $({props:{name:"load_lora_weights",anchor:"diffusers.StableDiffusionImg2ImgPipeline.load_lora_weights",parameters:[{name:"pretrained_model_name_or_path_or_dict",val:": typing.Union[str, typing.Dict[str, torch.Tensor]]"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.StableDiffusionImg2ImgPipeline.load_lora_weights.pretrained_model_name_or_path_or_dict",description:`<strong>pretrained_model_name_or_path_or_dict</strong> (<code>str</code> or <code>os.PathLike</code> or <code>dict</code>) &#x2014;
See <a href="/docs/diffusers/main/en/api/loaders#diffusers.loaders.LoraLoaderMixin.lora_state_dict">lora_state_dict()</a>.`,name:"pretrained_model_name_or_path_or_dict"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.load_lora_weights.kwargs",description:`<strong>kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
See <a href="/docs/diffusers/main/en/api/loaders#diffusers.loaders.LoraLoaderMixin.lora_state_dict">lora_state_dict()</a>.`,name:"kwargs"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders.py#L928"}}),He=new $({props:{name:"save_lora_weights",anchor:"diffusers.StableDiffusionImg2ImgPipeline.save_lora_weights",parameters:[{name:"save_directory",val:": typing.Union[str, os.PathLike]"},{name:"unet_lora_layers",val:": typing.Dict[str, typing.Union[torch.nn.modules.module.Module, torch.Tensor]] = None"},{name:"text_encoder_lora_layers",val:": typing.Dict[str, torch.nn.modules.module.Module] = None"},{name:"is_main_process",val:": bool = True"},{name:"weight_name",val:": str = None"},{name:"save_function",val:": typing.Callable = None"},{name:"safe_serialization",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.StableDiffusionImg2ImgPipeline.save_lora_weights.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Directory to save LoRA parameters to. Will be created if it doesn&#x2019;t exist.`,name:"save_directory"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.save_lora_weights.unet_lora_layers",description:`<strong>unet_lora_layers</strong> (<code>Dict[str, torch.nn.Module]</code> or <code>Dict[str, torch.Tensor]</code>) &#x2014;
State dict of the LoRA layers corresponding to the <code>unet</code>.`,name:"unet_lora_layers"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.save_lora_weights.text_encoder_lora_layers",description:`<strong>text_encoder_lora_layers</strong> (<code>Dict[str, torch.nn.Module]</code> or <code>Dict[str, torch.Tensor]</code>) &#x2014;
State dict of the LoRA layers corresponding to the <code>text_encoder</code>. Must explicitly pass the text
encoder LoRA state dict because it comes from &#x1F917; Transformers.`,name:"text_encoder_lora_layers"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.save_lora_weights.is_main_process",description:`<strong>is_main_process</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether the process calling this is the main process or not. Useful during distributed training and you
need to call this function on all processes. In this case, set <code>is_main_process=True</code> only on the main
process to avoid race conditions.`,name:"is_main_process"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.save_lora_weights.save_function",description:`<strong>save_function</strong> (<code>Callable</code>) &#x2014;
The function to use to save the state dictionary. Useful during distributed training when you need to
replace <code>torch.save</code> with another method. Can be configured with the environment variable
<code>DIFFUSERS_SAVE_MODE</code>.`,name:"save_function"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.save_lora_weights.safe_serialization",description:`<strong>safe_serialization</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to save the model using <code>safetensors</code> or the traditional PyTorch way with <code>pickle</code>.`,name:"safe_serialization"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders.py#L1534"}}),Oe=new $({props:{name:"enable_model_cpu_offload",anchor:"diffusers.StableDiffusionImg2ImgPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py#L228"}}),Ke=new $({props:{name:"encode_prompt",anchor:"diffusers.StableDiffusionImg2ImgPipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"device",val:""},{name:"num_images_per_prompt",val:""},{name:"do_classifier_free_guidance",val:""},{name:"negative_prompt",val:" = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"lora_scale",val:": typing.Optional[float] = None"}],parametersDescription:[{anchor:"diffusers.StableDiffusionImg2ImgPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded
device &#x2014; (<code>torch.device</code>):
torch device`,name:"prompt"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.encode_prompt.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>) &#x2014;
number of images that should be generated per prompt`,name:"num_images_per_prompt"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.encode_prompt.do_classifier_free_guidance",description:`<strong>do_classifier_free_guidance</strong> (<code>bool</code>) &#x2014;
whether to use classifier free guidance or not`,name:"do_classifier_free_guidance"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.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. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.StableDiffusionImg2ImgPipeline.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.StableDiffusionImg2ImgPipeline.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.StableDiffusionImg2ImgPipeline.encode_prompt.lora_scale",description:`<strong>lora_scale</strong> (<code>float</code>, <em>optional</em>) &#x2014;
A lora scale that will be applied to all LoRA layers of the text encoder if LoRA layers are loaded.`,name:"lora_scale"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py#L288"}}),et=new jn({}),tt=new $({props:{name:"class diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",anchor:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",parameters:[{name:"images",val:": typing.Union[typing.List[PIL.Image.Image], numpy.ndarray]"},{name:"nsfw_content_detected",val:": typing.Optional[typing.List[bool]]"}],parametersDescription:[{anchor:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput.images",description:`<strong>images</strong> (<code>List[PIL.Image.Image]</code> or <code>np.ndarray</code>) &#x2014;
List of denoised PIL images of length <code>batch_size</code> or NumPy array of shape <code>(batch_size, height, width, num_channels)</code>.`,name:"images"},{anchor:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput.nsfw_content_detected",description:`<strong>nsfw_content_detected</strong> (<code>List[bool]</code>) &#x2014;
List indicating whether the corresponding generated image contains &#x201C;not-safe-for-work&#x201D; (nsfw) content or
<code>None</code> if safety checking could not be performed.`,name:"nsfw_content_detected"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/__init__.py#L22"}}),nt=new jn({}),ot=new $({props:{name:"class diffusers.FlaxStableDiffusionImg2ImgPipeline",anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline",parameters:[{name:"vae",val:": FlaxAutoencoderKL"},{name:"text_encoder",val:": FlaxCLIPTextModel"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"unet",val:": FlaxUNet2DConditionModel"},{name:"scheduler",val:": typing.Union[diffusers.schedulers.scheduling_ddim_flax.FlaxDDIMScheduler, diffusers.schedulers.scheduling_pndm_flax.FlaxPNDMScheduler, diffusers.schedulers.scheduling_lms_discrete_flax.FlaxLMSDiscreteScheduler, diffusers.schedulers.scheduling_dpmsolver_multistep_flax.FlaxDPMSolverMultistepScheduler]"},{name:"safety_checker",val:": FlaxStableDiffusionSafetyChecker"},{name:"feature_extractor",val:": CLIPImageProcessor"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"}],parametersDescription:[{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/main/en/api/models/autoencoderkl#diffusers.FlaxAutoencoderKL">FlaxAutoencoderKL</a>) &#x2014;
Variational Auto-Encoder (VAE) model to encode and decode images to and from latent representations.`,name:"vae"},{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.text_encoder",description:`<strong>text_encoder</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.FlaxCLIPTextModel" rel="nofollow">FlaxCLIPTextModel</a>) &#x2014;
Frozen text-encoder (<a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a>).`,name:"text_encoder"},{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.tokenizer",description:`<strong>tokenizer</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>) &#x2014;
A <code>CLIPTokenizer</code> to tokenize text.`,name:"tokenizer"},{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/main/en/api/models/unet2d-cond#diffusers.FlaxUNet2DConditionModel">FlaxUNet2DConditionModel</a>) &#x2014;
A <code>FlaxUNet2DConditionModel</code> to denoise the encoded image latents.`,name:"unet"},{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to denoise the encoded image latents. Can be one of
<code>FlaxDDIMScheduler</code>, <code>FlaxLMSDiscreteScheduler</code>, <code>FlaxPNDMScheduler</code>, or
<code>FlaxDPMSolverMultistepScheduler</code>.`,name:"scheduler"},{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.safety_checker",description:`<strong>safety_checker</strong> (<code>FlaxStableDiffusionSafetyChecker</code>) &#x2014;
Classification module that estimates whether generated images could be considered offensive or harmful.
Please refer to the <a href="https://huggingface.co/runwayml/stable-diffusion-v1-5" rel="nofollow">model card</a> for more details
about a model&#x2019;s potential harms.`,name:"safety_checker"},{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.feature_extractor",description:`<strong>feature_extractor</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPImageProcessor" rel="nofollow">CLIPImageProcessor</a>) &#x2014;
A <code>CLIPImageProcessor</code> to extract features from generated images; used as inputs to the <code>safety_checker</code>.`,name:"feature_extractor"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_img2img.py#L105"}}),at=new $({props:{name:"__call__",anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.__call__",parameters:[{name:"prompt_ids",val:": array"},{name:"image",val:": array"},{name:"params",val:": typing.Union[typing.Dict, flax.core.frozen_dict.FrozenDict]"},{name:"prng_seed",val:": PRNGKeyArray"},{name:"strength",val:": float = 0.8"},{name:"num_inference_steps",val:": int = 50"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"guidance_scale",val:": typing.Union[float, array] = 7.5"},{name:"noise",val:": array = None"},{name:"neg_prompt_ids",val:": array = None"},{name:"return_dict",val:": bool = True"},{name:"jit",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.__call__.prompt_ids",description:`<strong>prompt_ids</strong> (<code>jnp.array</code>) &#x2014;
The prompt or prompts to guide image generation.`,name:"prompt_ids"},{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.__call__.image",description:`<strong>image</strong> (<code>jnp.array</code>) &#x2014;
Array representing an image batch to be used as the starting point.`,name:"image"},{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.__call__.params",description:`<strong>params</strong> (<code>Dict</code> or <code>FrozenDict</code>) &#x2014;
Dictionary containing the model parameters/weights.`,name:"params"},{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.__call__.prng_seed",description:`<strong>prng_seed</strong> (<code>jax.random.KeyArray</code> or <code>jax.Array</code>) &#x2014;
Array containing random number generator key.`,name:"prng_seed"},{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.__call__.strength",description:`<strong>strength</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
Indicates extent to transform the reference <code>image</code>. Must be between 0 and 1. <code>image</code> is used as a
starting point and more noise is added the higher 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 is maximum and the denoising
process runs for the full number of iterations specified in <code>num_inference_steps</code>. A value of 1
essentially ignores <code>image</code>.`,name:"strength"},{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.__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. This parameter is modulated by <code>strength</code>.`,name:"num_inference_steps"},{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.unet.config.sample_size * self.vae_scale_factor</code>) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.unet.config.sample_size * self.vae_scale_factor</code>) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
A higher guidance scale value encourages the model to generate images closely linked to the text
<code>prompt</code> at the expense of lower image quality. Guidance scale is enabled when <code>guidance_scale &gt; 1</code>.`,name:"guidance_scale"},{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.__call__.noise",description:`<strong>noise</strong> (<code>jnp.array</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents sampled from a Gaussian distribution to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. The array is generated by
sampling using the supplied random <code>generator</code>.`,name:"noise"},{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.__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 <a href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput">FlaxStableDiffusionPipelineOutput</a> instead of
a plain tuple.`,name:"return_dict"},{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.__call__.jit",description:`<strong>jit</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
Whether to run <code>pmap</code> versions of the generation and safety scoring functions.</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>This argument exists because <code>__call__</code> is not yet end-to-end pmap-able. It will be removed in a
future release.</p>

					</div>`,name:"jit"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_img2img.py#L337",returnDescription:`
<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput"
>FlaxStableDiffusionPipelineOutput</a> is
returned, otherwise a <code>tuple</code> is returned where the first element is a list with the generated images
and the second element is a list of <code>bool</code>s indicating whether the corresponding generated image
contains \u201Cnot-safe-for-work\u201D (nsfw) content.</p>
`,returnType:`
<p><a
  href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput"
>FlaxStableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),we=new ct({props:{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.__call__.example",$$slots:{default:[hr]},$$scope:{ctx:j}}}),it=new jn({}),rt=new $({props:{name:"class diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput",anchor:"diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput",parameters:[{name:"images",val:": ndarray"},{name:"nsfw_content_detected",val:": typing.List[bool]"}],parametersDescription:[{anchor:"diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput.images",description:`<strong>images</strong> (<code>np.ndarray</code>) &#x2014;
Denoised images of array shape of <code>(batch_size, height, width, num_channels)</code>.`,name:"images"},{anchor:"diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput.nsfw_content_detected",description:`<strong>nsfw_content_detected</strong> (<code>List[bool]</code>) &#x2014;
List indicating whether the corresponding generated image contains &#x201C;not-safe-for-work&#x201D; (nsfw) content
or <code>None</code> if safety checking could not be performed.`,name:"nsfw_content_detected"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/__init__.py#L118"}}),lt=new $({props:{name:"replace",anchor:"diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput.replace",parameters:[{name:"**updates",val:""}],source:"https://github.com/huggingface/diffusers/blob/main/src/flax/struct.py#L111"}}),{c(){d=s("meta"),b=c(),u=s("h1"),f=s("a"),_=s("span"),w(o.$$.fragment),m=c(),B=s("span"),co=r("Image-to-image"),$n=c(),mt=s("p"),po=r("The Stable Diffusion model can also be applied to image-to-image generation by passing a text prompt and an initial image to condition the generation of new images."),Dn=c(),L=s("p"),fo=r("The "),ut=s("a"),mo=r("StableDiffusionImg2ImgPipeline"),uo=r(" uses the diffusion-denoising mechanism proposed in "),$e=s("a"),go=r("SDEdit: Guided Image Synthesis and Editing with Stochastic Differential Equations"),ho=r(" by Chenlin Meng, Yutong He, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, Stefano Ermon."),Pn=c(),gt=s("p"),_o=r("The abstract from the paper is:"),kn=c(),ht=s("p"),Gt=s("em"),bo=r("Guided image synthesis enables everyday users to create and edit photo-realistic images with minimum effort. The key challenge is balancing faithfulness to the user input (e.g., hand-drawn colored strokes) and realism of the synthesized image. Existing GAN-based methods attempt to achieve such balance using either conditional GANs or GAN inversions, which are challenging and often require additional training data or loss functions for individual applications. To address these issues, we introduce a new image synthesis and editing method, Stochastic Differential Editing (SDEdit), based on a diffusion model generative prior, which synthesizes realistic images by iteratively denoising through a stochastic differential equation (SDE). Given an input image with user guide of any type, SDEdit first adds noise to the input, then subsequently denoises the resulting image through the SDE prior to increase its realism. SDEdit does not require task-specific training or inversions and can naturally achieve the balance between realism and faithfulness. SDEdit significantly outperforms state-of-the-art GAN-based methods by up to 98.09% on realism and 91.72% on overall satisfaction scores, according to a human perception study, on multiple tasks, including stroke-based image synthesis and editing as well as image compositing."),En=c(),w(ne.$$.fragment),Un=c(),Y=s("h2"),oe=s("a"),Bt=s("span"),w(De.$$.fragment),yo=c(),Ft=s("span"),wo=r("StableDiffusionImg2ImgPipeline"),Zn=c(),S=s("div"),w(Pe.$$.fragment),vo=c(),Nt=s("p"),Io=r("Pipeline for text-guided image-to-image generation using Stable Diffusion."),xo=c(),ke=s("p"),Mo=r("This model inherits from "),_t=s("a"),To=r("DiffusionPipeline"),So=r(`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),Jo=c(),Ct=s("p"),jo=r("The pipeline also inherits the following loading methods:"),$o=c(),F=s("ul"),bt=s("li"),yt=s("a"),Do=r("load_textual_inversion()"),Po=r(" for loading textual inversion embeddings"),ko=c(),wt=s("li"),vt=s("a"),Eo=r("load_lora_weights()"),Uo=r(" for loading LoRA weights"),Zo=c(),It=s("li"),xt=s("a"),Wo=r("save_lora_weights()"),Go=r(" for saving LoRA weights"),Bo=c(),se=s("li"),Mt=s("a"),Fo=r("from_single_file()"),No=r(" for loading "),At=s("code"),Co=r(".ckpt"),Ao=r(" files"),Lo=c(),X=s("div"),w(Ee.$$.fragment),Xo=c(),Lt=s("p"),Vo=r("The call function to the pipeline for generation."),Ro=c(),w(ae.$$.fragment),zo=c(),U=s("div"),w(Ue.$$.fragment),Yo=c(),Xt=s("p"),qo=r(`Enable sliced attention computation. When this option is enabled, the attention module splits the input tensor
in slices to compute attention in several steps. For more than one attention head, the computation is performed
sequentially over each head. This is useful to save some memory in exchange for a small speed decrease.`),Qo=c(),w(ie.$$.fragment),Ho=c(),w(re.$$.fragment),Oo=c(),le=s("div"),w(Ze.$$.fragment),Ko=c(),We=s("p"),es=r("Disable sliced attention computation. If "),Vt=s("code"),ts=r("enable_attention_slicing"),ns=r(` was previously called, attention is
computed in one step.`),os=c(),Z=s("div"),w(Ge.$$.fragment),ss=c(),Be=s("p"),as=r("Enable memory efficient attention from "),Fe=s("a"),is=r("xFormers"),rs=r(`. When this
option is enabled, you should observe lower GPU memory usage and a potential speed up during inference. Speed
up during training is not guaranteed.`),ls=c(),w(de.$$.fragment),ds=c(),w(ce.$$.fragment),cs=c(),pe=s("div"),w(Ne.$$.fragment),ps=c(),Ce=s("p"),fs=r("Disable memory efficient attention from "),Ae=s("a"),ms=r("xFormers"),us=r("."),gs=c(),D=s("div"),w(Le.$$.fragment),hs=c(),Xe=s("p"),_s=r("Load textual inversion embeddings into the text encoder of "),Tt=s("a"),bs=r("StableDiffusionPipeline"),ys=r(` (both \u{1F917} Diffusers and
Automatic1111 formats are supported).`),ws=c(),Rt=s("p"),vs=r("Example:"),Is=c(),w(fe.$$.fragment),xs=c(),Ve=s("p"),Ms=r(`To load a textual inversion embedding vector in Automatic1111 format, make sure to download the vector first
(for example from `),Re=s("a"),Ts=r("civitAI"),Ss=r(") and then load the vector"),Js=c(),w(me.$$.fragment),js=c(),V=s("div"),w(ze.$$.fragment),$s=c(),k=s("p"),Ds=r("Instantiate a "),St=s("a"),Ps=r("DiffusionPipeline"),ks=r(" from pretrained pipeline weights saved in the "),zt=s("code"),Es=r(".ckpt"),Us=r(" or "),Yt=s("code"),Zs=r(".safetensors"),Ws=r(`
format. The pipeline is set in evaluation mode (`),qt=s("code"),Gs=r("model.eval()"),Bs=r(") by default."),Fs=c(),w(ue.$$.fragment),Ns=c(),P=s("div"),w(Ye.$$.fragment),Cs=c(),N=s("p"),As=r("Load LoRA weights specified in "),Qt=s("code"),Ls=r("pretrained_model_name_or_path_or_dict"),Xs=r(" into "),Ht=s("code"),Vs=r("self.unet"),Rs=r(` and
`),Ot=s("code"),zs=r("self.text_encoder"),Ys=r("."),qs=c(),qe=s("p"),Qs=r("All kwargs are forwarded to "),Kt=s("code"),Hs=r("self.lora_state_dict"),Os=r("."),Ks=c(),Qe=s("p"),ea=r("See "),Jt=s("a"),ta=r("lora_state_dict()"),na=r(" for more details on how the state dict is loaded."),oa=c(),q=s("p"),sa=r("See "),jt=s("a"),aa=r("load_lora_into_unet()"),ia=r(` for more details on how the state dict is loaded into
`),en=s("code"),ra=r("self.unet"),la=r("."),da=c(),Q=s("p"),ca=r("See "),$t=s("a"),pa=r("load_lora_into_text_encoder()"),fa=r(` for more details on how the state dict is loaded
into `),tn=s("code"),ma=r("self.text_encoder"),ua=r("."),ga=c(),ge=s("div"),w(He.$$.fragment),ha=c(),nn=s("p"),_a=r("Save the LoRA parameters corresponding to the UNet and text encoder."),ba=c(),he=s("div"),w(Oe.$$.fragment),ya=c(),C=s("p"),wa=r(`Offload all models to CPU to reduce memory usage with a low impact on performance. Moves one whole model at a
time to the GPU when its `),on=s("code"),va=r("forward"),Ia=r(` method is called, and the model remains in GPU until the next model runs.
Memory savings are lower than using `),sn=s("code"),xa=r("enable_sequential_cpu_offload"),Ma=r(`, but performance is much better due to the
iterative execution of the `),an=s("code"),Ta=r("unet"),Sa=r("."),Ja=c(),_e=s("div"),w(Ke.$$.fragment),ja=c(),rn=s("p"),$a=r("Encodes the prompt into text encoder hidden states."),Wn=c(),H=s("h2"),be=s("a"),ln=s("span"),w(et.$$.fragment),Da=c(),dn=s("span"),Pa=r("StableDiffusionPipelineOutput"),Gn=c(),O=s("div"),w(tt.$$.fragment),ka=c(),cn=s("p"),Ea=r("Output class for Stable Diffusion pipelines."),Bn=c(),K=s("h2"),ye=s("a"),pn=s("span"),w(nt.$$.fragment),Ua=c(),fn=s("span"),Za=r("FlaxStableDiffusionImg2ImgPipeline"),Fn=c(),E=s("div"),w(ot.$$.fragment),Wa=c(),mn=s("p"),Ga=r("Flax-based pipeline for text-guided image-to-image generation using Stable Diffusion."),Ba=c(),st=s("p"),Fa=r("This model inherits from "),Dt=s("a"),Na=r("FlaxDiffusionPipeline"),Ca=r(`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),Aa=c(),R=s("div"),w(at.$$.fragment),La=c(),un=s("p"),Xa=r("The call function to the pipeline for generation."),Va=c(),w(we.$$.fragment),Nn=c(),ee=s("h2"),ve=s("a"),gn=s("span"),w(it.$$.fragment),Ra=c(),hn=s("span"),za=r("FlaxStableDiffusionPipelineOutput"),Cn=c(),A=s("div"),w(rt.$$.fragment),Ya=c(),_n=s("p"),qa=r("Output class for Flax-based Stable Diffusion pipelines."),Qa=c(),Ie=s("div"),w(lt.$$.fragment),Ha=c(),bn=s("p"),Oa=r("\u201CReturns a new object replacing the specified fields with new values."),this.h()},l(t){const h=ar('[data-svelte="svelte-1phssyn"]',document.head);d=a(h,"META",{name:!0,content:!0}),h.forEach(n),b=p(t),u=a(t,"H1",{class:!0});var dt=i(u);f=a(dt,"A",{id:!0,class:!0,href:!0});var yn=i(f);_=a(yn,"SPAN",{});var wn=i(_);v(o.$$.fragment,wn),wn.forEach(n),yn.forEach(n),m=p(dt),B=a(dt,"SPAN",{});var vn=i(B);co=l(vn,"Image-to-image"),vn.forEach(n),dt.forEach(n),$n=p(t),mt=a(t,"P",{});var In=i(mt);po=l(In,"The Stable Diffusion model can also be applied to image-to-image generation by passing a text prompt and an initial image to condition the generation of new images."),In.forEach(n),Dn=p(t),L=a(t,"P",{});var te=i(L);fo=l(te,"The "),ut=a(te,"A",{href:!0});var xn=i(ut);mo=l(xn,"StableDiffusionImg2ImgPipeline"),xn.forEach(n),uo=l(te," uses the diffusion-denoising mechanism proposed in "),$e=a(te,"A",{href:!0,rel:!0});var Mn=i($e);go=l(Mn,"SDEdit: Guided Image Synthesis and Editing with Stochastic Differential Equations"),Mn.forEach(n),ho=l(te," by Chenlin Meng, Yutong He, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, Stefano Ermon."),te.forEach(n),Pn=p(t),gt=a(t,"P",{});var Tn=i(gt);_o=l(Tn,"The abstract from the paper is:"),Tn.forEach(n),kn=p(t),ht=a(t,"P",{});var Sn=i(ht);Gt=a(Sn,"EM",{});var oi=i(Gt);bo=l(oi,"Guided image synthesis enables everyday users to create and edit photo-realistic images with minimum effort. The key challenge is balancing faithfulness to the user input (e.g., hand-drawn colored strokes) and realism of the synthesized image. Existing GAN-based methods attempt to achieve such balance using either conditional GANs or GAN inversions, which are challenging and often require additional training data or loss functions for individual applications. To address these issues, we introduce a new image synthesis and editing method, Stochastic Differential Editing (SDEdit), based on a diffusion model generative prior, which synthesizes realistic images by iteratively denoising through a stochastic differential equation (SDE). Given an input image with user guide of any type, SDEdit first adds noise to the input, then subsequently denoises the resulting image through the SDE prior to increase its realism. SDEdit does not require task-specific training or inversions and can naturally achieve the balance between realism and faithfulness. SDEdit significantly outperforms state-of-the-art GAN-based methods by up to 98.09% on realism and 91.72% on overall satisfaction scores, according to a human perception study, on multiple tasks, including stroke-based image synthesis and editing as well as image compositing."),oi.forEach(n),Sn.forEach(n),En=p(t),v(ne.$$.fragment,t),Un=p(t),Y=a(t,"H2",{class:!0});var Ln=i(Y);oe=a(Ln,"A",{id:!0,class:!0,href:!0});var si=i(oe);Bt=a(si,"SPAN",{});var ai=i(Bt);v(De.$$.fragment,ai),ai.forEach(n),si.forEach(n),yo=p(Ln),Ft=a(Ln,"SPAN",{});var ii=i(Ft);wo=l(ii,"StableDiffusionImg2ImgPipeline"),ii.forEach(n),Ln.forEach(n),Zn=p(t),S=a(t,"DIV",{class:!0});var J=i(S);v(Pe.$$.fragment,J),vo=p(J),Nt=a(J,"P",{});var ri=i(Nt);Io=l(ri,"Pipeline for text-guided image-to-image generation using Stable Diffusion."),ri.forEach(n),xo=p(J),ke=a(J,"P",{});var Xn=i(ke);Mo=l(Xn,"This model inherits from "),_t=a(Xn,"A",{href:!0});var li=i(_t);To=l(li,"DiffusionPipeline"),li.forEach(n),So=l(Xn,`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),Xn.forEach(n),Jo=p(J),Ct=a(J,"P",{});var di=i(Ct);jo=l(di,"The pipeline also inherits the following loading methods:"),di.forEach(n),$o=p(J),F=a(J,"UL",{});var xe=i(F);bt=a(xe,"LI",{});var Ka=i(bt);yt=a(Ka,"A",{href:!0});var ci=i(yt);Do=l(ci,"load_textual_inversion()"),ci.forEach(n),Po=l(Ka," for loading textual inversion embeddings"),Ka.forEach(n),ko=p(xe),wt=a(xe,"LI",{});var ei=i(wt);vt=a(ei,"A",{href:!0});var pi=i(vt);Eo=l(pi,"load_lora_weights()"),pi.forEach(n),Uo=l(ei," for loading LoRA weights"),ei.forEach(n),Zo=p(xe),It=a(xe,"LI",{});var ti=i(It);xt=a(ti,"A",{href:!0});var fi=i(xt);Wo=l(fi,"save_lora_weights()"),fi.forEach(n),Go=l(ti," for saving LoRA weights"),ti.forEach(n),Bo=p(xe),se=a(xe,"LI",{});var Jn=i(se);Mt=a(Jn,"A",{href:!0});var mi=i(Mt);Fo=l(mi,"from_single_file()"),mi.forEach(n),No=l(Jn," for loading "),At=a(Jn,"CODE",{});var ui=i(At);Co=l(ui,".ckpt"),ui.forEach(n),Ao=l(Jn," files"),Jn.forEach(n),xe.forEach(n),Lo=p(J),X=a(J,"DIV",{class:!0});var Pt=i(X);v(Ee.$$.fragment,Pt),Xo=p(Pt),Lt=a(Pt,"P",{});var gi=i(Lt);Vo=l(gi,"The call function to the pipeline for generation."),gi.forEach(n),Ro=p(Pt),v(ae.$$.fragment,Pt),Pt.forEach(n),zo=p(J),U=a(J,"DIV",{class:!0});var Me=i(U);v(Ue.$$.fragment,Me),Yo=p(Me),Xt=a(Me,"P",{});var hi=i(Xt);qo=l(hi,`Enable sliced attention computation. When this option is enabled, the attention module splits the input tensor
in slices to compute attention in several steps. For more than one attention head, the computation is performed
sequentially over each head. This is useful to save some memory in exchange for a small speed decrease.`),hi.forEach(n),Qo=p(Me),v(ie.$$.fragment,Me),Ho=p(Me),v(re.$$.fragment,Me),Me.forEach(n),Oo=p(J),le=a(J,"DIV",{class:!0});var Vn=i(le);v(Ze.$$.fragment,Vn),Ko=p(Vn),We=a(Vn,"P",{});var Rn=i(We);es=l(Rn,"Disable sliced attention computation. If "),Vt=a(Rn,"CODE",{});var _i=i(Vt);ts=l(_i,"enable_attention_slicing"),_i.forEach(n),ns=l(Rn,` was previously called, attention is
computed in one step.`),Rn.forEach(n),Vn.forEach(n),os=p(J),Z=a(J,"DIV",{class:!0});var Te=i(Z);v(Ge.$$.fragment,Te),ss=p(Te),Be=a(Te,"P",{});var zn=i(Be);as=l(zn,"Enable memory efficient attention from "),Fe=a(zn,"A",{href:!0,rel:!0});var bi=i(Fe);is=l(bi,"xFormers"),bi.forEach(n),rs=l(zn,`. When this
option is enabled, you should observe lower GPU memory usage and a potential speed up during inference. Speed
up during training is not guaranteed.`),zn.forEach(n),ls=p(Te),v(de.$$.fragment,Te),ds=p(Te),v(ce.$$.fragment,Te),Te.forEach(n),cs=p(J),pe=a(J,"DIV",{class:!0});var Yn=i(pe);v(Ne.$$.fragment,Yn),ps=p(Yn),Ce=a(Yn,"P",{});var qn=i(Ce);fs=l(qn,"Disable memory efficient attention from "),Ae=a(qn,"A",{href:!0,rel:!0});var yi=i(Ae);ms=l(yi,"xFormers"),yi.forEach(n),us=l(qn,"."),qn.forEach(n),Yn.forEach(n),gs=p(J),D=a(J,"DIV",{class:!0});var W=i(D);v(Le.$$.fragment,W),hs=p(W),Xe=a(W,"P",{});var Qn=i(Xe);_s=l(Qn,"Load textual inversion embeddings into the text encoder of "),Tt=a(Qn,"A",{href:!0});var wi=i(Tt);bs=l(wi,"StableDiffusionPipeline"),wi.forEach(n),ys=l(Qn,` (both \u{1F917} Diffusers and
Automatic1111 formats are supported).`),Qn.forEach(n),ws=p(W),Rt=a(W,"P",{});var vi=i(Rt);vs=l(vi,"Example:"),vi.forEach(n),Is=p(W),v(fe.$$.fragment,W),xs=p(W),Ve=a(W,"P",{});var Hn=i(Ve);Ms=l(Hn,`To load a textual inversion embedding vector in Automatic1111 format, make sure to download the vector first
(for example from `),Re=a(Hn,"A",{href:!0,rel:!0});var Ii=i(Re);Ts=l(Ii,"civitAI"),Ii.forEach(n),Ss=l(Hn,") and then load the vector"),Hn.forEach(n),Js=p(W),v(me.$$.fragment,W),W.forEach(n),js=p(J),V=a(J,"DIV",{class:!0});var kt=i(V);v(ze.$$.fragment,kt),$s=p(kt),k=a(kt,"P",{});var z=i(k);Ds=l(z,"Instantiate a "),St=a(z,"A",{href:!0});var xi=i(St);Ps=l(xi,"DiffusionPipeline"),xi.forEach(n),ks=l(z," from pretrained pipeline weights saved in the "),zt=a(z,"CODE",{});var Mi=i(zt);Es=l(Mi,".ckpt"),Mi.forEach(n),Us=l(z," or "),Yt=a(z,"CODE",{});var Ti=i(Yt);Zs=l(Ti,".safetensors"),Ti.forEach(n),Ws=l(z,`
format. The pipeline is set in evaluation mode (`),qt=a(z,"CODE",{});var Si=i(qt);Gs=l(Si,"model.eval()"),Si.forEach(n),Bs=l(z,") by default."),z.forEach(n),Fs=p(kt),v(ue.$$.fragment,kt),kt.forEach(n),Ns=p(J),P=a(J,"DIV",{class:!0});var G=i(P);v(Ye.$$.fragment,G),Cs=p(G),N=a(G,"P",{});var Se=i(N);As=l(Se,"Load LoRA weights specified in "),Qt=a(Se,"CODE",{});var Ji=i(Qt);Ls=l(Ji,"pretrained_model_name_or_path_or_dict"),Ji.forEach(n),Xs=l(Se," into "),Ht=a(Se,"CODE",{});var ji=i(Ht);Vs=l(ji,"self.unet"),ji.forEach(n),Rs=l(Se,` and
`),Ot=a(Se,"CODE",{});var $i=i(Ot);zs=l($i,"self.text_encoder"),$i.forEach(n),Ys=l(Se,"."),Se.forEach(n),qs=p(G),qe=a(G,"P",{});var On=i(qe);Qs=l(On,"All kwargs are forwarded to "),Kt=a(On,"CODE",{});var Di=i(Kt);Hs=l(Di,"self.lora_state_dict"),Di.forEach(n),Os=l(On,"."),On.forEach(n),Ks=p(G),Qe=a(G,"P",{});var Kn=i(Qe);ea=l(Kn,"See "),Jt=a(Kn,"A",{href:!0});var Pi=i(Jt);ta=l(Pi,"lora_state_dict()"),Pi.forEach(n),na=l(Kn," for more details on how the state dict is loaded."),Kn.forEach(n),oa=p(G),q=a(G,"P",{});var Et=i(q);sa=l(Et,"See "),jt=a(Et,"A",{href:!0});var ki=i(jt);aa=l(ki,"load_lora_into_unet()"),ki.forEach(n),ia=l(Et,` for more details on how the state dict is loaded into
`),en=a(Et,"CODE",{});var Ei=i(en);ra=l(Ei,"self.unet"),Ei.forEach(n),la=l(Et,"."),Et.forEach(n),da=p(G),Q=a(G,"P",{});var Ut=i(Q);ca=l(Ut,"See "),$t=a(Ut,"A",{href:!0});var Ui=i($t);pa=l(Ui,"load_lora_into_text_encoder()"),Ui.forEach(n),fa=l(Ut,` for more details on how the state dict is loaded
into `),tn=a(Ut,"CODE",{});var Zi=i(tn);ma=l(Zi,"self.text_encoder"),Zi.forEach(n),ua=l(Ut,"."),Ut.forEach(n),G.forEach(n),ga=p(J),ge=a(J,"DIV",{class:!0});var eo=i(ge);v(He.$$.fragment,eo),ha=p(eo),nn=a(eo,"P",{});var Wi=i(nn);_a=l(Wi,"Save the LoRA parameters corresponding to the UNet and text encoder."),Wi.forEach(n),eo.forEach(n),ba=p(J),he=a(J,"DIV",{class:!0});var to=i(he);v(Oe.$$.fragment,to),ya=p(to),C=a(to,"P",{});var Je=i(C);wa=l(Je,`Offload all models to CPU to reduce memory usage with a low impact on performance. Moves one whole model at a
time to the GPU when its `),on=a(Je,"CODE",{});var Gi=i(on);va=l(Gi,"forward"),Gi.forEach(n),Ia=l(Je,` method is called, and the model remains in GPU until the next model runs.
Memory savings are lower than using `),sn=a(Je,"CODE",{});var Bi=i(sn);xa=l(Bi,"enable_sequential_cpu_offload"),Bi.forEach(n),Ma=l(Je,`, but performance is much better due to the
iterative execution of the `),an=a(Je,"CODE",{});var Fi=i(an);Ta=l(Fi,"unet"),Fi.forEach(n),Sa=l(Je,"."),Je.forEach(n),to.forEach(n),Ja=p(J),_e=a(J,"DIV",{class:!0});var no=i(_e);v(Ke.$$.fragment,no),ja=p(no),rn=a(no,"P",{});var Ni=i(rn);$a=l(Ni,"Encodes the prompt into text encoder hidden states."),Ni.forEach(n),no.forEach(n),J.forEach(n),Wn=p(t),H=a(t,"H2",{class:!0});var oo=i(H);be=a(oo,"A",{id:!0,class:!0,href:!0});var Ci=i(be);ln=a(Ci,"SPAN",{});var Ai=i(ln);v(et.$$.fragment,Ai),Ai.forEach(n),Ci.forEach(n),Da=p(oo),dn=a(oo,"SPAN",{});var Li=i(dn);Pa=l(Li,"StableDiffusionPipelineOutput"),Li.forEach(n),oo.forEach(n),Gn=p(t),O=a(t,"DIV",{class:!0});var so=i(O);v(tt.$$.fragment,so),ka=p(so),cn=a(so,"P",{});var Xi=i(cn);Ea=l(Xi,"Output class for Stable Diffusion pipelines."),Xi.forEach(n),so.forEach(n),Bn=p(t),K=a(t,"H2",{class:!0});var ao=i(K);ye=a(ao,"A",{id:!0,class:!0,href:!0});var Vi=i(ye);pn=a(Vi,"SPAN",{});var Ri=i(pn);v(nt.$$.fragment,Ri),Ri.forEach(n),Vi.forEach(n),Ua=p(ao),fn=a(ao,"SPAN",{});var zi=i(fn);Za=l(zi,"FlaxStableDiffusionImg2ImgPipeline"),zi.forEach(n),ao.forEach(n),Fn=p(t),E=a(t,"DIV",{class:!0});var je=i(E);v(ot.$$.fragment,je),Wa=p(je),mn=a(je,"P",{});var Yi=i(mn);Ga=l(Yi,"Flax-based pipeline for text-guided image-to-image generation using Stable Diffusion."),Yi.forEach(n),Ba=p(je),st=a(je,"P",{});var io=i(st);Fa=l(io,"This model inherits from "),Dt=a(io,"A",{href:!0});var qi=i(Dt);Na=l(qi,"FlaxDiffusionPipeline"),qi.forEach(n),Ca=l(io,`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),io.forEach(n),Aa=p(je),R=a(je,"DIV",{class:!0});var Zt=i(R);v(at.$$.fragment,Zt),La=p(Zt),un=a(Zt,"P",{});var Qi=i(un);Xa=l(Qi,"The call function to the pipeline for generation."),Qi.forEach(n),Va=p(Zt),v(we.$$.fragment,Zt),Zt.forEach(n),je.forEach(n),Nn=p(t),ee=a(t,"H2",{class:!0});var ro=i(ee);ve=a(ro,"A",{id:!0,class:!0,href:!0});var Hi=i(ve);gn=a(Hi,"SPAN",{});var Oi=i(gn);v(it.$$.fragment,Oi),Oi.forEach(n),Hi.forEach(n),Ra=p(ro),hn=a(ro,"SPAN",{});var Ki=i(hn);za=l(Ki,"FlaxStableDiffusionPipelineOutput"),Ki.forEach(n),ro.forEach(n),Cn=p(t),A=a(t,"DIV",{class:!0});var Wt=i(A);v(rt.$$.fragment,Wt),Ya=p(Wt),_n=a(Wt,"P",{});var er=i(_n);qa=l(er,"Output class for Flax-based Stable Diffusion pipelines."),er.forEach(n),Qa=p(Wt),Ie=a(Wt,"DIV",{class:!0});var lo=i(Ie);v(lt.$$.fragment,lo),Ha=p(lo),bn=a(lo,"P",{});var tr=i(bn);Oa=l(tr,"\u201CReturns a new object replacing the specified fields with new values."),tr.forEach(n),lo.forEach(n),Wt.forEach(n),this.h()},h(){g(d,"name","hf:doc:metadata"),g(d,"content",JSON.stringify(br)),g(f,"id","imagetoimage"),g(f,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(f,"href","#imagetoimage"),g(u,"class","relative group"),g(ut,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline"),g($e,"href","https://huggingface.co/papers/2108.01073"),g($e,"rel","nofollow"),g(oe,"id","diffusers.StableDiffusionImg2ImgPipeline"),g(oe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(oe,"href","#diffusers.StableDiffusionImg2ImgPipeline"),g(Y,"class","relative group"),g(_t,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline"),g(yt,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline.load_textual_inversion"),g(vt,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline.load_lora_weights"),g(xt,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline.save_lora_weights"),g(Mt,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline.from_single_file"),g(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Fe,"href","https://facebookresearch.github.io/xformers/"),g(Fe,"rel","nofollow"),g(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Ae,"href","https://facebookresearch.github.io/xformers/"),g(Ae,"rel","nofollow"),g(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Tt,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),g(Re,"href","https://civitai.com/models/3036?modelVersionId=9857"),g(Re,"rel","nofollow"),g(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(St,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline"),g(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Jt,"href","/docs/diffusers/main/en/api/loaders#diffusers.loaders.LoraLoaderMixin.lora_state_dict"),g(jt,"href","/docs/diffusers/main/en/api/loaders#diffusers.loaders.LoraLoaderMixin.load_lora_into_unet"),g($t,"href","/docs/diffusers/main/en/api/loaders#diffusers.loaders.LoraLoaderMixin.load_lora_into_text_encoder"),g(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(he,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(_e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(be,"id","diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"),g(be,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(be,"href","#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"),g(H,"class","relative group"),g(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(ye,"id","diffusers.FlaxStableDiffusionImg2ImgPipeline"),g(ye,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(ye,"href","#diffusers.FlaxStableDiffusionImg2ImgPipeline"),g(K,"class","relative group"),g(Dt,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.FlaxDiffusionPipeline"),g(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(ve,"id","diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput"),g(ve,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(ve,"href","#diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput"),g(ee,"class","relative group"),g(Ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,h){e(document.head,d),y(t,b,h),y(t,u,h),e(u,f),e(f,_),I(o,_,null),e(u,m),e(u,B),e(B,co),y(t,$n,h),y(t,mt,h),e(mt,po),y(t,Dn,h),y(t,L,h),e(L,fo),e(L,ut),e(ut,mo),e(L,uo),e(L,$e),e($e,go),e(L,ho),y(t,Pn,h),y(t,gt,h),e(gt,_o),y(t,kn,h),y(t,ht,h),e(ht,Gt),e(Gt,bo),y(t,En,h),I(ne,t,h),y(t,Un,h),y(t,Y,h),e(Y,oe),e(oe,Bt),I(De,Bt,null),e(Y,yo),e(Y,Ft),e(Ft,wo),y(t,Zn,h),y(t,S,h),I(Pe,S,null),e(S,vo),e(S,Nt),e(Nt,Io),e(S,xo),e(S,ke),e(ke,Mo),e(ke,_t),e(_t,To),e(ke,So),e(S,Jo),e(S,Ct),e(Ct,jo),e(S,$o),e(S,F),e(F,bt),e(bt,yt),e(yt,Do),e(bt,Po),e(F,ko),e(F,wt),e(wt,vt),e(vt,Eo),e(wt,Uo),e(F,Zo),e(F,It),e(It,xt),e(xt,Wo),e(It,Go),e(F,Bo),e(F,se),e(se,Mt),e(Mt,Fo),e(se,No),e(se,At),e(At,Co),e(se,Ao),e(S,Lo),e(S,X),I(Ee,X,null),e(X,Xo),e(X,Lt),e(Lt,Vo),e(X,Ro),I(ae,X,null),e(S,zo),e(S,U),I(Ue,U,null),e(U,Yo),e(U,Xt),e(Xt,qo),e(U,Qo),I(ie,U,null),e(U,Ho),I(re,U,null),e(S,Oo),e(S,le),I(Ze,le,null),e(le,Ko),e(le,We),e(We,es),e(We,Vt),e(Vt,ts),e(We,ns),e(S,os),e(S,Z),I(Ge,Z,null),e(Z,ss),e(Z,Be),e(Be,as),e(Be,Fe),e(Fe,is),e(Be,rs),e(Z,ls),I(de,Z,null),e(Z,ds),I(ce,Z,null),e(S,cs),e(S,pe),I(Ne,pe,null),e(pe,ps),e(pe,Ce),e(Ce,fs),e(Ce,Ae),e(Ae,ms),e(Ce,us),e(S,gs),e(S,D),I(Le,D,null),e(D,hs),e(D,Xe),e(Xe,_s),e(Xe,Tt),e(Tt,bs),e(Xe,ys),e(D,ws),e(D,Rt),e(Rt,vs),e(D,Is),I(fe,D,null),e(D,xs),e(D,Ve),e(Ve,Ms),e(Ve,Re),e(Re,Ts),e(Ve,Ss),e(D,Js),I(me,D,null),e(S,js),e(S,V),I(ze,V,null),e(V,$s),e(V,k),e(k,Ds),e(k,St),e(St,Ps),e(k,ks),e(k,zt),e(zt,Es),e(k,Us),e(k,Yt),e(Yt,Zs),e(k,Ws),e(k,qt),e(qt,Gs),e(k,Bs),e(V,Fs),I(ue,V,null),e(S,Ns),e(S,P),I(Ye,P,null),e(P,Cs),e(P,N),e(N,As),e(N,Qt),e(Qt,Ls),e(N,Xs),e(N,Ht),e(Ht,Vs),e(N,Rs),e(N,Ot),e(Ot,zs),e(N,Ys),e(P,qs),e(P,qe),e(qe,Qs),e(qe,Kt),e(Kt,Hs),e(qe,Os),e(P,Ks),e(P,Qe),e(Qe,ea),e(Qe,Jt),e(Jt,ta),e(Qe,na),e(P,oa),e(P,q),e(q,sa),e(q,jt),e(jt,aa),e(q,ia),e(q,en),e(en,ra),e(q,la),e(P,da),e(P,Q),e(Q,ca),e(Q,$t),e($t,pa),e(Q,fa),e(Q,tn),e(tn,ma),e(Q,ua),e(S,ga),e(S,ge),I(He,ge,null),e(ge,ha),e(ge,nn),e(nn,_a),e(S,ba),e(S,he),I(Oe,he,null),e(he,ya),e(he,C),e(C,wa),e(C,on),e(on,va),e(C,Ia),e(C,sn),e(sn,xa),e(C,Ma),e(C,an),e(an,Ta),e(C,Sa),e(S,Ja),e(S,_e),I(Ke,_e,null),e(_e,ja),e(_e,rn),e(rn,$a),y(t,Wn,h),y(t,H,h),e(H,be),e(be,ln),I(et,ln,null),e(H,Da),e(H,dn),e(dn,Pa),y(t,Gn,h),y(t,O,h),I(tt,O,null),e(O,ka),e(O,cn),e(cn,Ea),y(t,Bn,h),y(t,K,h),e(K,ye),e(ye,pn),I(nt,pn,null),e(K,Ua),e(K,fn),e(fn,Za),y(t,Fn,h),y(t,E,h),I(ot,E,null),e(E,Wa),e(E,mn),e(mn,Ga),e(E,Ba),e(E,st),e(st,Fa),e(st,Dt),e(Dt,Na),e(st,Ca),e(E,Aa),e(E,R),I(at,R,null),e(R,La),e(R,un),e(un,Xa),e(R,Va),I(we,R,null),y(t,Nn,h),y(t,ee,h),e(ee,ve),e(ve,gn),I(it,gn,null),e(ee,Ra),e(ee,hn),e(hn,za),y(t,Cn,h),y(t,A,h),I(rt,A,null),e(A,Ya),e(A,_n),e(_n,qa),e(A,Qa),e(A,Ie),I(lt,Ie,null),e(Ie,Ha),e(Ie,bn),e(bn,Oa),An=!0},p(t,[h]){const dt={};h&2&&(dt.$$scope={dirty:h,ctx:t}),ne.$set(dt);const yn={};h&2&&(yn.$$scope={dirty:h,ctx:t}),ae.$set(yn);const wn={};h&2&&(wn.$$scope={dirty:h,ctx:t}),ie.$set(wn);const vn={};h&2&&(vn.$$scope={dirty:h,ctx:t}),re.$set(vn);const In={};h&2&&(In.$$scope={dirty:h,ctx:t}),de.$set(In);const te={};h&2&&(te.$$scope={dirty:h,ctx:t}),ce.$set(te);const xn={};h&2&&(xn.$$scope={dirty:h,ctx:t}),fe.$set(xn);const Mn={};h&2&&(Mn.$$scope={dirty:h,ctx:t}),me.$set(Mn);const Tn={};h&2&&(Tn.$$scope={dirty:h,ctx:t}),ue.$set(Tn);const Sn={};h&2&&(Sn.$$scope={dirty:h,ctx:t}),we.$set(Sn)},i(t){An||(x(o.$$.fragment,t),x(ne.$$.fragment,t),x(De.$$.fragment,t),x(Pe.$$.fragment,t),x(Ee.$$.fragment,t),x(ae.$$.fragment,t),x(Ue.$$.fragment,t),x(ie.$$.fragment,t),x(re.$$.fragment,t),x(Ze.$$.fragment,t),x(Ge.$$.fragment,t),x(de.$$.fragment,t),x(ce.$$.fragment,t),x(Ne.$$.fragment,t),x(Le.$$.fragment,t),x(fe.$$.fragment,t),x(me.$$.fragment,t),x(ze.$$.fragment,t),x(ue.$$.fragment,t),x(Ye.$$.fragment,t),x(He.$$.fragment,t),x(Oe.$$.fragment,t),x(Ke.$$.fragment,t),x(et.$$.fragment,t),x(tt.$$.fragment,t),x(nt.$$.fragment,t),x(ot.$$.fragment,t),x(at.$$.fragment,t),x(we.$$.fragment,t),x(it.$$.fragment,t),x(rt.$$.fragment,t),x(lt.$$.fragment,t),An=!0)},o(t){M(o.$$.fragment,t),M(ne.$$.fragment,t),M(De.$$.fragment,t),M(Pe.$$.fragment,t),M(Ee.$$.fragment,t),M(ae.$$.fragment,t),M(Ue.$$.fragment,t),M(ie.$$.fragment,t),M(re.$$.fragment,t),M(Ze.$$.fragment,t),M(Ge.$$.fragment,t),M(de.$$.fragment,t),M(ce.$$.fragment,t),M(Ne.$$.fragment,t),M(Le.$$.fragment,t),M(fe.$$.fragment,t),M(me.$$.fragment,t),M(ze.$$.fragment,t),M(ue.$$.fragment,t),M(Ye.$$.fragment,t),M(He.$$.fragment,t),M(Oe.$$.fragment,t),M(Ke.$$.fragment,t),M(et.$$.fragment,t),M(tt.$$.fragment,t),M(nt.$$.fragment,t),M(ot.$$.fragment,t),M(at.$$.fragment,t),M(we.$$.fragment,t),M(it.$$.fragment,t),M(rt.$$.fragment,t),M(lt.$$.fragment,t),An=!1},d(t){n(d),t&&n(b),t&&n(u),T(o),t&&n($n),t&&n(mt),t&&n(Dn),t&&n(L),t&&n(Pn),t&&n(gt),t&&n(kn),t&&n(ht),t&&n(En),T(ne,t),t&&n(Un),t&&n(Y),T(De),t&&n(Zn),t&&n(S),T(Pe),T(Ee),T(ae),T(Ue),T(ie),T(re),T(Ze),T(Ge),T(de),T(ce),T(Ne),T(Le),T(fe),T(me),T(ze),T(ue),T(Ye),T(He),T(Oe),T(Ke),t&&n(Wn),t&&n(H),T(et),t&&n(Gn),t&&n(O),T(tt),t&&n(Bn),t&&n(K),T(nt),t&&n(Fn),t&&n(E),T(ot),T(at),T(we),t&&n(Nn),t&&n(ee),T(it),t&&n(Cn),t&&n(A),T(rt),T(lt)}}}const br={local:"imagetoimage",sections:[{local:"diffusers.StableDiffusionImg2ImgPipeline",title:"StableDiffusionImg2ImgPipeline"},{local:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",title:"StableDiffusionPipelineOutput"},{local:"diffusers.FlaxStableDiffusionImg2ImgPipeline",title:"FlaxStableDiffusionImg2ImgPipeline"},{local:"diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput",title:"FlaxStableDiffusionPipelineOutput"}],title:"Image-to-image"};function yr(j){return ir(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Sr extends nr{constructor(d){super();or(this,d,yr,_r,sr,{})}}export{Sr as default,br as metadata};
