Buckets:

rtrm's picture
download
raw
13.3 kB
import{s as be,o as we,n as de}from"../chunks/scheduler.8c3d61f6.js";import{S as ve,i as ye,g as u,s as r,r as $,A as Te,h as d,f as s,c as l,j as L,u as b,x,k as H,y as h,a,v as w,d as v,t as y,w as T}from"../chunks/index.da70eac4.js";import{T as $e}from"../chunks/Tip.1d9b8c37.js";import{D as pe}from"../chunks/Docstring.c021b19a.js";import{C as De}from"../chunks/CodeBlock.a9c4becf.js";import{E as Me}from"../chunks/ExampleCodeBlock.56b4589c.js";import{H as ue,E as Pe}from"../chunks/getInferenceSnippets.725ed3d4.js";function xe(G){let n,f="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.";return{c(){n=u("p"),n.textContent=f},l(i){n=d(i,"P",{"data-svelte-h":!0}),x(n)!=="svelte-ic4u42"&&(n.textContent=f)},m(i,p){a(i,n,p)},p:de,d(i){i&&s(n)}}}function Ge(G){let n,f='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.';return{c(){n=u("p"),n.innerHTML=f},l(i){n=d(i,"P",{"data-svelte-h":!0}),x(n)!=="svelte-1qn15hi"&&(n.innerHTML=f)},m(i,p){a(i,n,p)},p:de,d(i){i&&s(n)}}}function Je(G){let n,f="Example:",i,p,c;return p=new De({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(){n=u("p"),n.textContent=f,i=r(),$(p.$$.fragment)},l(o){n=d(o,"P",{"data-svelte-h":!0}),x(n)!=="svelte-11lpom8"&&(n.textContent=f),i=l(o),b(p.$$.fragment,o)},m(o,_){a(o,n,_),a(o,i,_),w(p,o,_),c=!0},p:de,i(o){c||(v(p.$$.fragment,o),c=!0)},o(o){y(p.$$.fragment,o),c=!1},d(o){o&&(s(n),s(i)),T(p,o)}}}function ke(G){let n,f,i,p,c,o,_,O,B,fe='<a href="https://github.com/Harmonai-org/sample-generator" rel="nofollow">Dance Diffusion</a> is by Zach Evans.',R,j,ce='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,J,Q,C,Y,m,U,se,A,me="Pipeline for audio generation.",ie,S,he=`This model inherits from <a href="/docs/diffusers/pr_11797/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.).`,ae,D,Z,oe,V,_e="The call function to the pipeline for generation.",re,k,q,I,K,M,W,le,X,ge="Output class for audio pipelines.",ee,E,te,N,ne;return c=new $e({props:{warning:!0,$$slots:{default:[xe]},$$scope:{ctx:G}}}),_=new ue({props:{title:"Dance Diffusion",local:"dance-diffusion",headingTag:"h1"}}),J=new $e({props:{$$slots:{default:[Ge]},$$scope:{ctx:G}}}),C=new ue({props:{title:"DanceDiffusionPipeline",local:"diffusers.DanceDiffusionPipeline",headingTag:"h2"}}),U=new pe({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_11797/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/pr_11797/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/pr_11797/en/api/schedulers/ipndm#diffusers.IPNDMScheduler">IPNDMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/vr_11797/src/diffusers/pipelines/dance_diffusion/pipeline_dance_diffusion.py#L37"}}),Z=new pe({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/pr_11797/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_11797/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_11797/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_11797/en/api/pipelines/dance_diffusion#diffusers.AudioPipelineOutput"
>AudioPipelineOutput</a> or <code>tuple</code></p>
`}}),k=new Me({props:{anchor:"diffusers.DanceDiffusionPipeline.__call__.example",$$slots:{default:[Je]},$$scope:{ctx:G}}}),I=new ue({props:{title:"AudioPipelineOutput",local:"diffusers.AudioPipelineOutput",headingTag:"h2"}}),W=new pe({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/vr_11797/src/diffusers/pipelines/pipeline_utils.py#L130"}}),E=new Pe({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/dance_diffusion.md"}}),{c(){n=u("meta"),f=r(),i=u("p"),p=r(),$(c.$$.fragment),o=r(),$(_.$$.fragment),O=r(),B=u("p"),B.innerHTML=fe,R=r(),j=u("p"),j.innerHTML=ce,F=r(),$(J.$$.fragment),Q=r(),$(C.$$.fragment),Y=r(),m=u("div"),$(U.$$.fragment),se=r(),A=u("p"),A.textContent=me,ie=r(),S=u("p"),S.innerHTML=he,ae=r(),D=u("div"),$(Z.$$.fragment),oe=r(),V=u("p"),V.textContent=_e,re=r(),$(k.$$.fragment),q=r(),$(I.$$.fragment),K=r(),M=u("div"),$(W.$$.fragment),le=r(),X=u("p"),X.textContent=ge,ee=r(),$(E.$$.fragment),te=r(),N=u("p"),this.h()},l(e){const t=Te("svelte-u9bgzb",document.head);n=d(t,"META",{name:!0,content:!0}),t.forEach(s),f=l(e),i=d(e,"P",{}),L(i).forEach(s),p=l(e),b(c.$$.fragment,e),o=l(e),b(_.$$.fragment,e),O=l(e),B=d(e,"P",{"data-svelte-h":!0}),x(B)!=="svelte-z4ffbo"&&(B.innerHTML=fe),R=l(e),j=d(e,"P",{"data-svelte-h":!0}),x(j)!=="svelte-dzyais"&&(j.innerHTML=ce),F=l(e),b(J.$$.fragment,e),Q=l(e),b(C.$$.fragment,e),Y=l(e),m=d(e,"DIV",{class:!0});var g=L(m);b(U.$$.fragment,g),se=l(g),A=d(g,"P",{"data-svelte-h":!0}),x(A)!=="svelte-1jvczvp"&&(A.textContent=me),ie=l(g),S=d(g,"P",{"data-svelte-h":!0}),x(S)!=="svelte-177lmn5"&&(S.innerHTML=he),ae=l(g),D=d(g,"DIV",{class:!0});var P=L(D);b(Z.$$.fragment,P),oe=l(P),V=d(P,"P",{"data-svelte-h":!0}),x(V)!=="svelte-50j04k"&&(V.textContent=_e),re=l(P),b(k.$$.fragment,P),P.forEach(s),g.forEach(s),q=l(e),b(I.$$.fragment,e),K=l(e),M=d(e,"DIV",{class:!0});var z=L(M);b(W.$$.fragment,z),le=l(z),X=d(z,"P",{"data-svelte-h":!0}),x(X)!=="svelte-19ryw33"&&(X.textContent=ge),z.forEach(s),ee=l(e),b(E.$$.fragment,e),te=l(e),N=d(e,"P",{}),L(N).forEach(s),this.h()},h(){H(n,"name","hf:doc:metadata"),H(n,"content",Be),H(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),H(m,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),H(M,"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){h(document.head,n),a(e,f,t),a(e,i,t),a(e,p,t),w(c,e,t),a(e,o,t),w(_,e,t),a(e,O,t),a(e,B,t),a(e,R,t),a(e,j,t),a(e,F,t),w(J,e,t),a(e,Q,t),w(C,e,t),a(e,Y,t),a(e,m,t),w(U,m,null),h(m,se),h(m,A),h(m,ie),h(m,S),h(m,ae),h(m,D),w(Z,D,null),h(D,oe),h(D,V),h(D,re),w(k,D,null),a(e,q,t),w(I,e,t),a(e,K,t),a(e,M,t),w(W,M,null),h(M,le),h(M,X),a(e,ee,t),w(E,e,t),a(e,te,t),a(e,N,t),ne=!0},p(e,[t]){const g={};t&2&&(g.$$scope={dirty:t,ctx:e}),c.$set(g);const P={};t&2&&(P.$$scope={dirty:t,ctx:e}),J.$set(P);const z={};t&2&&(z.$$scope={dirty:t,ctx:e}),k.$set(z)},i(e){ne||(v(c.$$.fragment,e),v(_.$$.fragment,e),v(J.$$.fragment,e),v(C.$$.fragment,e),v(U.$$.fragment,e),v(Z.$$.fragment,e),v(k.$$.fragment,e),v(I.$$.fragment,e),v(W.$$.fragment,e),v(E.$$.fragment,e),ne=!0)},o(e){y(c.$$.fragment,e),y(_.$$.fragment,e),y(J.$$.fragment,e),y(C.$$.fragment,e),y(U.$$.fragment,e),y(Z.$$.fragment,e),y(k.$$.fragment,e),y(I.$$.fragment,e),y(W.$$.fragment,e),y(E.$$.fragment,e),ne=!1},d(e){e&&(s(f),s(i),s(p),s(o),s(O),s(B),s(R),s(j),s(F),s(Q),s(Y),s(m),s(q),s(K),s(M),s(ee),s(te),s(N)),s(n),T(c,e),T(_,e),T(J,e),T(C,e),T(U),T(Z),T(k),T(I,e),T(W),T(E,e)}}}const Be='{"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 je(G){return we(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ae extends ve{constructor(n){super(),ye(this,n,je,ke,be,{})}}export{Ae as component};

Xet Storage Details

Size:
13.3 kB
·
Xet hash:
a68ccf542b9b1393448a06ebee0fb617e120f18a848d3637ed4f12c0f3c22508

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.