import{S as ga,i as _a,s as ba,e as n,k as f,w,t as s,M as va,c as i,d as a,m as c,a as o,x as I,h as r,b as l,G as e,g as b,y as $,q as P,o as D,B as x,v as ya,L as wa}from"../../../../chunks/vendor-hf-doc-builder.js";import{T as Ia}from"../../../../chunks/Tip-hf-doc-builder.js";import{D as fe}from"../../../../chunks/Docstring-hf-doc-builder.js";import{C as $a}from"../../../../chunks/CodeBlock-hf-doc-builder.js";import{I as ha}from"../../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Pa}from"../../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Da(ce){let d,y;return{c(){d=n("p"),y=s(`\u26A0\uFE0F When memory efficient attention and sliced attention are both enabled, memory efficient attention takes
precedent.`)},l(g){d=i(g,"P",{});var h=o(d);y=r(h,`\u26A0\uFE0F When memory efficient attention and sliced attention are both enabled, memory efficient attention takes
precedent.`),h.forEach(a)},m(g,h){b(g,d,h),e(d,y)},d(g){g&&a(d)}}}function xa(ce){let d,y,g,h,V;return h=new $a({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(){d=n("p"),y=s("Examples:"),g=f(),w(h.$$.fragment)},l(p){d=i(p,"P",{});var E=o(d);y=r(E,"Examples:"),E.forEach(a),g=c(p),I(h.$$.fragment,p)},m(p,E){b(p,d,E),e(d,y),b(p,g,E),$(h,p,E),V=!0},p:wa,i(p){V||(P(h.$$.fragment,p),V=!0)},o(p){D(h.$$.fragment,p),V=!1},d(p){p&&a(d),p&&a(g),x(h,p)}}}function Sa(ce){let d,y,g,h,V,p,E,ge,qe,Ve,M,W,_e,N,Be,be,Re,Ee,S,de,ze,Qe,j,Ye,He,F,Ke,et,ke,J,tt,O,at,Te,pe,nt,Me,ue,X,ve,it,ot,q,st,We,u,B,rt,ye,lt,ft,R,ct,me,dt,pt,ut,C,z,mt,we,ht,gt,k,Q,_t,Ie,bt,vt,$e,yt,wt,G,Y,It,H,$t,Pe,Pt,Dt,xt,v,K,St,ee,Vt,te,Et,kt,Tt,De,Mt,Wt,L,Ct,U,Gt,Z,ae,Lt,ne,Ut,ie,Zt,At,Nt,A,oe,jt,se,Ft,xe,Jt,Ot,Ce;return p=new ha({}),N=new ha({}),B=new fe({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.18.0/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> (<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.18.0/en/api/models/unet2d-cond#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.18.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.18.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.18.0/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.18.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.18.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py#L37"}}),z=new fe({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.18.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.18.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.18.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py#L274",returnDescription:`
<p><a
  href="/docs/diffusers/v0.18.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.18.0/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),Q=new fe({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.18.0/src/diffusers/pipelines/pipeline_utils.py#L1461"}}),Y=new fe({props:{name:"disable_attention_slicing",anchor:"diffusers.StableDiffusionImageVariationPipeline.disable_attention_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/pipeline_utils.py#L1477"}}),K=new fe({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.18.0/src/diffusers/pipelines/pipeline_utils.py#L1399"}}),L=new Ia({props:{warning:!0,$$slots:{default:[Da]},$$scope:{ctx:ce}}}),U=new Pa({props:{anchor:"diffusers.StableDiffusionImageVariationPipeline.enable_xformers_memory_efficient_attention.example",$$slots:{default:[xa]},$$scope:{ctx:ce}}}),ae=new fe({props:{name:"disable_xformers_memory_efficient_attention",anchor:"diffusers.StableDiffusionImageVariationPipeline.disable_xformers_memory_efficient_attention",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/pipeline_utils.py#L1435"}}),oe=new fe({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.18.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py#L126"}}),{c(){d=n("meta"),y=f(),g=n("h1"),h=n("a"),V=n("span"),w(p.$$.fragment),E=f(),ge=n("span"),qe=s("Image Variation"),Ve=f(),M=n("h2"),W=n("a"),_e=n("span"),w(N.$$.fragment),Be=f(),be=n("span"),Re=s("StableDiffusionImageVariationPipeline"),Ee=f(),S=n("p"),de=n("a"),ze=s("StableDiffusionImageVariationPipeline"),Qe=s(" lets you generate variations from an input image using Stable Diffusion. It uses a fine-tuned version of Stable Diffusion model, trained by  "),j=n("a"),Ye=s("Justin Pinkney"),He=s(" (@Buntworthy) at "),F=n("a"),Ke=s("Lambda"),et=s("."),ke=f(),J=n("p"),tt=s(`The original codebase can be found here:
`),O=n("a"),at=s("Stable Diffusion Image Variations"),Te=f(),pe=n("p"),nt=s("Available Checkpoints are:"),Me=f(),ue=n("ul"),X=n("li"),ve=n("em"),it=s("sd-image-variations-diffusers"),ot=s(": "),q=n("a"),st=s("lambdalabs/sd-image-variations-diffusers"),We=f(),u=n("div"),w(B.$$.fragment),rt=f(),ye=n("p"),lt=s("Pipeline to generate variations from an input image using Stable Diffusion."),ft=f(),R=n("p"),ct=s("This model inherits from "),me=n("a"),dt=s("DiffusionPipeline"),pt=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.)`),ut=f(),C=n("div"),w(z.$$.fragment),mt=f(),we=n("p"),ht=s("Function invoked when calling the pipeline for generation."),gt=f(),k=n("div"),w(Q.$$.fragment),_t=f(),Ie=n("p"),bt=s("Enable sliced attention computation."),vt=f(),$e=n("p"),yt=s(`When this option is enabled, the attention module splits the input tensor in slices to compute attention in
several steps. This is useful to save some memory in exchange for a small speed decrease.`),wt=f(),G=n("div"),w(Y.$$.fragment),It=f(),H=n("p"),$t=s("Disable sliced attention computation. If "),Pe=n("code"),Pt=s("enable_attention_slicing"),Dt=s(` was previously called, attention is
computed in one step.`),xt=f(),v=n("div"),w(K.$$.fragment),St=f(),ee=n("p"),Vt=s("Enable memory efficient attention from "),te=n("a"),Et=s("xFormers"),kt=s("."),Tt=f(),De=n("p"),Mt=s(`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.`),Wt=f(),w(L.$$.fragment),Ct=f(),w(U.$$.fragment),Gt=f(),Z=n("div"),w(ae.$$.fragment),Lt=f(),ne=n("p"),Ut=s("Disable memory efficient attention from "),ie=n("a"),Zt=s("xFormers"),At=s("."),Nt=f(),A=n("div"),w(oe.$$.fragment),jt=f(),se=n("p"),Ft=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
`),xe=n("code"),Jt=s("torch.device('meta') and loaded to GPU only when their specific submodule has its "),Ot=s("forward` method called."),this.h()},l(t){const m=va('[data-svelte="svelte-1phssyn"]',document.head);d=i(m,"META",{name:!0,content:!0}),m.forEach(a),y=c(t),g=i(t,"H1",{class:!0});var re=o(g);h=i(re,"A",{id:!0,class:!0,href:!0});var Se=o(h);V=i(Se,"SPAN",{});var qt=o(V);I(p.$$.fragment,qt),qt.forEach(a),Se.forEach(a),E=c(re),ge=i(re,"SPAN",{});var Bt=o(ge);qe=r(Bt,"Image Variation"),Bt.forEach(a),re.forEach(a),Ve=c(t),M=i(t,"H2",{class:!0});var Ge=o(M);W=i(Ge,"A",{id:!0,class:!0,href:!0});var Rt=o(W);_e=i(Rt,"SPAN",{});var zt=o(_e);I(N.$$.fragment,zt),zt.forEach(a),Rt.forEach(a),Be=c(Ge),be=i(Ge,"SPAN",{});var Qt=o(be);Re=r(Qt,"StableDiffusionImageVariationPipeline"),Qt.forEach(a),Ge.forEach(a),Ee=c(t),S=i(t,"P",{});var le=o(S);de=i(le,"A",{href:!0});var Yt=o(de);ze=r(Yt,"StableDiffusionImageVariationPipeline"),Yt.forEach(a),Qe=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  "),j=i(le,"A",{href:!0,rel:!0});var Ht=o(j);Ye=r(Ht,"Justin Pinkney"),Ht.forEach(a),He=r(le," (@Buntworthy) at "),F=i(le,"A",{href:!0,rel:!0});var Kt=o(F);Ke=r(Kt,"Lambda"),Kt.forEach(a),et=r(le,"."),le.forEach(a),ke=c(t),J=i(t,"P",{});var Xt=o(J);tt=r(Xt,`The original codebase can be found here:
`),O=i(Xt,"A",{href:!0,rel:!0});var ea=o(O);at=r(ea,"Stable Diffusion Image Variations"),ea.forEach(a),Xt.forEach(a),Te=c(t),pe=i(t,"P",{});var ta=o(pe);nt=r(ta,"Available Checkpoints are:"),ta.forEach(a),Me=c(t),ue=i(t,"UL",{});var aa=o(ue);X=i(aa,"LI",{});var Le=o(X);ve=i(Le,"EM",{});var na=o(ve);it=r(na,"sd-image-variations-diffusers"),na.forEach(a),ot=r(Le,": "),q=i(Le,"A",{href:!0,rel:!0});var ia=o(q);st=r(ia,"lambdalabs/sd-image-variations-diffusers"),ia.forEach(a),Le.forEach(a),aa.forEach(a),We=c(t),u=i(t,"DIV",{class:!0});var _=o(u);I(B.$$.fragment,_),rt=c(_),ye=i(_,"P",{});var oa=o(ye);lt=r(oa,"Pipeline to generate variations from an input image using Stable Diffusion."),oa.forEach(a),ft=c(_),R=i(_,"P",{});var Ue=o(R);ct=r(Ue,"This model inherits from "),me=i(Ue,"A",{href:!0});var sa=o(me);dt=r(sa,"DiffusionPipeline"),sa.forEach(a),pt=r(Ue,`. 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.)`),Ue.forEach(a),ut=c(_),C=i(_,"DIV",{class:!0});var Ze=o(C);I(z.$$.fragment,Ze),mt=c(Ze),we=i(Ze,"P",{});var ra=o(we);ht=r(ra,"Function invoked when calling the pipeline for generation."),ra.forEach(a),Ze.forEach(a),gt=c(_),k=i(_,"DIV",{class:!0});var he=o(k);I(Q.$$.fragment,he),_t=c(he),Ie=i(he,"P",{});var la=o(Ie);bt=r(la,"Enable sliced attention computation."),la.forEach(a),vt=c(he),$e=i(he,"P",{});var fa=o($e);yt=r(fa,`When this option is enabled, the attention module splits the input tensor in slices to compute attention in
several steps. This is useful to save some memory in exchange for a small speed decrease.`),fa.forEach(a),he.forEach(a),wt=c(_),G=i(_,"DIV",{class:!0});var Ae=o(G);I(Y.$$.fragment,Ae),It=c(Ae),H=i(Ae,"P",{});var Ne=o(H);$t=r(Ne,"Disable sliced attention computation. If "),Pe=i(Ne,"CODE",{});var ca=o(Pe);Pt=r(ca,"enable_attention_slicing"),ca.forEach(a),Dt=r(Ne,` was previously called, attention is
computed in one step.`),Ne.forEach(a),Ae.forEach(a),xt=c(_),v=i(_,"DIV",{class:!0});var T=o(v);I(K.$$.fragment,T),St=c(T),ee=i(T,"P",{});var je=o(ee);Vt=r(je,"Enable memory efficient attention from "),te=i(je,"A",{href:!0,rel:!0});var da=o(te);Et=r(da,"xFormers"),da.forEach(a),kt=r(je,"."),je.forEach(a),Tt=c(T),De=i(T,"P",{});var pa=o(De);Mt=r(pa,`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.`),pa.forEach(a),Wt=c(T),I(L.$$.fragment,T),Ct=c(T),I(U.$$.fragment,T),T.forEach(a),Gt=c(_),Z=i(_,"DIV",{class:!0});var Fe=o(Z);I(ae.$$.fragment,Fe),Lt=c(Fe),ne=i(Fe,"P",{});var Je=o(ne);Ut=r(Je,"Disable memory efficient attention from "),ie=i(Je,"A",{href:!0,rel:!0});var ua=o(ie);Zt=r(ua,"xFormers"),ua.forEach(a),At=r(Je,"."),Je.forEach(a),Fe.forEach(a),Nt=c(_),A=i(_,"DIV",{class:!0});var Oe=o(A);I(oe.$$.fragment,Oe),jt=c(Oe),se=i(Oe,"P",{});var Xe=o(se);Ft=r(Xe,`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
`),xe=i(Xe,"CODE",{});var ma=o(xe);Jt=r(ma,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),ma.forEach(a),Ot=r(Xe,"forward` method called."),Xe.forEach(a),Oe.forEach(a),_.forEach(a),this.h()},h(){l(d,"name","hf:doc:metadata"),l(d,"content",JSON.stringify(Va)),l(h,"id","image-variation"),l(h,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(h,"href","#image-variation"),l(g,"class","relative group"),l(W,"id","diffusers.StableDiffusionImageVariationPipeline"),l(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"),l(W,"href","#diffusers.StableDiffusionImageVariationPipeline"),l(M,"class","relative group"),l(de,"href","/docs/diffusers/v0.18.0/en/api/pipelines/stable_diffusion/image_variation#diffusers.StableDiffusionImageVariationPipeline"),l(j,"href","https://www.justinpinkney.com/"),l(j,"rel","nofollow"),l(F,"href","https://lambdalabs.com/"),l(F,"rel","nofollow"),l(O,"href","https://github.com/LambdaLabsML/lambda-diffusers#stable-diffusion-image-variations"),l(O,"rel","nofollow"),l(q,"href","https://huggingface.co/lambdalabs/sd-image-variations-diffusers"),l(q,"rel","nofollow"),l(me,"href","/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),l(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(te,"href","https://facebookresearch.github.io/xformers/"),l(te,"rel","nofollow"),l(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ie,"href","https://facebookresearch.github.io/xformers/"),l(ie,"rel","nofollow"),l(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(u,"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,d),b(t,y,m),b(t,g,m),e(g,h),e(h,V),$(p,V,null),e(g,E),e(g,ge),e(ge,qe),b(t,Ve,m),b(t,M,m),e(M,W),e(W,_e),$(N,_e,null),e(M,Be),e(M,be),e(be,Re),b(t,Ee,m),b(t,S,m),e(S,de),e(de,ze),e(S,Qe),e(S,j),e(j,Ye),e(S,He),e(S,F),e(F,Ke),e(S,et),b(t,ke,m),b(t,J,m),e(J,tt),e(J,O),e(O,at),b(t,Te,m),b(t,pe,m),e(pe,nt),b(t,Me,m),b(t,ue,m),e(ue,X),e(X,ve),e(ve,it),e(X,ot),e(X,q),e(q,st),b(t,We,m),b(t,u,m),$(B,u,null),e(u,rt),e(u,ye),e(ye,lt),e(u,ft),e(u,R),e(R,ct),e(R,me),e(me,dt),e(R,pt),e(u,ut),e(u,C),$(z,C,null),e(C,mt),e(C,we),e(we,ht),e(u,gt),e(u,k),$(Q,k,null),e(k,_t),e(k,Ie),e(Ie,bt),e(k,vt),e(k,$e),e($e,yt),e(u,wt),e(u,G),$(Y,G,null),e(G,It),e(G,H),e(H,$t),e(H,Pe),e(Pe,Pt),e(H,Dt),e(u,xt),e(u,v),$(K,v,null),e(v,St),e(v,ee),e(ee,Vt),e(ee,te),e(te,Et),e(ee,kt),e(v,Tt),e(v,De),e(De,Mt),e(v,Wt),$(L,v,null),e(v,Ct),$(U,v,null),e(u,Gt),e(u,Z),$(ae,Z,null),e(Z,Lt),e(Z,ne),e(ne,Ut),e(ne,ie),e(ie,Zt),e(ne,At),e(u,Nt),e(u,A),$(oe,A,null),e(A,jt),e(A,se),e(se,Ft),e(se,xe),e(xe,Jt),e(se,Ot),Ce=!0},p(t,[m]){const re={};m&2&&(re.$$scope={dirty:m,ctx:t}),L.$set(re);const Se={};m&2&&(Se.$$scope={dirty:m,ctx:t}),U.$set(Se)},i(t){Ce||(P(p.$$.fragment,t),P(N.$$.fragment,t),P(B.$$.fragment,t),P(z.$$.fragment,t),P(Q.$$.fragment,t),P(Y.$$.fragment,t),P(K.$$.fragment,t),P(L.$$.fragment,t),P(U.$$.fragment,t),P(ae.$$.fragment,t),P(oe.$$.fragment,t),Ce=!0)},o(t){D(p.$$.fragment,t),D(N.$$.fragment,t),D(B.$$.fragment,t),D(z.$$.fragment,t),D(Q.$$.fragment,t),D(Y.$$.fragment,t),D(K.$$.fragment,t),D(L.$$.fragment,t),D(U.$$.fragment,t),D(ae.$$.fragment,t),D(oe.$$.fragment,t),Ce=!1},d(t){a(d),t&&a(y),t&&a(g),x(p),t&&a(Ve),t&&a(M),x(N),t&&a(Ee),t&&a(S),t&&a(ke),t&&a(J),t&&a(Te),t&&a(pe),t&&a(Me),t&&a(ue),t&&a(We),t&&a(u),x(B),x(z),x(Q),x(Y),x(K),x(L),x(U),x(ae),x(oe)}}}const Va={local:"image-variation",sections:[{local:"diffusers.StableDiffusionImageVariationPipeline",title:"StableDiffusionImageVariationPipeline"}],title:"Image Variation"};function Ea(ce){return ya(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class La extends ga{constructor(d){super();_a(this,d,Ea,Sa,ba,{})}}export{La as default,Va as metadata};
