import{s as be,o as we,n as $e}from"../chunks/scheduler.8c3d61f6.js";import{S as ye,i as ve,g as p,s as a,r as $,A as Te,h as d,f as n,c as o,j as H,x as P,u as b,k as X,y as m,a as s,v as w,d as y,t as v,w as T}from"../chunks/index.da70eac4.js";import{T as De}from"../chunks/Tip.6f698f24.js";import{D as de}from"../chunks/Docstring.367be9ed.js";import{C as Me}from"../chunks/CodeBlock.a9c4becf.js";import{E as Pe}from"../chunks/ExampleCodeBlock.dd9ee828.js";import{H as ue,E as xe}from"../chunks/getInferenceSnippets.cb466318.js";function ke(z){let i,_='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-a-pipeline">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=_},l(l){i=d(l,"P",{"data-svelte-h":!0}),P(i)!=="svelte-1qn15hi"&&(i.innerHTML=_)},m(l,u){s(l,i,u)},p:$e,d(l){l&&n(i)}}}function Ge(z){let i,_="Example:",l,u,f;return u=new Me({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBZnJvbSUyMHNjaXB5LmlvLndhdmZpbGUlMjBpbXBvcnQlMjB3cml0ZSUwQSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIyaGFybW9uYWklMkZtYWVzdHJvLTE1MGslMjIlMEFwaXBlJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkKSUwQXBpcGUlMjAlM0QlMjBwaXBlLnRvKCUyMmN1ZGElMjIpJTBBJTBBYXVkaW9zJTIwJTNEJTIwcGlwZShhdWRpb19sZW5ndGhfaW5fcyUzRDQuMCkuYXVkaW9zJTBBJTBBJTIzJTIwVG8lMjBzYXZlJTIwbG9jYWxseSUwQWZvciUyMGklMkMlMjBhdWRpbyUyMGluJTIwZW51bWVyYXRlKGF1ZGlvcyklM0ElMEElMjAlMjAlMjAlMjB3cml0ZShmJTIybWFlc3Ryb190ZXN0XyU3QmklN0Qud2F2JTIyJTJDJTIwcGlwZS51bmV0LnNhbXBsZV9yYXRlJTJDJTIwYXVkaW8udHJhbnNwb3NlKCkpJTBBJTBBJTIzJTIwVG8lMjBkaXNwbGF5JTIwaW4lMjBnb29nbGUlMjBjb2xhYiUwQWltcG9ydCUyMElQeXRob24uZGlzcGxheSUyMGFzJTIwaXBkJTBBJTBBZm9yJTIwYXVkaW8lMjBpbiUyMGF1ZGlvcyUzQSUwQSUyMCUyMCUyMCUyMGRpc3BsYXkoaXBkLkF1ZGlvKGF1ZGlvJTJDJTIwcmF0ZSUzRHBpcGUudW5ldC5zYW1wbGVfcmF0ZSkp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">from</span> scipy.io.wavfile <span class="hljs-keyword">import</span> write

model_id = <span class="hljs-string">&quot;harmonai/maestro-150k&quot;</span>
pipe = DiffusionPipeline.from_pretrained(model_id)
pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

audios = pipe(audio_length_in_s=<span class="hljs-number">4.0</span>).audios

<span class="hljs-comment"># To save locally</span>
<span class="hljs-keyword">for</span> i, audio <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(audios):
    write(<span class="hljs-string">f&quot;maestro_test_<span class="hljs-subst">{i}</span>.wav&quot;</span>, pipe.unet.sample_rate, audio.transpose())

<span class="hljs-comment"># To display in google colab</span>
<span class="hljs-keyword">import</span> IPython.display <span class="hljs-keyword">as</span> ipd

<span class="hljs-keyword">for</span> audio <span class="hljs-keyword">in</span> audios:
    display(ipd.Audio(audio, rate=pipe.unet.sample_rate))`,wrap:!1}}),{c(){i=p("p"),i.textContent=_,l=a(),$(u.$$.fragment)},l(r){i=d(r,"P",{"data-svelte-h":!0}),P(i)!=="svelte-11lpom8"&&(i.textContent=_),l=o(r),b(u.$$.fragment,r)},m(r,x){s(r,i,x),s(r,l,x),w(u,r,x),f=!0},p:$e,i(r){f||(y(u.$$.fragment,r),f=!0)},o(r){v(u.$$.fragment,r),f=!1},d(r){r&&(n(i),n(l)),T(u,r)}}}function Je(z){let i,_,l,u,f,r="<p>This pipeline is deprecated but it can still be used. However, we won’t test the pipeline anymore and won’t accept any changes to it. If you run into any issues, reinstall the last Diffusers version that supported this model.</p>",x,J,O,B,fe='<a href="https://github.com/Harmonai-org/sample-generator" rel="nofollow">Dance Diffusion</a> is by Zach Evans.',Q,j,ce='Dance Diffusion is the first in a suite of generative audio tools for producers and musicians released by <a href="https://github.com/Harmonai-org" rel="nofollow">Harmonai</a>.',R,k,F,U,Y,c,C,se,A,me="Pipeline for audio generation.",ae,L,he=`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.).`,oe,g,Z,re,S,_e="The call function to the pipeline for generation.",le,G,q,I,K,D,E,pe,V,ge="Output class for audio pipelines.",ee,W,te,N,ne;return J=new ue({props:{title:"Dance Diffusion",local:"dance-diffusion",headingTag:"h1"}}),k=new De({props:{$$slots:{default:[ke]},$$scope:{ctx:z}}}),U=new ue({props:{title:"DanceDiffusionPipeline",local:"diffusers.DanceDiffusionPipeline",headingTag:"h2"}}),C=new de({props:{name:"class diffusers.DanceDiffusionPipeline",anchor:"diffusers.DanceDiffusionPipeline",parameters:[{name:"unet",val:": UNet1DModel"},{name:"scheduler",val:": SchedulerMixin"}],parametersDescription:[{anchor:"diffusers.DanceDiffusionPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/main/en/api/models/unet#diffusers.UNet1DModel">UNet1DModel</a>) &#x2014;
A <code>UNet1DModel</code> to denoise the encoded audio.`,name:"unet"},{anchor:"diffusers.DanceDiffusionPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to denoise the encoded audio latents. Can be one of
<a href="/docs/diffusers/main/en/api/schedulers/ipndm#diffusers.IPNDMScheduler">IPNDMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/dance_diffusion/pipeline_dance_diffusion.py#L37"}}),Z=new de({props:{name:"__call__",anchor:"diffusers.DanceDiffusionPipeline.__call__",parameters:[{name:"batch_size",val:": int = 1"},{name:"num_inference_steps",val:": int = 100"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"audio_length_in_s",val:": typing.Optional[float] = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.DanceDiffusionPipeline.__call__.batch_size",description:`<strong>batch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of audio samples to generate.`,name:"batch_size"},{anchor:"diffusers.DanceDiffusionPipeline.__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 audio sample at
the expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.DanceDiffusionPipeline.__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.DanceDiffusionPipeline.__call__.audio_length_in_s",description:`<strong>audio_length_in_s</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.unet.config.sample_size/self.unet.config.sample_rate</code>) &#x2014;
The length of the generated audio sample in seconds.`,name:"audio_length_in_s"},{anchor:"diffusers.DanceDiffusionPipeline.__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/main/en/api/pipelines/dance_diffusion#diffusers.AudioPipelineOutput">AudioPipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/dance_diffusion/pipeline_dance_diffusion.py#L59",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


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


<p><a
  href="/docs/diffusers/main/en/api/pipelines/dance_diffusion#diffusers.AudioPipelineOutput"
>AudioPipelineOutput</a> or <code>tuple</code></p>
`}}),G=new Pe({props:{anchor:"diffusers.DanceDiffusionPipeline.__call__.example",$$slots:{default:[Ge]},$$scope:{ctx:z}}}),I=new ue({props:{title:"AudioPipelineOutput",local:"diffusers.AudioPipelineOutput",headingTag:"h2"}}),E=new de({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#L132"}}),W=new xe({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/dance_diffusion.md"}}),{c(){i=p("meta"),_=a(),l=p("p"),u=a(),f=p("blockquote"),f.innerHTML=r,x=a(),$(J.$$.fragment),O=a(),B=p("p"),B.innerHTML=fe,Q=a(),j=p("p"),j.innerHTML=ce,R=a(),$(k.$$.fragment),F=a(),$(U.$$.fragment),Y=a(),c=p("div"),$(C.$$.fragment),se=a(),A=p("p"),A.textContent=me,ae=a(),L=p("p"),L.innerHTML=he,oe=a(),g=p("div"),$(Z.$$.fragment),re=a(),S=p("p"),S.textContent=_e,le=a(),$(G.$$.fragment),q=a(),$(I.$$.fragment),K=a(),D=p("div"),$(E.$$.fragment),pe=a(),V=p("p"),V.textContent=ge,ee=a(),$(W.$$.fragment),te=a(),N=p("p"),this.h()},l(e){const t=Te("svelte-u9bgzb",document.head);i=d(t,"META",{name:!0,content:!0}),t.forEach(n),_=o(e),l=d(e,"P",{}),H(l).forEach(n),u=o(e),f=d(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),P(f)!=="svelte-124tjg"&&(f.innerHTML=r),x=o(e),b(J.$$.fragment,e),O=o(e),B=d(e,"P",{"data-svelte-h":!0}),P(B)!=="svelte-z4ffbo"&&(B.innerHTML=fe),Q=o(e),j=d(e,"P",{"data-svelte-h":!0}),P(j)!=="svelte-dzyais"&&(j.innerHTML=ce),R=o(e),b(k.$$.fragment,e),F=o(e),b(U.$$.fragment,e),Y=o(e),c=d(e,"DIV",{class:!0});var h=H(c);b(C.$$.fragment,h),se=o(h),A=d(h,"P",{"data-svelte-h":!0}),P(A)!=="svelte-1jvczvp"&&(A.textContent=me),ae=o(h),L=d(h,"P",{"data-svelte-h":!0}),P(L)!=="svelte-496sm0"&&(L.innerHTML=he),oe=o(h),g=d(h,"DIV",{class:!0});var M=H(g);b(Z.$$.fragment,M),re=o(M),S=d(M,"P",{"data-svelte-h":!0}),P(S)!=="svelte-50j04k"&&(S.textContent=_e),le=o(M),b(G.$$.fragment,M),M.forEach(n),h.forEach(n),q=o(e),b(I.$$.fragment,e),K=o(e),D=d(e,"DIV",{class:!0});var ie=H(D);b(E.$$.fragment,ie),pe=o(ie),V=d(ie,"P",{"data-svelte-h":!0}),P(V)!=="svelte-19ryw33"&&(V.textContent=ge),ie.forEach(n),ee=o(e),b(W.$$.fragment,e),te=o(e),N=d(e,"P",{}),H(N).forEach(n),this.h()},h(){X(i,"name","hf:doc:metadata"),X(i,"content",Be),X(f,"class","warning"),X(g,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),X(c,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),X(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,t){m(document.head,i),s(e,_,t),s(e,l,t),s(e,u,t),s(e,f,t),s(e,x,t),w(J,e,t),s(e,O,t),s(e,B,t),s(e,Q,t),s(e,j,t),s(e,R,t),w(k,e,t),s(e,F,t),w(U,e,t),s(e,Y,t),s(e,c,t),w(C,c,null),m(c,se),m(c,A),m(c,ae),m(c,L),m(c,oe),m(c,g),w(Z,g,null),m(g,re),m(g,S),m(g,le),w(G,g,null),s(e,q,t),w(I,e,t),s(e,K,t),s(e,D,t),w(E,D,null),m(D,pe),m(D,V),s(e,ee,t),w(W,e,t),s(e,te,t),s(e,N,t),ne=!0},p(e,[t]){const h={};t&2&&(h.$$scope={dirty:t,ctx:e}),k.$set(h);const M={};t&2&&(M.$$scope={dirty:t,ctx:e}),G.$set(M)},i(e){ne||(y(J.$$.fragment,e),y(k.$$.fragment,e),y(U.$$.fragment,e),y(C.$$.fragment,e),y(Z.$$.fragment,e),y(G.$$.fragment,e),y(I.$$.fragment,e),y(E.$$.fragment,e),y(W.$$.fragment,e),ne=!0)},o(e){v(J.$$.fragment,e),v(k.$$.fragment,e),v(U.$$.fragment,e),v(C.$$.fragment,e),v(Z.$$.fragment,e),v(G.$$.fragment,e),v(I.$$.fragment,e),v(E.$$.fragment,e),v(W.$$.fragment,e),ne=!1},d(e){e&&(n(_),n(l),n(u),n(f),n(x),n(O),n(B),n(Q),n(j),n(R),n(F),n(Y),n(c),n(q),n(K),n(D),n(ee),n(te),n(N)),n(i),T(J,e),T(k,e),T(U,e),T(C),T(Z),T(G),T(I,e),T(E),T(W,e)}}}const Be='{"title":"Dance Diffusion","local":"dance-diffusion","sections":[{"title":"DanceDiffusionPipeline","local":"diffusers.DanceDiffusionPipeline","sections":[],"depth":2},{"title":"AudioPipelineOutput","local":"diffusers.AudioPipelineOutput","sections":[],"depth":2}],"depth":1}';function je(z){return we(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ae extends ye{constructor(i){super(),ve(this,i,je,Je,be,{})}}export{Ae as component};
