Buckets:
| import{s as st,o as ot,n as Xe}from"../chunks/scheduler.53228c21.js";import{S as rt,i as lt,e as p,s as o,c as b,h as pt,a as c,d as n,b as r,f as J,g as _,j as $,k as P,l as i,m as f,n as y,t as v,o as w,p as I}from"../chunks/index.100fac89.js";import{C as ct}from"../chunks/CopyLLMTxtMenu.969c168d.js";import{D as te}from"../chunks/Docstring.8eea0d47.js";import{C as Re}from"../chunks/CodeBlock.d30a6509.js";import{E as ze}from"../chunks/ExampleCodeBlock.5e9b5749.js";import{H as Ne,E as ft}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.92f39b94.js";function dt(C){let s,x="Examples:",u,l,d;return l=new Re({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvbkltYWdlVmFyaWF0aW9uUGlwZWxpbmUlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFmcm9tJTIwaW8lMjBpbXBvcnQlMjBCeXRlc0lPJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEElMEFwaXBlJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uSW1hZ2VWYXJpYXRpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIybGFtYmRhbGFicyUyRnNkLWltYWdlLXZhcmlhdGlvbnMtZGlmZnVzZXJzJTIyJTJDJTIwcmV2aXNpb24lM0QlMjJ2Mi4wJTIyJTBBKSUwQXBpcGUlMjAlM0QlMjBwaXBlLnRvKCUyMmN1ZGElMjIpJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZsaDMuZ29vZ2xldXNlcmNvbnRlbnQuY29tJTJGeS1pRk9IZkxUd2t1UVNVZWdwd0RkZ0ttT2pSU1R2UHhhdDYzZFFMQjI1eGtUczRsaEliUlVGZU5CV1p6WWYzNzBnJTNEczEyMDAlMjIlMEElMEFyZXNwb25zZSUyMCUzRCUyMHJlcXVlc3RzLmdldCh1cmwpJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKEJ5dGVzSU8ocmVzcG9uc2UuY29udGVudCkpLmNvbnZlcnQoJTIyUkdCJTIyKSUwQSUwQW91dCUyMCUzRCUyMHBpcGUoaW1hZ2UlMkMlMjBudW1faW1hZ2VzX3Blcl9wcm9tcHQlM0QzJTJDJTIwZ3VpZGFuY2Vfc2NhbGUlM0QxNSklMEFvdXQlNUIlMjJpbWFnZXMlMjIlNUQlNUIwJTVELnNhdmUoJTIycmVzdWx0LmpwZyUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionImageVariationPipeline | |
| <span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image | |
| <span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO | |
| <span class="hljs-keyword">import</span> requests | |
| pipe = StableDiffusionImageVariationPipeline.from_pretrained( | |
| <span class="hljs-string">"lambdalabs/sd-image-variations-diffusers"</span>, revision=<span class="hljs-string">"v2.0"</span> | |
| ) | |
| pipe = pipe.to(<span class="hljs-string">"cuda"</span>) | |
| url = <span class="hljs-string">"https://lh3.googleusercontent.com/y-iFOHfLTwkuQSUegpwDdgKmOjRSTvPxat63dQLB25xkTs4lhIbRUFeNBWZzYf370g=s1200"</span> | |
| response = requests.get(url) | |
| image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">"RGB"</span>) | |
| out = pipe(image, num_images_per_prompt=<span class="hljs-number">3</span>, guidance_scale=<span class="hljs-number">15</span>) | |
| out[<span class="hljs-string">"images"</span>][<span class="hljs-number">0</span>].save(<span class="hljs-string">"result.jpg"</span>)`,wrap:!1}}),{c(){s=p("p"),s.textContent=x,u=o(),b(l.$$.fragment)},l(t){s=c(t,"P",{"data-svelte-h":!0}),$(s)!=="svelte-kvfsh7"&&(s.textContent=x),u=r(t),_(l.$$.fragment,t)},m(t,g){f(t,s,g),f(t,u,g),y(l,t,g),d=!0},p:Xe,i(t){d||(v(l.$$.fragment,t),d=!0)},o(t){w(l.$$.fragment,t),d=!1},d(t){t&&(n(s),n(u)),I(l,t)}}}function mt(C){let s,x="Examples:",u,l,d;return l=new Re({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFwaXBlJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUyQyUwQSUyMCUyMCUyMCUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUwQSUyMCUyMCUyMCUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUlMkMlMEEpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyYSUyMHBob3RvJTIwb2YlMjBhbiUyMGFzdHJvbmF1dCUyMHJpZGluZyUyMGElMjBob3JzZSUyMG9uJTIwbWFycyUyMiUwQXBpcGUuZW5hYmxlX2F0dGVudGlvbl9zbGljaW5nKCklMEFpbWFnZSUyMCUzRCUyMHBpcGUocHJvbXB0KS5pbWFnZXMlNUIwJTVE",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline | |
| <span class="hljs-meta">>>> </span>pipe = StableDiffusionPipeline.from_pretrained( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"stable-diffusion-v1-5/stable-diffusion-v1-5"</span>, | |
| <span class="hljs-meta">... </span> torch_dtype=torch.float16, | |
| <span class="hljs-meta">... </span> use_safetensors=<span class="hljs-literal">True</span>, | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>prompt = <span class="hljs-string">"a photo of an astronaut riding a horse on mars"</span> | |
| <span class="hljs-meta">>>> </span>pipe.enable_attention_slicing() | |
| <span class="hljs-meta">>>> </span>image = pipe(prompt).images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){s=p("p"),s.textContent=x,u=o(),b(l.$$.fragment)},l(t){s=c(t,"P",{"data-svelte-h":!0}),$(s)!=="svelte-kvfsh7"&&(s.textContent=x),u=r(t),_(l.$$.fragment,t)},m(t,g){f(t,s,g),f(t,u,g),y(l,t,g),d=!0},p:Xe,i(t){d||(v(l.$$.fragment,t),d=!0)},o(t){w(l.$$.fragment,t),d=!1},d(t){t&&(n(s),n(u)),I(l,t)}}}function ut(C){let s,x="Examples:",u,l,d;return l=new Re({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEFmcm9tJTIweGZvcm1lcnMub3BzJTIwaW1wb3J0JTIwTWVtb3J5RWZmaWNpZW50QXR0ZW50aW9uRmxhc2hBdHRlbnRpb25PcCUwQSUwQXBpcGUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLTItMSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlJTIwJTNEJTIwcGlwZS50byglMjJjdWRhJTIyKSUwQXBpcGUuZW5hYmxlX3hmb3JtZXJzX21lbW9yeV9lZmZpY2llbnRfYXR0ZW50aW9uKGF0dGVudGlvbl9vcCUzRE1lbW9yeUVmZmljaWVudEF0dGVudGlvbkZsYXNoQXR0ZW50aW9uT3ApJTBBJTIzJTIwV29ya2Fyb3VuZCUyMGZvciUyMG5vdCUyMGFjY2VwdGluZyUyMGF0dGVudGlvbiUyMHNoYXBlJTIwdXNpbmclMjBWQUUlMjBmb3IlMjBGbGFzaCUyMEF0dGVudGlvbiUwQXBpcGUudmFlLmVuYWJsZV94Zm9ybWVyc19tZW1vcnlfZWZmaWNpZW50X2F0dGVudGlvbihhdHRlbnRpb25fb3AlM0ROb25lKQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> xformers.ops <span class="hljs-keyword">import</span> MemoryEfficientAttentionFlashAttentionOp | |
| <span class="hljs-meta">>>> </span>pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">"stabilityai/stable-diffusion-2-1"</span>, torch_dtype=torch.float16) | |
| <span class="hljs-meta">>>> </span>pipe = pipe.to(<span class="hljs-string">"cuda"</span>) | |
| <span class="hljs-meta">>>> </span>pipe.enable_xformers_memory_efficient_attention(attention_op=MemoryEfficientAttentionFlashAttentionOp) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Workaround for not accepting attention shape using VAE for Flash Attention</span> | |
| <span class="hljs-meta">>>> </span>pipe.vae.enable_xformers_memory_efficient_attention(attention_op=<span class="hljs-literal">None</span>)`,wrap:!1}}),{c(){s=p("p"),s.textContent=x,u=o(),b(l.$$.fragment)},l(t){s=c(t,"P",{"data-svelte-h":!0}),$(s)!=="svelte-kvfsh7"&&(s.textContent=x),u=r(t),_(l.$$.fragment,t)},m(t,g){f(t,s,g),f(t,u,g),y(l,t,g),d=!0},p:Xe,i(t){d||(v(l.$$.fragment,t),d=!0)},o(t){w(l.$$.fragment,t),d=!1},d(t){t&&(n(s),n(u)),I(l,t)}}}function gt(C){let s,x,u,l,d,t,g,fe,B,Fe='The Stable Diffusion model can also generate variations from an input image. It uses a fine-tuned version of a Stable Diffusion model by <a href="https://www.justinpinkney.com/" rel="nofollow">Justin Pinkney</a> from <a href="https://lambdalabs.com/" rel="nofollow">Lambda</a>.',de,z,qe='The original codebase can be found at <a href="https://github.com/LambdaLabsML/lambda-diffusers#stable-diffusion-image-variations" rel="nofollow">LambdaLabsML/lambda-diffusers</a> and additional official checkpoints for image variation can be found at <a href="https://huggingface.co/lambdalabs/sd-image-variations-diffusers" rel="nofollow">lambdalabs/sd-image-variations-diffusers</a>.',me,V,Qe='<p>Make sure to check out the Stable Diffusion <a href="./overview#tips">Tips</a> section to learn how to explore the tradeoff between scheduler speed and quality, and how to reuse pipeline components efficiently!</p>',ue,N,ge,m,X,xe,ne,He="Pipeline to generate image variations from an input image using Stable Diffusion.",Me,ae,Oe=`This model inherits from <a href="/docs/diffusers/pr_12762/en/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a>. Check the superclass documentation for the generic methods | |
| implemented for all pipelines (downloading, saving, running on a particular device, etc.).`,Te,S,R,Pe,ie,Ye="The call function to the pipeline for generation.",Ue,Z,Se,M,F,De,se,Ae=`Enable sliced attention computation. When this option is enabled, the attention module splits the input tensor | |
| in slices to compute attention in several steps. For more than one attention head, the computation is performed | |
| sequentially over each head. This is useful to save some memory in exchange for a small speed decrease.`,ke,q,Ke=`<p>> ⚠️ Don’t enable attention slicing if you’re already using <code>scaled_dot_product_attention</code> (SDPA) | |
| from PyTorch > 2.0 or xFormers. These attention computations are already very memory efficient so you won’t | |
| need to enable > this function. If you enable attention slicing with SDPA or xFormers, it can lead to serious | |
| slow downs!</p>`,Je,j,Ce,L,Q,Ve,oe,et=`Disable sliced attention computation. If <code>enable_attention_slicing</code> was previously called, attention is | |
| computed in one step.`,Ze,T,H,je,re,tt=`Enable memory efficient attention from <a href="https://facebookresearch.github.io/xformers/" rel="nofollow">xFormers</a>. When this | |
| option is enabled, you should observe lower GPU memory usage and a potential speed up during inference. Speed | |
| up during training is not guaranteed.`,Le,O,nt=`<p>> ⚠️ When memory efficient attention and sliced attention are both enabled, memory efficient | |
| attention takes > precedent.</p>`,We,W,Ge,G,Y,Ee,le,at='Disable memory efficient attention from <a href="https://facebookresearch.github.io/xformers/" rel="nofollow">xFormers</a>.',he,A,be,D,K,Be,pe,it="Output class for Stable Diffusion pipelines.",_e,ee,ye,ce,ve;return d=new ct({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),g=new Ne({props:{title:"Image variation",local:"image-variation",headingTag:"h1"}}),N=new Ne({props:{title:"StableDiffusionImageVariationPipeline",local:"diffusers.StableDiffusionImageVariationPipeline",headingTag:"h2"}}),X=new te({props:{name:"class diffusers.StableDiffusionImageVariationPipeline",anchor:"diffusers.StableDiffusionImageVariationPipeline",parameters:[{name:"vae",val:": AutoencoderKL"},{name:"image_encoder",val:": CLIPVisionModelWithProjection"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": KarrasDiffusionSchedulers"},{name:"safety_checker",val:": StableDiffusionSafetyChecker"},{name:"feature_extractor",val:": CLIPImageProcessor"},{name:"requires_safety_checker",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.StableDiffusionImageVariationPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/pr_12762/en/api/models/autoencoderkl#diffusers.AutoencoderKL">AutoencoderKL</a>) — | |
| Variational Auto-Encoder (VAE) model to encode and decode images to and from latent representations.`,name:"vae"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.image_encoder",description:`<strong>image_encoder</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPVisionModelWithProjection" rel="nofollow">CLIPVisionModelWithProjection</a>) — | |
| Frozen CLIP image-encoder (<a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a>).`,name:"image_encoder"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.text_encoder",description:`<strong>text_encoder</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPTextModel" rel="nofollow">CLIPTextModel</a>) — | |
| Frozen text-encoder (<a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a>).`,name:"text_encoder"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.tokenizer",description:`<strong>tokenizer</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>) — | |
| A <code>CLIPTokenizer</code> to tokenize text.`,name:"tokenizer"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/pr_12762/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) — | |
| A <code>UNet2DConditionModel</code> to denoise the encoded image latents.`,name:"unet"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/pr_12762/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a>) — | |
| A scheduler to be used in combination with <code>unet</code> to denoise the encoded image latents. Can be one of | |
| <a href="/docs/diffusers/pr_12762/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/pr_12762/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/pr_12762/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.safety_checker",description:`<strong>safety_checker</strong> (<code>StableDiffusionSafetyChecker</code>) — | |
| Classification module that estimates whether generated images could be considered offensive or harmful. | |
| Please refer to the <a href="https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5" rel="nofollow">model card</a> for | |
| more details about a model’s potential harms.`,name:"safety_checker"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.feature_extractor",description:`<strong>feature_extractor</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPImageProcessor" rel="nofollow">CLIPImageProcessor</a>) — | |
| A <code>CLIPImageProcessor</code> to extract features from generated images; used as inputs to the <code>safety_checker</code>.`,name:"feature_extractor"}],source:"https://github.com/huggingface/diffusers/blob/vr_12762/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py#L44"}}),R=new te({props:{name:"__call__",anchor:"diffusers.StableDiffusionImageVariationPipeline.__call__",parameters:[{name:"image",val:": typing.Union[PIL.Image.Image, typing.List[PIL.Image.Image], torch.Tensor]"},{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.Tensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Optional[typing.Callable[[int, int, torch.Tensor], 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.Tensor</code>) — | |
| Image or images to guide image generation. If you provide a tensor, it needs to be compatible with | |
| <a href="https://huggingface.co/lambdalabs/sd-image-variations-diffusers/blob/main/feature_extractor/preprocessor_config.json" rel="nofollow"><code>CLIPImageProcessor</code></a>.`,name:"image"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.unet.config.sample_size * self.vae_scale_factor</code>) — | |
| The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.unet.config.sample_size * self.vae_scale_factor</code>) — | |
| 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) — | |
| The number of denoising steps. More denoising steps usually lead to a higher quality image at the | |
| expense of slower inference. This parameter is modulated by <code>strength</code>.`,name:"num_inference_steps"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) — | |
| A higher guidance scale value encourages the model to generate images closely linked to the text | |
| <code>prompt</code> at the expense of lower image quality. Guidance scale is enabled when <code>guidance_scale > 1</code>.`,name:"guidance_scale"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) — | |
| 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) — | |
| Corresponds to parameter eta (η) from the <a href="https://huggingface.co/papers/2010.02502" rel="nofollow">DDIM</a> paper. Only | |
| applies to the <a href="/docs/diffusers/pr_12762/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, and is ignored in other schedulers.`,name:"eta"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) — | |
| A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> to make | |
| generation deterministic.`,name:"generator"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for image | |
| generation. Can be used to tweak the same generation with different prompts. If not provided, a latents | |
| tensor is generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"pil"</code>) — | |
| The output format of the generated image. Choose between <code>PIL.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to return a <a href="/docs/diffusers/pr_12762/en/api/pipelines/stable_diffusion/depth2img#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>) — | |
| A function that calls every <code>callback_steps</code> steps during inference. The function is called with the | |
| following arguments: <code>callback(step: int, timestep: int, latents: torch.Tensor)</code>.`,name:"callback"},{anchor:"diffusers.StableDiffusionImageVariationPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) — | |
| The frequency at which the <code>callback</code> function is called. If not specified, the callback is called at | |
| every step.`,name:"callback_steps"}],source:"https://github.com/huggingface/diffusers/blob/vr_12762/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py#L259",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>If <code>return_dict</code> is <code>True</code>, <a | |
| href="/docs/diffusers/pr_12762/en/api/pipelines/stable_diffusion/depth2img#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput" | |
| >StableDiffusionPipelineOutput</a> is returned, | |
| otherwise a <code>tuple</code> is returned where the first element is a list with the generated images and the | |
| second element is a list of <code>bool</code>s indicating whether the corresponding generated image contains | |
| “not-safe-for-work” (nsfw) content.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/diffusers/pr_12762/en/api/pipelines/stable_diffusion/depth2img#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput" | |
| >StableDiffusionPipelineOutput</a> or <code>tuple</code></p> | |
| `}}),Z=new ze({props:{anchor:"diffusers.StableDiffusionImageVariationPipeline.__call__.example",$$slots:{default:[dt]},$$scope:{ctx:C}}}),F=new te({props:{name:"enable_attention_slicing",anchor:"diffusers.StableDiffusionImageVariationPipeline.enable_attention_slicing",parameters:[{name:"slice_size",val:": typing.Union[int, str, 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>"auto"</code>) — | |
| When <code>"auto"</code>, halves the input to the attention heads, so attention will be computed in two steps. If | |
| <code>"max"</code>, maximum amount of memory will be saved by running only one slice at a time. If a number is | |
| provided, uses as many slices as <code>attention_head_dim // slice_size</code>. In this case, <code>attention_head_dim</code> | |
| must be a multiple of <code>slice_size</code>.`,name:"slice_size"}],source:"https://github.com/huggingface/diffusers/blob/vr_12762/src/diffusers/pipelines/pipeline_utils.py#L1978"}}),j=new ze({props:{anchor:"diffusers.StableDiffusionImageVariationPipeline.enable_attention_slicing.example",$$slots:{default:[mt]},$$scope:{ctx:C}}}),Q=new te({props:{name:"disable_attention_slicing",anchor:"diffusers.StableDiffusionImageVariationPipeline.disable_attention_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_12762/src/diffusers/pipelines/pipeline_utils.py#L2015"}}),H=new te({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>) — | |
| Override the default <code>None</code> operator for use as <code>op</code> argument to the | |
| <a href="https://facebookresearch.github.io/xformers/components/ops.html#xformers.ops.memory_efficient_attention" rel="nofollow"><code>memory_efficient_attention()</code></a> | |
| function of xFormers.`,name:"attention_op"}],source:"https://github.com/huggingface/diffusers/blob/vr_12762/src/diffusers/pipelines/pipeline_utils.py#L1921"}}),W=new ze({props:{anchor:"diffusers.StableDiffusionImageVariationPipeline.enable_xformers_memory_efficient_attention.example",$$slots:{default:[ut]},$$scope:{ctx:C}}}),Y=new te({props:{name:"disable_xformers_memory_efficient_attention",anchor:"diffusers.StableDiffusionImageVariationPipeline.disable_xformers_memory_efficient_attention",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_12762/src/diffusers/pipelines/pipeline_utils.py#L1952"}}),A=new Ne({props:{title:"StableDiffusionPipelineOutput",local:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",headingTag:"h2"}}),K=new te({props:{name:"class diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",anchor:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",parameters:[{name:"images",val:": typing.Union[typing.List[PIL.Image.Image], numpy.ndarray]"},{name:"nsfw_content_detected",val:": typing.Optional[typing.List[bool]]"}],parametersDescription:[{anchor:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput.images",description:`<strong>images</strong> (<code>List[PIL.Image.Image]</code> or <code>np.ndarray</code>) — | |
| List of denoised PIL images of length <code>batch_size</code> or NumPy array of shape <code>(batch_size, height, width, num_channels)</code>.`,name:"images"},{anchor:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput.nsfw_content_detected",description:`<strong>nsfw_content_detected</strong> (<code>List[bool]</code>) — | |
| List indicating whether the corresponding generated image contains “not-safe-for-work” (nsfw) content or | |
| <code>None</code> if safety checking could not be performed.`,name:"nsfw_content_detected"}],source:"https://github.com/huggingface/diffusers/blob/vr_12762/src/diffusers/pipelines/stable_diffusion/pipeline_output.py#L11"}}),ee=new ft({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/stable_diffusion/image_variation.md"}}),{c(){s=p("meta"),x=o(),u=p("p"),l=o(),b(d.$$.fragment),t=o(),b(g.$$.fragment),fe=o(),B=p("p"),B.innerHTML=Fe,de=o(),z=p("p"),z.innerHTML=qe,me=o(),V=p("blockquote"),V.innerHTML=Qe,ue=o(),b(N.$$.fragment),ge=o(),m=p("div"),b(X.$$.fragment),xe=o(),ne=p("p"),ne.textContent=He,Me=o(),ae=p("p"),ae.innerHTML=Oe,Te=o(),S=p("div"),b(R.$$.fragment),Pe=o(),ie=p("p"),ie.textContent=Ye,Ue=o(),b(Z.$$.fragment),Se=o(),M=p("div"),b(F.$$.fragment),De=o(),se=p("p"),se.textContent=Ae,ke=o(),q=p("blockquote"),q.innerHTML=Ke,Je=o(),b(j.$$.fragment),Ce=o(),L=p("div"),b(Q.$$.fragment),Ve=o(),oe=p("p"),oe.innerHTML=et,Ze=o(),T=p("div"),b(H.$$.fragment),je=o(),re=p("p"),re.innerHTML=tt,Le=o(),O=p("blockquote"),O.innerHTML=nt,We=o(),b(W.$$.fragment),Ge=o(),G=p("div"),b(Y.$$.fragment),Ee=o(),le=p("p"),le.innerHTML=at,he=o(),b(A.$$.fragment),be=o(),D=p("div"),b(K.$$.fragment),Be=o(),pe=p("p"),pe.textContent=it,_e=o(),b(ee.$$.fragment),ye=o(),ce=p("p"),this.h()},l(e){const a=pt("svelte-u9bgzb",document.head);s=c(a,"META",{name:!0,content:!0}),a.forEach(n),x=r(e),u=c(e,"P",{}),J(u).forEach(n),l=r(e),_(d.$$.fragment,e),t=r(e),_(g.$$.fragment,e),fe=r(e),B=c(e,"P",{"data-svelte-h":!0}),$(B)!=="svelte-136oux4"&&(B.innerHTML=Fe),de=r(e),z=c(e,"P",{"data-svelte-h":!0}),$(z)!=="svelte-vto4t0"&&(z.innerHTML=qe),me=r(e),V=c(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),$(V)!=="svelte-15xttvv"&&(V.innerHTML=Qe),ue=r(e),_(N.$$.fragment,e),ge=r(e),m=c(e,"DIV",{class:!0});var h=J(m);_(X.$$.fragment,h),xe=r(h),ne=c(h,"P",{"data-svelte-h":!0}),$(ne)!=="svelte-1dj22j7"&&(ne.textContent=He),Me=r(h),ae=c(h,"P",{"data-svelte-h":!0}),$(ae)!=="svelte-dj6fbg"&&(ae.innerHTML=Oe),Te=r(h),S=c(h,"DIV",{class:!0});var k=J(S);_(R.$$.fragment,k),Pe=r(k),ie=c(k,"P",{"data-svelte-h":!0}),$(ie)!=="svelte-50j04k"&&(ie.textContent=Ye),Ue=r(k),_(Z.$$.fragment,k),k.forEach(n),Se=r(h),M=c(h,"DIV",{class:!0});var U=J(M);_(F.$$.fragment,U),De=r(U),se=c(U,"P",{"data-svelte-h":!0}),$(se)!=="svelte-10jaql7"&&(se.textContent=Ae),ke=r(U),q=c(U,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),$(q)!=="svelte-zc9fvp"&&(q.innerHTML=Ke),Je=r(U),_(j.$$.fragment,U),U.forEach(n),Ce=r(h),L=c(h,"DIV",{class:!0});var we=J(L);_(Q.$$.fragment,we),Ve=r(we),oe=c(we,"P",{"data-svelte-h":!0}),$(oe)!=="svelte-1lh0nh5"&&(oe.innerHTML=et),we.forEach(n),Ze=r(h),T=c(h,"DIV",{class:!0});var E=J(T);_(H.$$.fragment,E),je=r(E),re=c(E,"P",{"data-svelte-h":!0}),$(re)!=="svelte-e03q3e"&&(re.innerHTML=tt),Le=r(E),O=c(E,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),$(O)!=="svelte-3y0te0"&&(O.innerHTML=nt),We=r(E),_(W.$$.fragment,E),E.forEach(n),Ge=r(h),G=c(h,"DIV",{class:!0});var Ie=J(G);_(Y.$$.fragment,Ie),Ee=r(Ie),le=c(Ie,"P",{"data-svelte-h":!0}),$(le)!=="svelte-1vfte1e"&&(le.innerHTML=at),Ie.forEach(n),h.forEach(n),he=r(e),_(A.$$.fragment,e),be=r(e),D=c(e,"DIV",{class:!0});var $e=J(D);_(K.$$.fragment,$e),Be=r($e),pe=c($e,"P",{"data-svelte-h":!0}),$(pe)!=="svelte-1qpjiuf"&&(pe.textContent=it),$e.forEach(n),_e=r(e),_(ee.$$.fragment,e),ye=r(e),ce=c(e,"P",{}),J(ce).forEach(n),this.h()},h(){P(s,"name","hf:doc:metadata"),P(s,"content",ht),P(V,"class","tip"),P(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(q,"class","warning"),P(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(O,"class","warning"),P(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(m,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,a){i(document.head,s),f(e,x,a),f(e,u,a),f(e,l,a),y(d,e,a),f(e,t,a),y(g,e,a),f(e,fe,a),f(e,B,a),f(e,de,a),f(e,z,a),f(e,me,a),f(e,V,a),f(e,ue,a),y(N,e,a),f(e,ge,a),f(e,m,a),y(X,m,null),i(m,xe),i(m,ne),i(m,Me),i(m,ae),i(m,Te),i(m,S),y(R,S,null),i(S,Pe),i(S,ie),i(S,Ue),y(Z,S,null),i(m,Se),i(m,M),y(F,M,null),i(M,De),i(M,se),i(M,ke),i(M,q),i(M,Je),y(j,M,null),i(m,Ce),i(m,L),y(Q,L,null),i(L,Ve),i(L,oe),i(m,Ze),i(m,T),y(H,T,null),i(T,je),i(T,re),i(T,Le),i(T,O),i(T,We),y(W,T,null),i(m,Ge),i(m,G),y(Y,G,null),i(G,Ee),i(G,le),f(e,he,a),y(A,e,a),f(e,be,a),f(e,D,a),y(K,D,null),i(D,Be),i(D,pe),f(e,_e,a),y(ee,e,a),f(e,ye,a),f(e,ce,a),ve=!0},p(e,[a]){const h={};a&2&&(h.$$scope={dirty:a,ctx:e}),Z.$set(h);const k={};a&2&&(k.$$scope={dirty:a,ctx:e}),j.$set(k);const U={};a&2&&(U.$$scope={dirty:a,ctx:e}),W.$set(U)},i(e){ve||(v(d.$$.fragment,e),v(g.$$.fragment,e),v(N.$$.fragment,e),v(X.$$.fragment,e),v(R.$$.fragment,e),v(Z.$$.fragment,e),v(F.$$.fragment,e),v(j.$$.fragment,e),v(Q.$$.fragment,e),v(H.$$.fragment,e),v(W.$$.fragment,e),v(Y.$$.fragment,e),v(A.$$.fragment,e),v(K.$$.fragment,e),v(ee.$$.fragment,e),ve=!0)},o(e){w(d.$$.fragment,e),w(g.$$.fragment,e),w(N.$$.fragment,e),w(X.$$.fragment,e),w(R.$$.fragment,e),w(Z.$$.fragment,e),w(F.$$.fragment,e),w(j.$$.fragment,e),w(Q.$$.fragment,e),w(H.$$.fragment,e),w(W.$$.fragment,e),w(Y.$$.fragment,e),w(A.$$.fragment,e),w(K.$$.fragment,e),w(ee.$$.fragment,e),ve=!1},d(e){e&&(n(x),n(u),n(l),n(t),n(fe),n(B),n(de),n(z),n(me),n(V),n(ue),n(ge),n(m),n(he),n(be),n(D),n(_e),n(ye),n(ce)),n(s),I(d,e),I(g,e),I(N,e),I(X),I(R),I(Z),I(F),I(j),I(Q),I(H),I(W),I(Y),I(A,e),I(K),I(ee,e)}}}const ht='{"title":"Image variation","local":"image-variation","sections":[{"title":"StableDiffusionImageVariationPipeline","local":"diffusers.StableDiffusionImageVariationPipeline","sections":[],"depth":2},{"title":"StableDiffusionPipelineOutput","local":"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput","sections":[],"depth":2}],"depth":1}';function bt(C){return ot(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Mt extends rt{constructor(s){super(),lt(this,s,bt,gt,st,{})}}export{Mt as component}; | |
Xet Storage Details
- Size:
- 32.6 kB
- Xet hash:
- 37ae765e50dd277ad104e71b818c4d94638b14425567d704fd8ab6bdd2d8d832
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.