import{s as tt,o as nt,n as pe}from"../chunks/scheduler.8c3d61f6.js";import{S as at,i as st,g as c,s as l,r as h,A as it,h as p,f as i,c as f,j as U,u as _,x,k as j,y as r,a as d,v as b,d as $,t as w,w as v}from"../chunks/index.da70eac4.js";import{T as Be}from"../chunks/Tip.1d9b8c37.js";import{D as ne}from"../chunks/Docstring.6b390b9a.js";import{C as Xe}from"../chunks/CodeBlock.00a903b3.js";import{E as ze}from"../chunks/ExampleCodeBlock.db12be95.js";import{H as Ne,E as ot}from"../chunks/EditOnGithub.1e64e623.js";function rt(T){let t,m='Make sure to check out the Stable Diffusion <a href="./overview#tips">Tips</a> section to learn how to explore the tradeoff between scheduler speed and quality, and how to reuse pipeline components efficiently!';return{c(){t=c("p"),t.innerHTML=m},l(a){t=p(a,"P",{"data-svelte-h":!0}),x(t)!=="svelte-py3d2y"&&(t.innerHTML=m)},m(a,o){d(a,t,o)},p:pe,d(a){a&&i(t)}}}function lt(T){let t,m="Examples:",a,o,u;return o=new Xe({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>)`,wrap:!1}}),{c(){t=c("p"),t.textContent=m,a=l(),h(o.$$.fragment)},l(n){t=p(n,"P",{"data-svelte-h":!0}),x(t)!=="svelte-kvfsh7"&&(t.textContent=m),a=f(n),_(o.$$.fragment,n)},m(n,I){d(n,t,I),d(n,a,I),b(o,n,I),u=!0},p:pe,i(n){u||($(o.$$.fragment,n),u=!0)},o(n){w(o.$$.fragment,n),u=!1},d(n){n&&(i(t),i(a)),v(o,n)}}}function ft(T){let t,m=`⚠️ Don’t enable attention slicing if you’re already using <code>scaled_dot_product_attention</code> (SDPA) from PyTorch
2.0 or xFormers. These attention computations are already very memory efficient so you won’t need to enable
this function. If you enable attention slicing with SDPA or xFormers, it can lead to serious slow downs!`;return{c(){t=c("p"),t.innerHTML=m},l(a){t=p(a,"P",{"data-svelte-h":!0}),x(t)!=="svelte-ackzsn"&&(t.innerHTML=m)},m(a,o){d(a,t,o)},p:pe,d(a){a&&i(t)}}}function ct(T){let t,m="Examples:",a,o,u;return o=new Xe({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>]`,wrap:!1}}),{c(){t=c("p"),t.textContent=m,a=l(),h(o.$$.fragment)},l(n){t=p(n,"P",{"data-svelte-h":!0}),x(t)!=="svelte-kvfsh7"&&(t.textContent=m),a=f(n),_(o.$$.fragment,n)},m(n,I){d(n,t,I),d(n,a,I),b(o,n,I),u=!0},p:pe,i(n){u||($(o.$$.fragment,n),u=!0)},o(n){w(o.$$.fragment,n),u=!1},d(n){n&&(i(t),i(a)),v(o,n)}}}function pt(T){let t,m=`⚠️ When memory efficient attention and sliced attention are both enabled, memory efficient attention takes
precedent.`;return{c(){t=c("p"),t.textContent=m},l(a){t=p(a,"P",{"data-svelte-h":!0}),x(t)!=="svelte-17p1lpg"&&(t.textContent=m)},m(a,o){d(a,t,o)},p:pe,d(a){a&&i(t)}}}function dt(T){let t,m="Examples:",a,o,u;return o=new Xe({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>)`,wrap:!1}}),{c(){t=c("p"),t.textContent=m,a=l(),h(o.$$.fragment)},l(n){t=p(n,"P",{"data-svelte-h":!0}),x(t)!=="svelte-kvfsh7"&&(t.textContent=m),a=f(n),_(o.$$.fragment,n)},m(n,I){d(n,t,I),d(n,a,I),b(o,n,I),u=!0},p:pe,i(n){u||($(o.$$.fragment,n),u=!0)},o(n){w(o.$$.fragment,n),u=!1},d(n){n&&(i(t),i(a)),v(o,n)}}}function mt(T){let t,m,a,o,u,n,I,Re='The Stable Diffusion model can also generate variations from an input image. It uses a fine-tuned version of a Stable Diffusion model by <a href="https://www.justinpinkney.com/" rel="nofollow">Justin Pinkney</a> from <a href="https://lambdalabs.com/" rel="nofollow">Lambda</a>.',me,N,Fe='The original codebase can be found at <a href="https://github.com/LambdaLabsML/lambda-diffusers#stable-diffusion-image-variations" rel="nofollow">LambdaLabsML/lambda-diffusers</a> and additional official checkpoints for image variation can be found at <a href="https://huggingface.co/lambdalabs/sd-image-variations-diffusers" rel="nofollow">lambdalabs/sd-image-variations-diffusers</a>.',ue,Z,ge,X,he,g,R,ye,ae,qe="Pipeline to generate image variations from an input image using Stable Diffusion.",xe,se,Qe=`This model inherits from <a href="/docs/diffusers/pr_7018/en/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a>. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`,Te,S,F,Me,ie,Ye="The call function to the pipeline for generation.",Pe,C,Je,M,q,De,oe,He=`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.`,Se,W,Ve,G,ke,L,Q,Ue,re,Oe=`Disable sliced attention computation. If <code>enable_attention_slicing</code> was previously called, attention is
computed in one step.`,je,P,Y,Ze,le,Ae=`Enable memory efficient attention from <a href="https://facebookresearch.github.io/xformers/" rel="nofollow">xFormers</a>. 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.`,Ce,E,We,B,Ge,z,H,Le,fe,Ke='Disable memory efficient attention from <a href="https://facebookresearch.github.io/xformers/" rel="nofollow">xFormers</a>.',_e,O,be,V,A,Ee,ce,et="Output class for Stable Diffusion pipelines.",$e,K,we,de,ve;return u=new Ne({props:{title:"Image variation",local:"image-variation",headingTag:"h1"}}),Z=new Be({props:{$$slots:{default:[rt]},$$scope:{ctx:T}}}),X=new Ne({props:{title:"StableDiffusionImageVariationPipeline",local:"diffusers.StableDiffusionImageVariationPipeline",headingTag:"h2"}}),R=new ne({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/pr_7018/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/pr_7018/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/pr_7018/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/pr_7018/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/pr_7018/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/pr_7018/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/vr_7018/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py#L37"}}),F=new ne({props:{name:"__call__",anchor:"diffusers.StableDiffusionImageVariationPipeline.__call__",parameters:[{name:"image",val:": Union"},{name:"height",val:": Optional = None"},{name:"width",val:": Optional = None"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 7.5"},{name:"num_images_per_prompt",val:": Optional = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": Union = None"},{name:"latents",val:": Optional = None"},{name:"output_type",val:": Optional = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": Optional = 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.Tensor</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/pr_7018/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.Tensor</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/pr_7018/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.Tensor)</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/vr_7018/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py#L248",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/pr_7018/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
“not-safe-for-work” (nsfw) content.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/diffusers/pr_7018/en/api/pipelines/stable_diffusion/inpaint#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),C=new ze({props:{anchor:"diffusers.StableDiffusionImageVariationPipeline.__call__.example",$$slots:{default:[lt]},$$scope:{ctx:T}}}),q=new ne({props:{name:"enable_attention_slicing",anchor:"diffusers.StableDiffusionImageVariationPipeline.enable_attention_slicing",parameters:[{name:"slice_size",val:": Union = '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/vr_7018/src/diffusers/pipelines/pipeline_utils.py#L1634"}}),W=new Be({props:{warning:!0,$$slots:{default:[ft]},$$scope:{ctx:T}}}),G=new ze({props:{anchor:"diffusers.StableDiffusionImageVariationPipeline.enable_attention_slicing.example",$$slots:{default:[ct]},$$scope:{ctx:T}}}),Q=new ne({props:{name:"disable_attention_slicing",anchor:"diffusers.StableDiffusionImageVariationPipeline.disable_attention_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_7018/src/diffusers/pipelines/pipeline_utils.py#L1674"}}),Y=new ne({props:{name:"enable_xformers_memory_efficient_attention",anchor:"diffusers.StableDiffusionImageVariationPipeline.enable_xformers_memory_efficient_attention",parameters:[{name:"attention_op",val:": Optional = 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/vr_7018/src/diffusers/pipelines/pipeline_utils.py#L1573"}}),E=new Be({props:{warning:!0,$$slots:{default:[pt]},$$scope:{ctx:T}}}),B=new ze({props:{anchor:"diffusers.StableDiffusionImageVariationPipeline.enable_xformers_memory_efficient_attention.example",$$slots:{default:[dt]},$$scope:{ctx:T}}}),H=new ne({props:{name:"disable_xformers_memory_efficient_attention",anchor:"diffusers.StableDiffusionImageVariationPipeline.disable_xformers_memory_efficient_attention",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_7018/src/diffusers/pipelines/pipeline_utils.py#L1608"}}),O=new Ne({props:{title:"StableDiffusionPipelineOutput",local:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",headingTag:"h2"}}),A=new ne({props:{name:"class diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",anchor:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",parameters:[{name:"images",val:": Union"},{name:"nsfw_content_detected",val:": Optional"}],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/vr_7018/src/diffusers/pipelines/stable_diffusion/pipeline_output.py#L10"}}),K=new ot({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/stable_diffusion/image_variation.md"}}),{c(){t=c("meta"),m=l(),a=c("p"),o=l(),h(u.$$.fragment),n=l(),I=c("p"),I.innerHTML=Re,me=l(),N=c("p"),N.innerHTML=Fe,ue=l(),h(Z.$$.fragment),ge=l(),h(X.$$.fragment),he=l(),g=c("div"),h(R.$$.fragment),ye=l(),ae=c("p"),ae.textContent=qe,xe=l(),se=c("p"),se.innerHTML=Qe,Te=l(),S=c("div"),h(F.$$.fragment),Me=l(),ie=c("p"),ie.textContent=Ye,Pe=l(),h(C.$$.fragment),Je=l(),M=c("div"),h(q.$$.fragment),De=l(),oe=c("p"),oe.textContent=He,Se=l(),h(W.$$.fragment),Ve=l(),h(G.$$.fragment),ke=l(),L=c("div"),h(Q.$$.fragment),Ue=l(),re=c("p"),re.innerHTML=Oe,je=l(),P=c("div"),h(Y.$$.fragment),Ze=l(),le=c("p"),le.innerHTML=Ae,Ce=l(),h(E.$$.fragment),We=l(),h(B.$$.fragment),Ge=l(),z=c("div"),h(H.$$.fragment),Le=l(),fe=c("p"),fe.innerHTML=Ke,_e=l(),h(O.$$.fragment),be=l(),V=c("div"),h(A.$$.fragment),Ee=l(),ce=c("p"),ce.textContent=et,$e=l(),h(K.$$.fragment),we=l(),de=c("p"),this.h()},l(e){const s=it("svelte-u9bgzb",document.head);t=p(s,"META",{name:!0,content:!0}),s.forEach(i),m=f(e),a=p(e,"P",{}),U(a).forEach(i),o=f(e),_(u.$$.fragment,e),n=f(e),I=p(e,"P",{"data-svelte-h":!0}),x(I)!=="svelte-136oux4"&&(I.innerHTML=Re),me=f(e),N=p(e,"P",{"data-svelte-h":!0}),x(N)!=="svelte-vto4t0"&&(N.innerHTML=Fe),ue=f(e),_(Z.$$.fragment,e),ge=f(e),_(X.$$.fragment,e),he=f(e),g=p(e,"DIV",{class:!0});var y=U(g);_(R.$$.fragment,y),ye=f(y),ae=p(y,"P",{"data-svelte-h":!0}),x(ae)!=="svelte-1dj22j7"&&(ae.textContent=qe),xe=f(y),se=p(y,"P",{"data-svelte-h":!0}),x(se)!=="svelte-ibva0m"&&(se.innerHTML=Qe),Te=f(y),S=p(y,"DIV",{class:!0});var k=U(S);_(F.$$.fragment,k),Me=f(k),ie=p(k,"P",{"data-svelte-h":!0}),x(ie)!=="svelte-50j04k"&&(ie.textContent=Ye),Pe=f(k),_(C.$$.fragment,k),k.forEach(i),Je=f(y),M=p(y,"DIV",{class:!0});var J=U(M);_(q.$$.fragment,J),De=f(J),oe=p(J,"P",{"data-svelte-h":!0}),x(oe)!=="svelte-10jaql7"&&(oe.textContent=He),Se=f(J),_(W.$$.fragment,J),Ve=f(J),_(G.$$.fragment,J),J.forEach(i),ke=f(y),L=p(y,"DIV",{class:!0});var ee=U(L);_(Q.$$.fragment,ee),Ue=f(ee),re=p(ee,"P",{"data-svelte-h":!0}),x(re)!=="svelte-1lh0nh5"&&(re.innerHTML=Oe),ee.forEach(i),je=f(y),P=p(y,"DIV",{class:!0});var D=U(P);_(Y.$$.fragment,D),Ze=f(D),le=p(D,"P",{"data-svelte-h":!0}),x(le)!=="svelte-e03q3e"&&(le.innerHTML=Ae),Ce=f(D),_(E.$$.fragment,D),We=f(D),_(B.$$.fragment,D),D.forEach(i),Ge=f(y),z=p(y,"DIV",{class:!0});var te=U(z);_(H.$$.fragment,te),Le=f(te),fe=p(te,"P",{"data-svelte-h":!0}),x(fe)!=="svelte-1vfte1e"&&(fe.innerHTML=Ke),te.forEach(i),y.forEach(i),_e=f(e),_(O.$$.fragment,e),be=f(e),V=p(e,"DIV",{class:!0});var Ie=U(V);_(A.$$.fragment,Ie),Ee=f(Ie),ce=p(Ie,"P",{"data-svelte-h":!0}),x(ce)!=="svelte-1qpjiuf"&&(ce.textContent=et),Ie.forEach(i),$e=f(e),_(K.$$.fragment,e),we=f(e),de=p(e,"P",{}),U(de).forEach(i),this.h()},h(){j(t,"name","hf:doc:metadata"),j(t,"content",ut),j(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(g,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,s){r(document.head,t),d(e,m,s),d(e,a,s),d(e,o,s),b(u,e,s),d(e,n,s),d(e,I,s),d(e,me,s),d(e,N,s),d(e,ue,s),b(Z,e,s),d(e,ge,s),b(X,e,s),d(e,he,s),d(e,g,s),b(R,g,null),r(g,ye),r(g,ae),r(g,xe),r(g,se),r(g,Te),r(g,S),b(F,S,null),r(S,Me),r(S,ie),r(S,Pe),b(C,S,null),r(g,Je),r(g,M),b(q,M,null),r(M,De),r(M,oe),r(M,Se),b(W,M,null),r(M,Ve),b(G,M,null),r(g,ke),r(g,L),b(Q,L,null),r(L,Ue),r(L,re),r(g,je),r(g,P),b(Y,P,null),r(P,Ze),r(P,le),r(P,Ce),b(E,P,null),r(P,We),b(B,P,null),r(g,Ge),r(g,z),b(H,z,null),r(z,Le),r(z,fe),d(e,_e,s),b(O,e,s),d(e,be,s),d(e,V,s),b(A,V,null),r(V,Ee),r(V,ce),d(e,$e,s),b(K,e,s),d(e,we,s),d(e,de,s),ve=!0},p(e,[s]){const y={};s&2&&(y.$$scope={dirty:s,ctx:e}),Z.$set(y);const k={};s&2&&(k.$$scope={dirty:s,ctx:e}),C.$set(k);const J={};s&2&&(J.$$scope={dirty:s,ctx:e}),W.$set(J);const ee={};s&2&&(ee.$$scope={dirty:s,ctx:e}),G.$set(ee);const D={};s&2&&(D.$$scope={dirty:s,ctx:e}),E.$set(D);const te={};s&2&&(te.$$scope={dirty:s,ctx:e}),B.$set(te)},i(e){ve||($(u.$$.fragment,e),$(Z.$$.fragment,e),$(X.$$.fragment,e),$(R.$$.fragment,e),$(F.$$.fragment,e),$(C.$$.fragment,e),$(q.$$.fragment,e),$(W.$$.fragment,e),$(G.$$.fragment,e),$(Q.$$.fragment,e),$(Y.$$.fragment,e),$(E.$$.fragment,e),$(B.$$.fragment,e),$(H.$$.fragment,e),$(O.$$.fragment,e),$(A.$$.fragment,e),$(K.$$.fragment,e),ve=!0)},o(e){w(u.$$.fragment,e),w(Z.$$.fragment,e),w(X.$$.fragment,e),w(R.$$.fragment,e),w(F.$$.fragment,e),w(C.$$.fragment,e),w(q.$$.fragment,e),w(W.$$.fragment,e),w(G.$$.fragment,e),w(Q.$$.fragment,e),w(Y.$$.fragment,e),w(E.$$.fragment,e),w(B.$$.fragment,e),w(H.$$.fragment,e),w(O.$$.fragment,e),w(A.$$.fragment,e),w(K.$$.fragment,e),ve=!1},d(e){e&&(i(m),i(a),i(o),i(n),i(I),i(me),i(N),i(ue),i(ge),i(he),i(g),i(_e),i(be),i(V),i($e),i(we),i(de)),i(t),v(u,e),v(Z,e),v(X,e),v(R),v(F),v(C),v(q),v(W),v(G),v(Q),v(Y),v(E),v(B),v(H),v(O,e),v(A),v(K,e)}}}const ut='{"title":"Image variation","local":"image-variation","sections":[{"title":"StableDiffusionImageVariationPipeline","local":"diffusers.StableDiffusionImageVariationPipeline","sections":[],"depth":2},{"title":"StableDiffusionPipelineOutput","local":"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput","sections":[],"depth":2}],"depth":1}';function gt(T){return nt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class yt extends at{constructor(t){super(),st(this,t,gt,mt,tt,{})}}export{yt as component};
