import{S as ci,i as di,s as pi,e as a,k as l,w as P,t as s,M as mi,c as n,d as i,m as f,a as o,x as w,h as r,b as c,G as e,g as _,y as D,q as I,o as $,B as x,v as ui,L as hi}from"../../../../chunks/vendor-hf-doc-builder.js";import{D as ne}from"../../../../chunks/Docstring-hf-doc-builder.js";import{C as gi}from"../../../../chunks/CodeBlock-hf-doc-builder.js";import{I as fi}from"../../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as _i}from"../../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function bi(Ie){let h,L,b,g,S;return g=new gi({props:{code:`import torch
from diffusers import DiffusionPipeline
from xformers.ops import MemoryEfficientAttentionFlashAttentionOp

pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1", torch_dtype=torch.float16)
pipe = pipe.to("cuda")
pipe.enable_xformers_memory_efficient_attention(attention_op=MemoryEfficientAttentionFlashAttentionOp)
# Workaround for not accepting attention shape using VAE for Flash Attention
pipe.vae.enable_xformers_memory_efficient_attention(attention_op=None)`,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=a("p"),L=s("Examples:"),b=l(),P(g.$$.fragment)},l(d){h=n(d,"P",{});var E=o(h);L=r(E,"Examples:"),E.forEach(i),b=f(d),w(g.$$.fragment,d)},m(d,E){_(d,h,E),e(h,L),_(d,b,E),D(g,d,E),S=!0},p:hi,i(d){S||(I(g.$$.fragment,d),S=!0)},o(d){$(g.$$.fragment,d),S=!1},d(d){d&&i(h),d&&i(b),x(g,d)}}}function vi(Ie){let h,L,b,g,S,d,E,ce,We,$e,C,A,de,q,Fe,pe,Ge,xe,y,oe,ze,Be,U,Ke,He,W,Je,Re,Se,F,Qe,G,Xe,Ee,se,Ye,ke,re,z,me,Ze,et,B,tt,Ve,p,K,it,ue,at,nt,H,ot,le,st,rt,lt,M,J,ft,he,ct,dt,k,R,pt,ge,mt,ut,_e,ht,gt,T,Q,_t,X,bt,be,vt,yt,Pt,v,Y,wt,ve,Dt,It,ye,$t,xt,Pe,St,Et,N,kt,O,Z,Vt,we,Ct,Lt,j,ee,At,te,Mt,De,Tt,Nt,Ce;return d=new fi({}),q=new fi({}),K=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.16.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.16.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.16.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.16.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.16.0/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.16.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.16.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py#L35"}}),J=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.16.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.16.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.16.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py#L262",returnDescription:`
<p><a
  href="/docs/diffusers/v0.16.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.16.0/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),R=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.16.0/src/diffusers/pipelines/pipeline_utils.py#L1476"}}),Q=new ne({props:{name:"disable_attention_slicing",anchor:"diffusers.StableDiffusionImageVariationPipeline.disable_attention_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.16.0/src/diffusers/pipelines/pipeline_utils.py#L1492"}}),Y=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.16.0/src/diffusers/pipelines/pipeline_utils.py#L1418"}}),N=new _i({props:{anchor:"diffusers.StableDiffusionImageVariationPipeline.enable_xformers_memory_efficient_attention.example",$$slots:{default:[bi]},$$scope:{ctx:Ie}}}),Z=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.16.0/src/diffusers/pipelines/pipeline_utils.py#L1450"}}),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.16.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py#L123"}}),{c(){h=a("meta"),L=l(),b=a("h1"),g=a("a"),S=a("span"),P(d.$$.fragment),E=l(),ce=a("span"),We=s("Image Variation"),$e=l(),C=a("h2"),A=a("a"),de=a("span"),P(q.$$.fragment),Fe=l(),pe=a("span"),Ge=s("StableDiffusionImageVariationPipeline"),xe=l(),y=a("p"),oe=a("a"),ze=s("StableDiffusionImageVariationPipeline"),Be=s(" lets you generate variations from an input image using Stable Diffusion. It uses a fine-tuned version of Stable Diffusion model, trained by  "),U=a("a"),Ke=s("Justin Pinkney"),He=s(" (@Buntworthy) at "),W=a("a"),Je=s("Lambda"),Re=s("."),Se=l(),F=a("p"),Qe=s(`The original codebase can be found here:
`),G=a("a"),Xe=s("Stable Diffusion Image Variations"),Ee=l(),se=a("p"),Ye=s("Available Checkpoints are:"),ke=l(),re=a("ul"),z=a("li"),me=a("em"),Ze=s("sd-image-variations-diffusers"),et=s(": "),B=a("a"),tt=s("lambdalabs/sd-image-variations-diffusers"),Ve=l(),p=a("div"),P(K.$$.fragment),it=l(),ue=a("p"),at=s("Pipeline to generate variations from an input image using Stable Diffusion."),nt=l(),H=a("p"),ot=s("This model inherits from "),le=a("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(),M=a("div"),P(J.$$.fragment),ft=l(),he=a("p"),ct=s("Function invoked when calling the pipeline for generation."),dt=l(),k=a("div"),P(R.$$.fragment),pt=l(),ge=a("p"),mt=s("Enable sliced attention computation."),ut=l(),_e=a("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(),T=a("div"),P(Q.$$.fragment),_t=l(),X=a("p"),bt=s("Disable sliced attention computation. If "),be=a("code"),vt=s("enable_attention_slicing"),yt=s(` was previously invoked, this method will go
back to computing attention in one step.`),Pt=l(),v=a("div"),P(Y.$$.fragment),wt=l(),ve=a("p"),Dt=s("Enable memory efficient attention as implemented in xformers."),It=l(),ye=a("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.`),xt=l(),Pe=a("p"),St=s(`Warning: When Memory Efficient Attention and Sliced attention are both enabled, the Memory Efficient Attention
is used.`),Et=l(),P(N.$$.fragment),kt=l(),O=a("div"),P(Z.$$.fragment),Vt=l(),we=a("p"),Ct=s("Disable memory efficient attention as implemented in xformers."),Lt=l(),j=a("div"),P(ee.$$.fragment),At=l(),te=a("p"),Mt=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
`),De=a("code"),Tt=s("torch.device('meta') and loaded to GPU only when their specific submodule has its "),Nt=s("forward` method called."),this.h()},l(t){const m=mi('[data-svelte="svelte-1phssyn"]',document.head);h=n(m,"META",{name:!0,content:!0}),m.forEach(i),L=f(t),b=n(t,"H1",{class:!0});var ie=o(b);g=n(ie,"A",{id:!0,class:!0,href:!0});var jt=o(g);S=n(jt,"SPAN",{});var qt=o(S);w(d.$$.fragment,qt),qt.forEach(i),jt.forEach(i),E=f(ie),ce=n(ie,"SPAN",{});var Ut=o(ce);We=r(Ut,"Image Variation"),Ut.forEach(i),ie.forEach(i),$e=f(t),C=n(t,"H2",{class:!0});var Le=o(C);A=n(Le,"A",{id:!0,class:!0,href:!0});var Wt=o(A);de=n(Wt,"SPAN",{});var Ft=o(de);w(q.$$.fragment,Ft),Ft.forEach(i),Wt.forEach(i),Fe=f(Le),pe=n(Le,"SPAN",{});var Gt=o(pe);Ge=r(Gt,"StableDiffusionImageVariationPipeline"),Gt.forEach(i),Le.forEach(i),xe=f(t),y=n(t,"P",{});var ae=o(y);oe=n(ae,"A",{href:!0});var zt=o(oe);ze=r(zt,"StableDiffusionImageVariationPipeline"),zt.forEach(i),Be=r(ae," lets you generate variations from an input image using Stable Diffusion. It uses a fine-tuned version of Stable Diffusion model, trained by  "),U=n(ae,"A",{href:!0,rel:!0});var Bt=o(U);Ke=r(Bt,"Justin Pinkney"),Bt.forEach(i),He=r(ae," (@Buntworthy) at "),W=n(ae,"A",{href:!0,rel:!0});var Kt=o(W);Je=r(Kt,"Lambda"),Kt.forEach(i),Re=r(ae,"."),ae.forEach(i),Se=f(t),F=n(t,"P",{});var Ot=o(F);Qe=r(Ot,`The original codebase can be found here:
`),G=n(Ot,"A",{href:!0,rel:!0});var Ht=o(G);Xe=r(Ht,"Stable Diffusion Image Variations"),Ht.forEach(i),Ot.forEach(i),Ee=f(t),se=n(t,"P",{});var Jt=o(se);Ye=r(Jt,"Available Checkpoints are:"),Jt.forEach(i),ke=f(t),re=n(t,"UL",{});var Rt=o(re);z=n(Rt,"LI",{});var Ae=o(z);me=n(Ae,"EM",{});var Qt=o(me);Ze=r(Qt,"sd-image-variations-diffusers"),Qt.forEach(i),et=r(Ae,": "),B=n(Ae,"A",{href:!0,rel:!0});var Xt=o(B);tt=r(Xt,"lambdalabs/sd-image-variations-diffusers"),Xt.forEach(i),Ae.forEach(i),Rt.forEach(i),Ve=f(t),p=n(t,"DIV",{class:!0});var u=o(p);w(K.$$.fragment,u),it=f(u),ue=n(u,"P",{});var Yt=o(ue);at=r(Yt,"Pipeline to generate variations from an input image using Stable Diffusion."),Yt.forEach(i),nt=f(u),H=n(u,"P",{});var Me=o(H);ot=r(Me,"This model inherits from "),le=n(Me,"A",{href:!0});var Zt=o(le);st=r(Zt,"DiffusionPipeline"),Zt.forEach(i),rt=r(Me,`. 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.)`),Me.forEach(i),lt=f(u),M=n(u,"DIV",{class:!0});var Te=o(M);w(J.$$.fragment,Te),ft=f(Te),he=n(Te,"P",{});var ei=o(he);ct=r(ei,"Function invoked when calling the pipeline for generation."),ei.forEach(i),Te.forEach(i),dt=f(u),k=n(u,"DIV",{class:!0});var fe=o(k);w(R.$$.fragment,fe),pt=f(fe),ge=n(fe,"P",{});var ti=o(ge);mt=r(ti,"Enable sliced attention computation."),ti.forEach(i),ut=f(fe),_e=n(fe,"P",{});var ii=o(_e);ht=r(ii,`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.`),ii.forEach(i),fe.forEach(i),gt=f(u),T=n(u,"DIV",{class:!0});var Ne=o(T);w(Q.$$.fragment,Ne),_t=f(Ne),X=n(Ne,"P",{});var Oe=o(X);bt=r(Oe,"Disable sliced attention computation. If "),be=n(Oe,"CODE",{});var ai=o(be);vt=r(ai,"enable_attention_slicing"),ai.forEach(i),yt=r(Oe,` was previously invoked, this method will go
back to computing attention in one step.`),Oe.forEach(i),Ne.forEach(i),Pt=f(u),v=n(u,"DIV",{class:!0});var V=o(v);w(Y.$$.fragment,V),wt=f(V),ve=n(V,"P",{});var ni=o(ve);Dt=r(ni,"Enable memory efficient attention as implemented in xformers."),ni.forEach(i),It=f(V),ye=n(V,"P",{});var oi=o(ye);$t=r(oi,`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.`),oi.forEach(i),xt=f(V),Pe=n(V,"P",{});var si=o(Pe);St=r(si,`Warning: When Memory Efficient Attention and Sliced attention are both enabled, the Memory Efficient Attention
is used.`),si.forEach(i),Et=f(V),w(N.$$.fragment,V),V.forEach(i),kt=f(u),O=n(u,"DIV",{class:!0});var je=o(O);w(Z.$$.fragment,je),Vt=f(je),we=n(je,"P",{});var ri=o(we);Ct=r(ri,"Disable memory efficient attention as implemented in xformers."),ri.forEach(i),je.forEach(i),Lt=f(u),j=n(u,"DIV",{class:!0});var qe=o(j);w(ee.$$.fragment,qe),At=f(qe),te=n(qe,"P",{});var Ue=o(te);Mt=r(Ue,`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
`),De=n(Ue,"CODE",{});var li=o(De);Tt=r(li,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),li.forEach(i),Nt=r(Ue,"forward` method called."),Ue.forEach(i),qe.forEach(i),u.forEach(i),this.h()},h(){c(h,"name","hf:doc:metadata"),c(h,"content",JSON.stringify(yi)),c(g,"id","image-variation"),c(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"),c(g,"href","#image-variation"),c(b,"class","relative group"),c(A,"id","diffusers.StableDiffusionImageVariationPipeline"),c(A,"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"),c(A,"href","#diffusers.StableDiffusionImageVariationPipeline"),c(C,"class","relative group"),c(oe,"href","/docs/diffusers/v0.16.0/en/api/pipelines/stable_diffusion/image_variation#diffusers.StableDiffusionImageVariationPipeline"),c(U,"href","https://www.justinpinkney.com/"),c(U,"rel","nofollow"),c(W,"href","https://lambdalabs.com/"),c(W,"rel","nofollow"),c(G,"href","https://github.com/LambdaLabsML/lambda-diffusers#stable-diffusion-image-variations"),c(G,"rel","nofollow"),c(B,"href","https://huggingface.co/lambdalabs/sd-image-variations-diffusers"),c(B,"rel","nofollow"),c(le,"href","/docs/diffusers/v0.16.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),c(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(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,L,m),_(t,b,m),e(b,g),e(g,S),D(d,S,null),e(b,E),e(b,ce),e(ce,We),_(t,$e,m),_(t,C,m),e(C,A),e(A,de),D(q,de,null),e(C,Fe),e(C,pe),e(pe,Ge),_(t,xe,m),_(t,y,m),e(y,oe),e(oe,ze),e(y,Be),e(y,U),e(U,Ke),e(y,He),e(y,W),e(W,Je),e(y,Re),_(t,Se,m),_(t,F,m),e(F,Qe),e(F,G),e(G,Xe),_(t,Ee,m),_(t,se,m),e(se,Ye),_(t,ke,m),_(t,re,m),e(re,z),e(z,me),e(me,Ze),e(z,et),e(z,B),e(B,tt),_(t,Ve,m),_(t,p,m),D(K,p,null),e(p,it),e(p,ue),e(ue,at),e(p,nt),e(p,H),e(H,ot),e(H,le),e(le,st),e(H,rt),e(p,lt),e(p,M),D(J,M,null),e(M,ft),e(M,he),e(he,ct),e(p,dt),e(p,k),D(R,k,null),e(k,pt),e(k,ge),e(ge,mt),e(k,ut),e(k,_e),e(_e,ht),e(p,gt),e(p,T),D(Q,T,null),e(T,_t),e(T,X),e(X,bt),e(X,be),e(be,vt),e(X,yt),e(p,Pt),e(p,v),D(Y,v,null),e(v,wt),e(v,ve),e(ve,Dt),e(v,It),e(v,ye),e(ye,$t),e(v,xt),e(v,Pe),e(Pe,St),e(v,Et),D(N,v,null),e(p,kt),e(p,O),D(Z,O,null),e(O,Vt),e(O,we),e(we,Ct),e(p,Lt),e(p,j),D(ee,j,null),e(j,At),e(j,te),e(te,Mt),e(te,De),e(De,Tt),e(te,Nt),Ce=!0},p(t,[m]){const ie={};m&2&&(ie.$$scope={dirty:m,ctx:t}),N.$set(ie)},i(t){Ce||(I(d.$$.fragment,t),I(q.$$.fragment,t),I(K.$$.fragment,t),I(J.$$.fragment,t),I(R.$$.fragment,t),I(Q.$$.fragment,t),I(Y.$$.fragment,t),I(N.$$.fragment,t),I(Z.$$.fragment,t),I(ee.$$.fragment,t),Ce=!0)},o(t){$(d.$$.fragment,t),$(q.$$.fragment,t),$(K.$$.fragment,t),$(J.$$.fragment,t),$(R.$$.fragment,t),$(Q.$$.fragment,t),$(Y.$$.fragment,t),$(N.$$.fragment,t),$(Z.$$.fragment,t),$(ee.$$.fragment,t),Ce=!1},d(t){i(h),t&&i(L),t&&i(b),x(d),t&&i($e),t&&i(C),x(q),t&&i(xe),t&&i(y),t&&i(Se),t&&i(F),t&&i(Ee),t&&i(se),t&&i(ke),t&&i(re),t&&i(Ve),t&&i(p),x(K),x(J),x(R),x(Q),x(Y),x(N),x(Z),x(ee)}}}const yi={local:"image-variation",sections:[{local:"diffusers.StableDiffusionImageVariationPipeline",title:"StableDiffusionImageVariationPipeline"}],title:"Image Variation"};function Pi(Ie){return ui(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Si extends ci{constructor(h){super();di(this,h,Pi,vi,pi,{})}}export{Si as default,yi as metadata};
