import{S as pn,i as dn,s as un,e as i,k as u,w as I,t as f,M as mn,c as o,d as n,m,a as s,x as $,h as c,b as l,G as e,g as _,y as P,q as D,o as S,B as x,v as hn,L as fn}from"../../../../chunks/vendor-hf-doc-builder.js";import{T as rn}from"../../../../chunks/Tip-hf-doc-builder.js";import{D as ue}from"../../../../chunks/Docstring-hf-doc-builder.js";import{C as cn}from"../../../../chunks/CodeBlock-hf-doc-builder.js";import{I as Nt}from"../../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ln}from"../../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function gn(k){let r,v,d,p,y;return{c(){r=i("p"),v=f("Make sure to check out the Stable Diffusion "),d=i("a"),p=f("Tips"),y=f(" section to learn how to explore the tradeoff between scheduler speed and quality, and how to reuse pipeline components efficiently!"),this.h()},l(a){r=o(a,"P",{});var g=s(r);v=c(g,"Make sure to check out the Stable Diffusion "),d=o(g,"A",{href:!0});var Z=s(d);p=c(Z,"Tips"),Z.forEach(n),y=c(g," section to learn how to explore the tradeoff between scheduler speed and quality, and how to reuse pipeline components efficiently!"),g.forEach(n),this.h()},h(){l(d,"href","./overview#tips")},m(a,g){_(a,r,g),e(r,v),e(r,d),e(d,p),e(r,y)},d(a){a&&n(r)}}}function bn(k){let r,v,d,p,y;return p=new cn({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(){r=i("p"),v=f("Examples:"),d=u(),I(p.$$.fragment)},l(a){r=o(a,"P",{});var g=s(r);v=c(g,"Examples:"),g.forEach(n),d=m(a),$(p.$$.fragment,a)},m(a,g){_(a,r,g),e(r,v),_(a,d,g),P(p,a,g),y=!0},p:fn,i(a){y||(D(p.$$.fragment,a),y=!0)},o(a){S(p.$$.fragment,a),y=!1},d(a){a&&n(r),a&&n(d),x(p,a)}}}function _n(k){let r,v;return{c(){r=i("p"),v=f(`\u26A0\uFE0F When memory efficient attention and sliced attention are both enabled, memory efficient attention takes
precedent.`)},l(d){r=o(d,"P",{});var p=s(r);v=c(p,`\u26A0\uFE0F When memory efficient attention and sliced attention are both enabled, memory efficient attention takes
precedent.`),p.forEach(n)},m(d,p){_(d,r,p),e(r,v)},d(d){d&&n(r)}}}function vn(k){let r,v,d,p,y;return p=new cn({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(){r=i("p"),v=f("Examples:"),d=u(),I(p.$$.fragment)},l(a){r=o(a,"P",{});var g=s(r);v=c(g,"Examples:"),g.forEach(n),d=m(a),$(p.$$.fragment,a)},m(a,g){_(a,r,g),e(r,v),_(a,d,g),P(p,a,g),y=!0},p:fn,i(a){y||(D(p.$$.fragment,a),y=!0)},o(a){S(p.$$.fragment,a),y=!1},d(a){a&&n(r),a&&n(d),x(p,a)}}}function yn(k){let r,v,d,p,y,a,g,Z,qe,Me,M,Oe,R,Qe,Ye,q,He,Ke,Ve,V,et,O,tt,nt,Q,at,it,Ee,L,Je,J,G,_e,Y,ot,ve,st,Ue,b,H,rt,ye,lt,ft,K,ct,me,pt,dt,ut,E,ee,mt,we,ht,gt,j,bt,C,te,_t,Ie,vt,yt,N,ne,wt,ae,It,$e,$t,Pt,Dt,T,ie,St,oe,xt,se,Tt,kt,Mt,B,Vt,z,Et,F,re,Jt,le,Ut,fe,Wt,Zt,We,U,X,Pe,ce,Lt,De,Gt,Ze,W,pe,jt,Se,Ct,Le;return a=new Nt({}),L=new rn({props:{$$slots:{default:[gn]},$$scope:{ctx:k}}}),Y=new Nt({}),H=new ue({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/v0.19.2/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/v4.31.0/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/v4.31.0/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/v4.31.0/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/v0.19.2/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/v0.19.2/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/v0.19.2/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.19.2/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.19.2/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/v4.31.0/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/v0.19.2/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py#L37"}}),ee=new ue({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/v0.19.2/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/v0.19.2/en/api/pipelines/stable_diffusion/inpaint#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/v0.19.2/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/v0.19.2/en/api/pipelines/stable_diffusion/inpaint#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/v0.19.2/en/api/pipelines/stable_diffusion/inpaint#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),j=new ln({props:{anchor:"diffusers.StableDiffusionImageVariationPipeline.__call__.example",$$slots:{default:[bn]},$$scope:{ctx:k}}}),te=new ue({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/v0.19.2/src/diffusers/pipelines/pipeline_utils.py#L1669"}}),ne=new ue({props:{name:"disable_attention_slicing",anchor:"diffusers.StableDiffusionImageVariationPipeline.disable_attention_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.19.2/src/diffusers/pipelines/pipeline_utils.py#L1684"}}),ie=new ue({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/v0.19.2/src/diffusers/pipelines/pipeline_utils.py#L1608"}}),B=new rn({props:{warning:!0,$$slots:{default:[_n]},$$scope:{ctx:k}}}),z=new ln({props:{anchor:"diffusers.StableDiffusionImageVariationPipeline.enable_xformers_memory_efficient_attention.example",$$slots:{default:[vn]},$$scope:{ctx:k}}}),re=new ue({props:{name:"disable_xformers_memory_efficient_attention",anchor:"diffusers.StableDiffusionImageVariationPipeline.disable_xformers_memory_efficient_attention",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.19.2/src/diffusers/pipelines/pipeline_utils.py#L1643"}}),ce=new Nt({}),pe=new ue({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/v0.19.2/src/diffusers/pipelines/stable_diffusion/__init__.py#L22"}}),{c(){r=i("meta"),v=u(),d=i("h1"),p=i("a"),y=i("span"),I(a.$$.fragment),g=u(),Z=i("span"),qe=f("Image variation"),Me=u(),M=i("p"),Oe=f("The Stable Diffusion model can also generate variations from an input image. It uses a fine-tuned version of a Stable Diffusion model by "),R=i("a"),Qe=f("Justin Pinkney"),Ye=f(" from "),q=i("a"),He=f("Lambda"),Ke=f("."),Ve=u(),V=i("p"),et=f("The original codebase can be found at "),O=i("a"),tt=f("LambdaLabsML/lambda-diffusers"),nt=f(" and additional official checkpoints for image variation can be found at "),Q=i("a"),at=f("lambdalabs/sd-image-variations-diffusers"),it=f("."),Ee=u(),I(L.$$.fragment),Je=u(),J=i("h2"),G=i("a"),_e=i("span"),I(Y.$$.fragment),ot=u(),ve=i("span"),st=f("StableDiffusionImageVariationPipeline"),Ue=u(),b=i("div"),I(H.$$.fragment),rt=u(),ye=i("p"),lt=f("Pipeline to generate image variations from an input image using Stable Diffusion."),ft=u(),K=i("p"),ct=f("This model inherits from "),me=i("a"),pt=f("DiffusionPipeline"),dt=f(`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),ut=u(),E=i("div"),I(ee.$$.fragment),mt=u(),we=i("p"),ht=f("The call function to the pipeline for generation."),gt=u(),I(j.$$.fragment),bt=u(),C=i("div"),I(te.$$.fragment),_t=u(),Ie=i("p"),vt=f(`Enable sliced attention computation. When this option is enabled, the attention module splits the input tensor
in slices to compute attention in several steps. This is useful to save some memory in exchange for a small
speed decrease.`),yt=u(),N=i("div"),I(ne.$$.fragment),wt=u(),ae=i("p"),It=f("Disable sliced attention computation. If "),$e=i("code"),$t=f("enable_attention_slicing"),Pt=f(` was previously called, attention is
computed in one step.`),Dt=u(),T=i("div"),I(ie.$$.fragment),St=u(),oe=i("p"),xt=f("Enable memory efficient attention from "),se=i("a"),Tt=f("xFormers"),kt=f(`. 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.`),Mt=u(),I(B.$$.fragment),Vt=u(),I(z.$$.fragment),Et=u(),F=i("div"),I(re.$$.fragment),Jt=u(),le=i("p"),Ut=f("Disable memory efficient attention from "),fe=i("a"),Wt=f("xFormers"),Zt=f("."),We=u(),U=i("h2"),X=i("a"),Pe=i("span"),I(ce.$$.fragment),Lt=u(),De=i("span"),Gt=f("StableDiffusionPipelineOutput"),Ze=u(),W=i("div"),I(pe.$$.fragment),jt=u(),Se=i("p"),Ct=f("Output class for Stable Diffusion pipelines."),this.h()},l(t){const h=mn('[data-svelte="svelte-1phssyn"]',document.head);r=o(h,"META",{name:!0,content:!0}),h.forEach(n),v=m(t),d=o(t,"H1",{class:!0});var de=s(d);p=o(de,"A",{id:!0,class:!0,href:!0});var xe=s(p);y=o(xe,"SPAN",{});var Te=s(y);$(a.$$.fragment,Te),Te.forEach(n),xe.forEach(n),g=m(de),Z=o(de,"SPAN",{});var ke=s(Z);qe=c(ke,"Image variation"),ke.forEach(n),de.forEach(n),Me=m(t),M=o(t,"P",{});var he=s(M);Oe=c(he,"The Stable Diffusion model can also generate variations from an input image. It uses a fine-tuned version of a Stable Diffusion model by "),R=o(he,"A",{href:!0,rel:!0});var Bt=s(R);Qe=c(Bt,"Justin Pinkney"),Bt.forEach(n),Ye=c(he," from "),q=o(he,"A",{href:!0,rel:!0});var zt=s(q);He=c(zt,"Lambda"),zt.forEach(n),Ke=c(he,"."),he.forEach(n),Ve=m(t),V=o(t,"P",{});var ge=s(V);et=c(ge,"The original codebase can be found at "),O=o(ge,"A",{href:!0,rel:!0});var Ft=s(O);tt=c(Ft,"LambdaLabsML/lambda-diffusers"),Ft.forEach(n),nt=c(ge," and additional official checkpoints for image variation can be found at "),Q=o(ge,"A",{href:!0,rel:!0});var Xt=s(Q);at=c(Xt,"lambdalabs/sd-image-variations-diffusers"),Xt.forEach(n),it=c(ge,"."),ge.forEach(n),Ee=m(t),$(L.$$.fragment,t),Je=m(t),J=o(t,"H2",{class:!0});var Ge=s(J);G=o(Ge,"A",{id:!0,class:!0,href:!0});var At=s(G);_e=o(At,"SPAN",{});var Rt=s(_e);$(Y.$$.fragment,Rt),Rt.forEach(n),At.forEach(n),ot=m(Ge),ve=o(Ge,"SPAN",{});var qt=s(ve);st=c(qt,"StableDiffusionImageVariationPipeline"),qt.forEach(n),Ge.forEach(n),Ue=m(t),b=o(t,"DIV",{class:!0});var w=s(b);$(H.$$.fragment,w),rt=m(w),ye=o(w,"P",{});var Ot=s(ye);lt=c(Ot,"Pipeline to generate image variations from an input image using Stable Diffusion."),Ot.forEach(n),ft=m(w),K=o(w,"P",{});var je=s(K);ct=c(je,"This model inherits from "),me=o(je,"A",{href:!0});var Qt=s(me);pt=c(Qt,"DiffusionPipeline"),Qt.forEach(n),dt=c(je,`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),je.forEach(n),ut=m(w),E=o(w,"DIV",{class:!0});var be=s(E);$(ee.$$.fragment,be),mt=m(be),we=o(be,"P",{});var Yt=s(we);ht=c(Yt,"The call function to the pipeline for generation."),Yt.forEach(n),gt=m(be),$(j.$$.fragment,be),be.forEach(n),bt=m(w),C=o(w,"DIV",{class:!0});var Ce=s(C);$(te.$$.fragment,Ce),_t=m(Ce),Ie=o(Ce,"P",{});var Ht=s(Ie);vt=c(Ht,`Enable sliced attention computation. When this option is enabled, the attention module splits the input tensor
in slices to compute attention in several steps. This is useful to save some memory in exchange for a small
speed decrease.`),Ht.forEach(n),Ce.forEach(n),yt=m(w),N=o(w,"DIV",{class:!0});var Ne=s(N);$(ne.$$.fragment,Ne),wt=m(Ne),ae=o(Ne,"P",{});var Be=s(ae);It=c(Be,"Disable sliced attention computation. If "),$e=o(Be,"CODE",{});var Kt=s($e);$t=c(Kt,"enable_attention_slicing"),Kt.forEach(n),Pt=c(Be,` was previously called, attention is
computed in one step.`),Be.forEach(n),Ne.forEach(n),Dt=m(w),T=o(w,"DIV",{class:!0});var A=s(T);$(ie.$$.fragment,A),St=m(A),oe=o(A,"P",{});var ze=s(oe);xt=c(ze,"Enable memory efficient attention from "),se=o(ze,"A",{href:!0,rel:!0});var en=s(se);Tt=c(en,"xFormers"),en.forEach(n),kt=c(ze,`. 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.`),ze.forEach(n),Mt=m(A),$(B.$$.fragment,A),Vt=m(A),$(z.$$.fragment,A),A.forEach(n),Et=m(w),F=o(w,"DIV",{class:!0});var Fe=s(F);$(re.$$.fragment,Fe),Jt=m(Fe),le=o(Fe,"P",{});var Xe=s(le);Ut=c(Xe,"Disable memory efficient attention from "),fe=o(Xe,"A",{href:!0,rel:!0});var tn=s(fe);Wt=c(tn,"xFormers"),tn.forEach(n),Zt=c(Xe,"."),Xe.forEach(n),Fe.forEach(n),w.forEach(n),We=m(t),U=o(t,"H2",{class:!0});var Ae=s(U);X=o(Ae,"A",{id:!0,class:!0,href:!0});var nn=s(X);Pe=o(nn,"SPAN",{});var an=s(Pe);$(ce.$$.fragment,an),an.forEach(n),nn.forEach(n),Lt=m(Ae),De=o(Ae,"SPAN",{});var on=s(De);Gt=c(on,"StableDiffusionPipelineOutput"),on.forEach(n),Ae.forEach(n),Ze=m(t),W=o(t,"DIV",{class:!0});var Re=s(W);$(pe.$$.fragment,Re),jt=m(Re),Se=o(Re,"P",{});var sn=s(Se);Ct=c(sn,"Output class for Stable Diffusion pipelines."),sn.forEach(n),Re.forEach(n),this.h()},h(){l(r,"name","hf:doc:metadata"),l(r,"content",JSON.stringify(wn)),l(p,"id","image-variation"),l(p,"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"),l(p,"href","#image-variation"),l(d,"class","relative group"),l(R,"href","https://www.justinpinkney.com/"),l(R,"rel","nofollow"),l(q,"href","https://lambdalabs.com/"),l(q,"rel","nofollow"),l(O,"href","https://github.com/LambdaLabsML/lambda-diffusers#stable-diffusion-image-variations"),l(O,"rel","nofollow"),l(Q,"href","https://huggingface.co/lambdalabs/sd-image-variations-diffusers"),l(Q,"rel","nofollow"),l(G,"id","diffusers.StableDiffusionImageVariationPipeline"),l(G,"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"),l(G,"href","#diffusers.StableDiffusionImageVariationPipeline"),l(J,"class","relative group"),l(me,"href","/docs/diffusers/v0.19.2/en/api/pipelines/overview#diffusers.DiffusionPipeline"),l(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(se,"href","https://facebookresearch.github.io/xformers/"),l(se,"rel","nofollow"),l(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(fe,"href","https://facebookresearch.github.io/xformers/"),l(fe,"rel","nofollow"),l(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(X,"id","diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"),l(X,"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"),l(X,"href","#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"),l(U,"class","relative group"),l(W,"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,r),_(t,v,h),_(t,d,h),e(d,p),e(p,y),P(a,y,null),e(d,g),e(d,Z),e(Z,qe),_(t,Me,h),_(t,M,h),e(M,Oe),e(M,R),e(R,Qe),e(M,Ye),e(M,q),e(q,He),e(M,Ke),_(t,Ve,h),_(t,V,h),e(V,et),e(V,O),e(O,tt),e(V,nt),e(V,Q),e(Q,at),e(V,it),_(t,Ee,h),P(L,t,h),_(t,Je,h),_(t,J,h),e(J,G),e(G,_e),P(Y,_e,null),e(J,ot),e(J,ve),e(ve,st),_(t,Ue,h),_(t,b,h),P(H,b,null),e(b,rt),e(b,ye),e(ye,lt),e(b,ft),e(b,K),e(K,ct),e(K,me),e(me,pt),e(K,dt),e(b,ut),e(b,E),P(ee,E,null),e(E,mt),e(E,we),e(we,ht),e(E,gt),P(j,E,null),e(b,bt),e(b,C),P(te,C,null),e(C,_t),e(C,Ie),e(Ie,vt),e(b,yt),e(b,N),P(ne,N,null),e(N,wt),e(N,ae),e(ae,It),e(ae,$e),e($e,$t),e(ae,Pt),e(b,Dt),e(b,T),P(ie,T,null),e(T,St),e(T,oe),e(oe,xt),e(oe,se),e(se,Tt),e(oe,kt),e(T,Mt),P(B,T,null),e(T,Vt),P(z,T,null),e(b,Et),e(b,F),P(re,F,null),e(F,Jt),e(F,le),e(le,Ut),e(le,fe),e(fe,Wt),e(le,Zt),_(t,We,h),_(t,U,h),e(U,X),e(X,Pe),P(ce,Pe,null),e(U,Lt),e(U,De),e(De,Gt),_(t,Ze,h),_(t,W,h),P(pe,W,null),e(W,jt),e(W,Se),e(Se,Ct),Le=!0},p(t,[h]){const de={};h&2&&(de.$$scope={dirty:h,ctx:t}),L.$set(de);const xe={};h&2&&(xe.$$scope={dirty:h,ctx:t}),j.$set(xe);const Te={};h&2&&(Te.$$scope={dirty:h,ctx:t}),B.$set(Te);const ke={};h&2&&(ke.$$scope={dirty:h,ctx:t}),z.$set(ke)},i(t){Le||(D(a.$$.fragment,t),D(L.$$.fragment,t),D(Y.$$.fragment,t),D(H.$$.fragment,t),D(ee.$$.fragment,t),D(j.$$.fragment,t),D(te.$$.fragment,t),D(ne.$$.fragment,t),D(ie.$$.fragment,t),D(B.$$.fragment,t),D(z.$$.fragment,t),D(re.$$.fragment,t),D(ce.$$.fragment,t),D(pe.$$.fragment,t),Le=!0)},o(t){S(a.$$.fragment,t),S(L.$$.fragment,t),S(Y.$$.fragment,t),S(H.$$.fragment,t),S(ee.$$.fragment,t),S(j.$$.fragment,t),S(te.$$.fragment,t),S(ne.$$.fragment,t),S(ie.$$.fragment,t),S(B.$$.fragment,t),S(z.$$.fragment,t),S(re.$$.fragment,t),S(ce.$$.fragment,t),S(pe.$$.fragment,t),Le=!1},d(t){n(r),t&&n(v),t&&n(d),x(a),t&&n(Me),t&&n(M),t&&n(Ve),t&&n(V),t&&n(Ee),x(L,t),t&&n(Je),t&&n(J),x(Y),t&&n(Ue),t&&n(b),x(H),x(ee),x(j),x(te),x(ne),x(ie),x(B),x(z),x(re),t&&n(We),t&&n(U),x(ce),t&&n(Ze),t&&n(W),x(pe)}}}const wn={local:"image-variation",sections:[{local:"diffusers.StableDiffusionImageVariationPipeline",title:"StableDiffusionImageVariationPipeline"},{local:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",title:"StableDiffusionPipelineOutput"}],title:"Image variation"};function In(k){return hn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class kn extends pn{constructor(r){super();dn(this,r,In,yn,un,{})}}export{kn as default,wn as metadata};
