import{s as we,o as ve,n as Te}from"../chunks/scheduler.53228c21.js";import{S as Me,i as De,e as r,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 y,o as w,p as v}from"../chunks/index.100fac89.js";import{C as Pe}from"../chunks/CopyLLMTxtMenu.9360b11d.js";import{D as fe}from"../chunks/Docstring.22cc8849.js";import{C as ke}from"../chunks/CodeBlock.d30a6509.js";import{E as Ge}from"../chunks/ExampleCodeBlock.1963d52f.js";import{H as ce,E as Je}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.c9001d7a.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">&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(){o=r("p"),o.textContent=k,h=s(),g(f.$$.fragment)},l(l){o=p(l,"P",{"data-svelte-h":!0}),M(o)!=="svelte-11lpom8"&&(o.textContent=k),h=a(l),$(f.$$.fragment,l)},m(l,D){i(l,o,D),i(l,h,D),b(f,l,D),u=!0},p:Te,i(l){u||(y(f.$$.fragment,l),u=!0)},o(l){w(f.$$.fragment,l),u=!1},d(l){l&&(n(o),n(h)),v(f,l)}}}function je(O){let o,k,h,f,u,l="<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.",le,S,$e=`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.).`,re,_,Z,pe,A,be="The call function to the pipeline for generation.",ue,P,ee,I,te,T,E,de,V,ye="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/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 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) &#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>
`}}),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>) &#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"}}),L=new Je({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/dance_diffusion.md"}}),{c(){o=r("meta"),k=s(),h=r("p"),f=s(),u=r("blockquote"),u.innerHTML=l,D=s(),g(G.$$.fragment),Q=s(),g(J.$$.fragment),q=s(),B=r("p"),B.innerHTML=me,R=s(),j=r("p"),j.innerHTML=he,F=s(),x=r("blockquote"),x.innerHTML=_e,Y=s(),g(C.$$.fragment),K=s(),d=r("div"),g(U.$$.fragment),oe=s(),z=r("p"),z.textContent=ge,le=s(),S=r("p"),S.innerHTML=$e,re=s(),_=r("div"),g(Z.$$.fragment),pe=s(),A=r("p"),A.textContent=be,ue=s(),g(P.$$.fragment),ee=s(),g(I.$$.fragment),te=s(),T=r("div"),g(E.$$.fragment),de=s(),V=r("p"),V.textContent=ye,ne=s(),g(L.$$.fragment),ie=s(),N=r("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=l),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),le=a(m),S=p(m,"P",{"data-svelte-h":!0}),M(S)!=="svelte-496sm0"&&(S.innerHTML=$e),re=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=ye),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,le),c(d,S),c(d,re),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||(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=!0)},o(e){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=!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,we,{})}}export{Ae as component};
