Buckets:
hf-doc-build/doc / diffusers /main /en /_app /pages /api /pipelines /dance_diffusion.mdx-hf-doc-builder.js
| import{S as dn,i as cn,s as hn,e as i,k as m,w as B,t as f,M as mn,c as t,d as s,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=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(s),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(s),T=u(w," section to learn how to efficiently load the same components into multiple pipelines."),w.forEach(s),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&&s(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">"harmonai/maestro-150k"</span> | |
| pipe = DiffusionPipeline.from_pretrained(model_id) | |
| pipe = pipe.to(<span class="hljs-string">"cuda"</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"maestro_test_<span class="hljs-subst">{i}</span>.wav"</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(s),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&&s(r),a&&s(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,se,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 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>) — | |
| 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>) — | |
| 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#L28"}}),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) — | |
| 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) — | |
| 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>) — | |
| 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>) — | |
| 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>) — | |
| Whether or not to return a <a href="/docs/diffusers/main/en/api/pipelines/spectrogram_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#L48",returnDescription:` | |
| <p>If <code>return_dict</code> is <code>True</code>, <a | |
| href="/docs/diffusers/main/en/api/pipelines/spectrogram_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/spectrogram_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>) — | |
| 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=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"),ne=i("span"),B(Y.$$.fragment),Ge=m(),se=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=mn('[data-svelte="svelte-1phssyn"]',document.head);r=t(l,"META",{name:!0,content:!0}),l.forEach(s),$=_(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(s),le.forEach(s),v=_(Q),T=t(Q,"SPAN",{});var Qe=o(T);k=u(Qe,"Dance Diffusion"),Qe.forEach(s),Q.forEach(s),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(s),Pe=u(Le," is by Zach Evans."),Le.forEach(s),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(s),Me=u(ge,"."),ge.forEach(s),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(s),Be=u(ve,"."),ve.forEach(s),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(s),nn.forEach(s),Ge=_(we),se=t(we,"SPAN",{});var tn=o(se);Ae=u(tn,"DanceDiffusionPipeline"),tn.forEach(s),we.forEach(s),ce=_(e),b=t(e,"DIV",{class:!0});var W=o(b);G(C.$$.fragment,W),je=_(W),ie=t(W,"P",{});var an=o(ie);Ie=u(an,"Pipeline for audio generation."),an.forEach(s),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(s),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(s),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(s),We=_(ee),G(X.$$.fragment,ee),ee.forEach(s),W.forEach(s),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(s),ln.forEach(s),Oe=_($e),oe=t($e,"SPAN",{});var fn=o(oe);ze=u(fn,"AudioPipelineOutput"),fn.forEach(s),$e.forEach(s),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(s),ye.forEach(s),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,se),n(se,Ae),h(e,ce,l),h(e,b,l),A(C,b,null),n(b,je),n(b,ie),n(ie,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){s(r),e&&s($),e&&s(d),x(a),e&&s(w),e&&s(y),e&&s(pe),e&&s(N),e&&s(fe),e&&s(Z),e&&s(ue),x(S,e),e&&s(de),e&&s(M),x(Y),e&&s(ce),e&&s(b),x(C),x(R),x(X),e&&s(he),e&&s(E),x(H),e&&s(me),e&&s(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}; | |
Xet Storage Details
- Size:
- 15.6 kB
- Xet hash:
- 6284646746c1cc4cf23db28ab550e02920745c6c133552a8eff8f8131525578b
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.