import{S as lr,i as nr,s as rr,e as n,k as c,w as v,t as s,M as or,c as r,d as t,m as u,a as o,x as b,h as l,b as h,G as a,g as p,y as j,q as y,o as w,B as k,v as ir,L as pr}from"../../chunks/vendor-hf-doc-builder.js";import{T as Jl}from"../../chunks/Tip-hf-doc-builder.js";import{Y as cr}from"../../chunks/Youtube-hf-doc-builder.js";import{I as Qa}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as L}from"../../chunks/CodeBlock-hf-doc-builder.js";import{D as ur}from"../../chunks/DocNotebookDropdown-hf-doc-builder.js";import{F as tr,M as sr}from"../../chunks/Markdown-hf-doc-builder.js";function fr(ee){let f,g,m,$,A,E,P,I,q,F,M,O,H,S,T,Q,G,z,ae,N,W,_,D,V,pe,B,Y,be,je,U,me,ce,re,te;return{c(){f=s(`The task illustrated in this tutorial is supported by the following model architectures:

`),g=n("p"),m=n("a"),$=s("Audio Spectrogram Transformer"),A=s(", "),E=n("a"),P=s("Data2VecAudio"),I=s(", "),q=n("a"),F=s("Hubert"),M=s(", "),O=n("a"),H=s("SEW"),S=s(", "),T=n("a"),Q=s("SEW-D"),G=s(", "),z=n("a"),ae=s("UniSpeech"),N=s(", "),W=n("a"),_=s("UniSpeechSat"),D=s(", "),V=n("a"),pe=s("Wav2Vec2"),B=s(", "),Y=n("a"),be=s("Wav2Vec2-Conformer"),je=s(", "),U=n("a"),me=s("WavLM"),ce=s(", "),re=n("a"),te=s("Whisper"),this.h()},l(J){f=l(J,`The task illustrated in this tutorial is supported by the following model architectures:

`),g=r(J,"P",{});var x=o(g);m=r(x,"A",{href:!0});var Ae=o(m);$=l(Ae,"Audio Spectrogram Transformer"),Ae.forEach(t),A=l(x,", "),E=r(x,"A",{href:!0});var ye=o(E);P=l(ye,"Data2VecAudio"),ye.forEach(t),I=l(x,", "),q=r(x,"A",{href:!0});var K=o(q);F=l(K,"Hubert"),K.forEach(t),M=l(x,", "),O=r(x,"A",{href:!0});var we=o(O);H=l(we,"SEW"),we.forEach(t),S=l(x,", "),T=r(x,"A",{href:!0});var se=o(T);Q=l(se,"SEW-D"),se.forEach(t),G=l(x,", "),z=r(x,"A",{href:!0});var qe=o(z);ae=l(qe,"UniSpeech"),qe.forEach(t),N=l(x,", "),W=r(x,"A",{href:!0});var ke=o(W);_=l(ke,"UniSpeechSat"),ke.forEach(t),D=l(x,", "),V=r(x,"A",{href:!0});var oe=o(V);pe=l(oe,"Wav2Vec2"),oe.forEach(t),B=l(x,", "),Y=r(x,"A",{href:!0});var ie=o(Y);be=l(ie,"Wav2Vec2-Conformer"),ie.forEach(t),je=l(x,", "),U=r(x,"A",{href:!0});var X=o(U);me=l(X,"WavLM"),X.forEach(t),ce=l(x,", "),re=r(x,"A",{href:!0});var R=o(re);te=l(R,"Whisper"),R.forEach(t),x.forEach(t),this.h()},h(){h(m,"href","../model_doc/audio-spectrogram-transformer"),h(E,"href","../model_doc/data2vec-audio"),h(q,"href","../model_doc/hubert"),h(O,"href","../model_doc/sew"),h(T,"href","../model_doc/sew-d"),h(z,"href","../model_doc/unispeech"),h(W,"href","../model_doc/unispeech-sat"),h(V,"href","../model_doc/wav2vec2"),h(Y,"href","../model_doc/wav2vec2-conformer"),h(U,"href","../model_doc/wavlm"),h(re,"href","../model_doc/whisper")},m(J,x){p(J,f,x),p(J,g,x),a(g,m),a(m,$),a(g,A),a(g,E),a(E,P),a(g,I),a(g,q),a(q,F),a(g,M),a(g,O),a(O,H),a(g,S),a(g,T),a(T,Q),a(g,G),a(g,z),a(z,ae),a(g,N),a(g,W),a(W,_),a(g,D),a(g,V),a(V,pe),a(g,B),a(g,Y),a(Y,be),a(g,je),a(g,U),a(U,me),a(g,ce),a(g,re),a(re,te)},d(J){J&&t(f),J&&t(g)}}}function mr(ee){let f,g,m,$,A,E,P,I;return{c(){f=n("p"),g=s("If you aren\u2019t familiar with finetuning a model with the "),m=n("a"),$=s("Trainer"),A=s(", take a look at the basic tutorial "),E=n("a"),P=s("here"),I=s("!"),this.h()},l(q){f=r(q,"P",{});var F=o(f);g=l(F,"If you aren\u2019t familiar with finetuning a model with the "),m=r(F,"A",{href:!0});var M=o(m);$=l(M,"Trainer"),M.forEach(t),A=l(F,", take a look at the basic tutorial "),E=r(F,"A",{href:!0});var O=o(E);P=l(O,"here"),O.forEach(t),I=l(F,"!"),F.forEach(t),this.h()},h(){h(m,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer"),h(E,"href","../training#train-with-pytorch-trainer")},m(q,F){p(q,f,F),a(f,g),a(f,m),a(m,$),a(f,A),a(f,E),a(E,P),a(f,I)},d(q){q&&t(f)}}}function hr(ee){let f,g,m,$,A,E,P,I,q,F,M,O,H,S,T,Q,G,z,ae,N,W,_,D,V,pe,B,Y,be,je,U,me,ce,re,te,J,x,Ae,ye,K,we,se,qe,ke,oe,ie,X,R,Ce,ue,aa,Ie,Le,de,Ee;return f=new Jl({props:{$$slots:{default:[mr]},$$scope:{ctx:ee}}}),q=new L({props:{code:`from transformers import AutoModelForAudioClassification, TrainingArguments, Trainer

num_labels = len(id2label)
model = AutoModelForAudioClassification.from_pretrained(
    "facebook/wav2vec2-base", num_labels=num_labels, label2id=label2id, id2label=id2label
)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForAudioClassification, TrainingArguments, Trainer

<span class="hljs-meta">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(id2label)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForAudioClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;facebook/wav2vec2-base&quot;</span>, num_labels=num_labels, label2id=label2id, id2label=id2label
<span class="hljs-meta">... </span>)`}}),ie=new L({props:{code:`training_args = TrainingArguments(
    output_dir="my_awesome_mind_model",
    evaluation_strategy="epoch",
    save_strategy="epoch",
    learning_rate=3e-5,
    per_device_train_batch_size=32,
    gradient_accumulation_steps=4,
    per_device_eval_batch_size=32,
    num_train_epochs=10,
    warmup_ratio=0.1,
    logging_steps=10,
    load_best_model_at_end=True,
    metric_for_best_model="accuracy",
    push_to_hub=True,
)

trainer = Trainer(
    model=model,
    args=training_args,
    train_dataset=encoded_minds["train"],
    eval_dataset=encoded_minds["test"],
    tokenizer=feature_extractor,
    compute_metrics=compute_metrics,
)

trainer.train()`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>training_args = TrainingArguments(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;my_awesome_mind_model&quot;</span>,
<span class="hljs-meta">... </span>    evaluation_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
<span class="hljs-meta">... </span>    save_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
<span class="hljs-meta">... </span>    learning_rate=<span class="hljs-number">3e-5</span>,
<span class="hljs-meta">... </span>    per_device_train_batch_size=<span class="hljs-number">32</span>,
<span class="hljs-meta">... </span>    gradient_accumulation_steps=<span class="hljs-number">4</span>,
<span class="hljs-meta">... </span>    per_device_eval_batch_size=<span class="hljs-number">32</span>,
<span class="hljs-meta">... </span>    num_train_epochs=<span class="hljs-number">10</span>,
<span class="hljs-meta">... </span>    warmup_ratio=<span class="hljs-number">0.1</span>,
<span class="hljs-meta">... </span>    logging_steps=<span class="hljs-number">10</span>,
<span class="hljs-meta">... </span>    load_best_model_at_end=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    metric_for_best_model=<span class="hljs-string">&quot;accuracy&quot;</span>,
<span class="hljs-meta">... </span>    push_to_hub=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer = Trainer(
<span class="hljs-meta">... </span>    model=model,
<span class="hljs-meta">... </span>    args=training_args,
<span class="hljs-meta">... </span>    train_dataset=encoded_minds[<span class="hljs-string">&quot;train&quot;</span>],
<span class="hljs-meta">... </span>    eval_dataset=encoded_minds[<span class="hljs-string">&quot;test&quot;</span>],
<span class="hljs-meta">... </span>    tokenizer=feature_extractor,
<span class="hljs-meta">... </span>    compute_metrics=compute_metrics,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.train()`}}),de=new L({props:{code:"trainer.push_to_hub()",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()'}}),{c(){v(f.$$.fragment),g=c(),m=n("p"),$=s("You\u2019re ready to start training your model now! Load Wav2Vec2 with "),A=n("a"),E=s("AutoModelForAudioClassification"),P=s(" along with the number of expected labels, and the label mappings:"),I=c(),v(q.$$.fragment),F=c(),M=n("p"),O=s("At this point, only three steps remain:"),H=c(),S=n("ol"),T=n("li"),Q=s("Define your training hyperparameters in "),G=n("a"),z=s("TrainingArguments"),ae=s(". The only required parameter is "),N=n("code"),W=s("output_dir"),_=s(" which specifies where to save your model. You\u2019ll push this model to the Hub by setting "),D=n("code"),V=s("push_to_hub=True"),pe=s(" (you need to be signed in to Hugging Face to upload your model). At the end of each epoch, the "),B=n("a"),Y=s("Trainer"),be=s(" will evaluate the accuracy and save the training checkpoint."),je=c(),U=n("li"),me=s("Pass the training arguments to "),ce=n("a"),re=s("Trainer"),te=s(" along with the model, dataset, tokenizer, data collator, and "),J=n("code"),x=s("compute_metrics"),Ae=s(" function."),ye=c(),K=n("li"),we=s("Call "),se=n("a"),qe=s("train()"),ke=s(" to finetune your model."),oe=c(),v(ie.$$.fragment),X=c(),R=n("p"),Ce=s("Once training is completed, share your model to the Hub with the "),ue=n("a"),aa=s("push_to_hub()"),Ie=s(" method so everyone can use your model:"),Le=c(),v(de.$$.fragment),this.h()},l(d){b(f.$$.fragment,d),g=u(d),m=r(d,"P",{});var C=o(m);$=l(C,"You\u2019re ready to start training your model now! Load Wav2Vec2 with "),A=r(C,"A",{href:!0});var he=o(A);E=l(he,"AutoModelForAudioClassification"),he.forEach(t),P=l(C," along with the number of expected labels, and the label mappings:"),C.forEach(t),I=u(d),b(q.$$.fragment,d),F=u(d),M=r(d,"P",{});var ta=o(M);O=l(ta,"At this point, only three steps remain:"),ta.forEach(t),H=u(d),S=r(d,"OL",{});var Z=o(S);T=r(Z,"LI",{});var fe=o(T);Q=l(fe,"Define your training hyperparameters in "),G=r(fe,"A",{href:!0});var Ne=o(G);z=l(Ne,"TrainingArguments"),Ne.forEach(t),ae=l(fe,". The only required parameter is "),N=r(fe,"CODE",{});var Ca=o(N);W=l(Ca,"output_dir"),Ca.forEach(t),_=l(fe," which specifies where to save your model. You\u2019ll push this model to the Hub by setting "),D=r(fe,"CODE",{});var Ia=o(D);V=l(Ia,"push_to_hub=True"),Ia.forEach(t),pe=l(fe," (you need to be signed in to Hugging Face to upload your model). At the end of each epoch, the "),B=r(fe,"A",{href:!0});var Te=o(B);Y=l(Te,"Trainer"),Te.forEach(t),be=l(fe," will evaluate the accuracy and save the training checkpoint."),fe.forEach(t),je=u(Z),U=r(Z,"LI",{});var Pe=o(U);me=l(Pe,"Pass the training arguments to "),ce=r(Pe,"A",{href:!0});var Fa=o(ce);re=l(Fa,"Trainer"),Fa.forEach(t),te=l(Pe," along with the model, dataset, tokenizer, data collator, and "),J=r(Pe,"CODE",{});var sa=o(J);x=l(sa,"compute_metrics"),sa.forEach(t),Ae=l(Pe," function."),Pe.forEach(t),ye=u(Z),K=r(Z,"LI",{});var _e=o(K);we=l(_e,"Call "),se=r(_e,"A",{href:!0});var la=o(se);qe=l(la,"train()"),la.forEach(t),ke=l(_e," to finetune your model."),_e.forEach(t),Z.forEach(t),oe=u(d),b(ie.$$.fragment,d),X=u(d),R=r(d,"P",{});var xe=o(R);Ce=l(xe,"Once training is completed, share your model to the Hub with the "),ue=r(xe,"A",{href:!0});var Ma=o(ue);aa=l(Ma,"push_to_hub()"),Ma.forEach(t),Ie=l(xe," method so everyone can use your model:"),xe.forEach(t),Le=u(d),b(de.$$.fragment,d),this.h()},h(){h(A,"href","/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoModelForAudioClassification"),h(G,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.TrainingArguments"),h(B,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer"),h(ce,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer"),h(se,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer.train"),h(ue,"href","/docs/transformers/v4.29.0/en/main_classes/trainer#transformers.Trainer.push_to_hub")},m(d,C){j(f,d,C),p(d,g,C),p(d,m,C),a(m,$),a(m,A),a(A,E),a(m,P),p(d,I,C),j(q,d,C),p(d,F,C),p(d,M,C),a(M,O),p(d,H,C),p(d,S,C),a(S,T),a(T,Q),a(T,G),a(G,z),a(T,ae),a(T,N),a(N,W),a(T,_),a(T,D),a(D,V),a(T,pe),a(T,B),a(B,Y),a(T,be),a(S,je),a(S,U),a(U,me),a(U,ce),a(ce,re),a(U,te),a(U,J),a(J,x),a(U,Ae),a(S,ye),a(S,K),a(K,we),a(K,se),a(se,qe),a(K,ke),p(d,oe,C),j(ie,d,C),p(d,X,C),p(d,R,C),a(R,Ce),a(R,ue),a(ue,aa),a(R,Ie),p(d,Le,C),j(de,d,C),Ee=!0},p(d,C){const he={};C&2&&(he.$$scope={dirty:C,ctx:d}),f.$set(he)},i(d){Ee||(y(f.$$.fragment,d),y(q.$$.fragment,d),y(ie.$$.fragment,d),y(de.$$.fragment,d),Ee=!0)},o(d){w(f.$$.fragment,d),w(q.$$.fragment,d),w(ie.$$.fragment,d),w(de.$$.fragment,d),Ee=!1},d(d){k(f,d),d&&t(g),d&&t(m),d&&t(I),k(q,d),d&&t(F),d&&t(M),d&&t(H),d&&t(S),d&&t(oe),k(ie,d),d&&t(X),d&&t(R),d&&t(Le),k(de,d)}}}function dr(ee){let f,g;return f=new sr({props:{$$slots:{default:[hr]},$$scope:{ctx:ee}}}),{c(){v(f.$$.fragment)},l(m){b(f.$$.fragment,m)},m(m,$){j(f,m,$),g=!0},p(m,$){const A={};$&2&&(A.$$scope={dirty:$,ctx:m}),f.$set(A)},i(m){g||(y(f.$$.fragment,m),g=!0)},o(m){w(f.$$.fragment,m),g=!1},d(m){k(f,m)}}}function _r(ee){let f,g,m,$,A;return{c(){f=n("p"),g=s("For a more in-depth example of how to finetune a model for audio classification, take a look at the corresponding "),m=n("a"),$=s("PyTorch notebook"),A=s("."),this.h()},l(E){f=r(E,"P",{});var P=o(f);g=l(P,"For a more in-depth example of how to finetune a model for audio classification, take a look at the corresponding "),m=r(P,"A",{href:!0,rel:!0});var I=o(m);$=l(I,"PyTorch notebook"),I.forEach(t),A=l(P,"."),P.forEach(t),this.h()},h(){h(m,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/audio_classification.ipynb"),h(m,"rel","nofollow")},m(E,P){p(E,f,P),a(f,g),a(f,m),a(m,$),a(f,A)},d(E){E&&t(f)}}}function gr(ee){let f,g,m,$,A,E,P,I,q,F,M,O,H,S,T,Q,G,z,ae,N,W;return P=new L({props:{code:`from transformers import AutoFeatureExtractor

feature_extractor = AutoFeatureExtractor.from_pretrained("stevhliu/my_awesome_minds_model")
inputs = feature_extractor(dataset[0]["audio"]["array"], sampling_rate=sampling_rate, return_tensors="pt")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoFeatureExtractor

<span class="hljs-meta">&gt;&gt;&gt; </span>feature_extractor = AutoFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;stevhliu/my_awesome_minds_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = feature_extractor(dataset[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;array&quot;</span>], sampling_rate=sampling_rate, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)`}}),O=new L({props:{code:`from transformers import AutoModelForAudioClassification

model = AutoModelForAudioClassification.from_pretrained("stevhliu/my_awesome_minds_model")
with torch.no_grad():
    logits = model(**inputs).logits`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForAudioClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForAudioClassification.from_pretrained(<span class="hljs-string">&quot;stevhliu/my_awesome_minds_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits`}}),N=new L({props:{code:`import torch

predicted_class_ids = torch.argmax(logits).item()
predicted_label = model.config.id2label[predicted_class_ids]
predicted_label`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_ids = torch.argmax(logits).item()
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_label = model.config.id2label[predicted_class_ids]
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_label
<span class="hljs-string">&#x27;cash_deposit&#x27;</span>`}}),{c(){f=n("p"),g=s("Load a feature extractor to preprocess the audio file and return the "),m=n("code"),$=s("input"),A=s(" as PyTorch tensors:"),E=c(),v(P.$$.fragment),I=c(),q=n("p"),F=s("Pass your inputs to the model and return the logits:"),M=c(),v(O.$$.fragment),H=c(),S=n("p"),T=s("Get the class with the highest probability, and use the model\u2019s "),Q=n("code"),G=s("id2label"),z=s(" mapping to convert it to a label:"),ae=c(),v(N.$$.fragment)},l(_){f=r(_,"P",{});var D=o(f);g=l(D,"Load a feature extractor to preprocess the audio file and return the "),m=r(D,"CODE",{});var V=o(m);$=l(V,"input"),V.forEach(t),A=l(D," as PyTorch tensors:"),D.forEach(t),E=u(_),b(P.$$.fragment,_),I=u(_),q=r(_,"P",{});var pe=o(q);F=l(pe,"Pass your inputs to the model and return the logits:"),pe.forEach(t),M=u(_),b(O.$$.fragment,_),H=u(_),S=r(_,"P",{});var B=o(S);T=l(B,"Get the class with the highest probability, and use the model\u2019s "),Q=r(B,"CODE",{});var Y=o(Q);G=l(Y,"id2label"),Y.forEach(t),z=l(B," mapping to convert it to a label:"),B.forEach(t),ae=u(_),b(N.$$.fragment,_)},m(_,D){p(_,f,D),a(f,g),a(f,m),a(m,$),a(f,A),p(_,E,D),j(P,_,D),p(_,I,D),p(_,q,D),a(q,F),p(_,M,D),j(O,_,D),p(_,H,D),p(_,S,D),a(S,T),a(S,Q),a(Q,G),a(S,z),p(_,ae,D),j(N,_,D),W=!0},p:pr,i(_){W||(y(P.$$.fragment,_),y(O.$$.fragment,_),y(N.$$.fragment,_),W=!0)},o(_){w(P.$$.fragment,_),w(O.$$.fragment,_),w(N.$$.fragment,_),W=!1},d(_){_&&t(f),_&&t(E),k(P,_),_&&t(I),_&&t(q),_&&t(M),k(O,_),_&&t(H),_&&t(S),_&&t(ae),k(N,_)}}}function $r(ee){let f,g;return f=new sr({props:{$$slots:{default:[gr]},$$scope:{ctx:ee}}}),{c(){v(f.$$.fragment)},l(m){b(f.$$.fragment,m)},m(m,$){j(f,m,$),g=!0},p(m,$){const A={};$&2&&(A.$$scope={dirty:$,ctx:m}),f.$set(A)},i(m){g||(y(f.$$.fragment,m),g=!0)},o(m){w(f.$$.fragment,m),g=!1},d(m){k(f,m)}}}function vr(ee){let f,g,m,$,A,E,P,I,q,F,M,O,H,S,T,Q,G,z,ae,N,W,_,D,V,pe,B,Y,be,je,U,me,ce,re,te,J,x,Ae,ye,K,we,se,qe,ke,oe,ie,X,R,Ce,ue,aa,Ie,Le,de,Ee,d,C,he,ta,Z,fe,Ne,Ca,Ia,Te,Pe,Fa,sa,_e,la,xe,Ma,xt,na,At,le,ks,Xa,Es,xs,Za,As,qs,et,Ts,Ps,at,Ds,Ss,ra,Cs,Is,qt,oa,Tt,Oa,Fs,Pt,ia,Dt,Wa,Ms,St,He,ze,tt,Os,Ws,st,Ls,Ns,Hs,La,lt,zs,Vs,Ct,Na,Ys,It,pa,Ft,Ha,Us,Mt,ca,Ot,Fe,Ve,nt,ua,Rs,rt,Gs,Wt,za,Bs,Lt,fa,Nt,Ye,Js,ma,Ks,Qs,Ht,ha,zt,Va,Xs,Vt,De,da,Zs,ot,el,al,tl,_a,sl,ga,ll,nl,rl,it,ol,Yt,$a,Ut,ne,il,va,pl,cl,pt,ul,fl,ct,ml,hl,ut,dl,_l,ft,gl,$l,Rt,ba,Gt,Me,Ue,mt,ja,vl,ht,bl,Bt,ge,jl,ya,yl,wl,wa,kl,El,ka,xl,Al,Jt,Ea,Kt,Re,ql,xa,Tl,Pl,Qt,Aa,Xt,Ge,Dl,dt,Sl,Cl,Zt,Oe,Be,_t,qa,Il,gt,Fl,es,Je,as,Ke,ts,We,Qe,$t,Ta,Ml,vt,Ol,ss,Ya,Wl,ls,Ua,Ll,ns,Pa,rs,Se,Nl,Ra,Hl,zl,bt,Vl,Yl,os,Da,is,Xe,Ul,jt,Rl,Gl,ps,Ze,cs;return E=new Qa({}),M=new ur({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/audio_classification.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/audio_classification.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/tensorflow/audio_classification.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/audio_classification.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/audio_classification.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/tensorflow/audio_classification.ipynb"}]}}),H=new cr({props:{id:"KWwzcmG98Ds"}}),te=new Jl({props:{$$slots:{default:[fr]},$$scope:{ctx:ee}}}),K=new L({props:{code:"pip install transformers datasets evaluate",highlighted:"pip install transformers datasets evaluate"}}),oe=new L({props:{code:`from huggingface_hub import notebook_login

notebook_login()`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> notebook_login

<span class="hljs-meta">&gt;&gt;&gt; </span>notebook_login()`}}),ue=new Qa({}),he=new L({props:{code:`from datasets import load_dataset, Audio

minds = load_dataset("PolyAI/minds14", name="en-US", split="train")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset, Audio

<span class="hljs-meta">&gt;&gt;&gt; </span>minds = load_dataset(<span class="hljs-string">&quot;PolyAI/minds14&quot;</span>, name=<span class="hljs-string">&quot;en-US&quot;</span>, split=<span class="hljs-string">&quot;train&quot;</span>)`}}),_e=new L({props:{code:"minds = minds.train_test_split(test_size=0.2)",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>minds = minds.train_test_split(test_size=<span class="hljs-number">0.2</span>)'}}),na=new L({props:{code:"minds",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>minds
DatasetDict({
    train: Dataset({
        features: [<span class="hljs-string">&#x27;path&#x27;</span>, <span class="hljs-string">&#x27;audio&#x27;</span>, <span class="hljs-string">&#x27;transcription&#x27;</span>, <span class="hljs-string">&#x27;english_transcription&#x27;</span>, <span class="hljs-string">&#x27;intent_class&#x27;</span>, <span class="hljs-string">&#x27;lang_id&#x27;</span>],
        num_rows: <span class="hljs-number">450</span>
    })
    test: Dataset({
        features: [<span class="hljs-string">&#x27;path&#x27;</span>, <span class="hljs-string">&#x27;audio&#x27;</span>, <span class="hljs-string">&#x27;transcription&#x27;</span>, <span class="hljs-string">&#x27;english_transcription&#x27;</span>, <span class="hljs-string">&#x27;intent_class&#x27;</span>, <span class="hljs-string">&#x27;lang_id&#x27;</span>],
        num_rows: <span class="hljs-number">113</span>
    })
})`}}),oa=new L({props:{code:'minds = minds.remove_columns(["path", "transcription", "english_transcription", "lang_id"])',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>minds = minds.remove_columns([<span class="hljs-string">&quot;path&quot;</span>, <span class="hljs-string">&quot;transcription&quot;</span>, <span class="hljs-string">&quot;english_transcription&quot;</span>, <span class="hljs-string">&quot;lang_id&quot;</span>])'}}),ia=new L({props:{code:'minds["train"][0]',highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>minds[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;audio&#x27;</span>: {<span class="hljs-string">&#x27;array&#x27;</span>: array([ <span class="hljs-number">0.</span>        ,  <span class="hljs-number">0.</span>        ,  <span class="hljs-number">0.</span>        , ..., -<span class="hljs-number">0.00048828</span>,
         -<span class="hljs-number">0.00024414</span>, -<span class="hljs-number">0.00024414</span>], dtype=float32),
  <span class="hljs-string">&#x27;path&#x27;</span>: <span class="hljs-string">&#x27;/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~APP_ERROR/602b9a5fbb1e6d0fbce91f52.wav&#x27;</span>,
  <span class="hljs-string">&#x27;sampling_rate&#x27;</span>: <span class="hljs-number">8000</span>},
 <span class="hljs-string">&#x27;intent_class&#x27;</span>: <span class="hljs-number">2</span>}`}}),pa=new L({props:{code:`labels = minds["train"].features["intent_class"].names
label2id, id2label = dict(), dict()
for i, label in enumerate(labels):
    label2id[label] = str(i)
    id2label[str(i)] = label`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>labels = minds[<span class="hljs-string">&quot;train&quot;</span>].features[<span class="hljs-string">&quot;intent_class&quot;</span>].names
<span class="hljs-meta">&gt;&gt;&gt; </span>label2id, id2label = <span class="hljs-built_in">dict</span>(), <span class="hljs-built_in">dict</span>()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> i, label <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(labels):
<span class="hljs-meta">... </span>    label2id[label] = <span class="hljs-built_in">str</span>(i)
<span class="hljs-meta">... </span>    id2label[<span class="hljs-built_in">str</span>(i)] = label`}}),ca=new L({props:{code:"id2label[str(2)]",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>id2label[<span class="hljs-built_in">str</span>(<span class="hljs-number">2</span>)]
<span class="hljs-string">&#x27;app_error&#x27;</span>`}}),ua=new Qa({}),fa=new L({props:{code:`from transformers import AutoFeatureExtractor

feature_extractor = AutoFeatureExtractor.from_pretrained("facebook/wav2vec2-base")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoFeatureExtractor

<span class="hljs-meta">&gt;&gt;&gt; </span>feature_extractor = AutoFeatureExtractor.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-base&quot;</span>)`}}),ha=new L({props:{code:`minds = minds.cast_column("audio", Audio(sampling_rate=16_000))
minds["train"][0]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>minds = minds.cast_column(<span class="hljs-string">&quot;audio&quot;</span>, Audio(sampling_rate=<span class="hljs-number">16_000</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span>minds[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;audio&#x27;</span>: {<span class="hljs-string">&#x27;array&#x27;</span>: array([ <span class="hljs-number">2.2098757e-05</span>,  <span class="hljs-number">4.6582241e-05</span>, -<span class="hljs-number">2.2803260e-05</span>, ...,
         -<span class="hljs-number">2.8419291e-04</span>, -<span class="hljs-number">2.3305941e-04</span>, -<span class="hljs-number">1.1425107e-04</span>], dtype=float32),
  <span class="hljs-string">&#x27;path&#x27;</span>: <span class="hljs-string">&#x27;/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~APP_ERROR/602b9a5fbb1e6d0fbce91f52.wav&#x27;</span>,
  <span class="hljs-string">&#x27;sampling_rate&#x27;</span>: <span class="hljs-number">16000</span>},
 <span class="hljs-string">&#x27;intent_class&#x27;</span>: <span class="hljs-number">2</span>}`}}),$a=new L({props:{code:`def preprocess_function(examples):
    audio_arrays = [x["array"] for x in examples["audio"]]
    inputs = feature_extractor(
        audio_arrays, sampling_rate=feature_extractor.sampling_rate, max_length=16000, truncation=True
    )
    return inputs`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_function</span>(<span class="hljs-params">examples</span>):
<span class="hljs-meta">... </span>    audio_arrays = [x[<span class="hljs-string">&quot;array&quot;</span>] <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> examples[<span class="hljs-string">&quot;audio&quot;</span>]]
<span class="hljs-meta">... </span>    inputs = feature_extractor(
<span class="hljs-meta">... </span>        audio_arrays, sampling_rate=feature_extractor.sampling_rate, max_length=<span class="hljs-number">16000</span>, truncation=<span class="hljs-literal">True</span>
<span class="hljs-meta">... </span>    )
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> inputs`}}),ba=new L({props:{code:`encoded_minds = minds.map(preprocess_function, remove_columns="audio", batched=True)
encoded_minds = encoded_minds.rename_column("intent_class", "label")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>encoded_minds = minds.<span class="hljs-built_in">map</span>(preprocess_function, remove_columns=<span class="hljs-string">&quot;audio&quot;</span>, batched=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>encoded_minds = encoded_minds.rename_column(<span class="hljs-string">&quot;intent_class&quot;</span>, <span class="hljs-string">&quot;label&quot;</span>)`}}),ja=new Qa({}),Ea=new L({props:{code:`import evaluate

accuracy = evaluate.load("accuracy")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> evaluate

<span class="hljs-meta">&gt;&gt;&gt; </span>accuracy = evaluate.load(<span class="hljs-string">&quot;accuracy&quot;</span>)`}}),Aa=new L({props:{code:`import numpy as np


def compute_metrics(eval_pred):
    predictions = np.argmax(eval_pred.predictions, axis=1)
    return accuracy.compute(predictions=predictions, references=eval_pred.label_ids)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">compute_metrics</span>(<span class="hljs-params">eval_pred</span>):
<span class="hljs-meta">... </span>    predictions = np.argmax(eval_pred.predictions, axis=<span class="hljs-number">1</span>)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> accuracy.compute(predictions=predictions, references=eval_pred.label_ids)`}}),qa=new Qa({}),Je=new tr({props:{pytorch:!0,tensorflow:!1,jax:!1,$$slots:{pytorch:[dr]},$$scope:{ctx:ee}}}),Ke=new Jl({props:{$$slots:{default:[_r]},$$scope:{ctx:ee}}}),Ta=new Qa({}),Pa=new L({props:{code:`from datasets import load_dataset, Audio

dataset = load_dataset("PolyAI/minds14", name="en-US", split="train")
dataset = dataset.cast_column("audio", Audio(sampling_rate=16000))
sampling_rate = dataset.features["audio"].sampling_rate
audio_file = dataset[0]["audio"]["path"]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset, Audio

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;PolyAI/minds14&quot;</span>, name=<span class="hljs-string">&quot;en-US&quot;</span>, split=<span class="hljs-string">&quot;train&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = dataset.cast_column(<span class="hljs-string">&quot;audio&quot;</span>, Audio(sampling_rate=<span class="hljs-number">16000</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span>sampling_rate = dataset.features[<span class="hljs-string">&quot;audio&quot;</span>].sampling_rate
<span class="hljs-meta">&gt;&gt;&gt; </span>audio_file = dataset[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;path&quot;</span>]`}}),Da=new L({props:{code:`from transformers import pipeline

classifier = pipeline("audio-classification", model="stevhliu/my_awesome_minds_model")
classifier(audio_file)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>classifier = pipeline(<span class="hljs-string">&quot;audio-classification&quot;</span>, model=<span class="hljs-string">&quot;stevhliu/my_awesome_minds_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>classifier(audio_file)
[
    {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.09766869246959686</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;cash_deposit&#x27;</span>},
    {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.07998877018690109</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;app_error&#x27;</span>},
    {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.0781070664525032</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;joint_account&#x27;</span>},
    {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.07667109370231628</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;pay_bill&#x27;</span>},
    {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.0755252093076706</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;balance&#x27;</span>}
]`}}),Ze=new tr({props:{pytorch:!0,tensorflow:!1,jax:!1,$$slots:{pytorch:[$r]},$$scope:{ctx:ee}}}),{c(){f=n("meta"),g=c(),m=n("h1"),$=n("a"),A=n("span"),v(E.$$.fragment),P=c(),I=n("span"),q=s("Audio classification"),F=c(),v(M.$$.fragment),O=c(),v(H.$$.fragment),S=c(),T=n("p"),Q=s("Audio classification - just like with text - assigns a class label output from the input data. The only difference is instead of text inputs, you have raw audio waveforms. Some practical applications of audio classification include identifying speaker intent, language classification, and even animal species by their sounds."),G=c(),z=n("p"),ae=s("This guide will show you how to:"),N=c(),W=n("ol"),_=n("li"),D=s("Finetune "),V=n("a"),pe=s("Wav2Vec2"),B=s(" on the "),Y=n("a"),be=s("MInDS-14"),je=s(" dataset to classify speaker intent."),U=c(),me=n("li"),ce=s("Use your finetuned model for inference."),re=c(),v(te.$$.fragment),J=c(),x=n("p"),Ae=s("Before you begin, make sure you have all the necessary libraries installed:"),ye=c(),v(K.$$.fragment),we=c(),se=n("p"),qe=s("We encourage you to login to your Hugging Face account so you can upload and share your model with the community. When prompted, enter your token to login:"),ke=c(),v(oe.$$.fragment),ie=c(),X=n("h2"),R=n("a"),Ce=n("span"),v(ue.$$.fragment),aa=c(),Ie=n("span"),Le=s("Load MInDS-14 dataset"),de=c(),Ee=n("p"),d=s("Start by loading the MInDS-14 dataset from the \u{1F917} Datasets library:"),C=c(),v(he.$$.fragment),ta=c(),Z=n("p"),fe=s("Split the dataset\u2019s "),Ne=n("code"),Ca=s("train"),Ia=s(" split into a smaller train and test set with the "),Te=n("a"),Pe=s("train_test_split"),Fa=s(" method. This\u2019ll give you a chance to experiment and make sure everything works before spending more time on the full dataset."),sa=c(),v(_e.$$.fragment),la=c(),xe=n("p"),Ma=s("Then take a look at the dataset:"),xt=c(),v(na.$$.fragment),At=c(),le=n("p"),ks=s("While the dataset contains a lot of useful information, like "),Xa=n("code"),Es=s("lang_id"),xs=s(" and "),Za=n("code"),As=s("english_transcription"),qs=s(", you\u2019ll focus on the "),et=n("code"),Ts=s("audio"),Ps=s(" and "),at=n("code"),Ds=s("intent_class"),Ss=s(" in this guide. Remove the other columns with the "),ra=n("a"),Cs=s("remove_columns"),Is=s(" method:"),qt=c(),v(oa.$$.fragment),Tt=c(),Oa=n("p"),Fs=s("Take a look at an example now:"),Pt=c(),v(ia.$$.fragment),Dt=c(),Wa=n("p"),Ms=s("There are two fields:"),St=c(),He=n("ul"),ze=n("li"),tt=n("code"),Os=s("audio"),Ws=s(": a 1-dimensional "),st=n("code"),Ls=s("array"),Ns=s(" of the speech signal that must be called to load and resample the audio file."),Hs=c(),La=n("li"),lt=n("code"),zs=s("intent_class"),Vs=s(": represents the class id of the speaker\u2019s intent."),Ct=c(),Na=n("p"),Ys=s("To make it easier for the model to get the label name from the label id, create a dictionary that maps the label name to an integer and vice versa:"),It=c(),v(pa.$$.fragment),Ft=c(),Ha=n("p"),Us=s("Now you can convert the label id to a label name:"),Mt=c(),v(ca.$$.fragment),Ot=c(),Fe=n("h2"),Ve=n("a"),nt=n("span"),v(ua.$$.fragment),Rs=c(),rt=n("span"),Gs=s("Preprocess"),Wt=c(),za=n("p"),Bs=s("The next step is to load a Wav2Vec2 feature extractor to process the audio signal:"),Lt=c(),v(fa.$$.fragment),Nt=c(),Ye=n("p"),Js=s("The MInDS-14 dataset has a sampling rate of 8000khz (you can find this information in it\u2019s "),ma=n("a"),Ks=s("dataset card"),Qs=s("), which means you\u2019ll need to resample the dataset to 16000kHz to use the pretrained Wav2Vec2 model:"),Ht=c(),v(ha.$$.fragment),zt=c(),Va=n("p"),Xs=s("Now create a preprocessing function that:"),Vt=c(),De=n("ol"),da=n("li"),Zs=s("Calls the "),ot=n("code"),el=s("audio"),al=s(" column to load, and if necessary, resample the audio file."),tl=c(),_a=n("li"),sl=s("Checks if the sampling rate of the audio file matches the sampling rate of the audio data a model was pretrained with. You can find this information in the Wav2Vec2 "),ga=n("a"),ll=s("model card"),nl=s("."),rl=c(),it=n("li"),ol=s("Set a maximum input length to batch longer inputs without truncating them."),Yt=c(),v($a.$$.fragment),Ut=c(),ne=n("p"),il=s("To apply the preprocessing function over the entire dataset, use \u{1F917} Datasets "),va=n("a"),pl=s("map"),cl=s(" function. You can speed up "),pt=n("code"),ul=s("map"),fl=s(" by setting "),ct=n("code"),ml=s("batched=True"),hl=s(" to process multiple elements of the dataset at once. Remove the columns you don\u2019t need, and rename "),ut=n("code"),dl=s("intent_class"),_l=s(" to "),ft=n("code"),gl=s("label"),$l=s(" because that\u2019s the name the model expects:"),Rt=c(),v(ba.$$.fragment),Gt=c(),Me=n("h2"),Ue=n("a"),mt=n("span"),v(ja.$$.fragment),vl=c(),ht=n("span"),bl=s("Evaluate"),Bt=c(),ge=n("p"),jl=s("Including a metric during training is often helpful for evaluating your model\u2019s performance. You can quickly load a evaluation method with the \u{1F917} "),ya=n("a"),yl=s("Evaluate"),wl=s(" library. For this task, load the "),wa=n("a"),kl=s("accuracy"),El=s(" metric (see the \u{1F917} Evaluate "),ka=n("a"),xl=s("quick tour"),Al=s(" to learn more about how to load and compute a metric):"),Jt=c(),v(Ea.$$.fragment),Kt=c(),Re=n("p"),ql=s("Then create a function that passes your predictions and labels to "),xa=n("a"),Tl=s("compute"),Pl=s(" to calculate the accuracy:"),Qt=c(),v(Aa.$$.fragment),Xt=c(),Ge=n("p"),Dl=s("Your "),dt=n("code"),Sl=s("compute_metrics"),Cl=s(" function is ready to go now, and you\u2019ll return to it when you setup your training."),Zt=c(),Oe=n("h2"),Be=n("a"),_t=n("span"),v(qa.$$.fragment),Il=c(),gt=n("span"),Fl=s("Train"),es=c(),v(Je.$$.fragment),as=c(),v(Ke.$$.fragment),ts=c(),We=n("h2"),Qe=n("a"),$t=n("span"),v(Ta.$$.fragment),Ml=c(),vt=n("span"),Ol=s("Inference"),ss=c(),Ya=n("p"),Wl=s("Great, now that you\u2019ve finetuned a model, you can use it for inference!"),ls=c(),Ua=n("p"),Ll=s("Load an audio file you\u2019d like to run inference on. Remember to resample the sampling rate of the audio file to match the sampling rate of the model if you need to!"),ns=c(),v(Pa.$$.fragment),rs=c(),Se=n("p"),Nl=s("The simplest way to try out your finetuned model for inference is to use it in a "),Ra=n("a"),Hl=s("pipeline()"),zl=s(". Instantiate a "),bt=n("code"),Vl=s("pipeline"),Yl=s(" for audio classification with your model, and pass your audio file to it:"),os=c(),v(Da.$$.fragment),is=c(),Xe=n("p"),Ul=s("You can also manually replicate the results of the "),jt=n("code"),Rl=s("pipeline"),Gl=s(" if you\u2019d like:"),ps=c(),v(Ze.$$.fragment),this.h()},l(e){const i=or('[data-svelte="svelte-1phssyn"]',document.head);f=r(i,"META",{name:!0,content:!0}),i.forEach(t),g=u(e),m=r(e,"H1",{class:!0});var Sa=o(m);$=r(Sa,"A",{id:!0,class:!0,href:!0});var yt=o($);A=r(yt,"SPAN",{});var wt=o(A);b(E.$$.fragment,wt),wt.forEach(t),yt.forEach(t),P=u(Sa),I=r(Sa,"SPAN",{});var kt=o(I);q=l(kt,"Audio classification"),kt.forEach(t),Sa.forEach(t),F=u(e),b(M.$$.fragment,e),O=u(e),b(H.$$.fragment,e),S=u(e),T=r(e,"P",{});var Kl=o(T);Q=l(Kl,"Audio classification - just like with text - assigns a class label output from the input data. The only difference is instead of text inputs, you have raw audio waveforms. Some practical applications of audio classification include identifying speaker intent, language classification, and even animal species by their sounds."),Kl.forEach(t),G=u(e),z=r(e,"P",{});var Ql=o(z);ae=l(Ql,"This guide will show you how to:"),Ql.forEach(t),N=u(e),W=r(e,"OL",{});var us=o(W);_=r(us,"LI",{});var Ga=o(_);D=l(Ga,"Finetune "),V=r(Ga,"A",{href:!0,rel:!0});var Xl=o(V);pe=l(Xl,"Wav2Vec2"),Xl.forEach(t),B=l(Ga," on the "),Y=r(Ga,"A",{href:!0,rel:!0});var Zl=o(Y);be=l(Zl,"MInDS-14"),Zl.forEach(t),je=l(Ga," dataset to classify speaker intent."),Ga.forEach(t),U=u(us),me=r(us,"LI",{});var en=o(me);ce=l(en,"Use your finetuned model for inference."),en.forEach(t),us.forEach(t),re=u(e),b(te.$$.fragment,e),J=u(e),x=r(e,"P",{});var an=o(x);Ae=l(an,"Before you begin, make sure you have all the necessary libraries installed:"),an.forEach(t),ye=u(e),b(K.$$.fragment,e),we=u(e),se=r(e,"P",{});var tn=o(se);qe=l(tn,"We encourage you to login to your Hugging Face account so you can upload and share your model with the community. When prompted, enter your token to login:"),tn.forEach(t),ke=u(e),b(oe.$$.fragment,e),ie=u(e),X=r(e,"H2",{class:!0});var fs=o(X);R=r(fs,"A",{id:!0,class:!0,href:!0});var sn=o(R);Ce=r(sn,"SPAN",{});var ln=o(Ce);b(ue.$$.fragment,ln),ln.forEach(t),sn.forEach(t),aa=u(fs),Ie=r(fs,"SPAN",{});var nn=o(Ie);Le=l(nn,"Load MInDS-14 dataset"),nn.forEach(t),fs.forEach(t),de=u(e),Ee=r(e,"P",{});var rn=o(Ee);d=l(rn,"Start by loading the MInDS-14 dataset from the \u{1F917} Datasets library:"),rn.forEach(t),C=u(e),b(he.$$.fragment,e),ta=u(e),Z=r(e,"P",{});var Ba=o(Z);fe=l(Ba,"Split the dataset\u2019s "),Ne=r(Ba,"CODE",{});var on=o(Ne);Ca=l(on,"train"),on.forEach(t),Ia=l(Ba," split into a smaller train and test set with the "),Te=r(Ba,"A",{href:!0,rel:!0});var pn=o(Te);Pe=l(pn,"train_test_split"),pn.forEach(t),Fa=l(Ba," method. This\u2019ll give you a chance to experiment and make sure everything works before spending more time on the full dataset."),Ba.forEach(t),sa=u(e),b(_e.$$.fragment,e),la=u(e),xe=r(e,"P",{});var cn=o(xe);Ma=l(cn,"Then take a look at the dataset:"),cn.forEach(t),xt=u(e),b(na.$$.fragment,e),At=u(e),le=r(e,"P",{});var $e=o(le);ks=l($e,"While the dataset contains a lot of useful information, like "),Xa=r($e,"CODE",{});var un=o(Xa);Es=l(un,"lang_id"),un.forEach(t),xs=l($e," and "),Za=r($e,"CODE",{});var fn=o(Za);As=l(fn,"english_transcription"),fn.forEach(t),qs=l($e,", you\u2019ll focus on the "),et=r($e,"CODE",{});var mn=o(et);Ts=l(mn,"audio"),mn.forEach(t),Ps=l($e," and "),at=r($e,"CODE",{});var hn=o(at);Ds=l(hn,"intent_class"),hn.forEach(t),Ss=l($e," in this guide. Remove the other columns with the "),ra=r($e,"A",{href:!0,rel:!0});var dn=o(ra);Cs=l(dn,"remove_columns"),dn.forEach(t),Is=l($e," method:"),$e.forEach(t),qt=u(e),b(oa.$$.fragment,e),Tt=u(e),Oa=r(e,"P",{});var _n=o(Oa);Fs=l(_n,"Take a look at an example now:"),_n.forEach(t),Pt=u(e),b(ia.$$.fragment,e),Dt=u(e),Wa=r(e,"P",{});var gn=o(Wa);Ms=l(gn,"There are two fields:"),gn.forEach(t),St=u(e),He=r(e,"UL",{});var ms=o(He);ze=r(ms,"LI",{});var Et=o(ze);tt=r(Et,"CODE",{});var $n=o(tt);Os=l($n,"audio"),$n.forEach(t),Ws=l(Et,": a 1-dimensional "),st=r(Et,"CODE",{});var vn=o(st);Ls=l(vn,"array"),vn.forEach(t),Ns=l(Et," of the speech signal that must be called to load and resample the audio file."),Et.forEach(t),Hs=u(ms),La=r(ms,"LI",{});var Bl=o(La);lt=r(Bl,"CODE",{});var bn=o(lt);zs=l(bn,"intent_class"),bn.forEach(t),Vs=l(Bl,": represents the class id of the speaker\u2019s intent."),Bl.forEach(t),ms.forEach(t),Ct=u(e),Na=r(e,"P",{});var jn=o(Na);Ys=l(jn,"To make it easier for the model to get the label name from the label id, create a dictionary that maps the label name to an integer and vice versa:"),jn.forEach(t),It=u(e),b(pa.$$.fragment,e),Ft=u(e),Ha=r(e,"P",{});var yn=o(Ha);Us=l(yn,"Now you can convert the label id to a label name:"),yn.forEach(t),Mt=u(e),b(ca.$$.fragment,e),Ot=u(e),Fe=r(e,"H2",{class:!0});var hs=o(Fe);Ve=r(hs,"A",{id:!0,class:!0,href:!0});var wn=o(Ve);nt=r(wn,"SPAN",{});var kn=o(nt);b(ua.$$.fragment,kn),kn.forEach(t),wn.forEach(t),Rs=u(hs),rt=r(hs,"SPAN",{});var En=o(rt);Gs=l(En,"Preprocess"),En.forEach(t),hs.forEach(t),Wt=u(e),za=r(e,"P",{});var xn=o(za);Bs=l(xn,"The next step is to load a Wav2Vec2 feature extractor to process the audio signal:"),xn.forEach(t),Lt=u(e),b(fa.$$.fragment,e),Nt=u(e),Ye=r(e,"P",{});var ds=o(Ye);Js=l(ds,"The MInDS-14 dataset has a sampling rate of 8000khz (you can find this information in it\u2019s "),ma=r(ds,"A",{href:!0,rel:!0});var An=o(ma);Ks=l(An,"dataset card"),An.forEach(t),Qs=l(ds,"), which means you\u2019ll need to resample the dataset to 16000kHz to use the pretrained Wav2Vec2 model:"),ds.forEach(t),Ht=u(e),b(ha.$$.fragment,e),zt=u(e),Va=r(e,"P",{});var qn=o(Va);Xs=l(qn,"Now create a preprocessing function that:"),qn.forEach(t),Vt=u(e),De=r(e,"OL",{});var Ja=o(De);da=r(Ja,"LI",{});var _s=o(da);Zs=l(_s,"Calls the "),ot=r(_s,"CODE",{});var Tn=o(ot);el=l(Tn,"audio"),Tn.forEach(t),al=l(_s," column to load, and if necessary, resample the audio file."),_s.forEach(t),tl=u(Ja),_a=r(Ja,"LI",{});var gs=o(_a);sl=l(gs,"Checks if the sampling rate of the audio file matches the sampling rate of the audio data a model was pretrained with. You can find this information in the Wav2Vec2 "),ga=r(gs,"A",{href:!0,rel:!0});var Pn=o(ga);ll=l(Pn,"model card"),Pn.forEach(t),nl=l(gs,"."),gs.forEach(t),rl=u(Ja),it=r(Ja,"LI",{});var Dn=o(it);ol=l(Dn,"Set a maximum input length to batch longer inputs without truncating them."),Dn.forEach(t),Ja.forEach(t),Yt=u(e),b($a.$$.fragment,e),Ut=u(e),ne=r(e,"P",{});var ve=o(ne);il=l(ve,"To apply the preprocessing function over the entire dataset, use \u{1F917} Datasets "),va=r(ve,"A",{href:!0,rel:!0});var Sn=o(va);pl=l(Sn,"map"),Sn.forEach(t),cl=l(ve," function. You can speed up "),pt=r(ve,"CODE",{});var Cn=o(pt);ul=l(Cn,"map"),Cn.forEach(t),fl=l(ve," by setting "),ct=r(ve,"CODE",{});var In=o(ct);ml=l(In,"batched=True"),In.forEach(t),hl=l(ve," to process multiple elements of the dataset at once. Remove the columns you don\u2019t need, and rename "),ut=r(ve,"CODE",{});var Fn=o(ut);dl=l(Fn,"intent_class"),Fn.forEach(t),_l=l(ve," to "),ft=r(ve,"CODE",{});var Mn=o(ft);gl=l(Mn,"label"),Mn.forEach(t),$l=l(ve," because that\u2019s the name the model expects:"),ve.forEach(t),Rt=u(e),b(ba.$$.fragment,e),Gt=u(e),Me=r(e,"H2",{class:!0});var $s=o(Me);Ue=r($s,"A",{id:!0,class:!0,href:!0});var On=o(Ue);mt=r(On,"SPAN",{});var Wn=o(mt);b(ja.$$.fragment,Wn),Wn.forEach(t),On.forEach(t),vl=u($s),ht=r($s,"SPAN",{});var Ln=o(ht);bl=l(Ln,"Evaluate"),Ln.forEach(t),$s.forEach(t),Bt=u(e),ge=r(e,"P",{});var ea=o(ge);jl=l(ea,"Including a metric during training is often helpful for evaluating your model\u2019s performance. You can quickly load a evaluation method with the \u{1F917} "),ya=r(ea,"A",{href:!0,rel:!0});var Nn=o(ya);yl=l(Nn,"Evaluate"),Nn.forEach(t),wl=l(ea," library. For this task, load the "),wa=r(ea,"A",{href:!0,rel:!0});var Hn=o(wa);kl=l(Hn,"accuracy"),Hn.forEach(t),El=l(ea," metric (see the \u{1F917} Evaluate "),ka=r(ea,"A",{href:!0,rel:!0});var zn=o(ka);xl=l(zn,"quick tour"),zn.forEach(t),Al=l(ea," to learn more about how to load and compute a metric):"),ea.forEach(t),Jt=u(e),b(Ea.$$.fragment,e),Kt=u(e),Re=r(e,"P",{});var vs=o(Re);ql=l(vs,"Then create a function that passes your predictions and labels to "),xa=r(vs,"A",{href:!0,rel:!0});var Vn=o(xa);Tl=l(Vn,"compute"),Vn.forEach(t),Pl=l(vs," to calculate the accuracy:"),vs.forEach(t),Qt=u(e),b(Aa.$$.fragment,e),Xt=u(e),Ge=r(e,"P",{});var bs=o(Ge);Dl=l(bs,"Your "),dt=r(bs,"CODE",{});var Yn=o(dt);Sl=l(Yn,"compute_metrics"),Yn.forEach(t),Cl=l(bs," function is ready to go now, and you\u2019ll return to it when you setup your training."),bs.forEach(t),Zt=u(e),Oe=r(e,"H2",{class:!0});var js=o(Oe);Be=r(js,"A",{id:!0,class:!0,href:!0});var Un=o(Be);_t=r(Un,"SPAN",{});var Rn=o(_t);b(qa.$$.fragment,Rn),Rn.forEach(t),Un.forEach(t),Il=u(js),gt=r(js,"SPAN",{});var Gn=o(gt);Fl=l(Gn,"Train"),Gn.forEach(t),js.forEach(t),es=u(e),b(Je.$$.fragment,e),as=u(e),b(Ke.$$.fragment,e),ts=u(e),We=r(e,"H2",{class:!0});var ys=o(We);Qe=r(ys,"A",{id:!0,class:!0,href:!0});var Bn=o(Qe);$t=r(Bn,"SPAN",{});var Jn=o($t);b(Ta.$$.fragment,Jn),Jn.forEach(t),Bn.forEach(t),Ml=u(ys),vt=r(ys,"SPAN",{});var Kn=o(vt);Ol=l(Kn,"Inference"),Kn.forEach(t),ys.forEach(t),ss=u(e),Ya=r(e,"P",{});var Qn=o(Ya);Wl=l(Qn,"Great, now that you\u2019ve finetuned a model, you can use it for inference!"),Qn.forEach(t),ls=u(e),Ua=r(e,"P",{});var Xn=o(Ua);Ll=l(Xn,"Load an audio file you\u2019d like to run inference on. Remember to resample the sampling rate of the audio file to match the sampling rate of the model if you need to!"),Xn.forEach(t),ns=u(e),b(Pa.$$.fragment,e),rs=u(e),Se=r(e,"P",{});var Ka=o(Se);Nl=l(Ka,"The simplest way to try out your finetuned model for inference is to use it in a "),Ra=r(Ka,"A",{href:!0});var Zn=o(Ra);Hl=l(Zn,"pipeline()"),Zn.forEach(t),zl=l(Ka,". Instantiate a "),bt=r(Ka,"CODE",{});var er=o(bt);Vl=l(er,"pipeline"),er.forEach(t),Yl=l(Ka," for audio classification with your model, and pass your audio file to it:"),Ka.forEach(t),os=u(e),b(Da.$$.fragment,e),is=u(e),Xe=r(e,"P",{});var ws=o(Xe);Ul=l(ws,"You can also manually replicate the results of the "),jt=r(ws,"CODE",{});var ar=o(jt);Rl=l(ar,"pipeline"),ar.forEach(t),Gl=l(ws," if you\u2019d like:"),ws.forEach(t),ps=u(e),b(Ze.$$.fragment,e),this.h()},h(){h(f,"name","hf:doc:metadata"),h(f,"content",JSON.stringify(br)),h($,"id","audio-classification"),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"),h($,"href","#audio-classification"),h(m,"class","relative group"),h(V,"href","https://huggingface.co/facebook/wav2vec2-base"),h(V,"rel","nofollow"),h(Y,"href","https://huggingface.co/datasets/PolyAI/minds14"),h(Y,"rel","nofollow"),h(R,"id","load-minds14-dataset"),h(R,"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"),h(R,"href","#load-minds14-dataset"),h(X,"class","relative group"),h(Te,"href","https://huggingface.co/docs/datasets/v2.12.0/en/package_reference/main_classes#datasets.Dataset.train_test_split"),h(Te,"rel","nofollow"),h(ra,"href","https://huggingface.co/docs/datasets/v2.12.0/en/package_reference/main_classes#datasets.Dataset.remove_columns"),h(ra,"rel","nofollow"),h(Ve,"id","preprocess"),h(Ve,"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"),h(Ve,"href","#preprocess"),h(Fe,"class","relative group"),h(ma,"href","https://huggingface.co/datasets/PolyAI/minds14"),h(ma,"rel","nofollow"),h(ga,"href","https://huggingface.co/facebook/wav2vec2-base"),h(ga,"rel","nofollow"),h(va,"href","https://huggingface.co/docs/datasets/v2.12.0/en/package_reference/main_classes#datasets.Dataset.map"),h(va,"rel","nofollow"),h(Ue,"id","evaluate"),h(Ue,"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"),h(Ue,"href","#evaluate"),h(Me,"class","relative group"),h(ya,"href","https://huggingface.co/docs/evaluate/index"),h(ya,"rel","nofollow"),h(wa,"href","https://huggingface.co/spaces/evaluate-metric/accuracy"),h(wa,"rel","nofollow"),h(ka,"href","https://huggingface.co/docs/evaluate/a_quick_tour"),h(ka,"rel","nofollow"),h(xa,"href","https://huggingface.co/docs/evaluate/v0.4.0/en/package_reference/main_classes#evaluate.EvaluationModule.compute"),h(xa,"rel","nofollow"),h(Be,"id","train"),h(Be,"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"),h(Be,"href","#train"),h(Oe,"class","relative group"),h(Qe,"id","inference"),h(Qe,"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"),h(Qe,"href","#inference"),h(We,"class","relative group"),h(Ra,"href","/docs/transformers/v4.29.0/en/main_classes/pipelines#transformers.pipeline")},m(e,i){a(document.head,f),p(e,g,i),p(e,m,i),a(m,$),a($,A),j(E,A,null),a(m,P),a(m,I),a(I,q),p(e,F,i),j(M,e,i),p(e,O,i),j(H,e,i),p(e,S,i),p(e,T,i),a(T,Q),p(e,G,i),p(e,z,i),a(z,ae),p(e,N,i),p(e,W,i),a(W,_),a(_,D),a(_,V),a(V,pe),a(_,B),a(_,Y),a(Y,be),a(_,je),a(W,U),a(W,me),a(me,ce),p(e,re,i),j(te,e,i),p(e,J,i),p(e,x,i),a(x,Ae),p(e,ye,i),j(K,e,i),p(e,we,i),p(e,se,i),a(se,qe),p(e,ke,i),j(oe,e,i),p(e,ie,i),p(e,X,i),a(X,R),a(R,Ce),j(ue,Ce,null),a(X,aa),a(X,Ie),a(Ie,Le),p(e,de,i),p(e,Ee,i),a(Ee,d),p(e,C,i),j(he,e,i),p(e,ta,i),p(e,Z,i),a(Z,fe),a(Z,Ne),a(Ne,Ca),a(Z,Ia),a(Z,Te),a(Te,Pe),a(Z,Fa),p(e,sa,i),j(_e,e,i),p(e,la,i),p(e,xe,i),a(xe,Ma),p(e,xt,i),j(na,e,i),p(e,At,i),p(e,le,i),a(le,ks),a(le,Xa),a(Xa,Es),a(le,xs),a(le,Za),a(Za,As),a(le,qs),a(le,et),a(et,Ts),a(le,Ps),a(le,at),a(at,Ds),a(le,Ss),a(le,ra),a(ra,Cs),a(le,Is),p(e,qt,i),j(oa,e,i),p(e,Tt,i),p(e,Oa,i),a(Oa,Fs),p(e,Pt,i),j(ia,e,i),p(e,Dt,i),p(e,Wa,i),a(Wa,Ms),p(e,St,i),p(e,He,i),a(He,ze),a(ze,tt),a(tt,Os),a(ze,Ws),a(ze,st),a(st,Ls),a(ze,Ns),a(He,Hs),a(He,La),a(La,lt),a(lt,zs),a(La,Vs),p(e,Ct,i),p(e,Na,i),a(Na,Ys),p(e,It,i),j(pa,e,i),p(e,Ft,i),p(e,Ha,i),a(Ha,Us),p(e,Mt,i),j(ca,e,i),p(e,Ot,i),p(e,Fe,i),a(Fe,Ve),a(Ve,nt),j(ua,nt,null),a(Fe,Rs),a(Fe,rt),a(rt,Gs),p(e,Wt,i),p(e,za,i),a(za,Bs),p(e,Lt,i),j(fa,e,i),p(e,Nt,i),p(e,Ye,i),a(Ye,Js),a(Ye,ma),a(ma,Ks),a(Ye,Qs),p(e,Ht,i),j(ha,e,i),p(e,zt,i),p(e,Va,i),a(Va,Xs),p(e,Vt,i),p(e,De,i),a(De,da),a(da,Zs),a(da,ot),a(ot,el),a(da,al),a(De,tl),a(De,_a),a(_a,sl),a(_a,ga),a(ga,ll),a(_a,nl),a(De,rl),a(De,it),a(it,ol),p(e,Yt,i),j($a,e,i),p(e,Ut,i),p(e,ne,i),a(ne,il),a(ne,va),a(va,pl),a(ne,cl),a(ne,pt),a(pt,ul),a(ne,fl),a(ne,ct),a(ct,ml),a(ne,hl),a(ne,ut),a(ut,dl),a(ne,_l),a(ne,ft),a(ft,gl),a(ne,$l),p(e,Rt,i),j(ba,e,i),p(e,Gt,i),p(e,Me,i),a(Me,Ue),a(Ue,mt),j(ja,mt,null),a(Me,vl),a(Me,ht),a(ht,bl),p(e,Bt,i),p(e,ge,i),a(ge,jl),a(ge,ya),a(ya,yl),a(ge,wl),a(ge,wa),a(wa,kl),a(ge,El),a(ge,ka),a(ka,xl),a(ge,Al),p(e,Jt,i),j(Ea,e,i),p(e,Kt,i),p(e,Re,i),a(Re,ql),a(Re,xa),a(xa,Tl),a(Re,Pl),p(e,Qt,i),j(Aa,e,i),p(e,Xt,i),p(e,Ge,i),a(Ge,Dl),a(Ge,dt),a(dt,Sl),a(Ge,Cl),p(e,Zt,i),p(e,Oe,i),a(Oe,Be),a(Be,_t),j(qa,_t,null),a(Oe,Il),a(Oe,gt),a(gt,Fl),p(e,es,i),j(Je,e,i),p(e,as,i),j(Ke,e,i),p(e,ts,i),p(e,We,i),a(We,Qe),a(Qe,$t),j(Ta,$t,null),a(We,Ml),a(We,vt),a(vt,Ol),p(e,ss,i),p(e,Ya,i),a(Ya,Wl),p(e,ls,i),p(e,Ua,i),a(Ua,Ll),p(e,ns,i),j(Pa,e,i),p(e,rs,i),p(e,Se,i),a(Se,Nl),a(Se,Ra),a(Ra,Hl),a(Se,zl),a(Se,bt),a(bt,Vl),a(Se,Yl),p(e,os,i),j(Da,e,i),p(e,is,i),p(e,Xe,i),a(Xe,Ul),a(Xe,jt),a(jt,Rl),a(Xe,Gl),p(e,ps,i),j(Ze,e,i),cs=!0},p(e,[i]){const Sa={};i&2&&(Sa.$$scope={dirty:i,ctx:e}),te.$set(Sa);const yt={};i&2&&(yt.$$scope={dirty:i,ctx:e}),Je.$set(yt);const wt={};i&2&&(wt.$$scope={dirty:i,ctx:e}),Ke.$set(wt);const kt={};i&2&&(kt.$$scope={dirty:i,ctx:e}),Ze.$set(kt)},i(e){cs||(y(E.$$.fragment,e),y(M.$$.fragment,e),y(H.$$.fragment,e),y(te.$$.fragment,e),y(K.$$.fragment,e),y(oe.$$.fragment,e),y(ue.$$.fragment,e),y(he.$$.fragment,e),y(_e.$$.fragment,e),y(na.$$.fragment,e),y(oa.$$.fragment,e),y(ia.$$.fragment,e),y(pa.$$.fragment,e),y(ca.$$.fragment,e),y(ua.$$.fragment,e),y(fa.$$.fragment,e),y(ha.$$.fragment,e),y($a.$$.fragment,e),y(ba.$$.fragment,e),y(ja.$$.fragment,e),y(Ea.$$.fragment,e),y(Aa.$$.fragment,e),y(qa.$$.fragment,e),y(Je.$$.fragment,e),y(Ke.$$.fragment,e),y(Ta.$$.fragment,e),y(Pa.$$.fragment,e),y(Da.$$.fragment,e),y(Ze.$$.fragment,e),cs=!0)},o(e){w(E.$$.fragment,e),w(M.$$.fragment,e),w(H.$$.fragment,e),w(te.$$.fragment,e),w(K.$$.fragment,e),w(oe.$$.fragment,e),w(ue.$$.fragment,e),w(he.$$.fragment,e),w(_e.$$.fragment,e),w(na.$$.fragment,e),w(oa.$$.fragment,e),w(ia.$$.fragment,e),w(pa.$$.fragment,e),w(ca.$$.fragment,e),w(ua.$$.fragment,e),w(fa.$$.fragment,e),w(ha.$$.fragment,e),w($a.$$.fragment,e),w(ba.$$.fragment,e),w(ja.$$.fragment,e),w(Ea.$$.fragment,e),w(Aa.$$.fragment,e),w(qa.$$.fragment,e),w(Je.$$.fragment,e),w(Ke.$$.fragment,e),w(Ta.$$.fragment,e),w(Pa.$$.fragment,e),w(Da.$$.fragment,e),w(Ze.$$.fragment,e),cs=!1},d(e){t(f),e&&t(g),e&&t(m),k(E),e&&t(F),k(M,e),e&&t(O),k(H,e),e&&t(S),e&&t(T),e&&t(G),e&&t(z),e&&t(N),e&&t(W),e&&t(re),k(te,e),e&&t(J),e&&t(x),e&&t(ye),k(K,e),e&&t(we),e&&t(se),e&&t(ke),k(oe,e),e&&t(ie),e&&t(X),k(ue),e&&t(de),e&&t(Ee),e&&t(C),k(he,e),e&&t(ta),e&&t(Z),e&&t(sa),k(_e,e),e&&t(la),e&&t(xe),e&&t(xt),k(na,e),e&&t(At),e&&t(le),e&&t(qt),k(oa,e),e&&t(Tt),e&&t(Oa),e&&t(Pt),k(ia,e),e&&t(Dt),e&&t(Wa),e&&t(St),e&&t(He),e&&t(Ct),e&&t(Na),e&&t(It),k(pa,e),e&&t(Ft),e&&t(Ha),e&&t(Mt),k(ca,e),e&&t(Ot),e&&t(Fe),k(ua),e&&t(Wt),e&&t(za),e&&t(Lt),k(fa,e),e&&t(Nt),e&&t(Ye),e&&t(Ht),k(ha,e),e&&t(zt),e&&t(Va),e&&t(Vt),e&&t(De),e&&t(Yt),k($a,e),e&&t(Ut),e&&t(ne),e&&t(Rt),k(ba,e),e&&t(Gt),e&&t(Me),k(ja),e&&t(Bt),e&&t(ge),e&&t(Jt),k(Ea,e),e&&t(Kt),e&&t(Re),e&&t(Qt),k(Aa,e),e&&t(Xt),e&&t(Ge),e&&t(Zt),e&&t(Oe),k(qa),e&&t(es),k(Je,e),e&&t(as),k(Ke,e),e&&t(ts),e&&t(We),k(Ta),e&&t(ss),e&&t(Ya),e&&t(ls),e&&t(Ua),e&&t(ns),k(Pa,e),e&&t(rs),e&&t(Se),e&&t(os),k(Da,e),e&&t(is),e&&t(Xe),e&&t(ps),k(Ze,e)}}}const br={local:"audio-classification",sections:[{local:"load-minds14-dataset",title:"Load MInDS-14 dataset"},{local:"preprocess",title:"Preprocess"},{local:"evaluate",title:"Evaluate"},{local:"train",title:"Train"},{local:"inference",title:"Inference"}],title:"Audio classification"};function jr(ee){return ir(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Tr extends lr{constructor(f){super();nr(this,f,jr,vr,rr,{})}}export{Tr as default,br as metadata};
