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