import{S as us,i as ds,s as cs,e as i,k as m,w as B,t as f,M as hs,c as t,d as n,m as _,a as o,x as G,h as u,b as p,G as s,g as h,y as A,q as j,o as I,B as x,v as ms,L as _s}from"../../../chunks/vendor-hf-doc-builder.js";import{T as gs}from"../../../chunks/Tip-hf-doc-builder.js";import{D as Re}from"../../../chunks/Docstring-hf-doc-builder.js";import{C as vs}from"../../../chunks/CodeBlock-hf-doc-builder.js";import{I as He}from"../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ws}from"../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function bs(F){let r,$,d,c,g,a,v,T;return{c(){r=i("p"),$=f("Make sure to check out the Schedulers "),d=i("a"),c=f("guide"),g=f(" to learn how to explore the tradeoff between scheduler speed and quality, and see the "),a=i("a"),v=f("reuse components across pipelines"),T=f(" section to learn how to efficiently load the same components into multiple pipelines."),this.h()},l(k){r=t(k,"P",{});var w=o(r);$=u(w,"Make sure to check out the Schedulers "),d=t(w,"A",{href:!0});var y=o(d);c=u(y,"guide"),y.forEach(n),g=u(w," to learn how to explore the tradeoff between scheduler speed and quality, and see the "),a=t(w,"A",{href:!0});var D=o(a);v=u(D,"reuse components across pipelines"),D.forEach(n),T=u(w," section to learn how to efficiently load the same components into multiple pipelines."),w.forEach(n),this.h()},h(){p(d,"href","/using-diffusers/schedulers"),p(a,"href","/using-diffusers/loading#reuse-components-across-pipelines")},m(k,w){h(k,r,w),s(r,$),s(r,d),s(d,c),s(r,g),s(r,a),s(a,v),s(r,T)},d(k){k&&n(r)}}}function $s(F){let r,$,d,c,g;return c=new vs({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBZnJvbSUyMHNjaXB5LmlvLndhdmZpbGUlMjBpbXBvcnQlMjB3cml0ZSUwQSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIyaGFybW9uYWklMkZtYWVzdHJvLTE1MGslMjIlMEFwaXBlJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkKSUwQXBpcGUlMjAlM0QlMjBwaXBlLnRvKCUyMmN1ZGElMjIpJTBBJTBBYXVkaW9zJTIwJTNEJTIwcGlwZShhdWRpb19sZW5ndGhfaW5fcyUzRDQuMCkuYXVkaW9zJTBBJTBBJTIzJTIwVG8lMjBzYXZlJTIwbG9jYWxseSUwQWZvciUyMGklMkMlMjBhdWRpbyUyMGluJTIwZW51bWVyYXRlKGF1ZGlvcyklM0ElMEElMjAlMjAlMjAlMjB3cml0ZShmJTIybWFlc3Ryb190ZXN0XyU3QmklN0Qud2F2JTIyJTJDJTIwcGlwZS51bmV0LnNhbXBsZV9yYXRlJTJDJTIwYXVkaW8udHJhbnNwb3NlKCkpJTBBJTBBJTIzJTIwVG8lMjBkaXNsYXklMjBpbiUyMGdvb2dsZSUyMGNvbGFiJTBBaW1wb3J0JTIwSVB5dGhvbi5kaXNwbGF5JTIwYXMlMjBpcGQlMEElMEFmb3IlMjBhdWRpbyUyMGluJTIwYXVkaW9zJTNBJTBBJTIwJTIwJTIwJTIwZGlzcGxheShpcGQuQXVkaW8oYXVkaW8lMkMlMjByYXRlJTNEcGlwZS51bmV0LnNhbXBsZV9yYXRlKSk=",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 dislay 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))`}}),{c(){r=i("p"),$=f("Example:"),d=m(),B(c.$$.fragment)},l(a){r=t(a,"P",{});var v=o(r);$=u(v,"Example:"),v.forEach(n),d=_(a),G(c.$$.fragment,a)},m(a,v){h(a,r,v),s(r,$),h(a,d,v),A(c,a,v),g=!0},p:_s,i(a){g||(j(c.$$.fragment,a),g=!0)},o(a){I(c.$$.fragment,a),g=!1},d(a){a&&n(r),a&&n(d),x(c,a)}}}function ys(F){let r,$,d,c,g,a,v,T,k,w,y,D,De,Pe,pe,N,Te,O,ke,Me,fe,Z,Ee,z,Je,Be,ue,S,de,M,V,se,Y,Ge,ne,Ae,ce,b,C,je,ie,Ie,xe,L,Ne,K,Ze,Se,Ve,P,R,Xe,te,Ue,We,X,he,E,U,ae,H,Oe,oe,ze,me,J,q,Ye,re,Ce,_e;return a=new He({}),S=new gs({props:{$$slots:{default:[bs]},$$scope:{ctx:F}}}),Y=new He({}),C=new Re({props:{name:"class diffusers.DanceDiffusionPipeline",anchor:"diffusers.DanceDiffusionPipeline",parameters:[{name:"unet",val:""},{name:"scheduler",val:""}],parametersDescription:[{anchor:"diffusers.DanceDiffusionPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/v0.19.2/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/v0.19.2/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/v0.19.2/en/api/schedulers/ipndm#diffusers.IPNDMScheduler">IPNDMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.19.2/src/diffusers/pipelines/dance_diffusion/pipeline_dance_diffusion.py#L27"}}),R=new Re({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/v0.19.2/en/api/pipelines/dance_diffusion#diffusers.AudioPipelineOutput">AudioPipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.19.2/src/diffusers/pipelines/dance_diffusion/pipeline_dance_diffusion.py#L46",returnDescription:`
<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/v0.19.2/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:`
<p><a
  href="/docs/diffusers/v0.19.2/en/api/pipelines/dance_diffusion#diffusers.AudioPipelineOutput"
>AudioPipelineOutput</a> or <code>tuple</code></p>
`}}),X=new ws({props:{anchor:"diffusers.DanceDiffusionPipeline.__call__.example",$$slots:{default:[$s]},$$scope:{ctx:F}}}),H=new He({}),q=new Re({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/v0.19.2/src/diffusers/pipelines/pipeline_utils.py#L127"}}),{c(){r=i("meta"),$=m(),d=i("h1"),c=i("a"),g=i("span"),B(a.$$.fragment),v=m(),T=i("span"),k=f("Dance Diffusion"),w=m(),y=i("p"),D=i("a"),De=f("Dance Diffusion"),Pe=f(" is by Zach Evans."),pe=m(),N=i("p"),Te=f("Dance Diffusion is the first in a suite of generative audio tools for producers and musicians released by "),O=i("a"),ke=f("Harmonai"),Me=f("."),fe=m(),Z=i("p"),Ee=f("The original codebase of this implementation can be found at "),z=i("a"),Je=f("Harmonai-org"),Be=f("."),ue=m(),B(S.$$.fragment),de=m(),M=i("h2"),V=i("a"),se=i("span"),B(Y.$$.fragment),Ge=m(),ne=i("span"),Ae=f("DanceDiffusionPipeline"),ce=m(),b=i("div"),B(C.$$.fragment),je=m(),ie=i("p"),Ie=f("Pipeline for audio generation."),xe=m(),L=i("p"),Ne=f("This model inherits from "),K=i("a"),Ze=f("DiffusionPipeline"),Se=f(`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),Ve=m(),P=i("div"),B(R.$$.fragment),Xe=m(),te=i("p"),Ue=f("The call function to the pipeline for generation."),We=m(),B(X.$$.fragment),he=m(),E=i("h2"),U=i("a"),ae=i("span"),B(H.$$.fragment),Oe=m(),oe=i("span"),ze=f("AudioPipelineOutput"),me=m(),J=i("div"),B(q.$$.fragment),Ye=m(),re=i("p"),Ce=f("Output class for audio pipelines."),this.h()},l(e){const l=hs('[data-svelte="svelte-1phssyn"]',document.head);r=t(l,"META",{name:!0,content:!0}),l.forEach(n),$=_(e),d=t(e,"H1",{class:!0});var Q=o(d);c=t(Q,"A",{id:!0,class:!0,href:!0});var le=o(c);g=t(le,"SPAN",{});var qe=o(g);G(a.$$.fragment,qe),qe.forEach(n),le.forEach(n),v=_(Q),T=t(Q,"SPAN",{});var Qe=o(T);k=u(Qe,"Dance Diffusion"),Qe.forEach(n),Q.forEach(n),w=_(e),y=t(e,"P",{});var Le=o(y);D=t(Le,"A",{href:!0,rel:!0});var Fe=o(D);De=u(Fe,"Dance Diffusion"),Fe.forEach(n),Pe=u(Le," is by Zach Evans."),Le.forEach(n),pe=_(e),N=t(e,"P",{});var ge=o(N);Te=u(ge,"Dance Diffusion is the first in a suite of generative audio tools for producers and musicians released by "),O=t(ge,"A",{href:!0,rel:!0});var Ke=o(O);ke=u(Ke,"Harmonai"),Ke.forEach(n),Me=u(ge,"."),ge.forEach(n),fe=_(e),Z=t(e,"P",{});var ve=o(Z);Ee=u(ve,"The original codebase of this implementation can be found at "),z=t(ve,"A",{href:!0,rel:!0});var es=o(z);Je=u(es,"Harmonai-org"),es.forEach(n),Be=u(ve,"."),ve.forEach(n),ue=_(e),G(S.$$.fragment,e),de=_(e),M=t(e,"H2",{class:!0});var we=o(M);V=t(we,"A",{id:!0,class:!0,href:!0});var ss=o(V);se=t(ss,"SPAN",{});var ns=o(se);G(Y.$$.fragment,ns),ns.forEach(n),ss.forEach(n),Ge=_(we),ne=t(we,"SPAN",{});var is=o(ne);Ae=u(is,"DanceDiffusionPipeline"),is.forEach(n),we.forEach(n),ce=_(e),b=t(e,"DIV",{class:!0});var W=o(b);G(C.$$.fragment,W),je=_(W),ie=t(W,"P",{});var ts=o(ie);Ie=u(ts,"Pipeline for audio generation."),ts.forEach(n),xe=_(W),L=t(W,"P",{});var be=o(L);Ne=u(be,"This model inherits from "),K=t(be,"A",{href:!0});var as=o(K);Ze=u(as,"DiffusionPipeline"),as.forEach(n),Se=u(be,`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),be.forEach(n),Ve=_(W),P=t(W,"DIV",{class:!0});var ee=o(P);G(R.$$.fragment,ee),Xe=_(ee),te=t(ee,"P",{});var os=o(te);Ue=u(os,"The call function to the pipeline for generation."),os.forEach(n),We=_(ee),G(X.$$.fragment,ee),ee.forEach(n),W.forEach(n),he=_(e),E=t(e,"H2",{class:!0});var $e=o(E);U=t($e,"A",{id:!0,class:!0,href:!0});var rs=o(U);ae=t(rs,"SPAN",{});var ls=o(ae);G(H.$$.fragment,ls),ls.forEach(n),rs.forEach(n),Oe=_($e),oe=t($e,"SPAN",{});var ps=o(oe);ze=u(ps,"AudioPipelineOutput"),ps.forEach(n),$e.forEach(n),me=_(e),J=t(e,"DIV",{class:!0});var ye=o(J);G(q.$$.fragment,ye),Ye=_(ye),re=t(ye,"P",{});var fs=o(re);Ce=u(fs,"Output class for audio pipelines."),fs.forEach(n),ye.forEach(n),this.h()},h(){p(r,"name","hf:doc:metadata"),p(r,"content",JSON.stringify(Ds)),p(c,"id","dance-diffusion"),p(c,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(c,"href","#dance-diffusion"),p(d,"class","relative group"),p(D,"href","https://github.com/Harmonai-org/sample-generator"),p(D,"rel","nofollow"),p(O,"href","https://github.com/Harmonai-org"),p(O,"rel","nofollow"),p(z,"href","https://github.com/Harmonai-org/sample-generator"),p(z,"rel","nofollow"),p(V,"id","diffusers.DanceDiffusionPipeline"),p(V,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(V,"href","#diffusers.DanceDiffusionPipeline"),p(M,"class","relative group"),p(K,"href","/docs/diffusers/v0.19.2/en/api/pipelines/overview#diffusers.DiffusionPipeline"),p(P,"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(U,"id","diffusers.AudioPipelineOutput"),p(U,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(U,"href","#diffusers.AudioPipelineOutput"),p(E,"class","relative group"),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")},m(e,l){s(document.head,r),h(e,$,l),h(e,d,l),s(d,c),s(c,g),A(a,g,null),s(d,v),s(d,T),s(T,k),h(e,w,l),h(e,y,l),s(y,D),s(D,De),s(y,Pe),h(e,pe,l),h(e,N,l),s(N,Te),s(N,O),s(O,ke),s(N,Me),h(e,fe,l),h(e,Z,l),s(Z,Ee),s(Z,z),s(z,Je),s(Z,Be),h(e,ue,l),A(S,e,l),h(e,de,l),h(e,M,l),s(M,V),s(V,se),A(Y,se,null),s(M,Ge),s(M,ne),s(ne,Ae),h(e,ce,l),h(e,b,l),A(C,b,null),s(b,je),s(b,ie),s(ie,Ie),s(b,xe),s(b,L),s(L,Ne),s(L,K),s(K,Ze),s(L,Se),s(b,Ve),s(b,P),A(R,P,null),s(P,Xe),s(P,te),s(te,Ue),s(P,We),A(X,P,null),h(e,he,l),h(e,E,l),s(E,U),s(U,ae),A(H,ae,null),s(E,Oe),s(E,oe),s(oe,ze),h(e,me,l),h(e,J,l),A(q,J,null),s(J,Ye),s(J,re),s(re,Ce),_e=!0},p(e,[l]){const Q={};l&2&&(Q.$$scope={dirty:l,ctx:e}),S.$set(Q);const le={};l&2&&(le.$$scope={dirty:l,ctx:e}),X.$set(le)},i(e){_e||(j(a.$$.fragment,e),j(S.$$.fragment,e),j(Y.$$.fragment,e),j(C.$$.fragment,e),j(R.$$.fragment,e),j(X.$$.fragment,e),j(H.$$.fragment,e),j(q.$$.fragment,e),_e=!0)},o(e){I(a.$$.fragment,e),I(S.$$.fragment,e),I(Y.$$.fragment,e),I(C.$$.fragment,e),I(R.$$.fragment,e),I(X.$$.fragment,e),I(H.$$.fragment,e),I(q.$$.fragment,e),_e=!1},d(e){n(r),e&&n($),e&&n(d),x(a),e&&n(w),e&&n(y),e&&n(pe),e&&n(N),e&&n(fe),e&&n(Z),e&&n(ue),x(S,e),e&&n(de),e&&n(M),x(Y),e&&n(ce),e&&n(b),x(C),x(R),x(X),e&&n(he),e&&n(E),x(H),e&&n(me),e&&n(J),x(q)}}}const Ds={local:"dance-diffusion",sections:[{local:"diffusers.DanceDiffusionPipeline",title:"DanceDiffusionPipeline"},{local:"diffusers.AudioPipelineOutput",title:"AudioPipelineOutput"}],title:"Dance Diffusion"};function Ps(F){return ms(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Gs extends us{constructor(r){super();ds(this,r,Ps,ys,cs,{})}}export{Gs as default,Ds as metadata};
