import{s as qe,o as Oe,n as Ue}from"../chunks/scheduler.8c3d61f6.js";import{S as Ye,i as Qe,g as p,s as o,r as g,A as Xe,h as d,f as s,c as r,j as Y,u as h,x as T,k as Q,y as u,a,v as _,d as M,t as y,w as b}from"../chunks/index.da70eac4.js";import{T as He}from"../chunks/Tip.1d9b8c37.js";import{D as ie}from"../chunks/Docstring.6b390b9a.js";import{C as Ne}from"../chunks/CodeBlock.00a903b3.js";import{E as Ee}from"../chunks/ExampleCodeBlock.db12be95.js";import{H as ye,E as Ae}from"../chunks/EditOnGithub.1e64e623.js";function Fe(U){let i,w='Make sure to check out the Schedulers <a href="../../using-diffusers/schedulers">guide</a> to learn how to explore the tradeoff between scheduler speed and quality, and see the <a href="../../using-diffusers/loading#reuse-components-across-pipelines">reuse components across pipelines</a> section to learn how to efficiently load the same components into multiple pipelines.';return{c(){i=p("p"),i.innerHTML=w},l(c){i=d(c,"P",{"data-svelte-h":!0}),T(i)!=="svelte-1wmc0l4"&&(i.innerHTML=w)},m(c,l){a(c,i,l)},p:Ue,d(c){c&&s(i)}}}function Ke(U){let i,w="Example:",c,l,f;return l=new Ne({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBJTIzJTIwbG9hZCUyMG1vZGVsJTIwYW5kJTIwc2NoZWR1bGVyJTBBbGRtJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMkNvbXBWaXMlMkZsZG0tdGV4dDJpbS1sYXJnZS0yNTYlMjIpJTBBJTBBJTIzJTIwcnVuJTIwcGlwZWxpbmUlMjBpbiUyMGluZmVyZW5jZSUyMChzYW1wbGUlMjByYW5kb20lMjBub2lzZSUyMGFuZCUyMGRlbm9pc2UpJTBBcHJvbXB0JTIwJTNEJTIwJTIyQSUyMHBhaW50aW5nJTIwb2YlMjBhJTIwc3F1aXJyZWwlMjBlYXRpbmclMjBhJTIwYnVyZ2VyJTIyJTBBaW1hZ2VzJTIwJTNEJTIwbGRtKCU1QnByb21wdCU1RCUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0Q1MCUyQyUyMGV0YSUzRDAuMyUyQyUyMGd1aWRhbmNlX3NjYWxlJTNENikuaW1hZ2VzJTBBJTBBJTIzJTIwc2F2ZSUyMGltYWdlcyUwQWZvciUyMGlkeCUyQyUyMGltYWdlJTIwaW4lMjBlbnVtZXJhdGUoaW1hZ2VzKSUzQSUwQSUyMCUyMCUyMCUyMGltYWdlLnNhdmUoZiUyMnNxdWlycmVsLSU3QmlkeCU3RC5wbmclMjIp",highlighted:`<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-comment"># load model and scheduler</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>ldm = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;CompVis/ldm-text2im-large-256&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># run pipeline in inference (sample random noise and denoise)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;A painting of a squirrel eating a burger&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>images = ldm([prompt], num_inference_steps=<span class="hljs-number">50</span>, eta=<span class="hljs-number">0.3</span>, guidance_scale=<span class="hljs-number">6</span>).images

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># save images</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> idx, image <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(images):
<span class="hljs-meta">... </span>    image.save(<span class="hljs-string">f&quot;squirrel-<span class="hljs-subst">{idx}</span>.png&quot;</span>)`,wrap:!1}}),{c(){i=p("p"),i.textContent=w,c=o(),g(l.$$.fragment)},l(n){i=d(n,"P",{"data-svelte-h":!0}),T(i)!=="svelte-11lpom8"&&(i.textContent=w),c=r(n),h(l.$$.fragment,n)},m(n,m){a(n,i,m),a(n,c,m),_(l,n,m),f=!0},p:Ue,i(n){f||(M(l.$$.fragment,n),f=!0)},o(n){y(l.$$.fragment,n),f=!1},d(n){n&&(s(i),s(c)),b(l,n)}}}function et(U){let i,w="Example:",c,l,f;return l=new Ne({props:{code:"aW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFmcm9tJTIwaW8lMjBpbXBvcnQlMjBCeXRlc0lPJTBBZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMExETVN1cGVyUmVzb2x1dGlvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEElMjMlMjBsb2FkJTIwbW9kZWwlMjBhbmQlMjBzY2hlZHVsZXIlMEFwaXBlbGluZSUyMCUzRCUyMExETVN1cGVyUmVzb2x1dGlvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJDb21wVmlzJTJGbGRtLXN1cGVyLXJlc29sdXRpb24tNHgtb3BlbmltYWdlcyUyMiklMEFwaXBlbGluZSUyMCUzRCUyMHBpcGVsaW5lLnRvKCUyMmN1ZGElMjIpJTBBJTBBJTIzJTIwbGV0J3MlMjBkb3dubG9hZCUyMGFuJTIwJTIwaW1hZ2UlMEF1cmwlMjAlM0QlMjAoJTBBJTIwJTIwJTIwJTIwJTIyaHR0cHMlM0ElMkYlMkZ1c2VyLWltYWdlcy5naXRodWJ1c2VyY29udGVudC5jb20lMkYzODA2MTY1OSUyRjE5OTcwNTg5Ni1iNDhlMTdiOC1iMjMxLTQ3Y2QtYTI3MC00ZmZhNWE5M2ZhM2UucG5nJTIyJTBBKSUwQXJlc3BvbnNlJTIwJTNEJTIwcmVxdWVzdHMuZ2V0KHVybCklMEFsb3dfcmVzX2ltZyUyMCUzRCUyMEltYWdlLm9wZW4oQnl0ZXNJTyhyZXNwb25zZS5jb250ZW50KSkuY29udmVydCglMjJSR0IlMjIpJTBBbG93X3Jlc19pbWclMjAlM0QlMjBsb3dfcmVzX2ltZy5yZXNpemUoKDEyOCUyQyUyMDEyOCkpJTBBJTBBJTIzJTIwcnVuJTIwcGlwZWxpbmUlMjBpbiUyMGluZmVyZW5jZSUyMChzYW1wbGUlMjByYW5kb20lMjBub2lzZSUyMGFuZCUyMGRlbm9pc2UpJTBBdXBzY2FsZWRfaW1hZ2UlMjAlM0QlMjBwaXBlbGluZShsb3dfcmVzX2ltZyUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QxMDAlMkMlMjBldGElM0QxKS5pbWFnZXMlNUIwJTVEJTBBJTIzJTIwc2F2ZSUyMGltYWdlJTBBdXBzY2FsZWRfaW1hZ2Uuc2F2ZSglMjJsZG1fZ2VuZXJhdGVkX2ltYWdlLnBuZyUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> LDMSuperResolutionPipeline
<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-comment"># load model and scheduler</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline = LDMSuperResolutionPipeline.from_pretrained(<span class="hljs-string">&quot;CompVis/ldm-super-resolution-4x-openimages&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline = pipeline.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># let&#x27;s download an  image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>url = (
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://user-images.githubusercontent.com/38061659/199705896-b48e17b8-b231-47cd-a270-4ffa5a93fa3e.png&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>response = requests.get(url)
<span class="hljs-meta">&gt;&gt;&gt; </span>low_res_img = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>low_res_img = low_res_img.resize((<span class="hljs-number">128</span>, <span class="hljs-number">128</span>))

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># run pipeline in inference (sample random noise and denoise)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>upscaled_image = pipeline(low_res_img, num_inference_steps=<span class="hljs-number">100</span>, eta=<span class="hljs-number">1</span>).images[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># save image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>upscaled_image.save(<span class="hljs-string">&quot;ldm_generated_image.png&quot;</span>)`,wrap:!1}}),{c(){i=p("p"),i.textContent=w,c=o(),g(l.$$.fragment)},l(n){i=d(n,"P",{"data-svelte-h":!0}),T(i)!=="svelte-11lpom8"&&(i.textContent=w),c=r(n),h(l.$$.fragment,n)},m(n,m){a(n,i,m),a(n,c,m),_(l,n,m),f=!0},p:Ue,i(n){f||(M(l.$$.fragment,n),f=!0)},o(n){y(l.$$.fragment,n),f=!1},d(n){n&&(s(i),s(c)),b(l,n)}}}function tt(U){let i,w,c,l,f,n,m,Je='Latent Diffusion was proposed in <a href="https://huggingface.co/papers/2112.10752" rel="nofollow">High-Resolution Image Synthesis with Latent Diffusion Models</a> by Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, Björn Ommer.',ae,C,Se="The abstract from the paper is:",oe,G,Be="<em>By decomposing the image formation process into a sequential application of denoising autoencoders, diffusion models (DMs) achieve state-of-the-art synthesis results on image data and beyond. Additionally, their formulation allows for a guiding mechanism to control the image generation process without retraining. However, since these models typically operate directly in pixel space, optimization of powerful DMs often consumes hundreds of GPU days and inference is expensive due to sequential evaluations. To enable DM training on limited computational resources while retaining their quality and flexibility, we apply them in the latent space of powerful pretrained autoencoders. In contrast to previous work, training diffusion models on such a representation allows for the first time to reach a near-optimal point between complexity reduction and detail preservation, greatly boosting visual fidelity. By introducing cross-attention layers into the model architecture, we turn diffusion models into powerful and flexible generators for general conditioning inputs such as text or bounding boxes and high-resolution synthesis becomes possible in a convolutional manner. Our latent diffusion models (LDMs) achieve a new state of the art for image inpainting and highly competitive performance on various tasks, including unconditional image generation, semantic scene synthesis, and super-resolution, while significantly reducing computational requirements compared to pixel-based DMs.</em>",re,Z,Ce='The original codebase can be found at <a href="https://github.com/CompVis/latent-diffusion" rel="nofollow">CompVis/latent-diffusion</a>.',le,J,pe,V,de,v,k,be,X,Ge="Pipeline for text-to-image generation using latent diffusion.",Te,H,Ze=`This model inherits from <a href="/docs/diffusers/pr_10001/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.).`,we,D,W,ve,A,Ve="The call function to the pipeline for generation.",xe,S,ce,z,ue,x,R,$e,F,ke="A pipeline for image super-resolution using latent diffusion.",Ie,K,We=`This model inherits from <a href="/docs/diffusers/pr_10001/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.).`,De,P,E,Pe,ee,ze="The call function to the pipeline for generation.",je,B,fe,N,me,j,q,Le,te,Re="Output class for image pipelines.",ge,O,he,ne,_e;return f=new ye({props:{title:"Latent Diffusion",local:"latent-diffusion",headingTag:"h1"}}),J=new He({props:{$$slots:{default:[Fe]},$$scope:{ctx:U}}}),V=new ye({props:{title:"LDMTextToImagePipeline",local:"diffusers.LDMTextToImagePipeline",headingTag:"h2"}}),k=new ie({props:{name:"class diffusers.LDMTextToImagePipeline",anchor:"diffusers.LDMTextToImagePipeline",parameters:[{name:"vqvae",val:": typing.Union[diffusers.models.autoencoders.vq_model.VQModel, diffusers.models.autoencoders.autoencoder_kl.AutoencoderKL]"},{name:"bert",val:": PreTrainedModel"},{name:"tokenizer",val:": PreTrainedTokenizer"},{name:"unet",val:": typing.Union[diffusers.models.unets.unet_2d.UNet2DModel, diffusers.models.unets.unet_2d_condition.UNet2DConditionModel]"},{name:"scheduler",val:": typing.Union[diffusers.schedulers.scheduling_ddim.DDIMScheduler, diffusers.schedulers.scheduling_pndm.PNDMScheduler, diffusers.schedulers.scheduling_lms_discrete.LMSDiscreteScheduler]"}],parametersDescription:[{anchor:"diffusers.LDMTextToImagePipeline.vqvae",description:`<strong>vqvae</strong> (<a href="/docs/diffusers/pr_10001/en/api/models/vq#diffusers.VQModel">VQModel</a>) &#x2014;
Vector-quantized (VQ) model to encode and decode images to and from latent representations.`,name:"vqvae"},{anchor:"diffusers.LDMTextToImagePipeline.bert",description:`<strong>bert</strong> (<code>LDMBertModel</code>) &#x2014;
Text-encoder model based on <code>BERT</code>.`,name:"bert"},{anchor:"diffusers.LDMTextToImagePipeline.tokenizer",description:`<strong>tokenizer</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/bert#transformers.BertTokenizer" rel="nofollow">BertTokenizer</a>) &#x2014;
A <code>BertTokenizer</code> to tokenize text.`,name:"tokenizer"},{anchor:"diffusers.LDMTextToImagePipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/pr_10001/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
A <code>UNet2DConditionModel</code> to denoise the encoded image latents.`,name:"unet"},{anchor:"diffusers.LDMTextToImagePipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/pr_10001/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/pr_10001/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/pr_10001/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/pr_10001/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/vr_10001/src/diffusers/pipelines/latent_diffusion/pipeline_latent_diffusion.py#L32"}}),W=new ie({props:{name:"__call__",anchor:"diffusers.LDMTextToImagePipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"num_inference_steps",val:": typing.Optional[int] = 50"},{name:"guidance_scale",val:": typing.Optional[float] = 1.0"},{name:"eta",val:": typing.Optional[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:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.LDMTextToImagePipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The prompt or prompts to guide the image generation.`,name:"prompt"},{anchor:"diffusers.LDMTextToImagePipeline.__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>) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.LDMTextToImagePipeline.__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>) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.LDMTextToImagePipeline.__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.LDMTextToImagePipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
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 &gt; 1</code>.`,name:"guidance_scale"},{anchor:"diffusers.LDMTextToImagePipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
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.LDMTextToImagePipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.Tensor</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 is generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.LDMTextToImagePipeline.__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 generated image. Choose between <code>PIL.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.LDMTextToImagePipeline.__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/pr_10001/en/api/pipelines/latent_diffusion#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_10001/src/diffusers/pipelines/latent_diffusion/pipeline_latent_diffusion.py#L67",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/pr_10001/en/api/pipelines/latent_diffusion#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> is returned, otherwise a <code>tuple</code> is
returned where the first element is a list with the generated images.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/diffusers/pr_10001/en/api/pipelines/latent_diffusion#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),S=new Ee({props:{anchor:"diffusers.LDMTextToImagePipeline.__call__.example",$$slots:{default:[Ke]},$$scope:{ctx:U}}}),z=new ye({props:{title:"LDMSuperResolutionPipeline",local:"diffusers.LDMSuperResolutionPipeline",headingTag:"h2"}}),R=new ie({props:{name:"class diffusers.LDMSuperResolutionPipeline",anchor:"diffusers.LDMSuperResolutionPipeline",parameters:[{name:"vqvae",val:": VQModel"},{name:"unet",val:": UNet2DModel"},{name:"scheduler",val:": typing.Union[diffusers.schedulers.scheduling_ddim.DDIMScheduler, diffusers.schedulers.scheduling_pndm.PNDMScheduler, diffusers.schedulers.scheduling_lms_discrete.LMSDiscreteScheduler, diffusers.schedulers.scheduling_euler_discrete.EulerDiscreteScheduler, diffusers.schedulers.scheduling_euler_ancestral_discrete.EulerAncestralDiscreteScheduler, diffusers.schedulers.scheduling_dpmsolver_multistep.DPMSolverMultistepScheduler]"}],parametersDescription:[{anchor:"diffusers.LDMSuperResolutionPipeline.vqvae",description:`<strong>vqvae</strong> (<a href="/docs/diffusers/pr_10001/en/api/models/vq#diffusers.VQModel">VQModel</a>) &#x2014;
Vector-quantized (VQ) model to encode and decode images to and from latent representations.`,name:"vqvae"},{anchor:"diffusers.LDMSuperResolutionPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/pr_10001/en/api/models/unet2d#diffusers.UNet2DModel">UNet2DModel</a>) &#x2014;
A <code>UNet2DModel</code> to denoise the encoded image.`,name:"unet"},{anchor:"diffusers.LDMSuperResolutionPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/pr_10001/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 latens. Can be one of
<a href="/docs/diffusers/pr_10001/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/pr_10001/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, <a href="/docs/diffusers/pr_10001/en/api/schedulers/euler#diffusers.EulerDiscreteScheduler">EulerDiscreteScheduler</a>,
<a href="/docs/diffusers/pr_10001/en/api/schedulers/euler_ancestral#diffusers.EulerAncestralDiscreteScheduler">EulerAncestralDiscreteScheduler</a>, <a href="/docs/diffusers/pr_10001/en/api/schedulers/multistep_dpm_solver#diffusers.DPMSolverMultistepScheduler">DPMSolverMultistepScheduler</a>, or <a href="/docs/diffusers/pr_10001/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/vr_10001/src/diffusers/pipelines/latent_diffusion/pipeline_latent_diffusion_superresolution.py#L33"}}),E=new ie({props:{name:"__call__",anchor:"diffusers.LDMSuperResolutionPipeline.__call__",parameters:[{name:"image",val:": typing.Union[torch.Tensor, PIL.Image.Image] = None"},{name:"batch_size",val:": typing.Optional[int] = 1"},{name:"num_inference_steps",val:": typing.Optional[int] = 100"},{name:"eta",val:": typing.Optional[float] = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.LDMSuperResolutionPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.Tensor</code> or <code>PIL.Image.Image</code>) &#x2014;
<code>Image</code> or tensor representing an image batch to be used as the starting point for the process.`,name:"image"},{anchor:"diffusers.LDMSuperResolutionPipeline.__call__.batch_size",description:`<strong>batch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of images to generate.`,name:"batch_size"},{anchor:"diffusers.LDMSuperResolutionPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#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.LDMSuperResolutionPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) from the <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">DDIM</a> paper. Only applies
to the <a href="/docs/diffusers/pr_10001/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, and is ignored in other schedulers.`,name:"eta"},{anchor:"diffusers.LDMSuperResolutionPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
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.LDMSuperResolutionPipeline.__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 generated image. Choose between <code>PIL.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.LDMSuperResolutionPipeline.__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/pr_10001/en/api/pipelines/latent_diffusion#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_10001/src/diffusers/pipelines/latent_diffusion/pipeline_latent_diffusion_superresolution.py#L67",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/pr_10001/en/api/pipelines/latent_diffusion#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> is returned, otherwise a <code>tuple</code> is
returned where the first element is a list with the generated images</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/diffusers/pr_10001/en/api/pipelines/latent_diffusion#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),B=new Ee({props:{anchor:"diffusers.LDMSuperResolutionPipeline.__call__.example",$$slots:{default:[et]},$$scope:{ctx:U}}}),N=new ye({props:{title:"ImagePipelineOutput",local:"diffusers.ImagePipelineOutput",headingTag:"h2"}}),q=new ie({props:{name:"class diffusers.ImagePipelineOutput",anchor:"diffusers.ImagePipelineOutput",parameters:[{name:"images",val:": typing.Union[typing.List[PIL.Image.Image], numpy.ndarray]"}],parametersDescription:[{anchor:"diffusers.ImagePipelineOutput.images",description:`<strong>images</strong> (<code>List[PIL.Image.Image]</code> or <code>np.ndarray</code>) &#x2014;
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"}],source:"https://github.com/huggingface/diffusers/blob/vr_10001/src/diffusers/pipelines/pipeline_utils.py#L106"}}),O=new Ae({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/latent_diffusion.md"}}),{c(){i=p("meta"),w=o(),c=p("p"),l=o(),g(f.$$.fragment),n=o(),m=p("p"),m.innerHTML=Je,ae=o(),C=p("p"),C.textContent=Se,oe=o(),G=p("p"),G.innerHTML=Be,re=o(),Z=p("p"),Z.innerHTML=Ce,le=o(),g(J.$$.fragment),pe=o(),g(V.$$.fragment),de=o(),v=p("div"),g(k.$$.fragment),be=o(),X=p("p"),X.textContent=Ge,Te=o(),H=p("p"),H.innerHTML=Ze,we=o(),D=p("div"),g(W.$$.fragment),ve=o(),A=p("p"),A.textContent=Ve,xe=o(),g(S.$$.fragment),ce=o(),g(z.$$.fragment),ue=o(),x=p("div"),g(R.$$.fragment),$e=o(),F=p("p"),F.textContent=ke,Ie=o(),K=p("p"),K.innerHTML=We,De=o(),P=p("div"),g(E.$$.fragment),Pe=o(),ee=p("p"),ee.textContent=ze,je=o(),g(B.$$.fragment),fe=o(),g(N.$$.fragment),me=o(),j=p("div"),g(q.$$.fragment),Le=o(),te=p("p"),te.textContent=Re,ge=o(),g(O.$$.fragment),he=o(),ne=p("p"),this.h()},l(e){const t=Xe("svelte-u9bgzb",document.head);i=d(t,"META",{name:!0,content:!0}),t.forEach(s),w=r(e),c=d(e,"P",{}),Y(c).forEach(s),l=r(e),h(f.$$.fragment,e),n=r(e),m=d(e,"P",{"data-svelte-h":!0}),T(m)!=="svelte-1dm5g0h"&&(m.innerHTML=Je),ae=r(e),C=d(e,"P",{"data-svelte-h":!0}),T(C)!=="svelte-1cwsb16"&&(C.textContent=Se),oe=r(e),G=d(e,"P",{"data-svelte-h":!0}),T(G)!=="svelte-mfilaa"&&(G.innerHTML=Be),re=r(e),Z=d(e,"P",{"data-svelte-h":!0}),T(Z)!=="svelte-13wc5yz"&&(Z.innerHTML=Ce),le=r(e),h(J.$$.fragment,e),pe=r(e),h(V.$$.fragment,e),de=r(e),v=d(e,"DIV",{class:!0});var $=Y(v);h(k.$$.fragment,$),be=r($),X=d($,"P",{"data-svelte-h":!0}),T(X)!=="svelte-v0jro5"&&(X.textContent=Ge),Te=r($),H=d($,"P",{"data-svelte-h":!0}),T(H)!=="svelte-ndbkk8"&&(H.innerHTML=Ze),we=r($),D=d($,"DIV",{class:!0});var L=Y(D);h(W.$$.fragment,L),ve=r(L),A=d(L,"P",{"data-svelte-h":!0}),T(A)!=="svelte-50j04k"&&(A.textContent=Ve),xe=r(L),h(S.$$.fragment,L),L.forEach(s),$.forEach(s),ce=r(e),h(z.$$.fragment,e),ue=r(e),x=d(e,"DIV",{class:!0});var I=Y(x);h(R.$$.fragment,I),$e=r(I),F=d(I,"P",{"data-svelte-h":!0}),T(F)!=="svelte-gocjs6"&&(F.textContent=ke),Ie=r(I),K=d(I,"P",{"data-svelte-h":!0}),T(K)!=="svelte-ndbkk8"&&(K.innerHTML=We),De=r(I),P=d(I,"DIV",{class:!0});var se=Y(P);h(E.$$.fragment,se),Pe=r(se),ee=d(se,"P",{"data-svelte-h":!0}),T(ee)!=="svelte-50j04k"&&(ee.textContent=ze),je=r(se),h(B.$$.fragment,se),se.forEach(s),I.forEach(s),fe=r(e),h(N.$$.fragment,e),me=r(e),j=d(e,"DIV",{class:!0});var Me=Y(j);h(q.$$.fragment,Me),Le=r(Me),te=d(Me,"P",{"data-svelte-h":!0}),T(te)!=="svelte-19wetgi"&&(te.textContent=Re),Me.forEach(s),ge=r(e),h(O.$$.fragment,e),he=r(e),ne=d(e,"P",{}),Y(ne).forEach(s),this.h()},h(){Q(i,"name","hf:doc:metadata"),Q(i,"content",st),Q(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Q(j,"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,t){u(document.head,i),a(e,w,t),a(e,c,t),a(e,l,t),_(f,e,t),a(e,n,t),a(e,m,t),a(e,ae,t),a(e,C,t),a(e,oe,t),a(e,G,t),a(e,re,t),a(e,Z,t),a(e,le,t),_(J,e,t),a(e,pe,t),_(V,e,t),a(e,de,t),a(e,v,t),_(k,v,null),u(v,be),u(v,X),u(v,Te),u(v,H),u(v,we),u(v,D),_(W,D,null),u(D,ve),u(D,A),u(D,xe),_(S,D,null),a(e,ce,t),_(z,e,t),a(e,ue,t),a(e,x,t),_(R,x,null),u(x,$e),u(x,F),u(x,Ie),u(x,K),u(x,De),u(x,P),_(E,P,null),u(P,Pe),u(P,ee),u(P,je),_(B,P,null),a(e,fe,t),_(N,e,t),a(e,me,t),a(e,j,t),_(q,j,null),u(j,Le),u(j,te),a(e,ge,t),_(O,e,t),a(e,he,t),a(e,ne,t),_e=!0},p(e,[t]){const $={};t&2&&($.$$scope={dirty:t,ctx:e}),J.$set($);const L={};t&2&&(L.$$scope={dirty:t,ctx:e}),S.$set(L);const I={};t&2&&(I.$$scope={dirty:t,ctx:e}),B.$set(I)},i(e){_e||(M(f.$$.fragment,e),M(J.$$.fragment,e),M(V.$$.fragment,e),M(k.$$.fragment,e),M(W.$$.fragment,e),M(S.$$.fragment,e),M(z.$$.fragment,e),M(R.$$.fragment,e),M(E.$$.fragment,e),M(B.$$.fragment,e),M(N.$$.fragment,e),M(q.$$.fragment,e),M(O.$$.fragment,e),_e=!0)},o(e){y(f.$$.fragment,e),y(J.$$.fragment,e),y(V.$$.fragment,e),y(k.$$.fragment,e),y(W.$$.fragment,e),y(S.$$.fragment,e),y(z.$$.fragment,e),y(R.$$.fragment,e),y(E.$$.fragment,e),y(B.$$.fragment,e),y(N.$$.fragment,e),y(q.$$.fragment,e),y(O.$$.fragment,e),_e=!1},d(e){e&&(s(w),s(c),s(l),s(n),s(m),s(ae),s(C),s(oe),s(G),s(re),s(Z),s(le),s(pe),s(de),s(v),s(ce),s(ue),s(x),s(fe),s(me),s(j),s(ge),s(he),s(ne)),s(i),b(f,e),b(J,e),b(V,e),b(k),b(W),b(S),b(z,e),b(R),b(E),b(B),b(N,e),b(q),b(O,e)}}}const st='{"title":"Latent Diffusion","local":"latent-diffusion","sections":[{"title":"LDMTextToImagePipeline","local":"diffusers.LDMTextToImagePipeline","sections":[],"depth":2},{"title":"LDMSuperResolutionPipeline","local":"diffusers.LDMSuperResolutionPipeline","sections":[],"depth":2},{"title":"ImagePipelineOutput","local":"diffusers.ImagePipelineOutput","sections":[],"depth":2}],"depth":1}';function nt(U){return Oe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ct extends Ye{constructor(i){super(),Qe(this,i,nt,tt,qe,{})}}export{ct as component};
