import{S as da,i as ca,s as pa,e as i,k as l,w,t as s,M as ma,c as n,d as a,m as f,a as o,x as I,h as r,b as d,G as e,g as _,y as P,q as D,o as $,B as S,v as ua,L as ha}from"../../../../chunks/vendor-hf-doc-builder.js";import{D as ne}from"../../../../chunks/Docstring-hf-doc-builder.js";import{C as ga}from"../../../../chunks/CodeBlock-hf-doc-builder.js";import{I as fa}from"../../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as _a}from"../../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function ba(De){let h,T,b,g,x;return g=new ga({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(){h=i("p"),T=s("Examples:"),b=l(),w(g.$$.fragment)},l(c){h=n(c,"P",{});var V=o(h);T=r(V,"Examples:"),V.forEach(a),b=f(c),I(g.$$.fragment,c)},m(c,V){_(c,h,V),e(h,T),_(c,b,V),P(g,c,V),x=!0},p:ha,i(c){x||(D(g.$$.fragment,c),x=!0)},o(c){$(g.$$.fragment,c),x=!1},d(c){c&&a(h),c&&a(b),S(g,c)}}}function va(De){let h,T,b,g,x,c,V,de,je,$e,M,W,ce,Z,Je,pe,Fe,Se,y,oe,Oe,Xe,N,qe,Be,j,Re,ze,xe,J,Qe,F,Ye,Ve,se,He,Ee,re,O,me,Ke,et,X,tt,ke,p,q,at,ue,it,nt,B,ot,le,st,rt,lt,C,R,ft,he,dt,ct,E,z,pt,ge,mt,ut,_e,ht,gt,G,Q,_t,Y,bt,be,vt,yt,wt,v,H,It,ve,Pt,Dt,ye,$t,St,we,xt,Vt,L,Et,U,K,kt,Ie,Mt,Tt,A,ee,Wt,te,Ct,Pe,Gt,Lt,Me;return c=new fa({}),Z=new fa({}),q=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/v0.17.0/en/api/models#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> (<code>CLIPVisionModelWithProjection</code>) &#x2014;
Frozen CLIP image-encoder. Stable Diffusion Image Variation uses the vision portion of
<a href="https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPVisionModelWithProjection" rel="nofollow">CLIP</a>,
specifically the <a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a> variant.`,name:"image_encoder"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.unet",description:'<strong>unet</strong> (<a href="/docs/diffusers/v0.17.0/en/api/models#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014; Conditional U-Net architecture to denoise the encoded image latents.',name:"unet"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.17.0/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.17.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.17.0/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.17.0/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 details.`,name:"safety_checker"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.feature_extractor",description:`<strong>feature_extractor</strong> (<code>CLIPImageProcessor</code>) &#x2014;
Model that extracts features from generated images to be used as inputs for the <code>safety_checker</code>.`,name:"feature_extractor"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py#L37"}}),R=new ne({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;
The image or images to guide the image generation. If you provide a tensor, it needs to comply with the
configuration of
<a href="https://huggingface.co/lambdalabs/sd-image-variations-diffusers/blob/main/feature_extractor/preprocessor_config.json" rel="nofollow">this</a>
<code>CLIPImageProcessor</code>`,name:"image"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size * self.vae_scale_factor) &#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 self.unet.config.sample_size * self.vae_scale_factor) &#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.`,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;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,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;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/v0.17.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</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 will ge 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 generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.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.17.0/en/api/pipelines/stable_diffusion/overview#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 will be called every <code>callback_steps</code> steps during inference. The function will be
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 will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py#L274",returnDescription:`
<p><a
  href="/docs/diffusers/v0.17.0/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> if <code>return_dict</code> is True, otherwise a <code>tuple. When returning a tuple, the first element is a list with the generated images, and the second element is a list of </code>bool<code>s denoting whether the corresponding generated image likely represents "not-safe-for-work" (nsfw) content, according to the </code>safety_checker\`.</p>
`,returnType:`
<p><a
  href="/docs/diffusers/v0.17.0/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),z=new ne({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.17.0/src/diffusers/pipelines/pipeline_utils.py#L1492"}}),Q=new ne({props:{name:"disable_attention_slicing",anchor:"diffusers.StableDiffusionImageVariationPipeline.disable_attention_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/pipeline_utils.py#L1508"}}),H=new ne({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.17.0/src/diffusers/pipelines/pipeline_utils.py#L1434"}}),L=new _a({props:{anchor:"diffusers.StableDiffusionImageVariationPipeline.enable_xformers_memory_efficient_attention.example",$$slots:{default:[ba]},$$scope:{ctx:De}}}),K=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/v0.17.0/src/diffusers/pipelines/pipeline_utils.py#L1466"}}),ee=new ne({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.StableDiffusionImageVariationPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py#L126"}}),{c(){h=i("meta"),T=l(),b=i("h1"),g=i("a"),x=i("span"),w(c.$$.fragment),V=l(),de=i("span"),je=s("Image Variation"),$e=l(),M=i("h2"),W=i("a"),ce=i("span"),w(Z.$$.fragment),Je=l(),pe=i("span"),Fe=s("StableDiffusionImageVariationPipeline"),Se=l(),y=i("p"),oe=i("a"),Oe=s("StableDiffusionImageVariationPipeline"),Xe=s(" lets you generate variations from an input image using Stable Diffusion. It uses a fine-tuned version of Stable Diffusion model, trained by  "),N=i("a"),qe=s("Justin Pinkney"),Be=s(" (@Buntworthy) at "),j=i("a"),Re=s("Lambda"),ze=s("."),xe=l(),J=i("p"),Qe=s(`The original codebase can be found here:
`),F=i("a"),Ye=s("Stable Diffusion Image Variations"),Ve=l(),se=i("p"),He=s("Available Checkpoints are:"),Ee=l(),re=i("ul"),O=i("li"),me=i("em"),Ke=s("sd-image-variations-diffusers"),et=s(": "),X=i("a"),tt=s("lambdalabs/sd-image-variations-diffusers"),ke=l(),p=i("div"),w(q.$$.fragment),at=l(),ue=i("p"),it=s("Pipeline to generate variations from an input image using Stable Diffusion."),nt=l(),B=i("p"),ot=s("This model inherits from "),le=i("a"),st=s("DiffusionPipeline"),rt=s(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),lt=l(),C=i("div"),w(R.$$.fragment),ft=l(),he=i("p"),dt=s("Function invoked when calling the pipeline for generation."),ct=l(),E=i("div"),w(z.$$.fragment),pt=l(),ge=i("p"),mt=s("Enable sliced attention computation."),ut=l(),_e=i("p"),ht=s(`When this option is enabled, the attention module will split 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.`),gt=l(),G=i("div"),w(Q.$$.fragment),_t=l(),Y=i("p"),bt=s("Disable sliced attention computation. If "),be=i("code"),vt=s("enable_attention_slicing"),yt=s(` was previously invoked, this method will go
back to computing attention in one step.`),wt=l(),v=i("div"),w(H.$$.fragment),It=l(),ve=i("p"),Pt=s("Enable memory efficient attention as implemented in xformers."),Dt=l(),ye=i("p"),$t=s(`When this option is enabled, you should observe lower GPU memory usage and a potential speed up at inference
time. Speed up at training time is not guaranteed.`),St=l(),we=i("p"),xt=s(`Warning: When Memory Efficient Attention and Sliced attention are both enabled, the Memory Efficient Attention
is used.`),Vt=l(),w(L.$$.fragment),Et=l(),U=i("div"),w(K.$$.fragment),kt=l(),Ie=i("p"),Mt=s("Disable memory efficient attention as implemented in xformers."),Tt=l(),A=i("div"),w(ee.$$.fragment),Wt=l(),te=i("p"),Ct=s(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
`),Pe=i("code"),Gt=s("torch.device('meta') and loaded to GPU only when their specific submodule has its "),Lt=s("forward` method called."),this.h()},l(t){const m=ma('[data-svelte="svelte-1phssyn"]',document.head);h=n(m,"META",{name:!0,content:!0}),m.forEach(a),T=f(t),b=n(t,"H1",{class:!0});var ae=o(b);g=n(ae,"A",{id:!0,class:!0,href:!0});var At=o(g);x=n(At,"SPAN",{});var Zt=o(x);I(c.$$.fragment,Zt),Zt.forEach(a),At.forEach(a),V=f(ae),de=n(ae,"SPAN",{});var Nt=o(de);je=r(Nt,"Image Variation"),Nt.forEach(a),ae.forEach(a),$e=f(t),M=n(t,"H2",{class:!0});var Te=o(M);W=n(Te,"A",{id:!0,class:!0,href:!0});var jt=o(W);ce=n(jt,"SPAN",{});var Jt=o(ce);I(Z.$$.fragment,Jt),Jt.forEach(a),jt.forEach(a),Je=f(Te),pe=n(Te,"SPAN",{});var Ft=o(pe);Fe=r(Ft,"StableDiffusionImageVariationPipeline"),Ft.forEach(a),Te.forEach(a),Se=f(t),y=n(t,"P",{});var ie=o(y);oe=n(ie,"A",{href:!0});var Ot=o(oe);Oe=r(Ot,"StableDiffusionImageVariationPipeline"),Ot.forEach(a),Xe=r(ie," lets you generate variations from an input image using Stable Diffusion. It uses a fine-tuned version of Stable Diffusion model, trained by  "),N=n(ie,"A",{href:!0,rel:!0});var Xt=o(N);qe=r(Xt,"Justin Pinkney"),Xt.forEach(a),Be=r(ie," (@Buntworthy) at "),j=n(ie,"A",{href:!0,rel:!0});var qt=o(j);Re=r(qt,"Lambda"),qt.forEach(a),ze=r(ie,"."),ie.forEach(a),xe=f(t),J=n(t,"P",{});var Ut=o(J);Qe=r(Ut,`The original codebase can be found here:
`),F=n(Ut,"A",{href:!0,rel:!0});var Bt=o(F);Ye=r(Bt,"Stable Diffusion Image Variations"),Bt.forEach(a),Ut.forEach(a),Ve=f(t),se=n(t,"P",{});var Rt=o(se);He=r(Rt,"Available Checkpoints are:"),Rt.forEach(a),Ee=f(t),re=n(t,"UL",{});var zt=o(re);O=n(zt,"LI",{});var We=o(O);me=n(We,"EM",{});var Qt=o(me);Ke=r(Qt,"sd-image-variations-diffusers"),Qt.forEach(a),et=r(We,": "),X=n(We,"A",{href:!0,rel:!0});var Yt=o(X);tt=r(Yt,"lambdalabs/sd-image-variations-diffusers"),Yt.forEach(a),We.forEach(a),zt.forEach(a),ke=f(t),p=n(t,"DIV",{class:!0});var u=o(p);I(q.$$.fragment,u),at=f(u),ue=n(u,"P",{});var Ht=o(ue);it=r(Ht,"Pipeline to generate variations from an input image using Stable Diffusion."),Ht.forEach(a),nt=f(u),B=n(u,"P",{});var Ce=o(B);ot=r(Ce,"This model inherits from "),le=n(Ce,"A",{href:!0});var Kt=o(le);st=r(Kt,"DiffusionPipeline"),Kt.forEach(a),rt=r(Ce,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),Ce.forEach(a),lt=f(u),C=n(u,"DIV",{class:!0});var Ge=o(C);I(R.$$.fragment,Ge),ft=f(Ge),he=n(Ge,"P",{});var ea=o(he);dt=r(ea,"Function invoked when calling the pipeline for generation."),ea.forEach(a),Ge.forEach(a),ct=f(u),E=n(u,"DIV",{class:!0});var fe=o(E);I(z.$$.fragment,fe),pt=f(fe),ge=n(fe,"P",{});var ta=o(ge);mt=r(ta,"Enable sliced attention computation."),ta.forEach(a),ut=f(fe),_e=n(fe,"P",{});var aa=o(_e);ht=r(aa,`When this option is enabled, the attention module will split 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.`),aa.forEach(a),fe.forEach(a),gt=f(u),G=n(u,"DIV",{class:!0});var Le=o(G);I(Q.$$.fragment,Le),_t=f(Le),Y=n(Le,"P",{});var Ue=o(Y);bt=r(Ue,"Disable sliced attention computation. If "),be=n(Ue,"CODE",{});var ia=o(be);vt=r(ia,"enable_attention_slicing"),ia.forEach(a),yt=r(Ue,` was previously invoked, this method will go
back to computing attention in one step.`),Ue.forEach(a),Le.forEach(a),wt=f(u),v=n(u,"DIV",{class:!0});var k=o(v);I(H.$$.fragment,k),It=f(k),ve=n(k,"P",{});var na=o(ve);Pt=r(na,"Enable memory efficient attention as implemented in xformers."),na.forEach(a),Dt=f(k),ye=n(k,"P",{});var oa=o(ye);$t=r(oa,`When this option is enabled, you should observe lower GPU memory usage and a potential speed up at inference
time. Speed up at training time is not guaranteed.`),oa.forEach(a),St=f(k),we=n(k,"P",{});var sa=o(we);xt=r(sa,`Warning: When Memory Efficient Attention and Sliced attention are both enabled, the Memory Efficient Attention
is used.`),sa.forEach(a),Vt=f(k),I(L.$$.fragment,k),k.forEach(a),Et=f(u),U=n(u,"DIV",{class:!0});var Ae=o(U);I(K.$$.fragment,Ae),kt=f(Ae),Ie=n(Ae,"P",{});var ra=o(Ie);Mt=r(ra,"Disable memory efficient attention as implemented in xformers."),ra.forEach(a),Ae.forEach(a),Tt=f(u),A=n(u,"DIV",{class:!0});var Ze=o(A);I(ee.$$.fragment,Ze),Wt=f(Ze),te=n(Ze,"P",{});var Ne=o(te);Ct=r(Ne,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
`),Pe=n(Ne,"CODE",{});var la=o(Pe);Gt=r(la,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),la.forEach(a),Lt=r(Ne,"forward` method called."),Ne.forEach(a),Ze.forEach(a),u.forEach(a),this.h()},h(){d(h,"name","hf:doc:metadata"),d(h,"content",JSON.stringify(ya)),d(g,"id","image-variation"),d(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"),d(g,"href","#image-variation"),d(b,"class","relative group"),d(W,"id","diffusers.StableDiffusionImageVariationPipeline"),d(W,"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"),d(W,"href","#diffusers.StableDiffusionImageVariationPipeline"),d(M,"class","relative group"),d(oe,"href","/docs/diffusers/v0.17.0/en/api/pipelines/stable_diffusion/image_variation#diffusers.StableDiffusionImageVariationPipeline"),d(N,"href","https://www.justinpinkney.com/"),d(N,"rel","nofollow"),d(j,"href","https://lambdalabs.com/"),d(j,"rel","nofollow"),d(F,"href","https://github.com/LambdaLabsML/lambda-diffusers#stable-diffusion-image-variations"),d(F,"rel","nofollow"),d(X,"href","https://huggingface.co/lambdalabs/sd-image-variations-diffusers"),d(X,"rel","nofollow"),d(le,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),d(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(p,"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,m){e(document.head,h),_(t,T,m),_(t,b,m),e(b,g),e(g,x),P(c,x,null),e(b,V),e(b,de),e(de,je),_(t,$e,m),_(t,M,m),e(M,W),e(W,ce),P(Z,ce,null),e(M,Je),e(M,pe),e(pe,Fe),_(t,Se,m),_(t,y,m),e(y,oe),e(oe,Oe),e(y,Xe),e(y,N),e(N,qe),e(y,Be),e(y,j),e(j,Re),e(y,ze),_(t,xe,m),_(t,J,m),e(J,Qe),e(J,F),e(F,Ye),_(t,Ve,m),_(t,se,m),e(se,He),_(t,Ee,m),_(t,re,m),e(re,O),e(O,me),e(me,Ke),e(O,et),e(O,X),e(X,tt),_(t,ke,m),_(t,p,m),P(q,p,null),e(p,at),e(p,ue),e(ue,it),e(p,nt),e(p,B),e(B,ot),e(B,le),e(le,st),e(B,rt),e(p,lt),e(p,C),P(R,C,null),e(C,ft),e(C,he),e(he,dt),e(p,ct),e(p,E),P(z,E,null),e(E,pt),e(E,ge),e(ge,mt),e(E,ut),e(E,_e),e(_e,ht),e(p,gt),e(p,G),P(Q,G,null),e(G,_t),e(G,Y),e(Y,bt),e(Y,be),e(be,vt),e(Y,yt),e(p,wt),e(p,v),P(H,v,null),e(v,It),e(v,ve),e(ve,Pt),e(v,Dt),e(v,ye),e(ye,$t),e(v,St),e(v,we),e(we,xt),e(v,Vt),P(L,v,null),e(p,Et),e(p,U),P(K,U,null),e(U,kt),e(U,Ie),e(Ie,Mt),e(p,Tt),e(p,A),P(ee,A,null),e(A,Wt),e(A,te),e(te,Ct),e(te,Pe),e(Pe,Gt),e(te,Lt),Me=!0},p(t,[m]){const ae={};m&2&&(ae.$$scope={dirty:m,ctx:t}),L.$set(ae)},i(t){Me||(D(c.$$.fragment,t),D(Z.$$.fragment,t),D(q.$$.fragment,t),D(R.$$.fragment,t),D(z.$$.fragment,t),D(Q.$$.fragment,t),D(H.$$.fragment,t),D(L.$$.fragment,t),D(K.$$.fragment,t),D(ee.$$.fragment,t),Me=!0)},o(t){$(c.$$.fragment,t),$(Z.$$.fragment,t),$(q.$$.fragment,t),$(R.$$.fragment,t),$(z.$$.fragment,t),$(Q.$$.fragment,t),$(H.$$.fragment,t),$(L.$$.fragment,t),$(K.$$.fragment,t),$(ee.$$.fragment,t),Me=!1},d(t){a(h),t&&a(T),t&&a(b),S(c),t&&a($e),t&&a(M),S(Z),t&&a(Se),t&&a(y),t&&a(xe),t&&a(J),t&&a(Ve),t&&a(se),t&&a(Ee),t&&a(re),t&&a(ke),t&&a(p),S(q),S(R),S(z),S(Q),S(H),S(L),S(K),S(ee)}}}const ya={local:"image-variation",sections:[{local:"diffusers.StableDiffusionImageVariationPipeline",title:"StableDiffusionImageVariationPipeline"}],title:"Image Variation"};function wa(De){return ua(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class xa extends da{constructor(h){super();ca(this,h,wa,va,pa,{})}}export{xa as default,ya as metadata};
