import{S as hn,i as gn,s as bn,e as o,k as h,w as v,t as c,M as _n,c as s,d as n,m as g,a as l,x as $,h as p,b as m,G as e,g as w,y as I,q as P,o as T,B as D,v as wn,L as Qt}from"../../../../chunks/vendor-hf-doc-builder.js";import{T as Rt}from"../../../../chunks/Tip-hf-doc-builder.js";import{D as be}from"../../../../chunks/Docstring-hf-doc-builder.js";import{C as Yt}from"../../../../chunks/CodeBlock-hf-doc-builder.js";import{I as At}from"../../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as qt}from"../../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function yn(x){let i,b,f,r,_;return{c(){i=o("p"),b=c("Make sure to check out the Stable Diffusion "),f=o("a"),r=c("Tips"),_=c(" section to learn how to explore the tradeoff between scheduler speed and quality, and how to reuse pipeline components efficiently!"),this.h()},l(a){i=s(a,"P",{});var d=l(i);b=p(d,"Make sure to check out the Stable Diffusion "),f=s(d,"A",{href:!0});var k=l(f);r=p(k,"Tips"),k.forEach(n),_=p(d," section to learn how to explore the tradeoff between scheduler speed and quality, and how to reuse pipeline components efficiently!"),d.forEach(n),this.h()},h(){m(f,"href","./overview#tips")},m(a,d){w(a,i,d),e(i,b),e(i,f),e(f,r),e(i,_)},d(a){a&&n(i)}}}function vn(x){let i,b,f,r,_;return r=new Yt({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvbkltYWdlVmFyaWF0aW9uUGlwZWxpbmUlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFmcm9tJTIwaW8lMjBpbXBvcnQlMjBCeXRlc0lPJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEElMEFwaXBlJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uSW1hZ2VWYXJpYXRpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIybGFtYmRhbGFicyUyRnNkLWltYWdlLXZhcmlhdGlvbnMtZGlmZnVzZXJzJTIyJTJDJTIwcmV2aXNpb24lM0QlMjJ2Mi4wJTIyJTBBKSUwQXBpcGUlMjAlM0QlMjBwaXBlLnRvKCUyMmN1ZGElMjIpJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZsaDMuZ29vZ2xldXNlcmNvbnRlbnQuY29tJTJGeS1pRk9IZkxUd2t1UVNVZWdwd0RkZ0ttT2pSU1R2UHhhdDYzZFFMQjI1eGtUczRsaEliUlVGZU5CV1p6WWYzNzBnJTNEczEyMDAlMjIlMEElMEFyZXNwb25zZSUyMCUzRCUyMHJlcXVlc3RzLmdldCh1cmwpJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKEJ5dGVzSU8ocmVzcG9uc2UuY29udGVudCkpLmNvbnZlcnQoJTIyUkdCJTIyKSUwQSUwQW91dCUyMCUzRCUyMHBpcGUoaW1hZ2UlMkMlMjBudW1faW1hZ2VzX3Blcl9wcm9tcHQlM0QzJTJDJTIwZ3VpZGFuY2Vfc2NhbGUlM0QxNSklMEFvdXQlNUIlMjJpbWFnZXMlMjIlNUQlNUIwJTVELnNhdmUoJTIycmVzdWx0LmpwZyUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionImageVariationPipeline
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO
<span class="hljs-keyword">import</span> requests

pipe = StableDiffusionImageVariationPipeline.from_pretrained(
    <span class="hljs-string">&quot;lambdalabs/sd-image-variations-diffusers&quot;</span>, revision=<span class="hljs-string">&quot;v2.0&quot;</span>
)
pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

url = <span class="hljs-string">&quot;https://lh3.googleusercontent.com/y-iFOHfLTwkuQSUegpwDdgKmOjRSTvPxat63dQLB25xkTs4lhIbRUFeNBWZzYf370g=s1200&quot;</span>

response = requests.get(url)
image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)

out = pipe(image, num_images_per_prompt=<span class="hljs-number">3</span>, guidance_scale=<span class="hljs-number">15</span>)
out[<span class="hljs-string">&quot;images&quot;</span>][<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;result.jpg&quot;</span>)`}}),{c(){i=o("p"),b=c("Examples:"),f=h(),v(r.$$.fragment)},l(a){i=s(a,"P",{});var d=l(i);b=p(d,"Examples:"),d.forEach(n),f=g(a),$(r.$$.fragment,a)},m(a,d){w(a,i,d),e(i,b),w(a,f,d),I(r,a,d),_=!0},p:Qt,i(a){_||(P(r.$$.fragment,a),_=!0)},o(a){T(r.$$.fragment,a),_=!1},d(a){a&&n(i),a&&n(f),D(r,a)}}}function $n(x){let i,b,f,r,_;return{c(){i=o("p"),b=c("\u26A0\uFE0F Don\u2019t enable attention slicing if you\u2019re already using "),f=o("code"),r=c("scaled_dot_product_attention"),_=c(` (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(a){i=s(a,"P",{});var d=l(i);b=p(d,"\u26A0\uFE0F Don\u2019t enable attention slicing if you\u2019re already using "),f=s(d,"CODE",{});var k=l(f);r=p(k,"scaled_dot_product_attention"),k.forEach(n),_=p(d,` (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!`),d.forEach(n)},m(a,d){w(a,i,d),e(i,b),e(i,f),e(f,r),e(i,_)},d(a){a&&n(i)}}}function In(x){let i,b,f,r,_;return r=new Yt({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(){i=o("p"),b=c("Examples:"),f=h(),v(r.$$.fragment)},l(a){i=s(a,"P",{});var d=l(i);b=p(d,"Examples:"),d.forEach(n),f=g(a),$(r.$$.fragment,a)},m(a,d){w(a,i,d),e(i,b),w(a,f,d),I(r,a,d),_=!0},p:Qt,i(a){_||(P(r.$$.fragment,a),_=!0)},o(a){T(r.$$.fragment,a),_=!1},d(a){a&&n(i),a&&n(f),D(r,a)}}}function Pn(x){let i,b;return{c(){i=o("p"),b=c(`\u26A0\uFE0F When memory efficient attention and sliced attention are both enabled, memory efficient attention takes
precedent.`)},l(f){i=s(f,"P",{});var r=l(i);b=p(r,`\u26A0\uFE0F When memory efficient attention and sliced attention are both enabled, memory efficient attention takes
precedent.`),r.forEach(n)},m(f,r){w(f,i,r),e(i,b)},d(f){f&&n(i)}}}function Tn(x){let i,b,f,r,_;return r=new Yt({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(){i=o("p"),b=c("Examples:"),f=h(),v(r.$$.fragment)},l(a){i=s(a,"P",{});var d=l(i);b=p(d,"Examples:"),d.forEach(n),f=g(a),$(r.$$.fragment,a)},m(a,d){w(a,i,d),e(i,b),w(a,f,d),I(r,a,d),_=!0},p:Qt,i(a){_||(P(r.$$.fragment,a),_=!0)},o(a){T(r.$$.fragment,a),_=!1},d(a){a&&n(i),a&&n(f),D(r,a)}}}function Dn(x){let i,b,f,r,_,a,d,k,Oe,Ue,E,He,O,Ke,et,H,tt,nt,Ze,V,at,K,it,ot,ee,st,rt,We,L,je,Z,N,ve,te,lt,$e,ft,Ge,y,ne,ct,Ie,pt,dt,ae,mt,_e,ut,ht,gt,U,ie,bt,Pe,_t,wt,C,yt,J,oe,vt,Te,$t,It,B,Pt,F,Tt,z,se,Dt,re,St,De,xt,Jt,Mt,M,le,kt,fe,Et,ce,Vt,Ut,Zt,X,Wt,R,jt,A,pe,Gt,de,Lt,me,Nt,Ct,Le,W,q,Se,ue,Bt,xe,Ft,Ne,j,he,zt,Je,Xt,Ce;return a=new At({}),L=new Rt({props:{$$slots:{default:[yn]},$$scope:{ctx:x}}}),te=new At({}),ne=new be({props:{name:"class diffusers.StableDiffusionImageVariationPipeline",anchor:"diffusers.StableDiffusionImageVariationPipeline",parameters:[{name:"vae",val:": AutoencoderKL"},{name:"image_encoder",val:": CLIPVisionModelWithProjection"},{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.StableDiffusionImageVariationPipeline.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.StableDiffusionImageVariationPipeline.image_encoder",description:`<strong>image_encoder</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPVisionModelWithProjection" rel="nofollow">CLIPVisionModelWithProjection</a>) &#x2014;
Frozen CLIP image-encoder (<a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a>).`,name:"image_encoder"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.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.StableDiffusionImageVariationPipeline.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.StableDiffusionImageVariationPipeline.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.StableDiffusionImageVariationPipeline.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.StableDiffusionImageVariationPipeline.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.StableDiffusionImageVariationPipeline.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_image_variation.py#L37"}}),ie=new be({props:{name:"__call__",anchor:"diffusers.StableDiffusionImageVariationPipeline.__call__",parameters:[{name:"image",val:": typing.Union[PIL.Image.Image, typing.List[PIL.Image.Image], torch.FloatTensor]"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 7.5"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",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"}],parametersDescription:[{anchor:"diffusers.StableDiffusionImageVariationPipeline.__call__.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>List[PIL.Image.Image]</code> or <code>torch.FloatTensor</code>) &#x2014;
Image or images to guide image generation. If you provide a tensor, it needs to be compatible with
<a href="https://huggingface.co/lambdalabs/sd-image-variations-diffusers/blob/main/feature_extractor/preprocessor_config.json" rel="nofollow"><code>CLIPImageProcessor</code></a>.`,name:"image"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.__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.StableDiffusionImageVariationPipeline.__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.StableDiffusionImageVariationPipeline.__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.StableDiffusionImageVariationPipeline.__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.StableDiffusionImageVariationPipeline.__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.StableDiffusionImageVariationPipeline.__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.StableDiffusionImageVariationPipeline.__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.StableDiffusionImageVariationPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</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. If not provided, a latents
tensor is generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.__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.StableDiffusionImageVariationPipeline.__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/upscale#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput">StableDiffusionPipelineOutput</a> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.__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.StableDiffusionImageVariationPipeline.__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"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py#L242",returnDescription:`
<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/upscale#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/upscale#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),C=new qt({props:{anchor:"diffusers.StableDiffusionImageVariationPipeline.__call__.example",$$slots:{default:[vn]},$$scope:{ctx:x}}}),oe=new be({props:{name:"enable_attention_slicing",anchor:"diffusers.StableDiffusionImageVariationPipeline.enable_attention_slicing",parameters:[{name:"slice_size",val:": typing.Union[str, int, NoneType] = 'auto'"}],parametersDescription:[{anchor:"diffusers.StableDiffusionImageVariationPipeline.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#L1690"}}),B=new Rt({props:{warning:!0,$$slots:{default:[$n]},$$scope:{ctx:x}}}),F=new qt({props:{anchor:"diffusers.StableDiffusionImageVariationPipeline.enable_attention_slicing.example",$$slots:{default:[In]},$$scope:{ctx:x}}}),se=new be({props:{name:"disable_attention_slicing",anchor:"diffusers.StableDiffusionImageVariationPipeline.disable_attention_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L1730"}}),le=new be({props:{name:"enable_xformers_memory_efficient_attention",anchor:"diffusers.StableDiffusionImageVariationPipeline.enable_xformers_memory_efficient_attention",parameters:[{name:"attention_op",val:": typing.Optional[typing.Callable] = None"}],parametersDescription:[{anchor:"diffusers.StableDiffusionImageVariationPipeline.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#L1629"}}),X=new Rt({props:{warning:!0,$$slots:{default:[Pn]},$$scope:{ctx:x}}}),R=new qt({props:{anchor:"diffusers.StableDiffusionImageVariationPipeline.enable_xformers_memory_efficient_attention.example",$$slots:{default:[Tn]},$$scope:{ctx:x}}}),pe=new be({props:{name:"disable_xformers_memory_efficient_attention",anchor:"diffusers.StableDiffusionImageVariationPipeline.disable_xformers_memory_efficient_attention",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L1664"}}),ue=new At({}),he=new be({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"}}),{c(){i=o("meta"),b=h(),f=o("h1"),r=o("a"),_=o("span"),v(a.$$.fragment),d=h(),k=o("span"),Oe=c("Image variation"),Ue=h(),E=o("p"),He=c("The Stable Diffusion model can also generate variations from an input image. It uses a fine-tuned version of a Stable Diffusion model by "),O=o("a"),Ke=c("Justin Pinkney"),et=c(" from "),H=o("a"),tt=c("Lambda"),nt=c("."),Ze=h(),V=o("p"),at=c("The original codebase can be found at "),K=o("a"),it=c("LambdaLabsML/lambda-diffusers"),ot=c(" and additional official checkpoints for image variation can be found at "),ee=o("a"),st=c("lambdalabs/sd-image-variations-diffusers"),rt=c("."),We=h(),v(L.$$.fragment),je=h(),Z=o("h2"),N=o("a"),ve=o("span"),v(te.$$.fragment),lt=h(),$e=o("span"),ft=c("StableDiffusionImageVariationPipeline"),Ge=h(),y=o("div"),v(ne.$$.fragment),ct=h(),Ie=o("p"),pt=c("Pipeline to generate image variations from an input image using Stable Diffusion."),dt=h(),ae=o("p"),mt=c("This model inherits from "),_e=o("a"),ut=c("DiffusionPipeline"),ht=c(`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),gt=h(),U=o("div"),v(ie.$$.fragment),bt=h(),Pe=o("p"),_t=c("The call function to the pipeline for generation."),wt=h(),v(C.$$.fragment),yt=h(),J=o("div"),v(oe.$$.fragment),vt=h(),Te=o("p"),$t=c(`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.`),It=h(),v(B.$$.fragment),Pt=h(),v(F.$$.fragment),Tt=h(),z=o("div"),v(se.$$.fragment),Dt=h(),re=o("p"),St=c("Disable sliced attention computation. If "),De=o("code"),xt=c("enable_attention_slicing"),Jt=c(` was previously called, attention is
computed in one step.`),Mt=h(),M=o("div"),v(le.$$.fragment),kt=h(),fe=o("p"),Et=c("Enable memory efficient attention from "),ce=o("a"),Vt=c("xFormers"),Ut=c(`. 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.`),Zt=h(),v(X.$$.fragment),Wt=h(),v(R.$$.fragment),jt=h(),A=o("div"),v(pe.$$.fragment),Gt=h(),de=o("p"),Lt=c("Disable memory efficient attention from "),me=o("a"),Nt=c("xFormers"),Ct=c("."),Le=h(),W=o("h2"),q=o("a"),Se=o("span"),v(ue.$$.fragment),Bt=h(),xe=o("span"),Ft=c("StableDiffusionPipelineOutput"),Ne=h(),j=o("div"),v(he.$$.fragment),zt=h(),Je=o("p"),Xt=c("Output class for Stable Diffusion pipelines."),this.h()},l(t){const u=_n('[data-svelte="svelte-1phssyn"]',document.head);i=s(u,"META",{name:!0,content:!0}),u.forEach(n),b=g(t),f=s(t,"H1",{class:!0});var ge=l(f);r=s(ge,"A",{id:!0,class:!0,href:!0});var Me=l(r);_=s(Me,"SPAN",{});var ke=l(_);$(a.$$.fragment,ke),ke.forEach(n),Me.forEach(n),d=g(ge),k=s(ge,"SPAN",{});var Ee=l(k);Oe=p(Ee,"Image variation"),Ee.forEach(n),ge.forEach(n),Ue=g(t),E=s(t,"P",{});var G=l(E);He=p(G,"The Stable Diffusion model can also generate variations from an input image. It uses a fine-tuned version of a Stable Diffusion model by "),O=s(G,"A",{href:!0,rel:!0});var Ve=l(O);Ke=p(Ve,"Justin Pinkney"),Ve.forEach(n),et=p(G," from "),H=s(G,"A",{href:!0,rel:!0});var Ot=l(H);tt=p(Ot,"Lambda"),Ot.forEach(n),nt=p(G,"."),G.forEach(n),Ze=g(t),V=s(t,"P",{});var we=l(V);at=p(we,"The original codebase can be found at "),K=s(we,"A",{href:!0,rel:!0});var Ht=l(K);it=p(Ht,"LambdaLabsML/lambda-diffusers"),Ht.forEach(n),ot=p(we," and additional official checkpoints for image variation can be found at "),ee=s(we,"A",{href:!0,rel:!0});var Kt=l(ee);st=p(Kt,"lambdalabs/sd-image-variations-diffusers"),Kt.forEach(n),rt=p(we,"."),we.forEach(n),We=g(t),$(L.$$.fragment,t),je=g(t),Z=s(t,"H2",{class:!0});var Be=l(Z);N=s(Be,"A",{id:!0,class:!0,href:!0});var en=l(N);ve=s(en,"SPAN",{});var tn=l(ve);$(te.$$.fragment,tn),tn.forEach(n),en.forEach(n),lt=g(Be),$e=s(Be,"SPAN",{});var nn=l($e);ft=p(nn,"StableDiffusionImageVariationPipeline"),nn.forEach(n),Be.forEach(n),Ge=g(t),y=s(t,"DIV",{class:!0});var S=l(y);$(ne.$$.fragment,S),ct=g(S),Ie=s(S,"P",{});var an=l(Ie);pt=p(an,"Pipeline to generate image variations from an input image using Stable Diffusion."),an.forEach(n),dt=g(S),ae=s(S,"P",{});var Fe=l(ae);mt=p(Fe,"This model inherits from "),_e=s(Fe,"A",{href:!0});var on=l(_e);ut=p(on,"DiffusionPipeline"),on.forEach(n),ht=p(Fe,`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),Fe.forEach(n),gt=g(S),U=s(S,"DIV",{class:!0});var ye=l(U);$(ie.$$.fragment,ye),bt=g(ye),Pe=s(ye,"P",{});var sn=l(Pe);_t=p(sn,"The call function to the pipeline for generation."),sn.forEach(n),wt=g(ye),$(C.$$.fragment,ye),ye.forEach(n),yt=g(S),J=s(S,"DIV",{class:!0});var Q=l(J);$(oe.$$.fragment,Q),vt=g(Q),Te=s(Q,"P",{});var rn=l(Te);$t=p(rn,`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.`),rn.forEach(n),It=g(Q),$(B.$$.fragment,Q),Pt=g(Q),$(F.$$.fragment,Q),Q.forEach(n),Tt=g(S),z=s(S,"DIV",{class:!0});var ze=l(z);$(se.$$.fragment,ze),Dt=g(ze),re=s(ze,"P",{});var Xe=l(re);St=p(Xe,"Disable sliced attention computation. If "),De=s(Xe,"CODE",{});var ln=l(De);xt=p(ln,"enable_attention_slicing"),ln.forEach(n),Jt=p(Xe,` was previously called, attention is
computed in one step.`),Xe.forEach(n),ze.forEach(n),Mt=g(S),M=s(S,"DIV",{class:!0});var Y=l(M);$(le.$$.fragment,Y),kt=g(Y),fe=s(Y,"P",{});var Re=l(fe);Et=p(Re,"Enable memory efficient attention from "),ce=s(Re,"A",{href:!0,rel:!0});var fn=l(ce);Vt=p(fn,"xFormers"),fn.forEach(n),Ut=p(Re,`. 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.`),Re.forEach(n),Zt=g(Y),$(X.$$.fragment,Y),Wt=g(Y),$(R.$$.fragment,Y),Y.forEach(n),jt=g(S),A=s(S,"DIV",{class:!0});var Ae=l(A);$(pe.$$.fragment,Ae),Gt=g(Ae),de=s(Ae,"P",{});var qe=l(de);Lt=p(qe,"Disable memory efficient attention from "),me=s(qe,"A",{href:!0,rel:!0});var cn=l(me);Nt=p(cn,"xFormers"),cn.forEach(n),Ct=p(qe,"."),qe.forEach(n),Ae.forEach(n),S.forEach(n),Le=g(t),W=s(t,"H2",{class:!0});var Qe=l(W);q=s(Qe,"A",{id:!0,class:!0,href:!0});var pn=l(q);Se=s(pn,"SPAN",{});var dn=l(Se);$(ue.$$.fragment,dn),dn.forEach(n),pn.forEach(n),Bt=g(Qe),xe=s(Qe,"SPAN",{});var mn=l(xe);Ft=p(mn,"StableDiffusionPipelineOutput"),mn.forEach(n),Qe.forEach(n),Ne=g(t),j=s(t,"DIV",{class:!0});var Ye=l(j);$(he.$$.fragment,Ye),zt=g(Ye),Je=s(Ye,"P",{});var un=l(Je);Xt=p(un,"Output class for Stable Diffusion pipelines."),un.forEach(n),Ye.forEach(n),this.h()},h(){m(i,"name","hf:doc:metadata"),m(i,"content",JSON.stringify(Sn)),m(r,"id","image-variation"),m(r,"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"),m(r,"href","#image-variation"),m(f,"class","relative group"),m(O,"href","https://www.justinpinkney.com/"),m(O,"rel","nofollow"),m(H,"href","https://lambdalabs.com/"),m(H,"rel","nofollow"),m(K,"href","https://github.com/LambdaLabsML/lambda-diffusers#stable-diffusion-image-variations"),m(K,"rel","nofollow"),m(ee,"href","https://huggingface.co/lambdalabs/sd-image-variations-diffusers"),m(ee,"rel","nofollow"),m(N,"id","diffusers.StableDiffusionImageVariationPipeline"),m(N,"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"),m(N,"href","#diffusers.StableDiffusionImageVariationPipeline"),m(Z,"class","relative group"),m(_e,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline"),m(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ce,"href","https://facebookresearch.github.io/xformers/"),m(ce,"rel","nofollow"),m(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(me,"href","https://facebookresearch.github.io/xformers/"),m(me,"rel","nofollow"),m(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(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(q,"id","diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"),m(q,"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"),m(q,"href","#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"),m(W,"class","relative group"),m(j,"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,u){e(document.head,i),w(t,b,u),w(t,f,u),e(f,r),e(r,_),I(a,_,null),e(f,d),e(f,k),e(k,Oe),w(t,Ue,u),w(t,E,u),e(E,He),e(E,O),e(O,Ke),e(E,et),e(E,H),e(H,tt),e(E,nt),w(t,Ze,u),w(t,V,u),e(V,at),e(V,K),e(K,it),e(V,ot),e(V,ee),e(ee,st),e(V,rt),w(t,We,u),I(L,t,u),w(t,je,u),w(t,Z,u),e(Z,N),e(N,ve),I(te,ve,null),e(Z,lt),e(Z,$e),e($e,ft),w(t,Ge,u),w(t,y,u),I(ne,y,null),e(y,ct),e(y,Ie),e(Ie,pt),e(y,dt),e(y,ae),e(ae,mt),e(ae,_e),e(_e,ut),e(ae,ht),e(y,gt),e(y,U),I(ie,U,null),e(U,bt),e(U,Pe),e(Pe,_t),e(U,wt),I(C,U,null),e(y,yt),e(y,J),I(oe,J,null),e(J,vt),e(J,Te),e(Te,$t),e(J,It),I(B,J,null),e(J,Pt),I(F,J,null),e(y,Tt),e(y,z),I(se,z,null),e(z,Dt),e(z,re),e(re,St),e(re,De),e(De,xt),e(re,Jt),e(y,Mt),e(y,M),I(le,M,null),e(M,kt),e(M,fe),e(fe,Et),e(fe,ce),e(ce,Vt),e(fe,Ut),e(M,Zt),I(X,M,null),e(M,Wt),I(R,M,null),e(y,jt),e(y,A),I(pe,A,null),e(A,Gt),e(A,de),e(de,Lt),e(de,me),e(me,Nt),e(de,Ct),w(t,Le,u),w(t,W,u),e(W,q),e(q,Se),I(ue,Se,null),e(W,Bt),e(W,xe),e(xe,Ft),w(t,Ne,u),w(t,j,u),I(he,j,null),e(j,zt),e(j,Je),e(Je,Xt),Ce=!0},p(t,[u]){const ge={};u&2&&(ge.$$scope={dirty:u,ctx:t}),L.$set(ge);const Me={};u&2&&(Me.$$scope={dirty:u,ctx:t}),C.$set(Me);const ke={};u&2&&(ke.$$scope={dirty:u,ctx:t}),B.$set(ke);const Ee={};u&2&&(Ee.$$scope={dirty:u,ctx:t}),F.$set(Ee);const G={};u&2&&(G.$$scope={dirty:u,ctx:t}),X.$set(G);const Ve={};u&2&&(Ve.$$scope={dirty:u,ctx:t}),R.$set(Ve)},i(t){Ce||(P(a.$$.fragment,t),P(L.$$.fragment,t),P(te.$$.fragment,t),P(ne.$$.fragment,t),P(ie.$$.fragment,t),P(C.$$.fragment,t),P(oe.$$.fragment,t),P(B.$$.fragment,t),P(F.$$.fragment,t),P(se.$$.fragment,t),P(le.$$.fragment,t),P(X.$$.fragment,t),P(R.$$.fragment,t),P(pe.$$.fragment,t),P(ue.$$.fragment,t),P(he.$$.fragment,t),Ce=!0)},o(t){T(a.$$.fragment,t),T(L.$$.fragment,t),T(te.$$.fragment,t),T(ne.$$.fragment,t),T(ie.$$.fragment,t),T(C.$$.fragment,t),T(oe.$$.fragment,t),T(B.$$.fragment,t),T(F.$$.fragment,t),T(se.$$.fragment,t),T(le.$$.fragment,t),T(X.$$.fragment,t),T(R.$$.fragment,t),T(pe.$$.fragment,t),T(ue.$$.fragment,t),T(he.$$.fragment,t),Ce=!1},d(t){n(i),t&&n(b),t&&n(f),D(a),t&&n(Ue),t&&n(E),t&&n(Ze),t&&n(V),t&&n(We),D(L,t),t&&n(je),t&&n(Z),D(te),t&&n(Ge),t&&n(y),D(ne),D(ie),D(C),D(oe),D(B),D(F),D(se),D(le),D(X),D(R),D(pe),t&&n(Le),t&&n(W),D(ue),t&&n(Ne),t&&n(j),D(he)}}}const Sn={local:"image-variation",sections:[{local:"diffusers.StableDiffusionImageVariationPipeline",title:"StableDiffusionImageVariationPipeline"},{local:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",title:"StableDiffusionPipelineOutput"}],title:"Image variation"};function xn(x){return wn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Zn extends hn{constructor(i){super();gn(this,i,xn,Dn,bn,{})}}export{Zn as default,Sn as metadata};
