import{s as en,o as tn,n as st}from"../chunks/scheduler.182ea377.js";import{S as nn,i as sn,g as d,s as i,r as f,A as on,h as l,f as s,c as o,j as D,u as c,x,k as P,y as t,a as u,v as m,d as g,t as h,w as _}from"../chunks/index.abf12888.js";import{T as rn}from"../chunks/Tip.230e2334.js";import{D as k}from"../chunks/Docstring.93f6f462.js";import{C as Ut}from"../chunks/CodeBlock.57fe6e13.js";import{E as Lt}from"../chunks/ExampleCodeBlock.658f5cd6.js";import{H as Le}from"../chunks/Heading.16916d63.js";function an(j){let r,T='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(){r=d("p"),r.innerHTML=T},l($){r=l($,"P",{"data-svelte-h":!0}),x(r)!=="svelte-5fcsv6"&&(r.innerHTML=T)},m($,p){u($,r,p)},p:st,d($){$&&s(r)}}}function dn(j){let r,T="For audio diffusion:",$,p,b;return p=new Ut({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwSVB5dGhvbi5kaXNwbGF5JTIwaW1wb3J0JTIwQXVkaW8lMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFkZXZpY2UlMjAlM0QlMjAlMjJjdWRhJTIyJTIwaWYlMjB0b3JjaC5jdWRhLmlzX2F2YWlsYWJsZSgpJTIwZWxzZSUyMCUyMmNwdSUyMiUwQXBpcGUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIydGV0aWNpbyUyRmF1ZGlvLWRpZmZ1c2lvbi0yNTYlMjIpLnRvKGRldmljZSklMEElMEFvdXRwdXQlMjAlM0QlMjBwaXBlKCklMEFkaXNwbGF5KG91dHB1dC5pbWFnZXMlNUIwJTVEKSUwQWRpc3BsYXkoQXVkaW8ob3V0cHV0LmF1ZGlvcyU1QjAlNUQlMkMlMjByYXRlJTNEbWVsLmdldF9zYW1wbGVfcmF0ZSgpKSk=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> IPython.display <span class="hljs-keyword">import</span> Audio
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

device = <span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;cpu&quot;</span>
pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;teticio/audio-diffusion-256&quot;</span>).to(device)

output = pipe()
display(output.images[<span class="hljs-number">0</span>])
display(Audio(output.audios[<span class="hljs-number">0</span>], rate=mel.get_sample_rate()))`,wrap:!1}}),{c(){r=d("p"),r.textContent=T,$=i(),f(p.$$.fragment)},l(n){r=l(n,"P",{"data-svelte-h":!0}),x(r)!=="svelte-1smf6bg"&&(r.textContent=T),$=o(n),c(p.$$.fragment,n)},m(n,y){u(n,r,y),u(n,$,y),m(p,n,y),b=!0},p:st,i(n){b||(g(p.$$.fragment,n),b=!0)},o(n){h(p.$$.fragment,n),b=!1},d(n){n&&(s(r),s($)),_(p,n)}}}function ln(j){let r,T="For latent audio diffusion:",$,p,b;return p=new Ut({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwSVB5dGhvbi5kaXNwbGF5JTIwaW1wb3J0JTIwQXVkaW8lMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFkZXZpY2UlMjAlM0QlMjAlMjJjdWRhJTIyJTIwaWYlMjB0b3JjaC5jdWRhLmlzX2F2YWlsYWJsZSgpJTIwZWxzZSUyMCUyMmNwdSUyMiUwQXBpcGUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIydGV0aWNpbyUyRmxhdGVudC1hdWRpby1kaWZmdXNpb24tMjU2JTIyKS50byhkZXZpY2UpJTBBJTBBb3V0cHV0JTIwJTNEJTIwcGlwZSgpJTBBZGlzcGxheShvdXRwdXQuaW1hZ2VzJTVCMCU1RCklMEFkaXNwbGF5KEF1ZGlvKG91dHB1dC5hdWRpb3MlNUIwJTVEJTJDJTIwcmF0ZSUzRHBpcGUubWVsLmdldF9zYW1wbGVfcmF0ZSgpKSk=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> IPython.display <span class="hljs-keyword">import</span> Audio
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

device = <span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;cpu&quot;</span>
pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;teticio/latent-audio-diffusion-256&quot;</span>).to(device)

output = pipe()
display(output.images[<span class="hljs-number">0</span>])
display(Audio(output.audios[<span class="hljs-number">0</span>], rate=pipe.mel.get_sample_rate()))`,wrap:!1}}),{c(){r=d("p"),r.textContent=T,$=i(),f(p.$$.fragment)},l(n){r=l(n,"P",{"data-svelte-h":!0}),x(r)!=="svelte-1tdalp8"&&(r.textContent=T),$=o(n),c(p.$$.fragment,n)},m(n,y){u(n,r,y),u(n,$,y),m(p,n,y),b=!0},p:st,i(n){b||(g(p.$$.fragment,n),b=!0)},o(n){h(p.$$.fragment,n),b=!1},d(n){n&&(s(r),s($)),_(p,n)}}}function pn(j){let r,T="For other tasks like variation, inpainting, outpainting, etc:",$,p,b;return p=new Ut({props:{code:"b3V0cHV0JTIwJTNEJTIwcGlwZSglMEElMjAlMjAlMjAlMjByYXdfYXVkaW8lM0RvdXRwdXQuYXVkaW9zJTVCMCUyQyUyMDAlNUQlMkMlMEElMjAlMjAlMjAlMjBzdGFydF9zdGVwJTNEaW50KHBpcGUuZ2V0X2RlZmF1bHRfc3RlcHMoKSUyMCUyRiUyMDIpJTJDJTBBJTIwJTIwJTIwJTIwbWFza19zdGFydF9zZWNzJTNEMSUyQyUwQSUyMCUyMCUyMCUyMG1hc2tfZW5kX3NlY3MlM0QxJTJDJTBBKSUwQWRpc3BsYXkob3V0cHV0LmltYWdlcyU1QjAlNUQpJTBBZGlzcGxheShBdWRpbyhvdXRwdXQuYXVkaW9zJTVCMCU1RCUyQyUyMHJhdGUlM0RwaXBlLm1lbC5nZXRfc2FtcGxlX3JhdGUoKSkp",highlighted:`output = pipe(
    raw_audio=output.audios[<span class="hljs-number">0</span>, <span class="hljs-number">0</span>],
    start_step=<span class="hljs-built_in">int</span>(pipe.get_default_steps() / <span class="hljs-number">2</span>),
    mask_start_secs=<span class="hljs-number">1</span>,
    mask_end_secs=<span class="hljs-number">1</span>,
)
display(output.images[<span class="hljs-number">0</span>])
display(Audio(output.audios[<span class="hljs-number">0</span>], rate=pipe.mel.get_sample_rate()))`,wrap:!1}}),{c(){r=d("p"),r.textContent=T,$=i(),f(p.$$.fragment)},l(n){r=l(n,"P",{"data-svelte-h":!0}),x(r)!=="svelte-1p5i2x8"&&(r.textContent=T),$=o(n),c(p.$$.fragment,n)},m(n,y){u(n,r,y),u(n,$,y),m(p,n,y),b=!0},p:st,i(n){b||(g(p.$$.fragment,n),b=!0)},o(n){h(p.$$.fragment,n),b=!1},d(n){n&&(s(r),s($)),_(p,n)}}}function un(j){let r,T,$,p,b,n,y,Gt='<a href="https://github.com/teticio/audio-diffusion" rel="nofollow">Audio Diffusion</a> is by Robert Dargavel Smith, and it leverages the recent advances in image generation from diffusion models by converting audio samples to and from Mel spectrogram images.',Ue,q,Nt='The original codebase, training scripts and example notebooks can be found at <a href="https://github.com/teticio/audio-diffusion" rel="nofollow">teticio/audio-diffusion</a>.',Ge,U,Ne,Y,We,w,H,it,_e,Wt="Pipeline for audio diffusion.",ot,$e,Et=`This model inherits from <a href="/docs/diffusers/main/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.).`,rt,C,O,at,be,St="The call function to the pipeline for generation.",dt,xe,Vt="Examples:",lt,G,pt,N,ut,W,ft,E,K,ct,ve,Zt="Reverse the denoising step process to recover a noisy image from the generated image.",mt,S,ee,gt,ye,Xt="Returns default number of steps recommended for inference.",ht,V,te,_t,we,Bt="Spherical Linear intERPolation.",Ee,ne,Se,J,se,$t,Me,Rt="Output class for audio pipelines.",Ve,ie,Ze,L,oe,bt,De,Ft="Output class for image pipelines.",Xe,re,Be,v,ae,xt,Z,de,vt,Pe,zt="Convert slice of audio to spectrogram.",yt,X,le,wt,Te,Qt="Get slice of audio.",Mt,B,pe,Dt,Ce,qt="Get number of slices in audio.",Pt,R,ue,Tt,Ie,Yt="Get sample rate.",Ct,F,fe,It,Ae,Ht="Converts spectrogram to audio.",At,z,ce,kt,ke,Ot="Load audio.",jt,Q,me,Jt,je,Kt="Set resolution.",Re,Je,Fe;return b=new Le({props:{title:"Audio Diffusion",local:"audio-diffusion",headingTag:"h1"}}),U=new rn({props:{$$slots:{default:[an]},$$scope:{ctx:j}}}),Y=new Le({props:{title:"AudioDiffusionPipeline",local:"diffusers.AudioDiffusionPipeline",headingTag:"h2"}}),H=new k({props:{name:"class diffusers.AudioDiffusionPipeline",anchor:"diffusers.AudioDiffusionPipeline",parameters:[{name:"vqvae",val:": AutoencoderKL"},{name:"unet",val:": UNet2DConditionModel"},{name:"mel",val:": Mel"},{name:"scheduler",val:": typing.Union[diffusers.schedulers.scheduling_ddim.DDIMScheduler, diffusers.schedulers.scheduling_ddpm.DDPMScheduler]"}],parametersDescription:[{anchor:"diffusers.AudioDiffusionPipeline.vqae",description:`<strong>vqae</strong> (<a href="/docs/diffusers/main/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:"vqae"},{anchor:"diffusers.AudioDiffusionPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/main/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
A <code>UNet2DConditionModel</code> to denoise the encoded image latents.`,name:"unet"},{anchor:"diffusers.AudioDiffusionPipeline.mel",description:`<strong>mel</strong> (<a href="/docs/diffusers/main/en/api/pipelines/audio_diffusion#diffusers.Mel">Mel</a>) &#x2014;
Transform audio into a spectrogram.`,name:"mel"},{anchor:"diffusers.AudioDiffusionPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a> or <a href="/docs/diffusers/main/en/api/schedulers/ddpm#diffusers.DDPMScheduler">DDPMScheduler</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/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a> or <a href="/docs/diffusers/main/en/api/schedulers/ddpm#diffusers.DDPMScheduler">DDPMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/pipeline_audio_diffusion.py#L30"}}),O=new k({props:{name:"__call__",anchor:"diffusers.AudioDiffusionPipeline.__call__",parameters:[{name:"batch_size",val:": int = 1"},{name:"audio_file",val:": str = None"},{name:"raw_audio",val:": ndarray = None"},{name:"slice",val:": int = 0"},{name:"start_step",val:": int = 0"},{name:"steps",val:": int = None"},{name:"generator",val:": Generator = None"},{name:"mask_start_secs",val:": float = 0"},{name:"mask_end_secs",val:": float = 0"},{name:"step_generator",val:": Generator = None"},{name:"eta",val:": float = 0"},{name:"noise",val:": Tensor = None"},{name:"encoding",val:": Tensor = None"},{name:"return_dict",val:" = True"}],parametersDescription:[{anchor:"diffusers.AudioDiffusionPipeline.__call__.batch_size",description:`<strong>batch_size</strong> (<code>int</code>) &#x2014;
Number of samples to generate.`,name:"batch_size"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.audio_file",description:`<strong>audio_file</strong> (<code>str</code>) &#x2014;
An audio file that must be on disk due to <a href="https://librosa.org/" rel="nofollow">Librosa</a> limitation.`,name:"audio_file"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.raw_audio",description:`<strong>raw_audio</strong> (<code>np.ndarray</code>) &#x2014;
The raw audio file as a NumPy array.`,name:"raw_audio"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.slice",description:`<strong>slice</strong> (<code>int</code>) &#x2014;
Slice number of audio to convert.`,name:"slice"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.start_step",description:`<strong>start_step</strong> (int) &#x2014;
Step to start diffusion from.`,name:"start_step"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.steps",description:`<strong>steps</strong> (<code>int</code>) &#x2014;
Number of denoising steps (defaults to <code>50</code> for DDIM and <code>1000</code> for DDPM).`,name:"steps"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>) &#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.AudioDiffusionPipeline.__call__.mask_start_secs",description:`<strong>mask_start_secs</strong> (<code>float</code>) &#x2014;
Number of seconds of audio to mask (not generate) at start.`,name:"mask_start_secs"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.mask_end_secs",description:`<strong>mask_end_secs</strong> (<code>float</code>) &#x2014;
Number of seconds of audio to mask (not generate) at end.`,name:"mask_end_secs"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.step_generator",description:`<strong>step_generator</strong> (<code>torch.Generator</code>) &#x2014;
A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> used to denoise.
None`,name:"step_generator"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>) &#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/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, and is ignored in other schedulers.`,name:"eta"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.noise",description:`<strong>noise</strong> (<code>torch.Tensor</code>) &#x2014;
A noise tensor of shape <code>(batch_size, 1, height, width)</code> or <code>None</code>.`,name:"noise"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.encoding",description:`<strong>encoding</strong> (<code>torch.Tensor</code>) &#x2014;
A tensor for <a href="/docs/diffusers/main/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a> of shape <code>(batch_size, seq_length, cross_attention_dim)</code>.`,name:"encoding"},{anchor:"diffusers.AudioDiffusionPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/main/en/api/pipelines/audio_diffusion#diffusers.AudioPipelineOutput">AudioPipelineOutput</a>, <a href="/docs/diffusers/main/en/api/pipelines/audio_diffusion#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> or a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/pipeline_audio_diffusion.py#L70",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A list of Mel spectrograms (<code>float</code>, <code>List[np.ndarray]</code>) with the sample rate and raw audio.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[PIL Image]</code></p>
`}}),G=new Lt({props:{anchor:"diffusers.AudioDiffusionPipeline.__call__.example",$$slots:{default:[dn]},$$scope:{ctx:j}}}),N=new Lt({props:{anchor:"diffusers.AudioDiffusionPipeline.__call__.example-2",$$slots:{default:[ln]},$$scope:{ctx:j}}}),W=new Lt({props:{anchor:"diffusers.AudioDiffusionPipeline.__call__.example-3",$$slots:{default:[pn]},$$scope:{ctx:j}}}),K=new k({props:{name:"encode",anchor:"diffusers.AudioDiffusionPipeline.encode",parameters:[{name:"images",val:": typing.List[PIL.Image.Image]"},{name:"steps",val:": int = 50"}],parametersDescription:[{anchor:"diffusers.AudioDiffusionPipeline.encode.images",description:`<strong>images</strong> (<code>List[PIL Image]</code>) &#x2014;
List of images to encode.`,name:"images"},{anchor:"diffusers.AudioDiffusionPipeline.encode.steps",description:`<strong>steps</strong> (<code>int</code>) &#x2014;
Number of encoding steps to perform (defaults to <code>50</code>).`,name:"steps"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/pipeline_audio_diffusion.py#L270",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A noise tensor of shape <code>(batch_size, 1, height, width)</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>np.ndarray</code></p>
`}}),ee=new k({props:{name:"get_default_steps",anchor:"diffusers.AudioDiffusionPipeline.get_default_steps",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/pipeline_audio_diffusion.py#L61",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The number of steps.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>int</code></p>
`}}),te=new k({props:{name:"slerp",anchor:"diffusers.AudioDiffusionPipeline.slerp",parameters:[{name:"x0",val:": Tensor"},{name:"x1",val:": Tensor"},{name:"alpha",val:": float"}],parametersDescription:[{anchor:"diffusers.AudioDiffusionPipeline.slerp.x0",description:`<strong>x0</strong> (<code>torch.Tensor</code>) &#x2014;
The first tensor to interpolate between.`,name:"x0"},{anchor:"diffusers.AudioDiffusionPipeline.slerp.x1",description:`<strong>x1</strong> (<code>torch.Tensor</code>) &#x2014;
Second tensor to interpolate between.`,name:"x1"},{anchor:"diffusers.AudioDiffusionPipeline.slerp.alpha",description:`<strong>alpha</strong> (<code>float</code>) &#x2014;
Interpolation between 0 and 1`,name:"alpha"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/pipeline_audio_diffusion.py#L311",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The interpolated tensor.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.Tensor</code></p>
`}}),ne=new Le({props:{title:"AudioPipelineOutput",local:"diffusers.AudioPipelineOutput",headingTag:"h2"}}),se=new k({props:{name:"class diffusers.AudioPipelineOutput",anchor:"diffusers.AudioPipelineOutput",parameters:[{name:"audios",val:": ndarray"}],parametersDescription:[{anchor:"diffusers.AudioPipelineOutput.audios",description:`<strong>audios</strong> (<code>np.ndarray</code>) &#x2014;
List of denoised audio samples of a NumPy array of shape <code>(batch_size, num_channels, sample_rate)</code>.`,name:"audios"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L126"}}),ie=new Le({props:{title:"ImagePipelineOutput",local:"diffusers.ImagePipelineOutput",headingTag:"h2"}}),oe=new k({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/main/src/diffusers/pipelines/pipeline_utils.py#L112"}}),re=new Le({props:{title:"Mel",local:"diffusers.Mel",headingTag:"h2"}}),ae=new k({props:{name:"class diffusers.Mel",anchor:"diffusers.Mel",parameters:[{name:"x_res",val:": int = 256"},{name:"y_res",val:": int = 256"},{name:"sample_rate",val:": int = 22050"},{name:"n_fft",val:": int = 2048"},{name:"hop_length",val:": int = 512"},{name:"top_db",val:": int = 80"},{name:"n_iter",val:": int = 32"}],parametersDescription:[{anchor:"diffusers.Mel.x_res",description:`<strong>x_res</strong> (<code>int</code>) &#x2014;
x resolution of spectrogram (time).`,name:"x_res"},{anchor:"diffusers.Mel.y_res",description:`<strong>y_res</strong> (<code>int</code>) &#x2014;
y resolution of spectrogram (frequency bins).`,name:"y_res"},{anchor:"diffusers.Mel.sample_rate",description:`<strong>sample_rate</strong> (<code>int</code>) &#x2014;
Sample rate of audio.`,name:"sample_rate"},{anchor:"diffusers.Mel.n_fft",description:`<strong>n_fft</strong> (<code>int</code>) &#x2014;
Number of Fast Fourier Transforms.`,name:"n_fft"},{anchor:"diffusers.Mel.hop_length",description:`<strong>hop_length</strong> (<code>int</code>) &#x2014;
Hop length (a higher number is recommended if <code>y_res</code> &lt; 256).`,name:"hop_length"},{anchor:"diffusers.Mel.top_db",description:`<strong>top_db</strong> (<code>int</code>) &#x2014;
Loudest decibel value.`,name:"top_db"},{anchor:"diffusers.Mel.n_iter",description:`<strong>n_iter</strong> (<code>int</code>) &#x2014;
Number of iterations for Griffin-Lim Mel inversion.`,name:"n_iter"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/mel.py#L37"}}),de=new k({props:{name:"audio_slice_to_image",anchor:"diffusers.Mel.audio_slice_to_image",parameters:[{name:"slice",val:": int"}],parametersDescription:[{anchor:"diffusers.Mel.audio_slice_to_image.slice",description:`<strong>slice</strong> (<code>int</code>) &#x2014;
Slice number of audio to convert (out of <code>get_number_of_slices()</code>).`,name:"slice"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/mel.py#L143",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A grayscale image of <code>x_res x y_res</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>PIL Image</code></p>
`}}),le=new k({props:{name:"get_audio_slice",anchor:"diffusers.Mel.get_audio_slice",parameters:[{name:"slice",val:": int = 0"}],parametersDescription:[{anchor:"diffusers.Mel.get_audio_slice.slice",description:`<strong>slice</strong> (<code>int</code>) &#x2014;
Slice number of audio (out of <code>get_number_of_slices()</code>).`,name:"slice"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/mel.py#L121",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The audio slice as a NumPy array.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>np.ndarray</code></p>
`}}),pe=new k({props:{name:"get_number_of_slices",anchor:"diffusers.Mel.get_number_of_slices",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/mel.py#L112",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>Number of spectograms audio can be sliced into.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>int</code></p>
`}}),ue=new k({props:{name:"get_sample_rate",anchor:"diffusers.Mel.get_sample_rate",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/mel.py#L134",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>Sample rate of audio.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>int</code></p>
`}}),fe=new k({props:{name:"image_to_audio",anchor:"diffusers.Mel.image_to_audio",parameters:[{name:"image",val:": Image"}],parametersDescription:[{anchor:"diffusers.Mel.image_to_audio.image",description:`<strong>image</strong> (<code>PIL Image</code>) &#x2014;
An grayscale image of <code>x_res x y_res</code>.`,name:"image"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/mel.py#L162",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The audio as a NumPy array.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>audio (<code>np.ndarray</code>)</p>
`}}),ce=new k({props:{name:"load_audio",anchor:"diffusers.Mel.load_audio",parameters:[{name:"audio_file",val:": str = None"},{name:"raw_audio",val:": ndarray = None"}],parametersDescription:[{anchor:"diffusers.Mel.load_audio.audio_file",description:`<strong>audio_file</strong> (<code>str</code>) &#x2014;
An audio file that must be on disk due to <a href="https://librosa.org/" rel="nofollow">Librosa</a> limitation.`,name:"audio_file"},{anchor:"diffusers.Mel.load_audio.raw_audio",description:`<strong>raw_audio</strong> (<code>np.ndarray</code>) &#x2014;
The raw audio file as a NumPy array.`,name:"raw_audio"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/mel.py#L94"}}),me=new k({props:{name:"set_resolution",anchor:"diffusers.Mel.set_resolution",parameters:[{name:"x_res",val:": int"},{name:"y_res",val:": int"}],parametersDescription:[{anchor:"diffusers.Mel.set_resolution.x_res",description:`<strong>x_res</strong> (<code>int</code>) &#x2014;
x resolution of spectrogram (time).`,name:"x_res"},{anchor:"diffusers.Mel.set_resolution.y_res",description:`<strong>y_res</strong> (<code>int</code>) &#x2014;
y resolution of spectrogram (frequency bins).`,name:"y_res"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/audio_diffusion/mel.py#L80"}}),{c(){r=d("meta"),T=i(),$=d("p"),p=i(),f(b.$$.fragment),n=i(),y=d("p"),y.innerHTML=Gt,Ue=i(),q=d("p"),q.innerHTML=Nt,Ge=i(),f(U.$$.fragment),Ne=i(),f(Y.$$.fragment),We=i(),w=d("div"),f(H.$$.fragment),it=i(),_e=d("p"),_e.textContent=Wt,ot=i(),$e=d("p"),$e.innerHTML=Et,rt=i(),C=d("div"),f(O.$$.fragment),at=i(),be=d("p"),be.textContent=St,dt=i(),xe=d("p"),xe.textContent=Vt,lt=i(),f(G.$$.fragment),pt=i(),f(N.$$.fragment),ut=i(),f(W.$$.fragment),ft=i(),E=d("div"),f(K.$$.fragment),ct=i(),ve=d("p"),ve.textContent=Zt,mt=i(),S=d("div"),f(ee.$$.fragment),gt=i(),ye=d("p"),ye.textContent=Xt,ht=i(),V=d("div"),f(te.$$.fragment),_t=i(),we=d("p"),we.textContent=Bt,Ee=i(),f(ne.$$.fragment),Se=i(),J=d("div"),f(se.$$.fragment),$t=i(),Me=d("p"),Me.textContent=Rt,Ve=i(),f(ie.$$.fragment),Ze=i(),L=d("div"),f(oe.$$.fragment),bt=i(),De=d("p"),De.textContent=Ft,Xe=i(),f(re.$$.fragment),Be=i(),v=d("div"),f(ae.$$.fragment),xt=i(),Z=d("div"),f(de.$$.fragment),vt=i(),Pe=d("p"),Pe.textContent=zt,yt=i(),X=d("div"),f(le.$$.fragment),wt=i(),Te=d("p"),Te.textContent=Qt,Mt=i(),B=d("div"),f(pe.$$.fragment),Dt=i(),Ce=d("p"),Ce.textContent=qt,Pt=i(),R=d("div"),f(ue.$$.fragment),Tt=i(),Ie=d("p"),Ie.textContent=Yt,Ct=i(),F=d("div"),f(fe.$$.fragment),It=i(),Ae=d("p"),Ae.textContent=Ht,At=i(),z=d("div"),f(ce.$$.fragment),kt=i(),ke=d("p"),ke.textContent=Ot,jt=i(),Q=d("div"),f(me.$$.fragment),Jt=i(),je=d("p"),je.textContent=Kt,Re=i(),Je=d("p"),this.h()},l(e){const a=on("svelte-u9bgzb",document.head);r=l(a,"META",{name:!0,content:!0}),a.forEach(s),T=o(e),$=l(e,"P",{}),D($).forEach(s),p=o(e),c(b.$$.fragment,e),n=o(e),y=l(e,"P",{"data-svelte-h":!0}),x(y)!=="svelte-ry2ql6"&&(y.innerHTML=Gt),Ue=o(e),q=l(e,"P",{"data-svelte-h":!0}),x(q)!=="svelte-y6j4b4"&&(q.innerHTML=Nt),Ge=o(e),c(U.$$.fragment,e),Ne=o(e),c(Y.$$.fragment,e),We=o(e),w=l(e,"DIV",{class:!0});var M=D(w);c(H.$$.fragment,M),it=o(M),_e=l(M,"P",{"data-svelte-h":!0}),x(_e)!=="svelte-85kq2u"&&(_e.textContent=Wt),ot=o(M),$e=l(M,"P",{"data-svelte-h":!0}),x($e)!=="svelte-496sm0"&&($e.innerHTML=Et),rt=o(M),C=l(M,"DIV",{class:!0});var A=D(C);c(O.$$.fragment,A),at=o(A),be=l(A,"P",{"data-svelte-h":!0}),x(be)!=="svelte-50j04k"&&(be.textContent=St),dt=o(A),xe=l(A,"P",{"data-svelte-h":!0}),x(xe)!=="svelte-kvfsh7"&&(xe.textContent=Vt),lt=o(A),c(G.$$.fragment,A),pt=o(A),c(N.$$.fragment,A),ut=o(A),c(W.$$.fragment,A),A.forEach(s),ft=o(M),E=l(M,"DIV",{class:!0});var ge=D(E);c(K.$$.fragment,ge),ct=o(ge),ve=l(ge,"P",{"data-svelte-h":!0}),x(ve)!=="svelte-lh0ubq"&&(ve.textContent=Zt),ge.forEach(s),mt=o(M),S=l(M,"DIV",{class:!0});var he=D(S);c(ee.$$.fragment,he),gt=o(he),ye=l(he,"P",{"data-svelte-h":!0}),x(ye)!=="svelte-1hid80u"&&(ye.textContent=Xt),he.forEach(s),ht=o(M),V=l(M,"DIV",{class:!0});var ze=D(V);c(te.$$.fragment,ze),_t=o(ze),we=l(ze,"P",{"data-svelte-h":!0}),x(we)!=="svelte-168tp9o"&&(we.textContent=Bt),ze.forEach(s),M.forEach(s),Ee=o(e),c(ne.$$.fragment,e),Se=o(e),J=l(e,"DIV",{class:!0});var Qe=D(J);c(se.$$.fragment,Qe),$t=o(Qe),Me=l(Qe,"P",{"data-svelte-h":!0}),x(Me)!=="svelte-19ryw33"&&(Me.textContent=Rt),Qe.forEach(s),Ve=o(e),c(ie.$$.fragment,e),Ze=o(e),L=l(e,"DIV",{class:!0});var qe=D(L);c(oe.$$.fragment,qe),bt=o(qe),De=l(qe,"P",{"data-svelte-h":!0}),x(De)!=="svelte-19wetgi"&&(De.textContent=Ft),qe.forEach(s),Xe=o(e),c(re.$$.fragment,e),Be=o(e),v=l(e,"DIV",{class:!0});var I=D(v);c(ae.$$.fragment,I),xt=o(I),Z=l(I,"DIV",{class:!0});var Ye=D(Z);c(de.$$.fragment,Ye),vt=o(Ye),Pe=l(Ye,"P",{"data-svelte-h":!0}),x(Pe)!=="svelte-q43x8u"&&(Pe.textContent=zt),Ye.forEach(s),yt=o(I),X=l(I,"DIV",{class:!0});var He=D(X);c(le.$$.fragment,He),wt=o(He),Te=l(He,"P",{"data-svelte-h":!0}),x(Te)!=="svelte-1nkpff9"&&(Te.textContent=Qt),He.forEach(s),Mt=o(I),B=l(I,"DIV",{class:!0});var Oe=D(B);c(pe.$$.fragment,Oe),Dt=o(Oe),Ce=l(Oe,"P",{"data-svelte-h":!0}),x(Ce)!=="svelte-1enf83g"&&(Ce.textContent=qt),Oe.forEach(s),Pt=o(I),R=l(I,"DIV",{class:!0});var Ke=D(R);c(ue.$$.fragment,Ke),Tt=o(Ke),Ie=l(Ke,"P",{"data-svelte-h":!0}),x(Ie)!=="svelte-6fjj2"&&(Ie.textContent=Yt),Ke.forEach(s),Ct=o(I),F=l(I,"DIV",{class:!0});var et=D(F);c(fe.$$.fragment,et),It=o(et),Ae=l(et,"P",{"data-svelte-h":!0}),x(Ae)!=="svelte-15e67jm"&&(Ae.textContent=Ht),et.forEach(s),At=o(I),z=l(I,"DIV",{class:!0});var tt=D(z);c(ce.$$.fragment,tt),kt=o(tt),ke=l(tt,"P",{"data-svelte-h":!0}),x(ke)!=="svelte-1j27adc"&&(ke.textContent=Ot),tt.forEach(s),jt=o(I),Q=l(I,"DIV",{class:!0});var nt=D(Q);c(me.$$.fragment,nt),Jt=o(nt),je=l(nt,"P",{"data-svelte-h":!0}),x(je)!=="svelte-v0dk8k"&&(je.textContent=Kt),nt.forEach(s),I.forEach(s),Re=o(e),Je=l(e,"P",{}),D(Je).forEach(s),this.h()},h(){P(r,"name","hf:doc:metadata"),P(r,"content",fn),P(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(J,"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(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(z,"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","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(v,"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){t(document.head,r),u(e,T,a),u(e,$,a),u(e,p,a),m(b,e,a),u(e,n,a),u(e,y,a),u(e,Ue,a),u(e,q,a),u(e,Ge,a),m(U,e,a),u(e,Ne,a),m(Y,e,a),u(e,We,a),u(e,w,a),m(H,w,null),t(w,it),t(w,_e),t(w,ot),t(w,$e),t(w,rt),t(w,C),m(O,C,null),t(C,at),t(C,be),t(C,dt),t(C,xe),t(C,lt),m(G,C,null),t(C,pt),m(N,C,null),t(C,ut),m(W,C,null),t(w,ft),t(w,E),m(K,E,null),t(E,ct),t(E,ve),t(w,mt),t(w,S),m(ee,S,null),t(S,gt),t(S,ye),t(w,ht),t(w,V),m(te,V,null),t(V,_t),t(V,we),u(e,Ee,a),m(ne,e,a),u(e,Se,a),u(e,J,a),m(se,J,null),t(J,$t),t(J,Me),u(e,Ve,a),m(ie,e,a),u(e,Ze,a),u(e,L,a),m(oe,L,null),t(L,bt),t(L,De),u(e,Xe,a),m(re,e,a),u(e,Be,a),u(e,v,a),m(ae,v,null),t(v,xt),t(v,Z),m(de,Z,null),t(Z,vt),t(Z,Pe),t(v,yt),t(v,X),m(le,X,null),t(X,wt),t(X,Te),t(v,Mt),t(v,B),m(pe,B,null),t(B,Dt),t(B,Ce),t(v,Pt),t(v,R),m(ue,R,null),t(R,Tt),t(R,Ie),t(v,Ct),t(v,F),m(fe,F,null),t(F,It),t(F,Ae),t(v,At),t(v,z),m(ce,z,null),t(z,kt),t(z,ke),t(v,jt),t(v,Q),m(me,Q,null),t(Q,Jt),t(Q,je),u(e,Re,a),u(e,Je,a),Fe=!0},p(e,[a]){const M={};a&2&&(M.$$scope={dirty:a,ctx:e}),U.$set(M);const A={};a&2&&(A.$$scope={dirty:a,ctx:e}),G.$set(A);const ge={};a&2&&(ge.$$scope={dirty:a,ctx:e}),N.$set(ge);const he={};a&2&&(he.$$scope={dirty:a,ctx:e}),W.$set(he)},i(e){Fe||(g(b.$$.fragment,e),g(U.$$.fragment,e),g(Y.$$.fragment,e),g(H.$$.fragment,e),g(O.$$.fragment,e),g(G.$$.fragment,e),g(N.$$.fragment,e),g(W.$$.fragment,e),g(K.$$.fragment,e),g(ee.$$.fragment,e),g(te.$$.fragment,e),g(ne.$$.fragment,e),g(se.$$.fragment,e),g(ie.$$.fragment,e),g(oe.$$.fragment,e),g(re.$$.fragment,e),g(ae.$$.fragment,e),g(de.$$.fragment,e),g(le.$$.fragment,e),g(pe.$$.fragment,e),g(ue.$$.fragment,e),g(fe.$$.fragment,e),g(ce.$$.fragment,e),g(me.$$.fragment,e),Fe=!0)},o(e){h(b.$$.fragment,e),h(U.$$.fragment,e),h(Y.$$.fragment,e),h(H.$$.fragment,e),h(O.$$.fragment,e),h(G.$$.fragment,e),h(N.$$.fragment,e),h(W.$$.fragment,e),h(K.$$.fragment,e),h(ee.$$.fragment,e),h(te.$$.fragment,e),h(ne.$$.fragment,e),h(se.$$.fragment,e),h(ie.$$.fragment,e),h(oe.$$.fragment,e),h(re.$$.fragment,e),h(ae.$$.fragment,e),h(de.$$.fragment,e),h(le.$$.fragment,e),h(pe.$$.fragment,e),h(ue.$$.fragment,e),h(fe.$$.fragment,e),h(ce.$$.fragment,e),h(me.$$.fragment,e),Fe=!1},d(e){e&&(s(T),s($),s(p),s(n),s(y),s(Ue),s(q),s(Ge),s(Ne),s(We),s(w),s(Ee),s(Se),s(J),s(Ve),s(Ze),s(L),s(Xe),s(Be),s(v),s(Re),s(Je)),s(r),_(b,e),_(U,e),_(Y,e),_(H),_(O),_(G),_(N),_(W),_(K),_(ee),_(te),_(ne,e),_(se),_(ie,e),_(oe),_(re,e),_(ae),_(de),_(le),_(pe),_(ue),_(fe),_(ce),_(me)}}}const fn='{"title":"Audio Diffusion","local":"audio-diffusion","sections":[{"title":"AudioDiffusionPipeline","local":"diffusers.AudioDiffusionPipeline","sections":[],"depth":2},{"title":"AudioPipelineOutput","local":"diffusers.AudioPipelineOutput","sections":[],"depth":2},{"title":"ImagePipelineOutput","local":"diffusers.ImagePipelineOutput","sections":[],"depth":2},{"title":"Mel","local":"diffusers.Mel","sections":[],"depth":2}],"depth":1}';function cn(j){return tn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class vn extends nn{constructor(r){super(),sn(this,r,cn,un,en,{})}}export{vn as component};
