import{S as dn,i as cn,s as hn,e as s,k as m,w as B,t as f,M as mn,c as t,d as i,m as _,a as o,x as G,h as u,b as p,G as n,g as h,y as A,q as j,o as I,B as x,v as _n,L as gn}from"../../../chunks/vendor-hf-doc-builder.js";import{T as vn}from"../../../chunks/Tip-hf-doc-builder.js";import{D as Re}from"../../../chunks/Docstring-hf-doc-builder.js";import{C as wn}from"../../../chunks/CodeBlock-hf-doc-builder.js";import{I as He}from"../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as bn}from"../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function $n(F){let r,$,d,c,g,a,v,T;return{c(){r=s("p"),$=f("Make sure to check out the Schedulers "),d=s("a"),c=f("guide"),g=f(" to learn how to explore the tradeoff between scheduler speed and quality, and see the "),a=s("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(i),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(i),T=u(w," section to learn how to efficiently load the same components into multiple pipelines."),w.forEach(i),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),n(r,$),n(r,d),n(d,c),n(r,g),n(r,a),n(a,v),n(r,T)},d(k){k&&i(r)}}}function yn(F){let r,$,d,c,g;return c=new wn({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=s("p"),$=f("Example:"),d=m(),B(c.$$.fragment)},l(a){r=t(a,"P",{});var v=o(r);$=u(v,"Example:"),v.forEach(i),d=_(a),G(c.$$.fragment,a)},m(a,v){h(a,r,v),n(r,$),h(a,d,v),A(c,a,v),g=!0},p:gn,i(a){g||(j(c.$$.fragment,a),g=!0)},o(a){I(c.$$.fragment,a),g=!1},d(a){a&&i(r),a&&i(d),x(c,a)}}}function Dn(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,ne,Y,Ge,ie,Ae,ce,b,C,je,se,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 vn({props:{$$slots:{default:[$n]},$$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/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#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/main/en/api/pipelines/audio_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#L46",returnDescription:`
<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/main/en/api/pipelines/audio_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/main/en/api/pipelines/audio_diffusion#diffusers.AudioPipelineOutput"
>AudioPipelineOutput</a> or <code>tuple</code></p>
`}}),X=new bn({props:{anchor:"diffusers.DanceDiffusionPipeline.__call__.example",$$slots:{default:[yn]},$$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/main/src/diffusers/pipelines/pipeline_utils.py#L126"}}),{c(){r=s("meta"),$=m(),d=s("h1"),c=s("a"),g=s("span"),B(a.$$.fragment),v=m(),T=s("span"),k=f("Dance Diffusion"),w=m(),y=s("p"),D=s("a"),De=f("Dance Diffusion"),Pe=f(" is by Zach Evans."),pe=m(),N=s("p"),Te=f("Dance Diffusion is the first in a suite of generative audio tools for producers and musicians released by "),O=s("a"),ke=f("Harmonai"),Me=f("."),fe=m(),Z=s("p"),Ee=f("The original codebase of this implementation can be found at "),z=s("a"),Je=f("Harmonai-org"),Be=f("."),ue=m(),B(S.$$.fragment),de=m(),M=s("h2"),V=s("a"),ne=s("span"),B(Y.$$.fragment),Ge=m(),ie=s("span"),Ae=f("DanceDiffusionPipeline"),ce=m(),b=s("div"),B(C.$$.fragment),je=m(),se=s("p"),Ie=f("Pipeline for audio generation."),xe=m(),L=s("p"),Ne=f("This model inherits from "),K=s("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=s("div"),B(R.$$.fragment),Xe=m(),te=s("p"),Ue=f("The call function to the pipeline for generation."),We=m(),B(X.$$.fragment),he=m(),E=s("h2"),U=s("a"),ae=s("span"),B(H.$$.fragment),Oe=m(),oe=s("span"),ze=f("AudioPipelineOutput"),me=m(),J=s("div"),B(q.$$.fragment),Ye=m(),re=s("p"),Ce=f("Output class for audio pipelines."),this.h()},l(e){const l=mn('[data-svelte="svelte-1phssyn"]',document.head);r=t(l,"META",{name:!0,content:!0}),l.forEach(i),$=_(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(i),le.forEach(i),v=_(Q),T=t(Q,"SPAN",{});var Qe=o(T);k=u(Qe,"Dance Diffusion"),Qe.forEach(i),Q.forEach(i),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(i),Pe=u(Le," is by Zach Evans."),Le.forEach(i),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(i),Me=u(ge,"."),ge.forEach(i),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 en=o(z);Je=u(en,"Harmonai-org"),en.forEach(i),Be=u(ve,"."),ve.forEach(i),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 nn=o(V);ne=t(nn,"SPAN",{});var sn=o(ne);G(Y.$$.fragment,sn),sn.forEach(i),nn.forEach(i),Ge=_(we),ie=t(we,"SPAN",{});var tn=o(ie);Ae=u(tn,"DanceDiffusionPipeline"),tn.forEach(i),we.forEach(i),ce=_(e),b=t(e,"DIV",{class:!0});var W=o(b);G(C.$$.fragment,W),je=_(W),se=t(W,"P",{});var an=o(se);Ie=u(an,"Pipeline for audio generation."),an.forEach(i),xe=_(W),L=t(W,"P",{});var be=o(L);Ne=u(be,"This model inherits from "),K=t(be,"A",{href:!0});var on=o(K);Ze=u(on,"DiffusionPipeline"),on.forEach(i),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(i),Ve=_(W),P=t(W,"DIV",{class:!0});var ee=o(P);G(R.$$.fragment,ee),Xe=_(ee),te=t(ee,"P",{});var rn=o(te);Ue=u(rn,"The call function to the pipeline for generation."),rn.forEach(i),We=_(ee),G(X.$$.fragment,ee),ee.forEach(i),W.forEach(i),he=_(e),E=t(e,"H2",{class:!0});var $e=o(E);U=t($e,"A",{id:!0,class:!0,href:!0});var ln=o(U);ae=t(ln,"SPAN",{});var pn=o(ae);G(H.$$.fragment,pn),pn.forEach(i),ln.forEach(i),Oe=_($e),oe=t($e,"SPAN",{});var fn=o(oe);ze=u(fn,"AudioPipelineOutput"),fn.forEach(i),$e.forEach(i),me=_(e),J=t(e,"DIV",{class:!0});var ye=o(J);G(q.$$.fragment,ye),Ye=_(ye),re=t(ye,"P",{});var un=o(re);Ce=u(un,"Output class for audio pipelines."),un.forEach(i),ye.forEach(i),this.h()},h(){p(r,"name","hf:doc:metadata"),p(r,"content",JSON.stringify(Pn)),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/main/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){n(document.head,r),h(e,$,l),h(e,d,l),n(d,c),n(c,g),A(a,g,null),n(d,v),n(d,T),n(T,k),h(e,w,l),h(e,y,l),n(y,D),n(D,De),n(y,Pe),h(e,pe,l),h(e,N,l),n(N,Te),n(N,O),n(O,ke),n(N,Me),h(e,fe,l),h(e,Z,l),n(Z,Ee),n(Z,z),n(z,Je),n(Z,Be),h(e,ue,l),A(S,e,l),h(e,de,l),h(e,M,l),n(M,V),n(V,ne),A(Y,ne,null),n(M,Ge),n(M,ie),n(ie,Ae),h(e,ce,l),h(e,b,l),A(C,b,null),n(b,je),n(b,se),n(se,Ie),n(b,xe),n(b,L),n(L,Ne),n(L,K),n(K,Ze),n(L,Se),n(b,Ve),n(b,P),A(R,P,null),n(P,Xe),n(P,te),n(te,Ue),n(P,We),A(X,P,null),h(e,he,l),h(e,E,l),n(E,U),n(U,ae),A(H,ae,null),n(E,Oe),n(E,oe),n(oe,ze),h(e,me,l),h(e,J,l),A(q,J,null),n(J,Ye),n(J,re),n(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){i(r),e&&i($),e&&i(d),x(a),e&&i(w),e&&i(y),e&&i(pe),e&&i(N),e&&i(fe),e&&i(Z),e&&i(ue),x(S,e),e&&i(de),e&&i(M),x(Y),e&&i(ce),e&&i(b),x(C),x(R),x(X),e&&i(he),e&&i(E),x(H),e&&i(me),e&&i(J),x(q)}}}const Pn={local:"dance-diffusion",sections:[{local:"diffusers.DanceDiffusionPipeline",title:"DanceDiffusionPipeline"},{local:"diffusers.AudioPipelineOutput",title:"AudioPipelineOutput"}],title:"Dance Diffusion"};function Tn(F){return _n(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class An extends dn{constructor(r){super();cn(this,r,Tn,Dn,hn,{})}}export{An as default,Pn as metadata};
