import{S as Ir,i as Nr,s as Sr,e as l,k as c,w as u,t as r,M as Wr,c as n,d as s,m as p,a as i,x as f,h,b as d,N as bo,G as t,g as o,y as m,L as Ar,q as y,o as w,B as b,v as qr}from"../../chunks/vendor-hf-doc-builder.js";import{I as D}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as g}from"../../chunks/CodeBlock-hf-doc-builder.js";function Dr(Gn){let $,Tt,x,Z,Cs,he,go,Is,vo,Ut,v,Mo,Ns,ko,jo,Ss,To,Uo,Ws,Jo,Eo,Jt,Q,$o,As,xo,_o,Et,k,Co,qs,Io,No,ce,So,Wo,$t,Ke,Ao,xt,_,G,Ds,pe,qo,Zs,Do,_t,j,Zo,Qs,Qo,Go,Gs,Yo,Po,Ct,de,It,C,Y,Ys,ue,Ro,Ps,zo,Nt,es,Lo,St,I,P,Rs,fe,Fo,zs,Ho,Wt,T,Bo,me,Vo,Oo,Ls,Xo,Ko,At,ye,qt,R,el,we,Fs,sl,tl,Dt,be,Zt,ss,al,Qt,ge,Gt,ts,Hs,ol,Yt,ve,Pt,as,ll,Rt,N,z,Bs,Me,nl,Vs,il,zt,os,rl,Lt,ls,hl,Ft,ns,cl,Ht,L,pl,ke,dl,ul,Bt,je,is,Yn,Vt,rs,fl,Ot,hs,ml,Xt,Te,Kt,U,yl,Ue,wl,bl,Je,Os,gl,vl,ea,Ee,sa,cs,Xs,Ml,ta,$e,aa,ps,kl,oa,xe,la,_e,jl,Ce,Tl,na,ds,Ul,ia,Ie,Ks,Pn,ra,us,Jl,ha,Ne,et,Rn,ca,F,El,st,$l,xl,pa,Se,tt,zn,da,fs,_l,ua,S,H,at,We,Cl,ot,Il,fa,ms,Nl,ma,W,B,lt,Ae,Sl,nt,Wl,ya,V,Al,qe,ql,Dl,wa,ys,Zl,ba,De,ga,O,Ql,Ze,Gl,Yl,va,Qe,Ma,ws,Pl,ka,Ge,ja,bs,it,Rl,Ta,Ye,Ua,X,zl,Pe,Ll,Fl,Ja,gs,Hl,Ea,A,K,rt,Re,Bl,ht,Vl,$a,ee,Ol,ct,Xl,Kl,xa,vs,en,_a,J,sn,ze,tn,an,pt,on,ln,Ca,Ms,nn,Ia,se,rn,Le,hn,cn,Na,Fe,Sa,te,pn,dt,dn,un,Wa,He,Aa,ae,fn,ut,mn,yn,qa,Be,Da,ks,ft,wn,Za,Ve,Qa,js,bn,Ga,Oe,Ya,Ts,gn,Pa,M,vn,mt,Mn,kn,yt,jn,Tn,wt,Un,Jn,Ra,q,oe,bt,Xe,En,gt,$n,za,le,xn,vt,_n,Cn,La,E,In,Mt,Nn,Sn,kt,Wn,An,Fa,ne,qn,jt,Dn,Zn,Ha;return he=new D({}),pe=new D({}),de=new g({props:{code:"cGlwJTIwaW5zdGFsbCUyMGdpdCUyQmh0dHBzJTNBJTJGJTJGZ2l0aHViLmNvbSUyRmh1Z2dpbmdmYWNlJTJGdHJhbnNmb3JtZXJz",highlighted:'pip install git+https:<span class="hljs-regexp">//gi</span>thub.com<span class="hljs-regexp">/huggingface/</span>transformers'}}),ue=new D({}),fe=new D({}),ye=new g({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBbWluZHMlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyUG9seUFJJTJGbWluZHMxNCUyMiUyQyUyMG5hbWUlM0QlMjJlbi1BVSUyMiUyQyUyMHNwbGl0JTNEJTIydHJhaW4lMjIp",highlighted:`<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

minds = load_dataset(<span class="hljs-string">&quot;PolyAI/minds14&quot;</span>, name=<span class="hljs-string">&quot;en-AU&quot;</span>, split=<span class="hljs-string">&quot;train&quot;</span>)`}}),be=new g({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBY2xhc3NpZmllciUyMCUzRCUyMHBpcGVsaW5lKCUwQSUyMCUyMCUyMCUyMCUyMmF1ZGlvLWNsYXNzaWZpY2F0aW9uJTIyJTJDJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0QlMjJhbnRvbi1sJTJGeHRyZW1lX3NfeGxzcl8zMDBtX21pbmRzMTQlMjIlMkMlMEEp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

classifier = pipeline(
    <span class="hljs-string">&quot;audio-classification&quot;</span>,
    model=<span class="hljs-string">&quot;anton-l/xtreme_s_xlsr_300m_minds14&quot;</span>,
)`}}),ge=new g({props:{code:"Y2xhc3NpZmllcihtaW5kcyU1QjAlNUQlNUIlMjJwYXRoJTIyJTVEKQ==",highlighted:'classifier(minds[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;path&quot;</span>])'}}),ve=new g({props:{code:"JTVCJTBBJTIwJTIwJTIwJTIwJTdCJTIyc2NvcmUlMjIlM0ElMjAwLjk2MzE1MjUyNzgwOTE0MzElMkMlMjAlMjJsYWJlbCUyMiUzQSUyMCUyMnBheV9iaWxsJTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTdCJTIyc2NvcmUlMjIlM0ElMjAwLjAyODE5Njk4MzAzOTM3OTEyJTJDJTIwJTIybGFiZWwlMjIlM0ElMjAlMjJmcmVlemUlMjIlN0QlMkMlMEElMjAlMjAlMjAlMjAlN0IlMjJzY29yZSUyMiUzQSUyMDAuMDAzMjc4NzQ5Mjk2NDQxNjc0MiUyQyUyMCUyMmxhYmVsJTIyJTNBJTIwJTIyY2FyZF9pc3N1ZXMlMjIlN0QlMkMlMEElMjAlMjAlMjAlMjAlN0IlMjJzY29yZSUyMiUzQSUyMDAuMDAxOTQxNDQ0NTg1MDk5ODE2MyUyQyUyMCUyMmxhYmVsJTIyJTNBJTIwJTIyYWJyb2FkJTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTdCJTIyc2NvcmUlMjIlM0ElMjAwLjAwMDgzNzg2OTM2MDExMTY1MzglMkMlMjAlMjJsYWJlbCUyMiUzQSUyMCUyMmhpZ2hfdmFsdWVfcGF5bWVudCUyMiU3RCUyQyUwQSU1RA==",highlighted:`[
    {<span class="hljs-string">&quot;score&quot;</span>: <span class="hljs-number">0.9631525278091431</span>, <span class="hljs-string">&quot;label&quot;</span>: <span class="hljs-string">&quot;pay_bill&quot;</span>},
    {<span class="hljs-string">&quot;score&quot;</span>: <span class="hljs-number">0.02819698303937912</span>, <span class="hljs-string">&quot;label&quot;</span>: <span class="hljs-string">&quot;freeze&quot;</span>},
    {<span class="hljs-string">&quot;score&quot;</span>: <span class="hljs-number">0.0032787492964416742</span>, <span class="hljs-string">&quot;label&quot;</span>: <span class="hljs-string">&quot;card_issues&quot;</span>},
    {<span class="hljs-string">&quot;score&quot;</span>: <span class="hljs-number">0.0019414445850998163</span>, <span class="hljs-string">&quot;label&quot;</span>: <span class="hljs-string">&quot;abroad&quot;</span>},
    {<span class="hljs-string">&quot;score&quot;</span>: <span class="hljs-number">0.0008378693601116538</span>, <span class="hljs-string">&quot;label&quot;</span>: <span class="hljs-string">&quot;high_value_payment&quot;</span>},
]`}}),Me=new D({}),Te=new g({props:{code:"c3BlZWNoX2NvbW1hbmRzJTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMCUyMnNwZWVjaF9jb21tYW5kcyUyMiUyQyUyMCUyMnYwLjAyJTIyJTJDJTIwc3BsaXQlM0QlMjJ2YWxpZGF0aW9uJTIyJTJDJTIwc3RyZWFtaW5nJTNEVHJ1ZSUwQSklMEFzYW1wbGUlMjAlM0QlMjBuZXh0KGl0ZXIoc3BlZWNoX2NvbW1hbmRzKSk=",highlighted:`speech_commands = load_dataset(
    <span class="hljs-string">&quot;speech_commands&quot;</span>, <span class="hljs-string">&quot;v0.02&quot;</span>, split=<span class="hljs-string">&quot;validation&quot;</span>, streaming=<span class="hljs-literal">True</span>
)
sample = <span class="hljs-built_in">next</span>(<span class="hljs-built_in">iter</span>(speech_commands))`}}),Ee=new g({props:{code:"Y2xhc3NpZmllciUyMCUzRCUyMHBpcGVsaW5lKCUwQSUyMCUyMCUyMCUyMCUyMmF1ZGlvLWNsYXNzaWZpY2F0aW9uJTIyJTJDJTIwbW9kZWwlM0QlMjJNSVQlMkZhc3QtZmluZXR1bmVkLXNwZWVjaC1jb21tYW5kcy12MiUyMiUwQSklMEFjbGFzc2lmaWVyKHNhbXBsZSU1QiUyMmF1ZGlvJTIyJTVEKQ==",highlighted:`classifier = pipeline(
    <span class="hljs-string">&quot;audio-classification&quot;</span>, model=<span class="hljs-string">&quot;MIT/ast-finetuned-speech-commands-v2&quot;</span>
)
classifier(sample[<span class="hljs-string">&quot;audio&quot;</span>])`}}),$e=new g({props:{code:"JTVCJTdCJ3Njb3JlJyUzQSUyMDAuOTk5OTg5MjcxMTYzOTQwNCUyQyUyMCdsYWJlbCclM0ElMjAnYmFja3dhcmQnJTdEJTJDJTBBJTIwJTdCJ3Njb3JlJyUzQSUyMDEuNzUwNDg4ODc3NDA1NTg3MWUtMDYlMkMlMjAnbGFiZWwnJTNBJTIwJ2hhcHB5JyU3RCUyQyUwQSUyMCU3QidzY29yZSclM0ElMjA2LjcwMzA0MDE4NTEyOTc5NGUtMDclMkMlMjAnbGFiZWwnJTNBJTIwJ2ZvbGxvdyclN0QlMkMlMEElMjAlN0Inc2NvcmUnJTNBJTIwNS44MDU4ODQ0ODQyODg5ODFlLTA3JTJDJTIwJ2xhYmVsJyUzQSUyMCdzdG9wJyU3RCUyQyUwQSUyMCU3QidzY29yZSclM0ElMjA1LjYxNDU0NjY5NDIzMjU1OGUtMDclMkMlMjAnbGFiZWwnJTNBJTIwJ3VwJyU3RCU1RA==",highlighted:`[{<span class="hljs-symbol">&#x27;score</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-number">0.9999892711639404</span>, <span class="hljs-symbol">&#x27;label</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-symbol">&#x27;backward</span>&#x27;},
 {<span class="hljs-symbol">&#x27;score</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-number">1.7504888774055871</span>e-06, <span class="hljs-symbol">&#x27;label</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-symbol">&#x27;happy</span>&#x27;},
 {<span class="hljs-symbol">&#x27;score</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-number">6.703040185129794</span>e-07, <span class="hljs-symbol">&#x27;label</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-symbol">&#x27;follow</span>&#x27;},
 {<span class="hljs-symbol">&#x27;score</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-number">5.805884484288981</span>e-07, <span class="hljs-symbol">&#x27;label</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-symbol">&#x27;stop</span>&#x27;},
 {<span class="hljs-symbol">&#x27;score</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-number">5.614546694232558</span>e-07, <span class="hljs-symbol">&#x27;label</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-symbol">&#x27;up</span>&#x27;}]`}}),xe=new g({props:{code:"ZnJvbSUyMElQeXRob24uZGlzcGxheSUyMGltcG9ydCUyMEF1ZGlvJTBBJTBBY2xhc3NpZmllcihzYW1wbGUlNUIlMjJhdWRpbyUyMiU1RC5jb3B5KCkpJTBBQXVkaW8oc2FtcGxlJTVCJTIyYXVkaW8lMjIlNUQlNUIlMjJhcnJheSUyMiU1RCUyQyUyMHJhdGUlM0RzYW1wbGUlNUIlMjJhdWRpbyUyMiU1RCU1QiUyMnNhbXBsaW5nX3JhdGUlMjIlNUQp",highlighted:`from IPython<span class="hljs-selector-class">.display</span> import Audio

<span class="hljs-function"><span class="hljs-title">classifier</span><span class="hljs-params">(sample[<span class="hljs-string">&quot;audio&quot;</span>].copy()</span></span>)
<span class="hljs-function"><span class="hljs-title">Audio</span><span class="hljs-params">(sample[<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;array&quot;</span>], rate=sample[<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;sampling_rate&quot;</span>])</span></span>`}}),We=new D({}),Ae=new D({}),De=new g({props:{code:"ZmxldXJzJTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMmdvb2dsZSUyRmZsZXVycyUyMiUyQyUyMCUyMmFsbCUyMiUyQyUyMHNwbGl0JTNEJTIydmFsaWRhdGlvbiUyMiUyQyUyMHN0cmVhbWluZyUzRFRydWUpJTBBc2FtcGxlJTIwJTNEJTIwbmV4dChpdGVyKGZsZXVycykp",highlighted:`fleurs = load_dataset(<span class="hljs-string">&quot;google/fleurs&quot;</span>, <span class="hljs-string">&quot;all&quot;</span>, split=<span class="hljs-string">&quot;validation&quot;</span>, streaming=<span class="hljs-literal">True</span>)
sample = <span class="hljs-built_in">next</span>(<span class="hljs-built_in">iter</span>(fleurs))`}}),Qe=new g({props:{code:"Y2xhc3NpZmllciUyMCUzRCUyMHBpcGVsaW5lKCUwQSUyMCUyMCUyMCUyMCUyMmF1ZGlvLWNsYXNzaWZpY2F0aW9uJTIyJTJDJTIwbW9kZWwlM0QlMjJzYW5jaGl0LWdhbmRoaSUyRndoaXNwZXItbWVkaXVtLWZsZXVycy1sYW5nLWlkJTIyJTBBKQ==",highlighted:`classifier = pipeline(
    <span class="hljs-string">&quot;audio-classification&quot;</span>, model=<span class="hljs-string">&quot;sanchit-gandhi/whisper-medium-fleurs-lang-id&quot;</span>
)`}}),Ge=new g({props:{code:"Y2xhc3NpZmllcihzYW1wbGUlNUIlMjJhdWRpbyUyMiU1RCk=",highlighted:'classifier(sample[<span class="hljs-string">&quot;audio&quot;</span>])'}}),Ye=new g({props:{code:"JTVCJTdCJ3Njb3JlJyUzQSUyMDAuOTk5OTMzMDA0Mzc5MjcyNSUyQyUyMCdsYWJlbCclM0ElMjAnQWZyaWthYW5zJyU3RCUyQyUwQSUyMCU3QidzY29yZSclM0ElMjA3LjA5MzAyMzY2ODg1ODIyM2UtMDYlMkMlMjAnbGFiZWwnJTNBJTIwJ05vcnRoZXJuLVNvdGhvJyU3RCUyQyUwQSUyMCU3QidzY29yZSclM0ElMjA0LjI2OTE0OTQ4NTQ4MDczOWUtMDYlMkMlMjAnbGFiZWwnJTNBJTIwJ0ljZWxhbmRpYyclN0QlMkMlMEElMjAlN0Inc2NvcmUnJTNBJTIwMy4yNjYxMTQxNjMxMjUxNjY3ZS0wNiUyQyUyMCdsYWJlbCclM0ElMjAnRGFuaXNoJyU3RCUyQyUwQSUyMCU3QidzY29yZSclM0ElMjAzLjI1ODA3MjQxMDk3MjA5MDRlLTA2JTJDJTIwJ2xhYmVsJyUzQSUyMCdDYW50b25lc2UlMjBDaGluZXNlJyU3RCU1RA==",highlighted:`[{<span class="hljs-symbol">&#x27;score</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-number">0.9999330043792725</span>, <span class="hljs-symbol">&#x27;label</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-symbol">&#x27;Afrikaans</span>&#x27;},
 {<span class="hljs-symbol">&#x27;score</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-number">7.093023668858223</span>e-06, <span class="hljs-symbol">&#x27;label</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-symbol">&#x27;Northern-Sotho</span>&#x27;},
 {<span class="hljs-symbol">&#x27;score</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-number">4.269149485480739</span>e-06, <span class="hljs-symbol">&#x27;label</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-symbol">&#x27;Icelandic</span>&#x27;},
 {<span class="hljs-symbol">&#x27;score</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-number">3.2661141631251667</span>e-06, <span class="hljs-symbol">&#x27;label</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-symbol">&#x27;Danish</span>&#x27;},
 {<span class="hljs-symbol">&#x27;score</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-number">3.2580724109720904</span>e-06, <span class="hljs-symbol">&#x27;label</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-symbol">&#x27;Cantonese</span> Chinese&#x27;}]`}}),Re=new D({}),Fe=new g({props:{code:"ZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJhc2hyYXElMkZlc2M1MCUyMiUyQyUyMHNwbGl0JTNEJTIydHJhaW4lMjIlMkMlMjBzdHJlYW1pbmclM0RUcnVlKSUwQWF1ZGlvX3NhbXBsZSUyMCUzRCUyMG5leHQoaXRlcihkYXRhc2V0KSklNUIlMjJhdWRpbyUyMiU1RCU1QiUyMmFycmF5JTIyJTVE",highlighted:`dataset = load_dataset(<span class="hljs-string">&quot;ashraq/esc50&quot;</span>, split=<span class="hljs-string">&quot;train&quot;</span>, streaming=<span class="hljs-literal">True</span>)
audio_sample = <span class="hljs-built_in">next</span>(<span class="hljs-built_in">iter</span>(dataset))[<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;array&quot;</span>]`}}),He=new g({props:{code:"Y2FuZGlkYXRlX2xhYmVscyUyMCUzRCUyMCU1QiUyMlNvdW5kJTIwb2YlMjBhJTIwZG9nJTIyJTJDJTIwJTIyU291bmQlMjBvZiUyMHZhY3V1bSUyMGNsZWFuZXIlMjIlNUQ=",highlighted:'candidate_labels = [<span class="hljs-string">&quot;Sound of a dog&quot;</span>, <span class="hljs-string">&quot;Sound of vacuum cleaner&quot;</span>]'}}),Be=new g({props:{code:"Y2xhc3NpZmllciUyMCUzRCUyMHBpcGVsaW5lKCUwQSUyMCUyMCUyMCUyMHRhc2slM0QlMjJ6ZXJvLXNob3QtYXVkaW8tY2xhc3NpZmljYXRpb24lMjIlMkMlMjBtb2RlbCUzRCUyMmxhaW9uJTJGY2xhcC1odHNhdC11bmZ1c2VkJTIyJTBBKSUwQWNsYXNzaWZpZXIoYXVkaW9fc2FtcGxlJTJDJTIwY2FuZGlkYXRlX2xhYmVscyUzRGNhbmRpZGF0ZV9sYWJlbHMp",highlighted:`classifier = pipeline(
    task=<span class="hljs-string">&quot;zero-shot-audio-classification&quot;</span>, model=<span class="hljs-string">&quot;laion/clap-htsat-unfused&quot;</span>
)
classifier(audio_sample, candidate_labels=candidate_labels)`}}),Ve=new g({props:{code:"JTVCJTdCJ3Njb3JlJyUzQSUyMDAuOTk5NzI0MjA5MzA4NjI0MyUyQyUyMCdsYWJlbCclM0ElMjAnU291bmQlMjBvZiUyMGElMjBkb2cnJTdEJTJDJTIwJTdCJ3Njb3JlJyUzQSUyMDAuMDAwMjc1ODMyMzk3MTY0Nzc2OSUyQyUyMCdsYWJlbCclM0ElMjAnU291bmQlMjBvZiUyMHZhY3V1bSUyMGNsZWFuZXInJTdEJTVE",highlighted:'[{<span class="hljs-symbol">&#x27;score</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-number">0.9997242093086243</span>, <span class="hljs-symbol">&#x27;label</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-symbol">&#x27;Sound</span> of a dog&#x27;}, {<span class="hljs-symbol">&#x27;score</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-number">0.0002758323971647769</span>, <span class="hljs-symbol">&#x27;label</span><span class="hljs-symbol">&#x27;:</span> <span class="hljs-symbol">&#x27;Sound</span> of vacuum cleaner&#x27;}]'}}),Oe=new g({props:{code:"QXVkaW8oYXVkaW9fc2FtcGxlJTJDJTIwcmF0ZSUzRDE2MDAwKQ==",highlighted:'Audio(audio_sample, rate=<span class="hljs-number">16000</span>)'}}),Xe=new D({}),{c(){$=l("meta"),Tt=c(),x=l("h1"),Z=l("a"),Cs=l("span"),u(he.$$.fragment),go=c(),Is=l("span"),vo=r("Pre-trained models and datasets for audio classification"),Ut=c(),v=l("p"),Mo=r(`The Hugging Face Hub is home to over 500 pre-trained models for audio classification. In this section, we\u2019ll go through
some of the most common audio classification tasks and suggest appropriate pre-trained models for each. Using the `),Ns=l("code"),ko=r("pipeline()"),jo=r(`
class, switching between models and tasks is straightforward - once you know how to use `),Ss=l("code"),To=r("pipeline()"),Uo=r(` for one model, you\u2019ll
be able to use it for any model on the Hub no code changes! This makes experimenting with the `),Ws=l("code"),Jo=r("pipeline()"),Eo=r(` class extremely
fast, allowing you to quickly select the best pre-trained model for your needs.`),Jt=c(),Q=l("p"),$o=r(`Before we jump into the various audio classification problems, let\u2019s quickly recap the transformer architectures typically
used. The standard audio classification architecture is motivated by the nature of the task; we want to transform a sequence
of audio inputs (i.e. our input audio array) into a single class label prediction. Encoder-only models first map the input
audio sequence into a sequence of hidden-state representations by passing the inputs through a transformer block. The
sequence of hidden-state representations is then mapped to a class label output by taking the mean over the hidden-states,
and passing the resulting vector through a linear classification layer. Hence, there is a preference for `),As=l("em"),xo=r("encoder-only"),_o=r(`
models for audio classification.`),Et=c(),k=l("p"),Co=r("Decoder-only models introduce unnecessary complexity to the task, since they assume that the outputs can also be a "),qs=l("em"),Io=r("sequence"),No=r(`
of predictions (rather than a single class label prediction), and so generate multiple outputs. Therefore, they have slower
inference speed and tend not to be used. Encoder-decoder models are largely omitted for the same reason. These architecture
choices are analogous to those in NLP, where encoder-only models such as `),ce=l("a"),So=r("BERT"),Wo=r(`
are favoured for sequence classification tasks, and decoder-only models such as GPT reserved for sequence generation tasks.`),$t=c(),Ke=l("p"),Ao=r(`Now that we\u2019ve recapped the standard transformer architecture for audio classification, let\u2019s jump into the different
subsets of audio classification and cover the most popular models!`),xt=c(),_=l("h2"),G=l("a"),Ds=l("span"),u(pe.$$.fragment),qo=c(),Zs=l("span"),Do=r("\u{1F917} Transformers Installation"),_t=c(),j=l("p"),Zo=r("At the time of writing, the latest updates required for audio classification pipeline are only on the "),Qs=l("code"),Qo=r("main"),Go=r(` version of
the \u{1F917} Transformers repository, rather than the latest PyPi version. To make sure we have these updates locally, we\u2019ll
install Transformers from the `),Gs=l("code"),Yo=r("main"),Po=r(" branch with the following command:"),Ct=c(),u(de.$$.fragment),It=c(),C=l("h2"),Y=l("a"),Ys=l("span"),u(ue.$$.fragment),Ro=c(),Ps=l("span"),zo=r("Keyword Spotting"),Nt=c(),es=l("p"),Lo=r(`Keyword spotting (KWS) is the task of identifying a keyword in a spoken utterance. The set of possible keywords forms the
set of predicted class labels. Hence, to use a pre-trained keyword spotting model, you should ensure that your keywords
match those that the model was pre-trained on. Below, we\u2019ll introduce two datasets and models for keyword spotting.`),St=c(),I=l("h3"),P=l("a"),Rs=l("span"),u(fe.$$.fragment),Fo=c(),zs=l("span"),Ho=r("Minds-14"),Wt=c(),T=l("p"),Bo=r("Let\u2019s go ahead and use the same "),me=l("a"),Vo=r("MINDS-14"),Oo=r(` dataset that you have explored
in the previous unit. If you recall, MINDS-14 contains recordings of people asking an e-banking system questions in several
languages and dialects, and has the `),Ls=l("code"),Xo=r("intent_class"),Ko=r(" for each recording. We can classify the recordings by intent of the call."),At=c(),u(ye.$$.fragment),qt=c(),R=l("p"),el=r("We\u2019ll load the checkpoint "),we=l("a"),Fs=l("code"),sl=r('"anton-l/xtreme_s_xlsr_300m_minds14"'),tl=r(`,
which is an XLS-R model fine-tuned on MINDS-14 for approximately 50 epochs. It achieves 90% accuracy over all languages
from MINDS-14 on the evaluation set.`),Dt=c(),u(be.$$.fragment),Zt=c(),ss=l("p"),al=r("Finally, we can pass a sample to the classification pipeline to make a prediction:"),Qt=c(),u(ge.$$.fragment),Gt=c(),ts=l("p"),Hs=l("strong"),ol=r("Output:"),Yt=c(),u(ve.$$.fragment),Pt=c(),as=l("p"),ll=r(`Great! We\u2019ve identified that the intent of the call was paying a bill, with probability 96%. You can imagine this kind of
keyword spotting system being used as the first stage of an automated call centre, where we want to categorise incoming
customer calls based on their query and offer them contextualised support accordingly.`),Rt=c(),N=l("h3"),z=l("a"),Bs=l("span"),u(Me.$$.fragment),nl=c(),Vs=l("span"),il=r("Speech Commands"),zt=c(),os=l("p"),rl=r(`Speech Commands is a dataset of spoken words designed to evaluate audio classification models on simple command words.
The dataset consists of 15 classes of keywords, a class for silence, and an unknown class to include the false positive.
The 15 keywords are single words that would typically be used in on-device settings to control basic tasks or launch
other processes.`),Lt=c(),ls=l("p"),hl=r(`A similar model is running continuously on your mobile phone. Here, instead of having single command words, we have
\u2018wake words\u2019 specific to your device, such as \u201CHey Google\u201D or \u201CHey Siri\u201D. When the audio classification model detects
these wake words, it triggers your phone to start listening to the microphone and transcribe your speech using a speech
recognition model.`),Ft=c(),ns=l("p"),cl=r(`The audio classification model is much smaller and lighter than the speech recognition model, often only several millions
of parameters compared to several hundred millions for speech recognition. Thus, it can be run continuously on your device
without draining your battery! Only when the wake word is detected is the larger speech recognition model launched, and
afterwards it is shut down again. We\u2019ll cover transformer models for speech recognition in the next Unit, so by the end
of the course you should have the tools you need to build your own voice activated assistant!`),Ht=c(),L=l("p"),pl=r(`As with any dataset on the Hugging Face Hub, we can get a feel for the kind of audio data it has present without downloading
or committing it memory. After heading to the `),ke=l("a"),dl=r("Speech Commands\u2019 dataset card"),ul=r(`
on the Hub, we can use the Dataset Viewer to scroll through the first 100 samples of the dataset, listening to the audio
files and checking any other metadata information:`),Bt=c(),je=l("div"),is=l("img"),Vt=c(),rs=l("p"),fl=r(`The Dataset Preview is a brilliant way of experiencing audio datasets before committing to using them. You can pick any
dataset on the Hub, scroll through the samples and listen to the audio for the different subsets and splits, gauging whether
it\u2019s the right dataset for your needs. Once you\u2019ve selected a dataset, it\u2019s trivial to load the data so that you can start
using it.`),Ot=c(),hs=l("p"),ml=r("Let\u2019s do exactly that and load a sample of the Speech Commands dataset using streaming mode:"),Xt=c(),u(Te.$$.fragment),Kt=c(),U=l("p"),yl=r("We\u2019ll load an official "),Ue=l("a"),wl=r("Audio Spectrogram Transformer"),bl=r(`
checkpoint fine-tuned on the Speech Commands dataset, under the namespace `),Je=l("a"),Os=l("code"),gl=r('"MIT/ast-finetuned-speech-commands-v2"'),vl=r(":"),ea=c(),u(Ee.$$.fragment),sa=c(),cs=l("p"),Xs=l("strong"),Ml=r("Output:"),ta=c(),u($e.$$.fragment),aa=c(),ps=l("p"),kl=r(`Cool! Looks like the example contains the word \u201Cbackward\u201D with high probability. We can take a listen to the sample
and verify this is correct:`),oa=c(),u(xe.$$.fragment),la=c(),_e=l("p"),jl=r(`Now, you might be wondering how we\u2019ve selected these pre-trained models to show you in these audio classification examples.
The truth is, finding pre-trained models for your dataset and task is very straightforward! The first thing we need to do
is head to the Hugging Face Hub and click on the \u201CModels\u201D tab: `),Ce=l("a"),Tl=r("https://huggingface.co/models"),na=c(),ds=l("p"),Ul=r("This is going to bring up all the models on the Hugging Face Hub, sorted by downloads in the past 30 days:"),ia=c(),Ie=l("div"),Ks=l("img"),ra=c(),us=l("p"),Jl=r(`You\u2019ll notice on the left-hand side that we have a selection of tabs that we can select to filter models by task, library,
dataset, etc. Scroll down and select the task \u201CAudio Classification\u201D from the list of audio tasks:`),ha=c(),Ne=l("div"),et=l("img"),ca=c(),F=l("p"),El=r(`We\u2019re now presented with the sub-set of 500+ audio classification models on the Hub. To further refine this selection, we
can filter models by dataset. Click on the tab \u201CDatasets\u201D, and in the search box type \u201Cspeech_commands\u201D. As you begin typing,
you\u2019ll see the selection for `),st=l("code"),$l=r("speech_commands"),xl=r(` appear underneath the search tab. You can click this button to filter all
audio classification models to those fine-tuned on the Speech Commands dataset:`),pa=c(),Se=l("div"),tt=l("img"),da=c(),fs=l("p"),_l=r(`Great! We see that we have 6 pre-trained models available to us for this specific dataset and task. You\u2019ll recognise the
first of these models as the Audio Spectrogram Transformer checkpoint that we used in the previous example. This process
of filtering models on the Hub is exactly how we went about selecting the checkpoint to show you!`),ua=c(),S=l("h2"),H=l("a"),at=l("span"),u(We.$$.fragment),Cl=c(),ot=l("span"),Il=r("Language Identification"),fa=c(),ms=l("p"),Nl=r(`Language identification (LID) is the task of identifying the language spoken in an audio sample from a list of candidate
languages. LID can form an important part in many speech pipelines. For example, given an audio sample in an unknown language,
an LID model can be used to categorise the language(s) spoken in the audio sample, and then select an appropriate speech
recognition model trained on that language to transcribe the audio.`),ma=c(),W=l("h3"),B=l("a"),lt=l("span"),u(Ae.$$.fragment),Sl=c(),nt=l("span"),Wl=r("FLEURS"),ya=c(),V=l("p"),Al=r(`FLEURS (Few-shot Learning Evaluation of Universal Representations of Speech) is a dataset for evaluating speech recognition
systems in 102 languages, including many that are classified as \u2018low-resource\u2019. Take a look at the FLEURS dataset
card on the Hub and explore the different languages that are present: `),qe=l("a"),ql=r("google/fleurs"),Dl=r(`.
Can you find your native tongue here? If not, what\u2019s the most closely related language?`),wa=c(),ys=l("p"),Zl=r("Let\u2019s load up a sample from the validation split of the FLEURS dataset using streaming mode:"),ba=c(),u(De.$$.fragment),ga=c(),O=l("p"),Ql=r("Great! Now we can load our audio classification model. For this, we\u2019ll use a version of "),Ze=l("a"),Gl=r("Whisper"),Yl=r(`
fine-tuned on the FLEURS dataset, which is currently the most performant LID model on the Hub:`),va=c(),u(Qe.$$.fragment),Ma=c(),ws=l("p"),Pl=r("We can then pass the audio through our classifier and generate a prediction:"),ka=c(),u(Ge.$$.fragment),ja=c(),bs=l("p"),it=l("strong"),Rl=r("Output:"),Ta=c(),u(Ye.$$.fragment),Ua=c(),X=l("p"),zl=r(`We can see that the model predicted the audio was in Afrikaans with extremely high probability (near 1). The FLEURS dataset
contains audio data from a wide range of languages - we can see that possible class labels include Northern-Sotho, Icelandic,
Danish and Cantonese Chinese amongst others. You can find the full list of languages on the dataset card here: `),Pe=l("a"),Ll=r("google/fleurs"),Fl=r("."),Ja=c(),gs=l("p"),Hl=r("Over to you! What other checkpoints can you find for FLEURS LID on the Hub? What transformer models are they using under-the-hood?"),Ea=c(),A=l("h2"),K=l("a"),rt=l("span"),u(Re.$$.fragment),Bl=c(),ht=l("span"),Vl=r("Zero-Shot Audio Classification"),$a=c(),ee=l("p"),Ol=r("In the traditional paradigm for audio classification, the model predicts a class label from a "),ct=l("em"),Xl=r("pre-defined"),Kl=r(` set of
possible classes. This poses a barrier to using pre-trained models for audio classification, since the label set of the
pre-trained model must match that of the downstream task. For the previous example of LID, the model must predict one of
the 102 langauge classes on which it was trained. If the downstream task actually requires 110 languages, the model would
not be able to predict 8 of the 110 languages, and so would require re-training to achieve full coverage. This limits the
effectiveness of transfer learning for audio classification tasks.`),xa=c(),vs=l("p"),en=r(`Zero-shot audio classification is a method for taking a pre-trained audio classification model trained on a set of labelled
examples and enabling it to be able to classify new examples from previously unseen classes. Let\u2019s take a look at how we
can achieve this!`),_a=c(),J=l("p"),sn=r("Currently, \u{1F917} Transformers supports one kind of model for zero-shot audio classification: the "),ze=l("a"),tn=r("CLAP model"),an=r(`.
CLAP is a transformer-based model that takes both audio and text as inputs, and computes the `),pt=l("em"),on=r("similarity"),ln=r(` between the two.
If we pass a text input that strongly correlates with an audio input, we\u2019ll get a high similarity score. Conversely, passing
a text input that is completely unrelated to the audio input will return a low similarity.`),Ca=c(),Ms=l("p"),nn=r(`We can use this similarity prediction for zero-shot audio classification by passing one audio input to the model and
multiple candidate labels. The model will return a similarity score for each of the candidate labels, and we can pick the
one that has the highest score as our prediction.`),Ia=c(),se=l("p"),rn=r("Let\u2019s take an example where we use one audio input from the "),Le=l("a"),hn=r("Environmental Speech Challenge (ESC)"),cn=r(`
dataset:`),Na=c(),u(Fe.$$.fragment),Sa=c(),te=l("p"),pn=r(`We then define our candidate labels, which form the set of possible classification labels. The model will return a
classification probability for each of the labels we define. This means we need to know `),dt=l("em"),dn=r("a-priori"),un=r(` the set of possible
labels in our classification problem, such that the correct label is contained within the set and is thus assigned a
valid probability score. Note that we can either pass the full set of labels to the model, or a hand-selected subset
that we believe contains the correct label. Passing the full set of labels is going to be more exhaustive, but comes
at the expense of lower classification accuracy since the classification space is larger (provided the correct label is
our chosen subset of labels):`),Wa=c(),u(He.$$.fragment),Aa=c(),ae=l("p"),fn=r("We can run both through the model to find the candidate label that is "),ut=l("em"),mn=r("most similar"),yn=r(" to the audio input:"),qa=c(),u(Be.$$.fragment),Da=c(),ks=l("p"),ft=l("strong"),wn=r("Output:"),Za=c(),u(Ve.$$.fragment),Qa=c(),js=l("p"),bn=r(`Alright! The model seems pretty confident we have the sound of a dog - it predicts it with 99.96% probability, so we\u2019ll
take that as our prediction. Let\u2019s confirm whether we were right by listening to the audio sample (don\u2019t turn up your
volume too high or else you might get a jump!):`),Ga=c(),u(Oe.$$.fragment),Ya=c(),Ts=l("p"),gn=r(`Perfect! We have the sound of a dog barking \u{1F415}, which aligns with the model\u2019s prediction. Have a play with different audio
samples and different candidate labels - can you define a set of labels that give good generalisation across the ESC
dataset? Hint: think about where you could find information on the possible sounds in ESC and construct your labels accordingly!`),Pa=c(),M=l("p"),vn=r("You might be wondering why we don\u2019t use the zero-shot audio classification pipeline for "),mt=l("strong"),Mn=r("all"),kn=r(` audio classification tasks?
It seems as though we can make predictions for any audio classification problem by defining appropriate class labels `),yt=l("em"),jn=r("a-priori"),Tn=r(`,
thus bypassing the constraint that our classification task needs to match the labels that the model was pre-trained on.
This comes down to the nature of the CLAP model used in the zero-shot pipeline: CLAP is pre-trained on `),wt=l("em"),Un=r("generic"),Jn=r(` audio
classification data, similar to the environmental sounds in the ESC dataset, rather than specifically speech data, like
we had in the LID task. If you gave it speech in English and speech in Spanish, CLAP would know that both examples were
speech data \u{1F5E3}\uFE0F But it wouldn\u2019t be able to differentiate between the languages in the same way a dedicated LID model is
able to.`),Ra=c(),q=l("h2"),oe=l("a"),bt=l("span"),u(Xe.$$.fragment),En=c(),gt=l("span"),$n=r("What next?"),za=c(),le=l("p"),xn=r(`We\u2019ve covered a number of different audio classification tasks and presented the most relevant datasets and models that
you can download from the Hugging Face Hub and use in just several lines of code using the `),vt=l("code"),_n=r("pipeline()"),Cn=r(` class. These tasks
included keyword spotting, language identification and zero-shot audio classification.`),La=c(),E=l("p"),In=r("But what if we want to do something "),Mt=l("strong"),Nn=r("new"),Sn=r(`? We\u2019ve worked extensively on speech processing tasks, but this is only one
aspect of audio classification. Another popular field of audio processing involves `),kt=l("strong"),Wn=r("music"),An=r(`. While music has inherently
different features to speech, many of the same principles that we\u2019ve learnt about already can be applied to music.`),Fa=c(),ne=l("p"),qn=r(`In the following section, we\u2019ll go through a step-by-step guide on how you can fine-tune a transformer model with \u{1F917}
Transformers on the task of music classification. By the end of it, you\u2019ll have a fine-tuned checkpoint that you can plug
into the `),jt=l("code"),Dn=r("pipeline()"),Zn=r(" class, enabling you to classify songs in exactly the same way that we\u2019ve classified speech here!"),this.h()},l(e){const a=Wr('[data-svelte="svelte-1phssyn"]',document.head);$=n(a,"META",{name:!0,content:!0}),a.forEach(s),Tt=p(e),x=n(e,"H1",{class:!0});var Ba=i(x);Z=n(Ba,"A",{id:!0,class:!0,href:!0});var Ln=i(Z);Cs=n(Ln,"SPAN",{});var Fn=i(Cs);f(he.$$.fragment,Fn),Fn.forEach(s),Ln.forEach(s),go=p(Ba),Is=n(Ba,"SPAN",{});var Hn=i(Is);vo=h(Hn,"Pre-trained models and datasets for audio classification"),Hn.forEach(s),Ba.forEach(s),Ut=p(e),v=n(e,"P",{});var ie=i(v);Mo=h(ie,`The Hugging Face Hub is home to over 500 pre-trained models for audio classification. In this section, we\u2019ll go through
some of the most common audio classification tasks and suggest appropriate pre-trained models for each. Using the `),Ns=n(ie,"CODE",{});var Bn=i(Ns);ko=h(Bn,"pipeline()"),Bn.forEach(s),jo=h(ie,`
class, switching between models and tasks is straightforward - once you know how to use `),Ss=n(ie,"CODE",{});var Vn=i(Ss);To=h(Vn,"pipeline()"),Vn.forEach(s),Uo=h(ie,` for one model, you\u2019ll
be able to use it for any model on the Hub no code changes! This makes experimenting with the `),Ws=n(ie,"CODE",{});var On=i(Ws);Jo=h(On,"pipeline()"),On.forEach(s),Eo=h(ie,` class extremely
fast, allowing you to quickly select the best pre-trained model for your needs.`),ie.forEach(s),Jt=p(e),Q=n(e,"P",{});var Va=i(Q);$o=h(Va,`Before we jump into the various audio classification problems, let\u2019s quickly recap the transformer architectures typically
used. The standard audio classification architecture is motivated by the nature of the task; we want to transform a sequence
of audio inputs (i.e. our input audio array) into a single class label prediction. Encoder-only models first map the input
audio sequence into a sequence of hidden-state representations by passing the inputs through a transformer block. The
sequence of hidden-state representations is then mapped to a class label output by taking the mean over the hidden-states,
and passing the resulting vector through a linear classification layer. Hence, there is a preference for `),As=n(Va,"EM",{});var Xn=i(As);xo=h(Xn,"encoder-only"),Xn.forEach(s),_o=h(Va,`
models for audio classification.`),Va.forEach(s),Et=p(e),k=n(e,"P",{});var Us=i(k);Co=h(Us,"Decoder-only models introduce unnecessary complexity to the task, since they assume that the outputs can also be a "),qs=n(Us,"EM",{});var Kn=i(qs);Io=h(Kn,"sequence"),Kn.forEach(s),No=h(Us,`
of predictions (rather than a single class label prediction), and so generate multiple outputs. Therefore, they have slower
inference speed and tend not to be used. Encoder-decoder models are largely omitted for the same reason. These architecture
choices are analogous to those in NLP, where encoder-only models such as `),ce=n(Us,"A",{href:!0,rel:!0});var ei=i(ce);So=h(ei,"BERT"),ei.forEach(s),Wo=h(Us,`
are favoured for sequence classification tasks, and decoder-only models such as GPT reserved for sequence generation tasks.`),Us.forEach(s),$t=p(e),Ke=n(e,"P",{});var si=i(Ke);Ao=h(si,`Now that we\u2019ve recapped the standard transformer architecture for audio classification, let\u2019s jump into the different
subsets of audio classification and cover the most popular models!`),si.forEach(s),xt=p(e),_=n(e,"H2",{class:!0});var Oa=i(_);G=n(Oa,"A",{id:!0,class:!0,href:!0});var ti=i(G);Ds=n(ti,"SPAN",{});var ai=i(Ds);f(pe.$$.fragment,ai),ai.forEach(s),ti.forEach(s),qo=p(Oa),Zs=n(Oa,"SPAN",{});var oi=i(Zs);Do=h(oi,"\u{1F917} Transformers Installation"),oi.forEach(s),Oa.forEach(s),_t=p(e),j=n(e,"P",{});var Js=i(j);Zo=h(Js,"At the time of writing, the latest updates required for audio classification pipeline are only on the "),Qs=n(Js,"CODE",{});var li=i(Qs);Qo=h(li,"main"),li.forEach(s),Go=h(Js,` version of
the \u{1F917} Transformers repository, rather than the latest PyPi version. To make sure we have these updates locally, we\u2019ll
install Transformers from the `),Gs=n(Js,"CODE",{});var ni=i(Gs);Yo=h(ni,"main"),ni.forEach(s),Po=h(Js," branch with the following command:"),Js.forEach(s),Ct=p(e),f(de.$$.fragment,e),It=p(e),C=n(e,"H2",{class:!0});var Xa=i(C);Y=n(Xa,"A",{id:!0,class:!0,href:!0});var ii=i(Y);Ys=n(ii,"SPAN",{});var ri=i(Ys);f(ue.$$.fragment,ri),ri.forEach(s),ii.forEach(s),Ro=p(Xa),Ps=n(Xa,"SPAN",{});var hi=i(Ps);zo=h(hi,"Keyword Spotting"),hi.forEach(s),Xa.forEach(s),Nt=p(e),es=n(e,"P",{});var ci=i(es);Lo=h(ci,`Keyword spotting (KWS) is the task of identifying a keyword in a spoken utterance. The set of possible keywords forms the
set of predicted class labels. Hence, to use a pre-trained keyword spotting model, you should ensure that your keywords
match those that the model was pre-trained on. Below, we\u2019ll introduce two datasets and models for keyword spotting.`),ci.forEach(s),St=p(e),I=n(e,"H3",{class:!0});var Ka=i(I);P=n(Ka,"A",{id:!0,class:!0,href:!0});var pi=i(P);Rs=n(pi,"SPAN",{});var di=i(Rs);f(fe.$$.fragment,di),di.forEach(s),pi.forEach(s),Fo=p(Ka),zs=n(Ka,"SPAN",{});var ui=i(zs);Ho=h(ui,"Minds-14"),ui.forEach(s),Ka.forEach(s),Wt=p(e),T=n(e,"P",{});var Es=i(T);Bo=h(Es,"Let\u2019s go ahead and use the same "),me=n(Es,"A",{href:!0,rel:!0});var fi=i(me);Vo=h(fi,"MINDS-14"),fi.forEach(s),Oo=h(Es,` dataset that you have explored
in the previous unit. If you recall, MINDS-14 contains recordings of people asking an e-banking system questions in several
languages and dialects, and has the `),Ls=n(Es,"CODE",{});var mi=i(Ls);Xo=h(mi,"intent_class"),mi.forEach(s),Ko=h(Es," for each recording. We can classify the recordings by intent of the call."),Es.forEach(s),At=p(e),f(ye.$$.fragment,e),qt=p(e),R=n(e,"P",{});var eo=i(R);el=h(eo,"We\u2019ll load the checkpoint "),we=n(eo,"A",{href:!0,rel:!0});var yi=i(we);Fs=n(yi,"CODE",{});var wi=i(Fs);sl=h(wi,'"anton-l/xtreme_s_xlsr_300m_minds14"'),wi.forEach(s),yi.forEach(s),tl=h(eo,`,
which is an XLS-R model fine-tuned on MINDS-14 for approximately 50 epochs. It achieves 90% accuracy over all languages
from MINDS-14 on the evaluation set.`),eo.forEach(s),Dt=p(e),f(be.$$.fragment,e),Zt=p(e),ss=n(e,"P",{});var bi=i(ss);al=h(bi,"Finally, we can pass a sample to the classification pipeline to make a prediction:"),bi.forEach(s),Qt=p(e),f(ge.$$.fragment,e),Gt=p(e),ts=n(e,"P",{});var gi=i(ts);Hs=n(gi,"STRONG",{});var vi=i(Hs);ol=h(vi,"Output:"),vi.forEach(s),gi.forEach(s),Yt=p(e),f(ve.$$.fragment,e),Pt=p(e),as=n(e,"P",{});var Mi=i(as);ll=h(Mi,`Great! We\u2019ve identified that the intent of the call was paying a bill, with probability 96%. You can imagine this kind of
keyword spotting system being used as the first stage of an automated call centre, where we want to categorise incoming
customer calls based on their query and offer them contextualised support accordingly.`),Mi.forEach(s),Rt=p(e),N=n(e,"H3",{class:!0});var so=i(N);z=n(so,"A",{id:!0,class:!0,href:!0});var ki=i(z);Bs=n(ki,"SPAN",{});var ji=i(Bs);f(Me.$$.fragment,ji),ji.forEach(s),ki.forEach(s),nl=p(so),Vs=n(so,"SPAN",{});var Ti=i(Vs);il=h(Ti,"Speech Commands"),Ti.forEach(s),so.forEach(s),zt=p(e),os=n(e,"P",{});var Ui=i(os);rl=h(Ui,`Speech Commands is a dataset of spoken words designed to evaluate audio classification models on simple command words.
The dataset consists of 15 classes of keywords, a class for silence, and an unknown class to include the false positive.
The 15 keywords are single words that would typically be used in on-device settings to control basic tasks or launch
other processes.`),Ui.forEach(s),Lt=p(e),ls=n(e,"P",{});var Ji=i(ls);hl=h(Ji,`A similar model is running continuously on your mobile phone. Here, instead of having single command words, we have
\u2018wake words\u2019 specific to your device, such as \u201CHey Google\u201D or \u201CHey Siri\u201D. When the audio classification model detects
these wake words, it triggers your phone to start listening to the microphone and transcribe your speech using a speech
recognition model.`),Ji.forEach(s),Ft=p(e),ns=n(e,"P",{});var Ei=i(ns);cl=h(Ei,`The audio classification model is much smaller and lighter than the speech recognition model, often only several millions
of parameters compared to several hundred millions for speech recognition. Thus, it can be run continuously on your device
without draining your battery! Only when the wake word is detected is the larger speech recognition model launched, and
afterwards it is shut down again. We\u2019ll cover transformer models for speech recognition in the next Unit, so by the end
of the course you should have the tools you need to build your own voice activated assistant!`),Ei.forEach(s),Ht=p(e),L=n(e,"P",{});var to=i(L);pl=h(to,`As with any dataset on the Hugging Face Hub, we can get a feel for the kind of audio data it has present without downloading
or committing it memory. After heading to the `),ke=n(to,"A",{href:!0,rel:!0});var $i=i(ke);dl=h($i,"Speech Commands\u2019 dataset card"),$i.forEach(s),ul=h(to,`
on the Hub, we can use the Dataset Viewer to scroll through the first 100 samples of the dataset, listening to the audio
files and checking any other metadata information:`),to.forEach(s),Bt=p(e),je=n(e,"DIV",{class:!0});var xi=i(je);is=n(xi,"IMG",{src:!0,alt:!0}),xi.forEach(s),Vt=p(e),rs=n(e,"P",{});var _i=i(rs);fl=h(_i,`The Dataset Preview is a brilliant way of experiencing audio datasets before committing to using them. You can pick any
dataset on the Hub, scroll through the samples and listen to the audio for the different subsets and splits, gauging whether
it\u2019s the right dataset for your needs. Once you\u2019ve selected a dataset, it\u2019s trivial to load the data so that you can start
using it.`),_i.forEach(s),Ot=p(e),hs=n(e,"P",{});var Ci=i(hs);ml=h(Ci,"Let\u2019s do exactly that and load a sample of the Speech Commands dataset using streaming mode:"),Ci.forEach(s),Xt=p(e),f(Te.$$.fragment,e),Kt=p(e),U=n(e,"P",{});var $s=i(U);yl=h($s,"We\u2019ll load an official "),Ue=n($s,"A",{href:!0,rel:!0});var Ii=i(Ue);wl=h(Ii,"Audio Spectrogram Transformer"),Ii.forEach(s),bl=h($s,`
checkpoint fine-tuned on the Speech Commands dataset, under the namespace `),Je=n($s,"A",{href:!0,rel:!0});var Ni=i(Je);Os=n(Ni,"CODE",{});var Si=i(Os);gl=h(Si,'"MIT/ast-finetuned-speech-commands-v2"'),Si.forEach(s),Ni.forEach(s),vl=h($s,":"),$s.forEach(s),ea=p(e),f(Ee.$$.fragment,e),sa=p(e),cs=n(e,"P",{});var Wi=i(cs);Xs=n(Wi,"STRONG",{});var Ai=i(Xs);Ml=h(Ai,"Output:"),Ai.forEach(s),Wi.forEach(s),ta=p(e),f($e.$$.fragment,e),aa=p(e),ps=n(e,"P",{});var qi=i(ps);kl=h(qi,`Cool! Looks like the example contains the word \u201Cbackward\u201D with high probability. We can take a listen to the sample
and verify this is correct:`),qi.forEach(s),oa=p(e),f(xe.$$.fragment,e),la=p(e),_e=n(e,"P",{});var Qn=i(_e);jl=h(Qn,`Now, you might be wondering how we\u2019ve selected these pre-trained models to show you in these audio classification examples.
The truth is, finding pre-trained models for your dataset and task is very straightforward! The first thing we need to do
is head to the Hugging Face Hub and click on the \u201CModels\u201D tab: `),Ce=n(Qn,"A",{href:!0,rel:!0});var Di=i(Ce);Tl=h(Di,"https://huggingface.co/models"),Di.forEach(s),Qn.forEach(s),na=p(e),ds=n(e,"P",{});var Zi=i(ds);Ul=h(Zi,"This is going to bring up all the models on the Hugging Face Hub, sorted by downloads in the past 30 days:"),Zi.forEach(s),ia=p(e),Ie=n(e,"DIV",{class:!0});var Qi=i(Ie);Ks=n(Qi,"IMG",{src:!0}),Qi.forEach(s),ra=p(e),us=n(e,"P",{});var Gi=i(us);Jl=h(Gi,`You\u2019ll notice on the left-hand side that we have a selection of tabs that we can select to filter models by task, library,
dataset, etc. Scroll down and select the task \u201CAudio Classification\u201D from the list of audio tasks:`),Gi.forEach(s),ha=p(e),Ne=n(e,"DIV",{class:!0});var Yi=i(Ne);et=n(Yi,"IMG",{src:!0}),Yi.forEach(s),ca=p(e),F=n(e,"P",{});var ao=i(F);El=h(ao,`We\u2019re now presented with the sub-set of 500+ audio classification models on the Hub. To further refine this selection, we
can filter models by dataset. Click on the tab \u201CDatasets\u201D, and in the search box type \u201Cspeech_commands\u201D. As you begin typing,
you\u2019ll see the selection for `),st=n(ao,"CODE",{});var Pi=i(st);$l=h(Pi,"speech_commands"),Pi.forEach(s),xl=h(ao,` appear underneath the search tab. You can click this button to filter all
audio classification models to those fine-tuned on the Speech Commands dataset:`),ao.forEach(s),pa=p(e),Se=n(e,"DIV",{class:!0});var Ri=i(Se);tt=n(Ri,"IMG",{src:!0}),Ri.forEach(s),da=p(e),fs=n(e,"P",{});var zi=i(fs);_l=h(zi,`Great! We see that we have 6 pre-trained models available to us for this specific dataset and task. You\u2019ll recognise the
first of these models as the Audio Spectrogram Transformer checkpoint that we used in the previous example. This process
of filtering models on the Hub is exactly how we went about selecting the checkpoint to show you!`),zi.forEach(s),ua=p(e),S=n(e,"H2",{class:!0});var oo=i(S);H=n(oo,"A",{id:!0,class:!0,href:!0});var Li=i(H);at=n(Li,"SPAN",{});var Fi=i(at);f(We.$$.fragment,Fi),Fi.forEach(s),Li.forEach(s),Cl=p(oo),ot=n(oo,"SPAN",{});var Hi=i(ot);Il=h(Hi,"Language Identification"),Hi.forEach(s),oo.forEach(s),fa=p(e),ms=n(e,"P",{});var Bi=i(ms);Nl=h(Bi,`Language identification (LID) is the task of identifying the language spoken in an audio sample from a list of candidate
languages. LID can form an important part in many speech pipelines. For example, given an audio sample in an unknown language,
an LID model can be used to categorise the language(s) spoken in the audio sample, and then select an appropriate speech
recognition model trained on that language to transcribe the audio.`),Bi.forEach(s),ma=p(e),W=n(e,"H3",{class:!0});var lo=i(W);B=n(lo,"A",{id:!0,class:!0,href:!0});var Vi=i(B);lt=n(Vi,"SPAN",{});var Oi=i(lt);f(Ae.$$.fragment,Oi),Oi.forEach(s),Vi.forEach(s),Sl=p(lo),nt=n(lo,"SPAN",{});var Xi=i(nt);Wl=h(Xi,"FLEURS"),Xi.forEach(s),lo.forEach(s),ya=p(e),V=n(e,"P",{});var no=i(V);Al=h(no,`FLEURS (Few-shot Learning Evaluation of Universal Representations of Speech) is a dataset for evaluating speech recognition
systems in 102 languages, including many that are classified as \u2018low-resource\u2019. Take a look at the FLEURS dataset
card on the Hub and explore the different languages that are present: `),qe=n(no,"A",{href:!0,rel:!0});var Ki=i(qe);ql=h(Ki,"google/fleurs"),Ki.forEach(s),Dl=h(no,`.
Can you find your native tongue here? If not, what\u2019s the most closely related language?`),no.forEach(s),wa=p(e),ys=n(e,"P",{});var er=i(ys);Zl=h(er,"Let\u2019s load up a sample from the validation split of the FLEURS dataset using streaming mode:"),er.forEach(s),ba=p(e),f(De.$$.fragment,e),ga=p(e),O=n(e,"P",{});var io=i(O);Ql=h(io,"Great! Now we can load our audio classification model. For this, we\u2019ll use a version of "),Ze=n(io,"A",{href:!0,rel:!0});var sr=i(Ze);Gl=h(sr,"Whisper"),sr.forEach(s),Yl=h(io,`
fine-tuned on the FLEURS dataset, which is currently the most performant LID model on the Hub:`),io.forEach(s),va=p(e),f(Qe.$$.fragment,e),Ma=p(e),ws=n(e,"P",{});var tr=i(ws);Pl=h(tr,"We can then pass the audio through our classifier and generate a prediction:"),tr.forEach(s),ka=p(e),f(Ge.$$.fragment,e),ja=p(e),bs=n(e,"P",{});var ar=i(bs);it=n(ar,"STRONG",{});var or=i(it);Rl=h(or,"Output:"),or.forEach(s),ar.forEach(s),Ta=p(e),f(Ye.$$.fragment,e),Ua=p(e),X=n(e,"P",{});var ro=i(X);zl=h(ro,`We can see that the model predicted the audio was in Afrikaans with extremely high probability (near 1). The FLEURS dataset
contains audio data from a wide range of languages - we can see that possible class labels include Northern-Sotho, Icelandic,
Danish and Cantonese Chinese amongst others. You can find the full list of languages on the dataset card here: `),Pe=n(ro,"A",{href:!0,rel:!0});var lr=i(Pe);Ll=h(lr,"google/fleurs"),lr.forEach(s),Fl=h(ro,"."),ro.forEach(s),Ja=p(e),gs=n(e,"P",{});var nr=i(gs);Hl=h(nr,"Over to you! What other checkpoints can you find for FLEURS LID on the Hub? What transformer models are they using under-the-hood?"),nr.forEach(s),Ea=p(e),A=n(e,"H2",{class:!0});var ho=i(A);K=n(ho,"A",{id:!0,class:!0,href:!0});var ir=i(K);rt=n(ir,"SPAN",{});var rr=i(rt);f(Re.$$.fragment,rr),rr.forEach(s),ir.forEach(s),Bl=p(ho),ht=n(ho,"SPAN",{});var hr=i(ht);Vl=h(hr,"Zero-Shot Audio Classification"),hr.forEach(s),ho.forEach(s),$a=p(e),ee=n(e,"P",{});var co=i(ee);Ol=h(co,"In the traditional paradigm for audio classification, the model predicts a class label from a "),ct=n(co,"EM",{});var cr=i(ct);Xl=h(cr,"pre-defined"),cr.forEach(s),Kl=h(co,` set of
possible classes. This poses a barrier to using pre-trained models for audio classification, since the label set of the
pre-trained model must match that of the downstream task. For the previous example of LID, the model must predict one of
the 102 langauge classes on which it was trained. If the downstream task actually requires 110 languages, the model would
not be able to predict 8 of the 110 languages, and so would require re-training to achieve full coverage. This limits the
effectiveness of transfer learning for audio classification tasks.`),co.forEach(s),xa=p(e),vs=n(e,"P",{});var pr=i(vs);en=h(pr,`Zero-shot audio classification is a method for taking a pre-trained audio classification model trained on a set of labelled
examples and enabling it to be able to classify new examples from previously unseen classes. Let\u2019s take a look at how we
can achieve this!`),pr.forEach(s),_a=p(e),J=n(e,"P",{});var xs=i(J);sn=h(xs,"Currently, \u{1F917} Transformers supports one kind of model for zero-shot audio classification: the "),ze=n(xs,"A",{href:!0,rel:!0});var dr=i(ze);tn=h(dr,"CLAP model"),dr.forEach(s),an=h(xs,`.
CLAP is a transformer-based model that takes both audio and text as inputs, and computes the `),pt=n(xs,"EM",{});var ur=i(pt);on=h(ur,"similarity"),ur.forEach(s),ln=h(xs,` between the two.
If we pass a text input that strongly correlates with an audio input, we\u2019ll get a high similarity score. Conversely, passing
a text input that is completely unrelated to the audio input will return a low similarity.`),xs.forEach(s),Ca=p(e),Ms=n(e,"P",{});var fr=i(Ms);nn=h(fr,`We can use this similarity prediction for zero-shot audio classification by passing one audio input to the model and
multiple candidate labels. The model will return a similarity score for each of the candidate labels, and we can pick the
one that has the highest score as our prediction.`),fr.forEach(s),Ia=p(e),se=n(e,"P",{});var po=i(se);rn=h(po,"Let\u2019s take an example where we use one audio input from the "),Le=n(po,"A",{href:!0,rel:!0});var mr=i(Le);hn=h(mr,"Environmental Speech Challenge (ESC)"),mr.forEach(s),cn=h(po,`
dataset:`),po.forEach(s),Na=p(e),f(Fe.$$.fragment,e),Sa=p(e),te=n(e,"P",{});var uo=i(te);pn=h(uo,`We then define our candidate labels, which form the set of possible classification labels. The model will return a
classification probability for each of the labels we define. This means we need to know `),dt=n(uo,"EM",{});var yr=i(dt);dn=h(yr,"a-priori"),yr.forEach(s),un=h(uo,` the set of possible
labels in our classification problem, such that the correct label is contained within the set and is thus assigned a
valid probability score. Note that we can either pass the full set of labels to the model, or a hand-selected subset
that we believe contains the correct label. Passing the full set of labels is going to be more exhaustive, but comes
at the expense of lower classification accuracy since the classification space is larger (provided the correct label is
our chosen subset of labels):`),uo.forEach(s),Wa=p(e),f(He.$$.fragment,e),Aa=p(e),ae=n(e,"P",{});var fo=i(ae);fn=h(fo,"We can run both through the model to find the candidate label that is "),ut=n(fo,"EM",{});var wr=i(ut);mn=h(wr,"most similar"),wr.forEach(s),yn=h(fo," to the audio input:"),fo.forEach(s),qa=p(e),f(Be.$$.fragment,e),Da=p(e),ks=n(e,"P",{});var br=i(ks);ft=n(br,"STRONG",{});var gr=i(ft);wn=h(gr,"Output:"),gr.forEach(s),br.forEach(s),Za=p(e),f(Ve.$$.fragment,e),Qa=p(e),js=n(e,"P",{});var vr=i(js);bn=h(vr,`Alright! The model seems pretty confident we have the sound of a dog - it predicts it with 99.96% probability, so we\u2019ll
take that as our prediction. Let\u2019s confirm whether we were right by listening to the audio sample (don\u2019t turn up your
volume too high or else you might get a jump!):`),vr.forEach(s),Ga=p(e),f(Oe.$$.fragment,e),Ya=p(e),Ts=n(e,"P",{});var Mr=i(Ts);gn=h(Mr,`Perfect! We have the sound of a dog barking \u{1F415}, which aligns with the model\u2019s prediction. Have a play with different audio
samples and different candidate labels - can you define a set of labels that give good generalisation across the ESC
dataset? Hint: think about where you could find information on the possible sounds in ESC and construct your labels accordingly!`),Mr.forEach(s),Pa=p(e),M=n(e,"P",{});var re=i(M);vn=h(re,"You might be wondering why we don\u2019t use the zero-shot audio classification pipeline for "),mt=n(re,"STRONG",{});var kr=i(mt);Mn=h(kr,"all"),kr.forEach(s),kn=h(re,` audio classification tasks?
It seems as though we can make predictions for any audio classification problem by defining appropriate class labels `),yt=n(re,"EM",{});var jr=i(yt);jn=h(jr,"a-priori"),jr.forEach(s),Tn=h(re,`,
thus bypassing the constraint that our classification task needs to match the labels that the model was pre-trained on.
This comes down to the nature of the CLAP model used in the zero-shot pipeline: CLAP is pre-trained on `),wt=n(re,"EM",{});var Tr=i(wt);Un=h(Tr,"generic"),Tr.forEach(s),Jn=h(re,` audio
classification data, similar to the environmental sounds in the ESC dataset, rather than specifically speech data, like
we had in the LID task. If you gave it speech in English and speech in Spanish, CLAP would know that both examples were
speech data \u{1F5E3}\uFE0F But it wouldn\u2019t be able to differentiate between the languages in the same way a dedicated LID model is
able to.`),re.forEach(s),Ra=p(e),q=n(e,"H2",{class:!0});var mo=i(q);oe=n(mo,"A",{id:!0,class:!0,href:!0});var Ur=i(oe);bt=n(Ur,"SPAN",{});var Jr=i(bt);f(Xe.$$.fragment,Jr),Jr.forEach(s),Ur.forEach(s),En=p(mo),gt=n(mo,"SPAN",{});var Er=i(gt);$n=h(Er,"What next?"),Er.forEach(s),mo.forEach(s),za=p(e),le=n(e,"P",{});var yo=i(le);xn=h(yo,`We\u2019ve covered a number of different audio classification tasks and presented the most relevant datasets and models that
you can download from the Hugging Face Hub and use in just several lines of code using the `),vt=n(yo,"CODE",{});var $r=i(vt);_n=h($r,"pipeline()"),$r.forEach(s),Cn=h(yo,` class. These tasks
included keyword spotting, language identification and zero-shot audio classification.`),yo.forEach(s),La=p(e),E=n(e,"P",{});var _s=i(E);In=h(_s,"But what if we want to do something "),Mt=n(_s,"STRONG",{});var xr=i(Mt);Nn=h(xr,"new"),xr.forEach(s),Sn=h(_s,`? We\u2019ve worked extensively on speech processing tasks, but this is only one
aspect of audio classification. Another popular field of audio processing involves `),kt=n(_s,"STRONG",{});var _r=i(kt);Wn=h(_r,"music"),_r.forEach(s),An=h(_s,`. While music has inherently
different features to speech, many of the same principles that we\u2019ve learnt about already can be applied to music.`),_s.forEach(s),Fa=p(e),ne=n(e,"P",{});var wo=i(ne);qn=h(wo,`In the following section, we\u2019ll go through a step-by-step guide on how you can fine-tune a transformer model with \u{1F917}
Transformers on the task of music classification. By the end of it, you\u2019ll have a fine-tuned checkpoint that you can plug
into the `),jt=n(wo,"CODE",{});var Cr=i(jt);Dn=h(Cr,"pipeline()"),Cr.forEach(s),Zn=h(wo," class, enabling you to classify songs in exactly the same way that we\u2019ve classified speech here!"),wo.forEach(s),this.h()},h(){d($,"name","hf:doc:metadata"),d($,"content",JSON.stringify(Zr)),d(Z,"id","pretrained-models-and-datasets-for-audio-classification"),d(Z,"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"),d(Z,"href","#pretrained-models-and-datasets-for-audio-classification"),d(x,"class","relative group"),d(ce,"href","https://huggingface.co/blog/bert-101"),d(ce,"rel","nofollow"),d(G,"id","transformers-installation"),d(G,"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"),d(G,"href","#transformers-installation"),d(_,"class","relative group"),d(Y,"id","keyword-spotting"),d(Y,"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"),d(Y,"href","#keyword-spotting"),d(C,"class","relative group"),d(P,"id","minds14"),d(P,"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"),d(P,"href","#minds14"),d(I,"class","relative group"),d(me,"href","https://huggingface.co/datasets/PolyAI/minds14"),d(me,"rel","nofollow"),d(we,"href","https://huggingface.co/anton-l/xtreme_s_xlsr_300m_minds14"),d(we,"rel","nofollow"),d(z,"id","speech-commands"),d(z,"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"),d(z,"href","#speech-commands"),d(N,"class","relative group"),d(ke,"href","https://huggingface.co/datasets/speech_commands"),d(ke,"rel","nofollow"),bo(is.src,Yn="https://huggingface.co/datasets/huggingface-course/audio-course-images/resolve/main/speech_commands.png")||d(is,"src",Yn),d(is,"alt","Diagram of datasets viewer."),d(je,"class","flex justify-center"),d(Ue,"href","https://huggingface.co/docs/transformers/model_doc/audio-spectrogram-transformer"),d(Ue,"rel","nofollow"),d(Je,"href","https://huggingface.co/MIT/ast-finetuned-speech-commands-v2"),d(Je,"rel","nofollow"),d(Ce,"href","https://huggingface.co/models"),d(Ce,"rel","nofollow"),bo(Ks.src,Pn="https://huggingface.co/datasets/huggingface-course/audio-course-images/resolve/main/all_models.png")||d(Ks,"src",Pn),d(Ie,"class","flex justify-center"),bo(et.src,Rn="https://huggingface.co/datasets/huggingface-course/audio-course-images/resolve/main/by_audio_classification.png")||d(et,"src",Rn),d(Ne,"class","flex justify-center"),bo(tt.src,zn="https://huggingface.co/datasets/huggingface-course/audio-course-images/resolve/main/by_speech_commands.png")||d(tt,"src",zn),d(Se,"class","flex justify-center"),d(H,"id","language-identification"),d(H,"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"),d(H,"href","#language-identification"),d(S,"class","relative group"),d(B,"id","fleurs"),d(B,"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"),d(B,"href","#fleurs"),d(W,"class","relative group"),d(qe,"href","https://huggingface.co/datasets/google/fleurs"),d(qe,"rel","nofollow"),d(Ze,"href","https://arxiv.org/pdf/2212.04356.pdf"),d(Ze,"rel","nofollow"),d(Pe,"href","https://huggingface.co/datasets/google/fleurs"),d(Pe,"rel","nofollow"),d(K,"id","zeroshot-audio-classification"),d(K,"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"),d(K,"href","#zeroshot-audio-classification"),d(A,"class","relative group"),d(ze,"href","https://huggingface.co/docs/transformers/model_doc/clap"),d(ze,"rel","nofollow"),d(Le,"href","https://huggingface.co/datasets/ashraq/esc50"),d(Le,"rel","nofollow"),d(oe,"id","what-next"),d(oe,"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"),d(oe,"href","#what-next"),d(q,"class","relative group")},m(e,a){t(document.head,$),o(e,Tt,a),o(e,x,a),t(x,Z),t(Z,Cs),m(he,Cs,null),t(x,go),t(x,Is),t(Is,vo),o(e,Ut,a),o(e,v,a),t(v,Mo),t(v,Ns),t(Ns,ko),t(v,jo),t(v,Ss),t(Ss,To),t(v,Uo),t(v,Ws),t(Ws,Jo),t(v,Eo),o(e,Jt,a),o(e,Q,a),t(Q,$o),t(Q,As),t(As,xo),t(Q,_o),o(e,Et,a),o(e,k,a),t(k,Co),t(k,qs),t(qs,Io),t(k,No),t(k,ce),t(ce,So),t(k,Wo),o(e,$t,a),o(e,Ke,a),t(Ke,Ao),o(e,xt,a),o(e,_,a),t(_,G),t(G,Ds),m(pe,Ds,null),t(_,qo),t(_,Zs),t(Zs,Do),o(e,_t,a),o(e,j,a),t(j,Zo),t(j,Qs),t(Qs,Qo),t(j,Go),t(j,Gs),t(Gs,Yo),t(j,Po),o(e,Ct,a),m(de,e,a),o(e,It,a),o(e,C,a),t(C,Y),t(Y,Ys),m(ue,Ys,null),t(C,Ro),t(C,Ps),t(Ps,zo),o(e,Nt,a),o(e,es,a),t(es,Lo),o(e,St,a),o(e,I,a),t(I,P),t(P,Rs),m(fe,Rs,null),t(I,Fo),t(I,zs),t(zs,Ho),o(e,Wt,a),o(e,T,a),t(T,Bo),t(T,me),t(me,Vo),t(T,Oo),t(T,Ls),t(Ls,Xo),t(T,Ko),o(e,At,a),m(ye,e,a),o(e,qt,a),o(e,R,a),t(R,el),t(R,we),t(we,Fs),t(Fs,sl),t(R,tl),o(e,Dt,a),m(be,e,a),o(e,Zt,a),o(e,ss,a),t(ss,al),o(e,Qt,a),m(ge,e,a),o(e,Gt,a),o(e,ts,a),t(ts,Hs),t(Hs,ol),o(e,Yt,a),m(ve,e,a),o(e,Pt,a),o(e,as,a),t(as,ll),o(e,Rt,a),o(e,N,a),t(N,z),t(z,Bs),m(Me,Bs,null),t(N,nl),t(N,Vs),t(Vs,il),o(e,zt,a),o(e,os,a),t(os,rl),o(e,Lt,a),o(e,ls,a),t(ls,hl),o(e,Ft,a),o(e,ns,a),t(ns,cl),o(e,Ht,a),o(e,L,a),t(L,pl),t(L,ke),t(ke,dl),t(L,ul),o(e,Bt,a),o(e,je,a),t(je,is),o(e,Vt,a),o(e,rs,a),t(rs,fl),o(e,Ot,a),o(e,hs,a),t(hs,ml),o(e,Xt,a),m(Te,e,a),o(e,Kt,a),o(e,U,a),t(U,yl),t(U,Ue),t(Ue,wl),t(U,bl),t(U,Je),t(Je,Os),t(Os,gl),t(U,vl),o(e,ea,a),m(Ee,e,a),o(e,sa,a),o(e,cs,a),t(cs,Xs),t(Xs,Ml),o(e,ta,a),m($e,e,a),o(e,aa,a),o(e,ps,a),t(ps,kl),o(e,oa,a),m(xe,e,a),o(e,la,a),o(e,_e,a),t(_e,jl),t(_e,Ce),t(Ce,Tl),o(e,na,a),o(e,ds,a),t(ds,Ul),o(e,ia,a),o(e,Ie,a),t(Ie,Ks),o(e,ra,a),o(e,us,a),t(us,Jl),o(e,ha,a),o(e,Ne,a),t(Ne,et),o(e,ca,a),o(e,F,a),t(F,El),t(F,st),t(st,$l),t(F,xl),o(e,pa,a),o(e,Se,a),t(Se,tt),o(e,da,a),o(e,fs,a),t(fs,_l),o(e,ua,a),o(e,S,a),t(S,H),t(H,at),m(We,at,null),t(S,Cl),t(S,ot),t(ot,Il),o(e,fa,a),o(e,ms,a),t(ms,Nl),o(e,ma,a),o(e,W,a),t(W,B),t(B,lt),m(Ae,lt,null),t(W,Sl),t(W,nt),t(nt,Wl),o(e,ya,a),o(e,V,a),t(V,Al),t(V,qe),t(qe,ql),t(V,Dl),o(e,wa,a),o(e,ys,a),t(ys,Zl),o(e,ba,a),m(De,e,a),o(e,ga,a),o(e,O,a),t(O,Ql),t(O,Ze),t(Ze,Gl),t(O,Yl),o(e,va,a),m(Qe,e,a),o(e,Ma,a),o(e,ws,a),t(ws,Pl),o(e,ka,a),m(Ge,e,a),o(e,ja,a),o(e,bs,a),t(bs,it),t(it,Rl),o(e,Ta,a),m(Ye,e,a),o(e,Ua,a),o(e,X,a),t(X,zl),t(X,Pe),t(Pe,Ll),t(X,Fl),o(e,Ja,a),o(e,gs,a),t(gs,Hl),o(e,Ea,a),o(e,A,a),t(A,K),t(K,rt),m(Re,rt,null),t(A,Bl),t(A,ht),t(ht,Vl),o(e,$a,a),o(e,ee,a),t(ee,Ol),t(ee,ct),t(ct,Xl),t(ee,Kl),o(e,xa,a),o(e,vs,a),t(vs,en),o(e,_a,a),o(e,J,a),t(J,sn),t(J,ze),t(ze,tn),t(J,an),t(J,pt),t(pt,on),t(J,ln),o(e,Ca,a),o(e,Ms,a),t(Ms,nn),o(e,Ia,a),o(e,se,a),t(se,rn),t(se,Le),t(Le,hn),t(se,cn),o(e,Na,a),m(Fe,e,a),o(e,Sa,a),o(e,te,a),t(te,pn),t(te,dt),t(dt,dn),t(te,un),o(e,Wa,a),m(He,e,a),o(e,Aa,a),o(e,ae,a),t(ae,fn),t(ae,ut),t(ut,mn),t(ae,yn),o(e,qa,a),m(Be,e,a),o(e,Da,a),o(e,ks,a),t(ks,ft),t(ft,wn),o(e,Za,a),m(Ve,e,a),o(e,Qa,a),o(e,js,a),t(js,bn),o(e,Ga,a),m(Oe,e,a),o(e,Ya,a),o(e,Ts,a),t(Ts,gn),o(e,Pa,a),o(e,M,a),t(M,vn),t(M,mt),t(mt,Mn),t(M,kn),t(M,yt),t(yt,jn),t(M,Tn),t(M,wt),t(wt,Un),t(M,Jn),o(e,Ra,a),o(e,q,a),t(q,oe),t(oe,bt),m(Xe,bt,null),t(q,En),t(q,gt),t(gt,$n),o(e,za,a),o(e,le,a),t(le,xn),t(le,vt),t(vt,_n),t(le,Cn),o(e,La,a),o(e,E,a),t(E,In),t(E,Mt),t(Mt,Nn),t(E,Sn),t(E,kt),t(kt,Wn),t(E,An),o(e,Fa,a),o(e,ne,a),t(ne,qn),t(ne,jt),t(jt,Dn),t(ne,Zn),Ha=!0},p:Ar,i(e){Ha||(y(he.$$.fragment,e),y(pe.$$.fragment,e),y(de.$$.fragment,e),y(ue.$$.fragment,e),y(fe.$$.fragment,e),y(ye.$$.fragment,e),y(be.$$.fragment,e),y(ge.$$.fragment,e),y(ve.$$.fragment,e),y(Me.$$.fragment,e),y(Te.$$.fragment,e),y(Ee.$$.fragment,e),y($e.$$.fragment,e),y(xe.$$.fragment,e),y(We.$$.fragment,e),y(Ae.$$.fragment,e),y(De.$$.fragment,e),y(Qe.$$.fragment,e),y(Ge.$$.fragment,e),y(Ye.$$.fragment,e),y(Re.$$.fragment,e),y(Fe.$$.fragment,e),y(He.$$.fragment,e),y(Be.$$.fragment,e),y(Ve.$$.fragment,e),y(Oe.$$.fragment,e),y(Xe.$$.fragment,e),Ha=!0)},o(e){w(he.$$.fragment,e),w(pe.$$.fragment,e),w(de.$$.fragment,e),w(ue.$$.fragment,e),w(fe.$$.fragment,e),w(ye.$$.fragment,e),w(be.$$.fragment,e),w(ge.$$.fragment,e),w(ve.$$.fragment,e),w(Me.$$.fragment,e),w(Te.$$.fragment,e),w(Ee.$$.fragment,e),w($e.$$.fragment,e),w(xe.$$.fragment,e),w(We.$$.fragment,e),w(Ae.$$.fragment,e),w(De.$$.fragment,e),w(Qe.$$.fragment,e),w(Ge.$$.fragment,e),w(Ye.$$.fragment,e),w(Re.$$.fragment,e),w(Fe.$$.fragment,e),w(He.$$.fragment,e),w(Be.$$.fragment,e),w(Ve.$$.fragment,e),w(Oe.$$.fragment,e),w(Xe.$$.fragment,e),Ha=!1},d(e){s($),e&&s(Tt),e&&s(x),b(he),e&&s(Ut),e&&s(v),e&&s(Jt),e&&s(Q),e&&s(Et),e&&s(k),e&&s($t),e&&s(Ke),e&&s(xt),e&&s(_),b(pe),e&&s(_t),e&&s(j),e&&s(Ct),b(de,e),e&&s(It),e&&s(C),b(ue),e&&s(Nt),e&&s(es),e&&s(St),e&&s(I),b(fe),e&&s(Wt),e&&s(T),e&&s(At),b(ye,e),e&&s(qt),e&&s(R),e&&s(Dt),b(be,e),e&&s(Zt),e&&s(ss),e&&s(Qt),b(ge,e),e&&s(Gt),e&&s(ts),e&&s(Yt),b(ve,e),e&&s(Pt),e&&s(as),e&&s(Rt),e&&s(N),b(Me),e&&s(zt),e&&s(os),e&&s(Lt),e&&s(ls),e&&s(Ft),e&&s(ns),e&&s(Ht),e&&s(L),e&&s(Bt),e&&s(je),e&&s(Vt),e&&s(rs),e&&s(Ot),e&&s(hs),e&&s(Xt),b(Te,e),e&&s(Kt),e&&s(U),e&&s(ea),b(Ee,e),e&&s(sa),e&&s(cs),e&&s(ta),b($e,e),e&&s(aa),e&&s(ps),e&&s(oa),b(xe,e),e&&s(la),e&&s(_e),e&&s(na),e&&s(ds),e&&s(ia),e&&s(Ie),e&&s(ra),e&&s(us),e&&s(ha),e&&s(Ne),e&&s(ca),e&&s(F),e&&s(pa),e&&s(Se),e&&s(da),e&&s(fs),e&&s(ua),e&&s(S),b(We),e&&s(fa),e&&s(ms),e&&s(ma),e&&s(W),b(Ae),e&&s(ya),e&&s(V),e&&s(wa),e&&s(ys),e&&s(ba),b(De,e),e&&s(ga),e&&s(O),e&&s(va),b(Qe,e),e&&s(Ma),e&&s(ws),e&&s(ka),b(Ge,e),e&&s(ja),e&&s(bs),e&&s(Ta),b(Ye,e),e&&s(Ua),e&&s(X),e&&s(Ja),e&&s(gs),e&&s(Ea),e&&s(A),b(Re),e&&s($a),e&&s(ee),e&&s(xa),e&&s(vs),e&&s(_a),e&&s(J),e&&s(Ca),e&&s(Ms),e&&s(Ia),e&&s(se),e&&s(Na),b(Fe,e),e&&s(Sa),e&&s(te),e&&s(Wa),b(He,e),e&&s(Aa),e&&s(ae),e&&s(qa),b(Be,e),e&&s(Da),e&&s(ks),e&&s(Za),b(Ve,e),e&&s(Qa),e&&s(js),e&&s(Ga),b(Oe,e),e&&s(Ya),e&&s(Ts),e&&s(Pa),e&&s(M),e&&s(Ra),e&&s(q),b(Xe),e&&s(za),e&&s(le),e&&s(La),e&&s(E),e&&s(Fa),e&&s(ne)}}}const Zr={local:"pretrained-models-and-datasets-for-audio-classification",sections:[{local:"transformers-installation",title:"\u{1F917} Transformers Installation"},{local:"keyword-spotting",sections:[{local:"minds14",title:"Minds-14"},{local:"speech-commands",title:"Speech Commands"}],title:"Keyword Spotting"},{local:"language-identification",sections:[{local:"fleurs",title:"FLEURS"}],title:"Language Identification"},{local:"zeroshot-audio-classification",title:"Zero-Shot Audio Classification"},{local:"what-next",title:"What next?"}],title:"Pre-trained models and datasets for audio classification"};function Qr(Gn){return qr(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Rr extends Ir{constructor($){super();Nr(this,$,Qr,Dr,Sr,{})}}export{Rr as default,Zr as metadata};
