import{S as Yi,i as qi,s as Qi,e as s,k as p,w,t as l,M as Hi,c as a,d as n,m as f,a as i,x as v,h as r,b as g,G as e,g as y,y as I,q as x,o as M,B as T,v as Oi,L as dt}from"../../../../chunks/vendor-hf-doc-builder.js";import{T as qa}from"../../../../chunks/Tip-hf-doc-builder.js";import{D as k}from"../../../../chunks/Docstring-hf-doc-builder.js";import{C as ct}from"../../../../chunks/CodeBlock-hf-doc-builder.js";import{I as Tn}from"../../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as rt}from"../../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Ki(j){let d,b,u,c,_;return{c(){d=s("p"),b=l("Make sure to check out the Stable Diffusion "),u=s("a"),c=l("Tips"),_=l(" 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=r(m,"Make sure to check out the Stable Diffusion "),u=a(m,"A",{href:!0});var B=i(u);c=r(B,"Tips"),B.forEach(n),_=r(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,c),e(d,_)},d(o){o&&n(d)}}}function el(j){let d,b,u,c,_;return c=new ct({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=l("Examples:"),u=p(),w(c.$$.fragment)},l(o){d=a(o,"P",{});var m=i(d);b=r(m,"Examples:"),m.forEach(n),u=f(o),v(c.$$.fragment,o)},m(o,m){y(o,d,m),e(d,b),y(o,u,m),I(c,o,m),_=!0},p:dt,i(o){_||(x(c.$$.fragment,o),_=!0)},o(o){M(c.$$.fragment,o),_=!1},d(o){o&&n(d),o&&n(u),T(c,o)}}}function tl(j){let d,b,u,c,_;return{c(){d=s("p"),b=l("\u26A0\uFE0F Don\u2019t enable attention slicing if you\u2019re already using "),u=s("code"),c=l("scaled_dot_product_attention"),_=l(` (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=r(m,"\u26A0\uFE0F Don\u2019t enable attention slicing if you\u2019re already using "),u=a(m,"CODE",{});var B=i(u);c=r(B,"scaled_dot_product_attention"),B.forEach(n),_=r(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,c),e(d,_)},d(o){o&&n(d)}}}function nl(j){let d,b,u,c,_;return c=new ct({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=l("Examples:"),u=p(),w(c.$$.fragment)},l(o){d=a(o,"P",{});var m=i(d);b=r(m,"Examples:"),m.forEach(n),u=f(o),v(c.$$.fragment,o)},m(o,m){y(o,d,m),e(d,b),y(o,u,m),I(c,o,m),_=!0},p:dt,i(o){_||(x(c.$$.fragment,o),_=!0)},o(o){M(c.$$.fragment,o),_=!1},d(o){o&&n(d),o&&n(u),T(c,o)}}}function ol(j){let d,b;return{c(){d=s("p"),b=l(`\u26A0\uFE0F When memory efficient attention and sliced attention are both enabled, memory efficient attention takes
precedent.`)},l(u){d=a(u,"P",{});var c=i(d);b=r(c,`\u26A0\uFE0F When memory efficient attention and sliced attention are both enabled, memory efficient attention takes
precedent.`),c.forEach(n)},m(u,c){y(u,d,c),e(d,b)},d(u){u&&n(d)}}}function sl(j){let d,b,u,c,_;return c=new ct({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=l("Examples:"),u=p(),w(c.$$.fragment)},l(o){d=a(o,"P",{});var m=i(d);b=r(m,"Examples:"),m.forEach(n),u=f(o),v(c.$$.fragment,o)},m(o,m){y(o,d,m),e(d,b),y(o,u,m),I(c,o,m),_=!0},p:dt,i(o){_||(x(c.$$.fragment,o),_=!0)},o(o){M(c.$$.fragment,o),_=!1},d(o){o&&n(d),o&&n(u),T(c,o)}}}function al(j){let d,b,u,c,_;return c=new ct({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=l("To load a textual inversion embedding vector in \u{1F917} Diffusers format:"),u=p(),w(c.$$.fragment)},l(o){d=a(o,"P",{});var m=i(d);b=r(m,"To load a textual inversion embedding vector in \u{1F917} Diffusers format:"),m.forEach(n),u=f(o),v(c.$$.fragment,o)},m(o,m){y(o,d,m),e(d,b),y(o,u,m),I(c,o,m),_=!0},p:dt,i(o){_||(x(c.$$.fragment,o),_=!0)},o(o){M(c.$$.fragment,o),_=!1},d(o){o&&n(d),o&&n(u),T(c,o)}}}function il(j){let d,b,u,c,_;return c=new ct({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=l("locally:"),u=p(),w(c.$$.fragment)},l(o){d=a(o,"P",{});var m=i(d);b=r(m,"locally:"),m.forEach(n),u=f(o),v(c.$$.fragment,o)},m(o,m){y(o,d,m),e(d,b),y(o,u,m),I(c,o,m),_=!0},p:dt,i(o){_||(x(c.$$.fragment,o),_=!0)},o(o){M(c.$$.fragment,o),_=!1},d(o){o&&n(d),o&&n(u),T(c,o)}}}function ll(j){let d,b,u,c,_;return c=new ct({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=l("Examples:"),u=p(),w(c.$$.fragment)},l(o){d=a(o,"P",{});var m=i(d);b=r(m,"Examples:"),m.forEach(n),u=f(o),v(c.$$.fragment,o)},m(o,m){y(o,d,m),e(d,b),y(o,u,m),I(c,o,m),_=!0},p:dt,i(o){_||(x(c.$$.fragment,o),_=!0)},o(o){M(c.$$.fragment,o),_=!1},d(o){o&&n(d),o&&n(u),T(c,o)}}}function rl(j){let d,b,u,c,_;return c=new ct({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=l("Examples:"),u=p(),w(c.$$.fragment)},l(o){d=a(o,"P",{});var m=i(d);b=r(m,"Examples:"),m.forEach(n),u=f(o),v(c.$$.fragment,o)},m(o,m){y(o,d,m),e(d,b),y(o,u,m),I(c,o,m),_=!0},p:dt,i(o){_||(x(c.$$.fragment,o),_=!0)},o(o){M(c.$$.fragment,o),_=!1},d(o){o&&n(d),o&&n(u),T(c,o)}}}function dl(j){let d,b,u,c,_,o,m,B,ao,Jn,pt,io,Sn,X,lo,ft,ro,co,je,po,fo,jn,mt,mo,$n,ut,Zt,uo,Dn,ne,kn,Y,oe,Wt,$e,go,Gt,ho,Pn,J,De,_o,Bt,bo,yo,ke,wo,gt,vo,Io,xo,Ft,Mo,To,F,ht,_t,Jo,So,jo,bt,yt,$o,Do,ko,wt,vt,Po,Eo,Uo,se,It,Zo,Wo,Nt,Go,Bo,Fo,L,Pe,No,Ct,Co,Ao,ae,Xo,U,Ee,Lo,At,Vo,Ro,ie,zo,le,Yo,re,Ue,qo,Ze,Qo,Xt,Ho,Oo,Ko,Z,We,es,Ge,ts,Be,ns,os,ss,de,as,ce,is,pe,Fe,ls,Ne,rs,Ce,ds,cs,ps,$,Ae,fs,Xe,ms,xt,us,gs,hs,Lt,_s,bs,fe,ys,Le,ws,Ve,vs,Is,xs,me,Ms,V,Re,Ts,P,Js,Mt,Ss,js,Vt,$s,Ds,Rt,ks,Ps,zt,Es,Us,Zs,ue,Ws,D,ze,Gs,N,Bs,Yt,Fs,Ns,qt,Cs,As,Qt,Xs,Ls,Vs,Ye,Rs,Ht,zs,Ys,qs,qe,Qs,Tt,Hs,Os,Ks,q,ea,Jt,ta,na,Ot,oa,sa,aa,Q,ia,St,la,ra,Kt,da,ca,pa,ge,Qe,fa,en,ma,ua,he,He,ga,C,ha,tn,_a,ba,nn,ya,wa,on,va,Ia,En,H,_e,sn,Oe,xa,an,Ma,Un,O,Ke,Ta,ln,Ja,Zn,K,be,rn,et,Sa,dn,ja,Wn,E,tt,$a,cn,Da,ka,nt,Pa,jt,Ea,Ua,Za,R,ot,Wa,pn,Ga,Ba,ye,Gn,ee,we,fn,st,Fa,mn,Na,Bn,A,at,Ca,un,Aa,Xa,ve,it,La,gn,Va,Fn;return o=new Tn({}),ne=new qa({props:{$$slots:{default:[Ki]},$$scope:{ctx:j}}}),$e=new Tn({}),De=new k({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"}}),Pe=new k({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#L571",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 rt({props:{anchor:"diffusers.StableDiffusionImg2ImgPipeline.__call__.example",$$slots:{default:[el]},$$scope:{ctx:j}}}),Ee=new k({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 qa({props:{warning:!0,$$slots:{default:[tl]},$$scope:{ctx:j}}}),le=new rt({props:{anchor:"diffusers.StableDiffusionImg2ImgPipeline.enable_attention_slicing.example",$$slots:{default:[nl]},$$scope:{ctx:j}}}),Ue=new k({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"}}),We=new k({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 qa({props:{warning:!0,$$slots:{default:[ol]},$$scope:{ctx:j}}}),ce=new rt({props:{anchor:"diffusers.StableDiffusionImg2ImgPipeline.enable_xformers_memory_efficient_attention.example",$$slots:{default:[sl]},$$scope:{ctx:j}}}),Fe=new k({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"}}),Ae=new k({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#L591"}}),fe=new rt({props:{anchor:"diffusers.StableDiffusionImg2ImgPipeline.load_textual_inversion.example",$$slots:{default:[al]},$$scope:{ctx:j}}}),me=new rt({props:{anchor:"diffusers.StableDiffusionImg2ImgPipeline.load_textual_inversion.example-2",$$slots:{default:[il]},$$scope:{ctx:j}}}),Re=new k({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#L1727"}}),ue=new rt({props:{anchor:"diffusers.StableDiffusionImg2ImgPipeline.from_single_file.example",$$slots:{default:[ll]},$$scope:{ctx:j}}}),ze=new k({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#L863"}}),Qe=new k({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#L1439"}}),He=new k({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"}}),Oe=new Tn({}),Ke=new k({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"}}),et=new Tn({}),tt=new k({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"}}),ot=new k({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>
`}}),ye=new rt({props:{anchor:"diffusers.FlaxStableDiffusionImg2ImgPipeline.__call__.example",$$slots:{default:[rl]},$$scope:{ctx:j}}}),st=new Tn({}),at=new k({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"}}),it=new k({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=p(),u=s("h1"),c=s("a"),_=s("span"),w(o.$$.fragment),m=p(),B=s("span"),ao=l("Image-to-image"),Jn=p(),pt=s("p"),io=l("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."),Sn=p(),X=s("p"),lo=l("The "),ft=s("a"),ro=l("StableDiffusionImg2ImgPipeline"),co=l(" uses the diffusion-denoising mechanism proposed in "),je=s("a"),po=l("SDEdit: Guided Image Synthesis and Editing with Stochastic Differential Equations"),fo=l(" by Chenlin Meng, Yutong He, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, Stefano Ermon."),jn=p(),mt=s("p"),mo=l("The abstract from the paper is:"),$n=p(),ut=s("p"),Zt=s("em"),uo=l("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."),Dn=p(),w(ne.$$.fragment),kn=p(),Y=s("h2"),oe=s("a"),Wt=s("span"),w($e.$$.fragment),go=p(),Gt=s("span"),ho=l("StableDiffusionImg2ImgPipeline"),Pn=p(),J=s("div"),w(De.$$.fragment),_o=p(),Bt=s("p"),bo=l("Pipeline for text-guided image-to-image generation using Stable Diffusion."),yo=p(),ke=s("p"),wo=l("This model inherits from "),gt=s("a"),vo=l("DiffusionPipeline"),Io=l(`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),xo=p(),Ft=s("p"),Mo=l("The pipeline also inherits the following loading methods:"),To=p(),F=s("ul"),ht=s("li"),_t=s("a"),Jo=l("load_textual_inversion()"),So=l(" for loading textual inversion embeddings"),jo=p(),bt=s("li"),yt=s("a"),$o=l("load_lora_weights()"),Do=l(" for loading LoRA weights"),ko=p(),wt=s("li"),vt=s("a"),Po=l("save_lora_weights()"),Eo=l(" for saving LoRA weights"),Uo=p(),se=s("li"),It=s("a"),Zo=l("from_single_file()"),Wo=l(" for loading "),Nt=s("code"),Go=l(".ckpt"),Bo=l(" files"),Fo=p(),L=s("div"),w(Pe.$$.fragment),No=p(),Ct=s("p"),Co=l("The call function to the pipeline for generation."),Ao=p(),w(ae.$$.fragment),Xo=p(),U=s("div"),w(Ee.$$.fragment),Lo=p(),At=s("p"),Vo=l(`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.`),Ro=p(),w(ie.$$.fragment),zo=p(),w(le.$$.fragment),Yo=p(),re=s("div"),w(Ue.$$.fragment),qo=p(),Ze=s("p"),Qo=l("Disable sliced attention computation. If "),Xt=s("code"),Ho=l("enable_attention_slicing"),Oo=l(` was previously called, attention is
computed in one step.`),Ko=p(),Z=s("div"),w(We.$$.fragment),es=p(),Ge=s("p"),ts=l("Enable memory efficient attention from "),Be=s("a"),ns=l("xFormers"),os=l(`. 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.`),ss=p(),w(de.$$.fragment),as=p(),w(ce.$$.fragment),is=p(),pe=s("div"),w(Fe.$$.fragment),ls=p(),Ne=s("p"),rs=l("Disable memory efficient attention from "),Ce=s("a"),ds=l("xFormers"),cs=l("."),ps=p(),$=s("div"),w(Ae.$$.fragment),fs=p(),Xe=s("p"),ms=l("Load textual inversion embeddings into the text encoder of "),xt=s("a"),us=l("StableDiffusionPipeline"),gs=l(` (both \u{1F917} Diffusers and
Automatic1111 formats are supported).`),hs=p(),Lt=s("p"),_s=l("Example:"),bs=p(),w(fe.$$.fragment),ys=p(),Le=s("p"),ws=l(`To load a textual inversion embedding vector in Automatic1111 format, make sure to download the vector first
(for example from `),Ve=s("a"),vs=l("civitAI"),Is=l(") and then load the vector"),xs=p(),w(me.$$.fragment),Ms=p(),V=s("div"),w(Re.$$.fragment),Ts=p(),P=s("p"),Js=l("Instantiate a "),Mt=s("a"),Ss=l("DiffusionPipeline"),js=l(" from pretrained pipeline weights saved in the "),Vt=s("code"),$s=l(".ckpt"),Ds=l(" or "),Rt=s("code"),ks=l(".safetensors"),Ps=l(`
format. The pipeline is set in evaluation mode (`),zt=s("code"),Es=l("model.eval()"),Us=l(") by default."),Zs=p(),w(ue.$$.fragment),Ws=p(),D=s("div"),w(ze.$$.fragment),Gs=p(),N=s("p"),Bs=l("Load LoRA weights specified in "),Yt=s("code"),Fs=l("pretrained_model_name_or_path_or_dict"),Ns=l(" into "),qt=s("code"),Cs=l("self.unet"),As=l(` and
`),Qt=s("code"),Xs=l("self.text_encoder"),Ls=l("."),Vs=p(),Ye=s("p"),Rs=l("All kwargs are forwarded to "),Ht=s("code"),zs=l("self.lora_state_dict"),Ys=l("."),qs=p(),qe=s("p"),Qs=l("See "),Tt=s("a"),Hs=l("lora_state_dict()"),Os=l(" for more details on how the state dict is loaded."),Ks=p(),q=s("p"),ea=l("See "),Jt=s("a"),ta=l("load_lora_into_unet()"),na=l(` for more details on how the state dict is loaded into
`),Ot=s("code"),oa=l("self.unet"),sa=l("."),aa=p(),Q=s("p"),ia=l("See "),St=s("a"),la=l("load_lora_into_text_encoder()"),ra=l(` for more details on how the state dict is loaded
into `),Kt=s("code"),da=l("self.text_encoder"),ca=l("."),pa=p(),ge=s("div"),w(Qe.$$.fragment),fa=p(),en=s("p"),ma=l("Save the LoRA parameters corresponding to the UNet and text encoder."),ua=p(),he=s("div"),w(He.$$.fragment),ga=p(),C=s("p"),ha=l(`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 `),tn=s("code"),_a=l("forward"),ba=l(` method is called, and the model remains in GPU until the next model runs.
Memory savings are lower than using `),nn=s("code"),ya=l("enable_sequential_cpu_offload"),wa=l(`, but performance is much better due to the
iterative execution of the `),on=s("code"),va=l("unet"),Ia=l("."),En=p(),H=s("h2"),_e=s("a"),sn=s("span"),w(Oe.$$.fragment),xa=p(),an=s("span"),Ma=l("StableDiffusionPipelineOutput"),Un=p(),O=s("div"),w(Ke.$$.fragment),Ta=p(),ln=s("p"),Ja=l("Output class for Stable Diffusion pipelines."),Zn=p(),K=s("h2"),be=s("a"),rn=s("span"),w(et.$$.fragment),Sa=p(),dn=s("span"),ja=l("FlaxStableDiffusionImg2ImgPipeline"),Wn=p(),E=s("div"),w(tt.$$.fragment),$a=p(),cn=s("p"),Da=l("Flax-based pipeline for text-guided image-to-image generation using Stable Diffusion."),ka=p(),nt=s("p"),Pa=l("This model inherits from "),jt=s("a"),Ea=l("FlaxDiffusionPipeline"),Ua=l(`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),Za=p(),R=s("div"),w(ot.$$.fragment),Wa=p(),pn=s("p"),Ga=l("The call function to the pipeline for generation."),Ba=p(),w(ye.$$.fragment),Gn=p(),ee=s("h2"),we=s("a"),fn=s("span"),w(st.$$.fragment),Fa=p(),mn=s("span"),Na=l("FlaxStableDiffusionPipelineOutput"),Bn=p(),A=s("div"),w(at.$$.fragment),Ca=p(),un=s("p"),Aa=l("Output class for Flax-based Stable Diffusion pipelines."),Xa=p(),ve=s("div"),w(it.$$.fragment),La=p(),gn=s("p"),Va=l("\u201CReturns a new object replacing the specified fields with new values."),this.h()},l(t){const h=Hi('[data-svelte="svelte-1phssyn"]',document.head);d=a(h,"META",{name:!0,content:!0}),h.forEach(n),b=f(t),u=a(t,"H1",{class:!0});var lt=i(u);c=a(lt,"A",{id:!0,class:!0,href:!0});var hn=i(c);_=a(hn,"SPAN",{});var _n=i(_);v(o.$$.fragment,_n),_n.forEach(n),hn.forEach(n),m=f(lt),B=a(lt,"SPAN",{});var bn=i(B);ao=r(bn,"Image-to-image"),bn.forEach(n),lt.forEach(n),Jn=f(t),pt=a(t,"P",{});var yn=i(pt);io=r(yn,"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."),yn.forEach(n),Sn=f(t),X=a(t,"P",{});var te=i(X);lo=r(te,"The "),ft=a(te,"A",{href:!0});var wn=i(ft);ro=r(wn,"StableDiffusionImg2ImgPipeline"),wn.forEach(n),co=r(te," uses the diffusion-denoising mechanism proposed in "),je=a(te,"A",{href:!0,rel:!0});var vn=i(je);po=r(vn,"SDEdit: Guided Image Synthesis and Editing with Stochastic Differential Equations"),vn.forEach(n),fo=r(te," by Chenlin Meng, Yutong He, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, Stefano Ermon."),te.forEach(n),jn=f(t),mt=a(t,"P",{});var In=i(mt);mo=r(In,"The abstract from the paper is:"),In.forEach(n),$n=f(t),ut=a(t,"P",{});var xn=i(ut);Zt=a(xn,"EM",{});var Qa=i(Zt);uo=r(Qa,"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."),Qa.forEach(n),xn.forEach(n),Dn=f(t),v(ne.$$.fragment,t),kn=f(t),Y=a(t,"H2",{class:!0});var Nn=i(Y);oe=a(Nn,"A",{id:!0,class:!0,href:!0});var Ha=i(oe);Wt=a(Ha,"SPAN",{});var Oa=i(Wt);v($e.$$.fragment,Oa),Oa.forEach(n),Ha.forEach(n),go=f(Nn),Gt=a(Nn,"SPAN",{});var Ka=i(Gt);ho=r(Ka,"StableDiffusionImg2ImgPipeline"),Ka.forEach(n),Nn.forEach(n),Pn=f(t),J=a(t,"DIV",{class:!0});var S=i(J);v(De.$$.fragment,S),_o=f(S),Bt=a(S,"P",{});var ei=i(Bt);bo=r(ei,"Pipeline for text-guided image-to-image generation using Stable Diffusion."),ei.forEach(n),yo=f(S),ke=a(S,"P",{});var Cn=i(ke);wo=r(Cn,"This model inherits from "),gt=a(Cn,"A",{href:!0});var ti=i(gt);vo=r(ti,"DiffusionPipeline"),ti.forEach(n),Io=r(Cn,`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),Cn.forEach(n),xo=f(S),Ft=a(S,"P",{});var ni=i(Ft);Mo=r(ni,"The pipeline also inherits the following loading methods:"),ni.forEach(n),To=f(S),F=a(S,"UL",{});var Ie=i(F);ht=a(Ie,"LI",{});var Ra=i(ht);_t=a(Ra,"A",{href:!0});var oi=i(_t);Jo=r(oi,"load_textual_inversion()"),oi.forEach(n),So=r(Ra," for loading textual inversion embeddings"),Ra.forEach(n),jo=f(Ie),bt=a(Ie,"LI",{});var za=i(bt);yt=a(za,"A",{href:!0});var si=i(yt);$o=r(si,"load_lora_weights()"),si.forEach(n),Do=r(za," for loading LoRA weights"),za.forEach(n),ko=f(Ie),wt=a(Ie,"LI",{});var Ya=i(wt);vt=a(Ya,"A",{href:!0});var ai=i(vt);Po=r(ai,"save_lora_weights()"),ai.forEach(n),Eo=r(Ya," for saving LoRA weights"),Ya.forEach(n),Uo=f(Ie),se=a(Ie,"LI",{});var Mn=i(se);It=a(Mn,"A",{href:!0});var ii=i(It);Zo=r(ii,"from_single_file()"),ii.forEach(n),Wo=r(Mn," for loading "),Nt=a(Mn,"CODE",{});var li=i(Nt);Go=r(li,".ckpt"),li.forEach(n),Bo=r(Mn," files"),Mn.forEach(n),Ie.forEach(n),Fo=f(S),L=a(S,"DIV",{class:!0});var $t=i(L);v(Pe.$$.fragment,$t),No=f($t),Ct=a($t,"P",{});var ri=i(Ct);Co=r(ri,"The call function to the pipeline for generation."),ri.forEach(n),Ao=f($t),v(ae.$$.fragment,$t),$t.forEach(n),Xo=f(S),U=a(S,"DIV",{class:!0});var xe=i(U);v(Ee.$$.fragment,xe),Lo=f(xe),At=a(xe,"P",{});var di=i(At);Vo=r(di,`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.`),di.forEach(n),Ro=f(xe),v(ie.$$.fragment,xe),zo=f(xe),v(le.$$.fragment,xe),xe.forEach(n),Yo=f(S),re=a(S,"DIV",{class:!0});var An=i(re);v(Ue.$$.fragment,An),qo=f(An),Ze=a(An,"P",{});var Xn=i(Ze);Qo=r(Xn,"Disable sliced attention computation. If "),Xt=a(Xn,"CODE",{});var ci=i(Xt);Ho=r(ci,"enable_attention_slicing"),ci.forEach(n),Oo=r(Xn,` was previously called, attention is
computed in one step.`),Xn.forEach(n),An.forEach(n),Ko=f(S),Z=a(S,"DIV",{class:!0});var Me=i(Z);v(We.$$.fragment,Me),es=f(Me),Ge=a(Me,"P",{});var Ln=i(Ge);ts=r(Ln,"Enable memory efficient attention from "),Be=a(Ln,"A",{href:!0,rel:!0});var pi=i(Be);ns=r(pi,"xFormers"),pi.forEach(n),os=r(Ln,`. 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.`),Ln.forEach(n),ss=f(Me),v(de.$$.fragment,Me),as=f(Me),v(ce.$$.fragment,Me),Me.forEach(n),is=f(S),pe=a(S,"DIV",{class:!0});var Vn=i(pe);v(Fe.$$.fragment,Vn),ls=f(Vn),Ne=a(Vn,"P",{});var Rn=i(Ne);rs=r(Rn,"Disable memory efficient attention from "),Ce=a(Rn,"A",{href:!0,rel:!0});var fi=i(Ce);ds=r(fi,"xFormers"),fi.forEach(n),cs=r(Rn,"."),Rn.forEach(n),Vn.forEach(n),ps=f(S),$=a(S,"DIV",{class:!0});var W=i($);v(Ae.$$.fragment,W),fs=f(W),Xe=a(W,"P",{});var zn=i(Xe);ms=r(zn,"Load textual inversion embeddings into the text encoder of "),xt=a(zn,"A",{href:!0});var mi=i(xt);us=r(mi,"StableDiffusionPipeline"),mi.forEach(n),gs=r(zn,` (both \u{1F917} Diffusers and
Automatic1111 formats are supported).`),zn.forEach(n),hs=f(W),Lt=a(W,"P",{});var ui=i(Lt);_s=r(ui,"Example:"),ui.forEach(n),bs=f(W),v(fe.$$.fragment,W),ys=f(W),Le=a(W,"P",{});var Yn=i(Le);ws=r(Yn,`To load a textual inversion embedding vector in Automatic1111 format, make sure to download the vector first
(for example from `),Ve=a(Yn,"A",{href:!0,rel:!0});var gi=i(Ve);vs=r(gi,"civitAI"),gi.forEach(n),Is=r(Yn,") and then load the vector"),Yn.forEach(n),xs=f(W),v(me.$$.fragment,W),W.forEach(n),Ms=f(S),V=a(S,"DIV",{class:!0});var Dt=i(V);v(Re.$$.fragment,Dt),Ts=f(Dt),P=a(Dt,"P",{});var z=i(P);Js=r(z,"Instantiate a "),Mt=a(z,"A",{href:!0});var hi=i(Mt);Ss=r(hi,"DiffusionPipeline"),hi.forEach(n),js=r(z," from pretrained pipeline weights saved in the "),Vt=a(z,"CODE",{});var _i=i(Vt);$s=r(_i,".ckpt"),_i.forEach(n),Ds=r(z," or "),Rt=a(z,"CODE",{});var bi=i(Rt);ks=r(bi,".safetensors"),bi.forEach(n),Ps=r(z,`
format. The pipeline is set in evaluation mode (`),zt=a(z,"CODE",{});var yi=i(zt);Es=r(yi,"model.eval()"),yi.forEach(n),Us=r(z,") by default."),z.forEach(n),Zs=f(Dt),v(ue.$$.fragment,Dt),Dt.forEach(n),Ws=f(S),D=a(S,"DIV",{class:!0});var G=i(D);v(ze.$$.fragment,G),Gs=f(G),N=a(G,"P",{});var Te=i(N);Bs=r(Te,"Load LoRA weights specified in "),Yt=a(Te,"CODE",{});var wi=i(Yt);Fs=r(wi,"pretrained_model_name_or_path_or_dict"),wi.forEach(n),Ns=r(Te," into "),qt=a(Te,"CODE",{});var vi=i(qt);Cs=r(vi,"self.unet"),vi.forEach(n),As=r(Te,` and
`),Qt=a(Te,"CODE",{});var Ii=i(Qt);Xs=r(Ii,"self.text_encoder"),Ii.forEach(n),Ls=r(Te,"."),Te.forEach(n),Vs=f(G),Ye=a(G,"P",{});var qn=i(Ye);Rs=r(qn,"All kwargs are forwarded to "),Ht=a(qn,"CODE",{});var xi=i(Ht);zs=r(xi,"self.lora_state_dict"),xi.forEach(n),Ys=r(qn,"."),qn.forEach(n),qs=f(G),qe=a(G,"P",{});var Qn=i(qe);Qs=r(Qn,"See "),Tt=a(Qn,"A",{href:!0});var Mi=i(Tt);Hs=r(Mi,"lora_state_dict()"),Mi.forEach(n),Os=r(Qn," for more details on how the state dict is loaded."),Qn.forEach(n),Ks=f(G),q=a(G,"P",{});var kt=i(q);ea=r(kt,"See "),Jt=a(kt,"A",{href:!0});var Ti=i(Jt);ta=r(Ti,"load_lora_into_unet()"),Ti.forEach(n),na=r(kt,` for more details on how the state dict is loaded into
`),Ot=a(kt,"CODE",{});var Ji=i(Ot);oa=r(Ji,"self.unet"),Ji.forEach(n),sa=r(kt,"."),kt.forEach(n),aa=f(G),Q=a(G,"P",{});var Pt=i(Q);ia=r(Pt,"See "),St=a(Pt,"A",{href:!0});var Si=i(St);la=r(Si,"load_lora_into_text_encoder()"),Si.forEach(n),ra=r(Pt,` for more details on how the state dict is loaded
into `),Kt=a(Pt,"CODE",{});var ji=i(Kt);da=r(ji,"self.text_encoder"),ji.forEach(n),ca=r(Pt,"."),Pt.forEach(n),G.forEach(n),pa=f(S),ge=a(S,"DIV",{class:!0});var Hn=i(ge);v(Qe.$$.fragment,Hn),fa=f(Hn),en=a(Hn,"P",{});var $i=i(en);ma=r($i,"Save the LoRA parameters corresponding to the UNet and text encoder."),$i.forEach(n),Hn.forEach(n),ua=f(S),he=a(S,"DIV",{class:!0});var On=i(he);v(He.$$.fragment,On),ga=f(On),C=a(On,"P",{});var Je=i(C);ha=r(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 `),tn=a(Je,"CODE",{});var Di=i(tn);_a=r(Di,"forward"),Di.forEach(n),ba=r(Je,` method is called, and the model remains in GPU until the next model runs.
Memory savings are lower than using `),nn=a(Je,"CODE",{});var ki=i(nn);ya=r(ki,"enable_sequential_cpu_offload"),ki.forEach(n),wa=r(Je,`, but performance is much better due to the
iterative execution of the `),on=a(Je,"CODE",{});var Pi=i(on);va=r(Pi,"unet"),Pi.forEach(n),Ia=r(Je,"."),Je.forEach(n),On.forEach(n),S.forEach(n),En=f(t),H=a(t,"H2",{class:!0});var Kn=i(H);_e=a(Kn,"A",{id:!0,class:!0,href:!0});var Ei=i(_e);sn=a(Ei,"SPAN",{});var Ui=i(sn);v(Oe.$$.fragment,Ui),Ui.forEach(n),Ei.forEach(n),xa=f(Kn),an=a(Kn,"SPAN",{});var Zi=i(an);Ma=r(Zi,"StableDiffusionPipelineOutput"),Zi.forEach(n),Kn.forEach(n),Un=f(t),O=a(t,"DIV",{class:!0});var eo=i(O);v(Ke.$$.fragment,eo),Ta=f(eo),ln=a(eo,"P",{});var Wi=i(ln);Ja=r(Wi,"Output class for Stable Diffusion pipelines."),Wi.forEach(n),eo.forEach(n),Zn=f(t),K=a(t,"H2",{class:!0});var to=i(K);be=a(to,"A",{id:!0,class:!0,href:!0});var Gi=i(be);rn=a(Gi,"SPAN",{});var Bi=i(rn);v(et.$$.fragment,Bi),Bi.forEach(n),Gi.forEach(n),Sa=f(to),dn=a(to,"SPAN",{});var Fi=i(dn);ja=r(Fi,"FlaxStableDiffusionImg2ImgPipeline"),Fi.forEach(n),to.forEach(n),Wn=f(t),E=a(t,"DIV",{class:!0});var Se=i(E);v(tt.$$.fragment,Se),$a=f(Se),cn=a(Se,"P",{});var Ni=i(cn);Da=r(Ni,"Flax-based pipeline for text-guided image-to-image generation using Stable Diffusion."),Ni.forEach(n),ka=f(Se),nt=a(Se,"P",{});var no=i(nt);Pa=r(no,"This model inherits from "),jt=a(no,"A",{href:!0});var Ci=i(jt);Ea=r(Ci,"FlaxDiffusionPipeline"),Ci.forEach(n),Ua=r(no,`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),no.forEach(n),Za=f(Se),R=a(Se,"DIV",{class:!0});var Et=i(R);v(ot.$$.fragment,Et),Wa=f(Et),pn=a(Et,"P",{});var Ai=i(pn);Ga=r(Ai,"The call function to the pipeline for generation."),Ai.forEach(n),Ba=f(Et),v(ye.$$.fragment,Et),Et.forEach(n),Se.forEach(n),Gn=f(t),ee=a(t,"H2",{class:!0});var oo=i(ee);we=a(oo,"A",{id:!0,class:!0,href:!0});var Xi=i(we);fn=a(Xi,"SPAN",{});var Li=i(fn);v(st.$$.fragment,Li),Li.forEach(n),Xi.forEach(n),Fa=f(oo),mn=a(oo,"SPAN",{});var Vi=i(mn);Na=r(Vi,"FlaxStableDiffusionPipelineOutput"),Vi.forEach(n),oo.forEach(n),Bn=f(t),A=a(t,"DIV",{class:!0});var Ut=i(A);v(at.$$.fragment,Ut),Ca=f(Ut),un=a(Ut,"P",{});var Ri=i(un);Aa=r(Ri,"Output class for Flax-based Stable Diffusion pipelines."),Ri.forEach(n),Xa=f(Ut),ve=a(Ut,"DIV",{class:!0});var so=i(ve);v(it.$$.fragment,so),La=f(so),gn=a(so,"P",{});var zi=i(gn);Va=r(zi,"\u201CReturns a new object replacing the specified fields with new values."),zi.forEach(n),so.forEach(n),Ut.forEach(n),this.h()},h(){g(d,"name","hf:doc:metadata"),g(d,"content",JSON.stringify(cl)),g(c,"id","imagetoimage"),g(c,"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(c,"href","#imagetoimage"),g(u,"class","relative group"),g(ft,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline"),g(je,"href","https://huggingface.co/papers/2108.01073"),g(je,"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(gt,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline"),g(_t,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline.load_textual_inversion"),g(yt,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline.load_lora_weights"),g(vt,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline.save_lora_weights"),g(It,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline.from_single_file"),g(L,"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(re,"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,"href","https://facebookresearch.github.io/xformers/"),g(Be,"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(Ce,"href","https://facebookresearch.github.io/xformers/"),g(Ce,"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(xt,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),g(Ve,"href","https://civitai.com/models/3036?modelVersionId=9857"),g(Ve,"rel","nofollow"),g($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Mt,"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(Tt,"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(St,"href","/docs/diffusers/main/en/api/loaders#diffusers.loaders.LoraLoaderMixin.load_lora_into_text_encoder"),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(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(J,"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,"id","diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"),g(_e,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(_e,"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(be,"id","diffusers.FlaxStableDiffusionImg2ImgPipeline"),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.FlaxStableDiffusionImg2ImgPipeline"),g(K,"class","relative group"),g(jt,"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(we,"id","diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput"),g(we,"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(we,"href","#diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput"),g(ee,"class","relative group"),g(ve,"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,c),e(c,_),I(o,_,null),e(u,m),e(u,B),e(B,ao),y(t,Jn,h),y(t,pt,h),e(pt,io),y(t,Sn,h),y(t,X,h),e(X,lo),e(X,ft),e(ft,ro),e(X,co),e(X,je),e(je,po),e(X,fo),y(t,jn,h),y(t,mt,h),e(mt,mo),y(t,$n,h),y(t,ut,h),e(ut,Zt),e(Zt,uo),y(t,Dn,h),I(ne,t,h),y(t,kn,h),y(t,Y,h),e(Y,oe),e(oe,Wt),I($e,Wt,null),e(Y,go),e(Y,Gt),e(Gt,ho),y(t,Pn,h),y(t,J,h),I(De,J,null),e(J,_o),e(J,Bt),e(Bt,bo),e(J,yo),e(J,ke),e(ke,wo),e(ke,gt),e(gt,vo),e(ke,Io),e(J,xo),e(J,Ft),e(Ft,Mo),e(J,To),e(J,F),e(F,ht),e(ht,_t),e(_t,Jo),e(ht,So),e(F,jo),e(F,bt),e(bt,yt),e(yt,$o),e(bt,Do),e(F,ko),e(F,wt),e(wt,vt),e(vt,Po),e(wt,Eo),e(F,Uo),e(F,se),e(se,It),e(It,Zo),e(se,Wo),e(se,Nt),e(Nt,Go),e(se,Bo),e(J,Fo),e(J,L),I(Pe,L,null),e(L,No),e(L,Ct),e(Ct,Co),e(L,Ao),I(ae,L,null),e(J,Xo),e(J,U),I(Ee,U,null),e(U,Lo),e(U,At),e(At,Vo),e(U,Ro),I(ie,U,null),e(U,zo),I(le,U,null),e(J,Yo),e(J,re),I(Ue,re,null),e(re,qo),e(re,Ze),e(Ze,Qo),e(Ze,Xt),e(Xt,Ho),e(Ze,Oo),e(J,Ko),e(J,Z),I(We,Z,null),e(Z,es),e(Z,Ge),e(Ge,ts),e(Ge,Be),e(Be,ns),e(Ge,os),e(Z,ss),I(de,Z,null),e(Z,as),I(ce,Z,null),e(J,is),e(J,pe),I(Fe,pe,null),e(pe,ls),e(pe,Ne),e(Ne,rs),e(Ne,Ce),e(Ce,ds),e(Ne,cs),e(J,ps),e(J,$),I(Ae,$,null),e($,fs),e($,Xe),e(Xe,ms),e(Xe,xt),e(xt,us),e(Xe,gs),e($,hs),e($,Lt),e(Lt,_s),e($,bs),I(fe,$,null),e($,ys),e($,Le),e(Le,ws),e(Le,Ve),e(Ve,vs),e(Le,Is),e($,xs),I(me,$,null),e(J,Ms),e(J,V),I(Re,V,null),e(V,Ts),e(V,P),e(P,Js),e(P,Mt),e(Mt,Ss),e(P,js),e(P,Vt),e(Vt,$s),e(P,Ds),e(P,Rt),e(Rt,ks),e(P,Ps),e(P,zt),e(zt,Es),e(P,Us),e(V,Zs),I(ue,V,null),e(J,Ws),e(J,D),I(ze,D,null),e(D,Gs),e(D,N),e(N,Bs),e(N,Yt),e(Yt,Fs),e(N,Ns),e(N,qt),e(qt,Cs),e(N,As),e(N,Qt),e(Qt,Xs),e(N,Ls),e(D,Vs),e(D,Ye),e(Ye,Rs),e(Ye,Ht),e(Ht,zs),e(Ye,Ys),e(D,qs),e(D,qe),e(qe,Qs),e(qe,Tt),e(Tt,Hs),e(qe,Os),e(D,Ks),e(D,q),e(q,ea),e(q,Jt),e(Jt,ta),e(q,na),e(q,Ot),e(Ot,oa),e(q,sa),e(D,aa),e(D,Q),e(Q,ia),e(Q,St),e(St,la),e(Q,ra),e(Q,Kt),e(Kt,da),e(Q,ca),e(J,pa),e(J,ge),I(Qe,ge,null),e(ge,fa),e(ge,en),e(en,ma),e(J,ua),e(J,he),I(He,he,null),e(he,ga),e(he,C),e(C,ha),e(C,tn),e(tn,_a),e(C,ba),e(C,nn),e(nn,ya),e(C,wa),e(C,on),e(on,va),e(C,Ia),y(t,En,h),y(t,H,h),e(H,_e),e(_e,sn),I(Oe,sn,null),e(H,xa),e(H,an),e(an,Ma),y(t,Un,h),y(t,O,h),I(Ke,O,null),e(O,Ta),e(O,ln),e(ln,Ja),y(t,Zn,h),y(t,K,h),e(K,be),e(be,rn),I(et,rn,null),e(K,Sa),e(K,dn),e(dn,ja),y(t,Wn,h),y(t,E,h),I(tt,E,null),e(E,$a),e(E,cn),e(cn,Da),e(E,ka),e(E,nt),e(nt,Pa),e(nt,jt),e(jt,Ea),e(nt,Ua),e(E,Za),e(E,R),I(ot,R,null),e(R,Wa),e(R,pn),e(pn,Ga),e(R,Ba),I(ye,R,null),y(t,Gn,h),y(t,ee,h),e(ee,we),e(we,fn),I(st,fn,null),e(ee,Fa),e(ee,mn),e(mn,Na),y(t,Bn,h),y(t,A,h),I(at,A,null),e(A,Ca),e(A,un),e(un,Aa),e(A,Xa),e(A,ve),I(it,ve,null),e(ve,La),e(ve,gn),e(gn,Va),Fn=!0},p(t,[h]){const lt={};h&2&&(lt.$$scope={dirty:h,ctx:t}),ne.$set(lt);const hn={};h&2&&(hn.$$scope={dirty:h,ctx:t}),ae.$set(hn);const _n={};h&2&&(_n.$$scope={dirty:h,ctx:t}),ie.$set(_n);const bn={};h&2&&(bn.$$scope={dirty:h,ctx:t}),le.$set(bn);const yn={};h&2&&(yn.$$scope={dirty:h,ctx:t}),de.$set(yn);const te={};h&2&&(te.$$scope={dirty:h,ctx:t}),ce.$set(te);const wn={};h&2&&(wn.$$scope={dirty:h,ctx:t}),fe.$set(wn);const vn={};h&2&&(vn.$$scope={dirty:h,ctx:t}),me.$set(vn);const In={};h&2&&(In.$$scope={dirty:h,ctx:t}),ue.$set(In);const xn={};h&2&&(xn.$$scope={dirty:h,ctx:t}),ye.$set(xn)},i(t){Fn||(x(o.$$.fragment,t),x(ne.$$.fragment,t),x($e.$$.fragment,t),x(De.$$.fragment,t),x(Pe.$$.fragment,t),x(ae.$$.fragment,t),x(Ee.$$.fragment,t),x(ie.$$.fragment,t),x(le.$$.fragment,t),x(Ue.$$.fragment,t),x(We.$$.fragment,t),x(de.$$.fragment,t),x(ce.$$.fragment,t),x(Fe.$$.fragment,t),x(Ae.$$.fragment,t),x(fe.$$.fragment,t),x(me.$$.fragment,t),x(Re.$$.fragment,t),x(ue.$$.fragment,t),x(ze.$$.fragment,t),x(Qe.$$.fragment,t),x(He.$$.fragment,t),x(Oe.$$.fragment,t),x(Ke.$$.fragment,t),x(et.$$.fragment,t),x(tt.$$.fragment,t),x(ot.$$.fragment,t),x(ye.$$.fragment,t),x(st.$$.fragment,t),x(at.$$.fragment,t),x(it.$$.fragment,t),Fn=!0)},o(t){M(o.$$.fragment,t),M(ne.$$.fragment,t),M($e.$$.fragment,t),M(De.$$.fragment,t),M(Pe.$$.fragment,t),M(ae.$$.fragment,t),M(Ee.$$.fragment,t),M(ie.$$.fragment,t),M(le.$$.fragment,t),M(Ue.$$.fragment,t),M(We.$$.fragment,t),M(de.$$.fragment,t),M(ce.$$.fragment,t),M(Fe.$$.fragment,t),M(Ae.$$.fragment,t),M(fe.$$.fragment,t),M(me.$$.fragment,t),M(Re.$$.fragment,t),M(ue.$$.fragment,t),M(ze.$$.fragment,t),M(Qe.$$.fragment,t),M(He.$$.fragment,t),M(Oe.$$.fragment,t),M(Ke.$$.fragment,t),M(et.$$.fragment,t),M(tt.$$.fragment,t),M(ot.$$.fragment,t),M(ye.$$.fragment,t),M(st.$$.fragment,t),M(at.$$.fragment,t),M(it.$$.fragment,t),Fn=!1},d(t){n(d),t&&n(b),t&&n(u),T(o),t&&n(Jn),t&&n(pt),t&&n(Sn),t&&n(X),t&&n(jn),t&&n(mt),t&&n($n),t&&n(ut),t&&n(Dn),T(ne,t),t&&n(kn),t&&n(Y),T($e),t&&n(Pn),t&&n(J),T(De),T(Pe),T(ae),T(Ee),T(ie),T(le),T(Ue),T(We),T(de),T(ce),T(Fe),T(Ae),T(fe),T(me),T(Re),T(ue),T(ze),T(Qe),T(He),t&&n(En),t&&n(H),T(Oe),t&&n(Un),t&&n(O),T(Ke),t&&n(Zn),t&&n(K),T(et),t&&n(Wn),t&&n(E),T(tt),T(ot),T(ye),t&&n(Gn),t&&n(ee),T(st),t&&n(Bn),t&&n(A),T(at),T(it)}}}const cl={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 pl(j){return Oi(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class bl extends Yi{constructor(d){super();qi(this,d,pl,dl,Qi,{})}}export{bl as default,cl as metadata};
