Buckets:
| import{s as ye,o as ve,n as Te}from"../chunks/scheduler.53228c21.js";import{S as Me,i as De,e as l,s,c as g,h as xe,a as p,d as n,b as a,f as H,j as M,g as $,k as W,l as c,m as i,n as b,t as w,o as y,p as v}from"../chunks/index.100fac89.js";import{C as Pe}from"../chunks/CopyLLMTxtMenu.8a16ebe2.js";import{D as fe}from"../chunks/Docstring.07ca7ce7.js";import{C as ke}from"../chunks/CodeBlock.d30a6509.js";import{E as Ge}from"../chunks/ExampleCodeBlock.672157f9.js";import{H as ce,E as Je}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.83a5c0e1.js";function Be(O){let o,k="Example:",h,f,u;return f=new ke({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">"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 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(){o=l("p"),o.textContent=k,h=s(),g(f.$$.fragment)},l(r){o=p(r,"P",{"data-svelte-h":!0}),M(o)!=="svelte-11lpom8"&&(o.textContent=k),h=a(r),$(f.$$.fragment,r)},m(r,D){i(r,o,D),i(r,h,D),b(f,r,D),u=!0},p:Te,i(r){u||(w(f.$$.fragment,r),u=!0)},o(r){y(f.$$.fragment,r),u=!1},d(r){r&&(n(o),n(h)),v(f,r)}}}function je(O){let o,k,h,f,u,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>",D,G,Q,J,q,B,me='<a href="https://github.com/Harmonai-org/sample-generator" rel="nofollow">Dance Diffusion</a> is by Zach Evans.',R,j,he='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>.',F,x,_e='<p>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.</p>',Y,C,K,d,U,oe,z,ge="Pipeline for audio generation.",re,S,$e=`This model inherits from <a href="/docs/diffusers/pr_11636/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.).`,le,_,Z,pe,A,be="The call function to the pipeline for generation.",ue,P,ee,I,te,T,E,de,V,we="Output class for audio pipelines.",ne,L,ie,N,se;return G=new Pe({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),J=new ce({props:{title:"Dance Diffusion",local:"dance-diffusion",headingTag:"h1"}}),C=new ce({props:{title:"DanceDiffusionPipeline",local:"diffusers.DanceDiffusionPipeline",headingTag:"h2"}}),U=new fe({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/pr_11636/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/pr_11636/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/pr_11636/en/api/schedulers/ipndm#diffusers.IPNDMScheduler">IPNDMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/vr_11636/src/diffusers/pipelines/dance_diffusion/pipeline_dance_diffusion.py#L37"}}),Z=new fe({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/pr_11636/en/api/pipelines/dance_diffusion#diffusers.AudioPipelineOutput">AudioPipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_11636/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/pr_11636/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/pr_11636/en/api/pipelines/dance_diffusion#diffusers.AudioPipelineOutput" | |
| >AudioPipelineOutput</a> or <code>tuple</code></p> | |
| `}}),P=new Ge({props:{anchor:"diffusers.DanceDiffusionPipeline.__call__.example",$$slots:{default:[Be]},$$scope:{ctx:O}}}),I=new ce({props:{title:"AudioPipelineOutput",local:"diffusers.AudioPipelineOutput",headingTag:"h2"}}),E=new fe({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/vr_11636/src/diffusers/pipelines/pipeline_utils.py#L132"}}),L=new Je({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/dance_diffusion.md"}}),{c(){o=l("meta"),k=s(),h=l("p"),f=s(),u=l("blockquote"),u.innerHTML=r,D=s(),g(G.$$.fragment),Q=s(),g(J.$$.fragment),q=s(),B=l("p"),B.innerHTML=me,R=s(),j=l("p"),j.innerHTML=he,F=s(),x=l("blockquote"),x.innerHTML=_e,Y=s(),g(C.$$.fragment),K=s(),d=l("div"),g(U.$$.fragment),oe=s(),z=l("p"),z.textContent=ge,re=s(),S=l("p"),S.innerHTML=$e,le=s(),_=l("div"),g(Z.$$.fragment),pe=s(),A=l("p"),A.textContent=be,ue=s(),g(P.$$.fragment),ee=s(),g(I.$$.fragment),te=s(),T=l("div"),g(E.$$.fragment),de=s(),V=l("p"),V.textContent=we,ne=s(),g(L.$$.fragment),ie=s(),N=l("p"),this.h()},l(e){const t=xe("svelte-u9bgzb",document.head);o=p(t,"META",{name:!0,content:!0}),t.forEach(n),k=a(e),h=p(e,"P",{}),H(h).forEach(n),f=a(e),u=p(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),M(u)!=="svelte-124tjg"&&(u.innerHTML=r),D=a(e),$(G.$$.fragment,e),Q=a(e),$(J.$$.fragment,e),q=a(e),B=p(e,"P",{"data-svelte-h":!0}),M(B)!=="svelte-z4ffbo"&&(B.innerHTML=me),R=a(e),j=p(e,"P",{"data-svelte-h":!0}),M(j)!=="svelte-dzyais"&&(j.innerHTML=he),F=a(e),x=p(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),M(x)!=="svelte-r1jcqf"&&(x.innerHTML=_e),Y=a(e),$(C.$$.fragment,e),K=a(e),d=p(e,"DIV",{class:!0});var m=H(d);$(U.$$.fragment,m),oe=a(m),z=p(m,"P",{"data-svelte-h":!0}),M(z)!=="svelte-1jvczvp"&&(z.textContent=ge),re=a(m),S=p(m,"P",{"data-svelte-h":!0}),M(S)!=="svelte-1w7teon"&&(S.innerHTML=$e),le=a(m),_=p(m,"DIV",{class:!0});var X=H(_);$(Z.$$.fragment,X),pe=a(X),A=p(X,"P",{"data-svelte-h":!0}),M(A)!=="svelte-50j04k"&&(A.textContent=be),ue=a(X),$(P.$$.fragment,X),X.forEach(n),m.forEach(n),ee=a(e),$(I.$$.fragment,e),te=a(e),T=p(e,"DIV",{class:!0});var ae=H(T);$(E.$$.fragment,ae),de=a(ae),V=p(ae,"P",{"data-svelte-h":!0}),M(V)!=="svelte-19ryw33"&&(V.textContent=we),ae.forEach(n),ne=a(e),$(L.$$.fragment,e),ie=a(e),N=p(e,"P",{}),H(N).forEach(n),this.h()},h(){W(o,"name","hf:doc:metadata"),W(o,"content",Ce),W(u,"class","warning"),W(x,"class","tip"),W(_,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(d,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(T,"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){c(document.head,o),i(e,k,t),i(e,h,t),i(e,f,t),i(e,u,t),i(e,D,t),b(G,e,t),i(e,Q,t),b(J,e,t),i(e,q,t),i(e,B,t),i(e,R,t),i(e,j,t),i(e,F,t),i(e,x,t),i(e,Y,t),b(C,e,t),i(e,K,t),i(e,d,t),b(U,d,null),c(d,oe),c(d,z),c(d,re),c(d,S),c(d,le),c(d,_),b(Z,_,null),c(_,pe),c(_,A),c(_,ue),b(P,_,null),i(e,ee,t),b(I,e,t),i(e,te,t),i(e,T,t),b(E,T,null),c(T,de),c(T,V),i(e,ne,t),b(L,e,t),i(e,ie,t),i(e,N,t),se=!0},p(e,[t]){const m={};t&2&&(m.$$scope={dirty:t,ctx:e}),P.$set(m)},i(e){se||(w(G.$$.fragment,e),w(J.$$.fragment,e),w(C.$$.fragment,e),w(U.$$.fragment,e),w(Z.$$.fragment,e),w(P.$$.fragment,e),w(I.$$.fragment,e),w(E.$$.fragment,e),w(L.$$.fragment,e),se=!0)},o(e){y(G.$$.fragment,e),y(J.$$.fragment,e),y(C.$$.fragment,e),y(U.$$.fragment,e),y(Z.$$.fragment,e),y(P.$$.fragment,e),y(I.$$.fragment,e),y(E.$$.fragment,e),y(L.$$.fragment,e),se=!1},d(e){e&&(n(k),n(h),n(f),n(u),n(D),n(Q),n(q),n(B),n(R),n(j),n(F),n(x),n(Y),n(K),n(d),n(ee),n(te),n(T),n(ne),n(ie),n(N)),n(o),v(G,e),v(J,e),v(C,e),v(U),v(Z),v(P),v(I,e),v(E),v(L,e)}}}const Ce='{"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 Ue(O){return ve(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ae extends Me{constructor(o){super(),De(this,o,Ue,je,ye,{})}}export{Ae as component}; | |
Xet Storage Details
- Size:
- 13.2 kB
- Xet hash:
- dd234bf2b772db68736a8f7f3dba864ab4aff08bdc8ead3310a9abe10054941c
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.