import{S as Fo,i as Ho,s as So,e as n,k as c,w as g,t as a,M as qo,c as o,d as t,m as h,a as r,x as b,h as l,b as d,G as s,g as i,y as w,q as J,o as _,B as U,v as Do,L as Po}from"../../chunks/vendor-hf-doc-builder.js";import{T as Sa}from"../../chunks/Tip-hf-doc-builder.js";import{Y as Lo}from"../../chunks/Youtube-hf-doc-builder.js";import{I as pt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as V}from"../../chunks/CodeBlock-hf-doc-builder.js";import{D as Oo}from"../../chunks/DocNotebookDropdown-hf-doc-builder.js";import{F as Qo,M as zo}from"../../chunks/Markdown-hf-doc-builder.js";function Ko(D){let m,y,u,j,$,v,A,Z,k,E,G,I,Q,B,z,P,X,C,L,q,Y,x,F,N,M,R,H,ne,S,O,K;return{c(){m=a(`The task illustrated in this tutorial is supported by the following model architectures:

`),y=n("p"),u=n("a"),j=a("Data2VecAudio"),$=a(", "),v=n("a"),A=a("Hubert"),Z=a(", "),k=n("a"),E=a("M-CTC-T"),G=a(", "),I=n("a"),Q=a("SEW"),B=a(", "),z=n("a"),P=a("SEW-D"),X=a(", "),C=n("a"),L=a("UniSpeech"),q=a(", "),Y=n("a"),x=a("UniSpeechSat"),F=a(", "),N=n("a"),M=a("Wav2Vec2"),R=a(", "),H=n("a"),ne=a("Wav2Vec2-Conformer"),S=a(", "),O=n("a"),K=a("WavLM"),this.h()},l(ee){m=l(ee,`The task illustrated in this tutorial is supported by the following model architectures:

`),y=o(ee,"P",{});var T=r(y);u=o(T,"A",{href:!0});var ae=r(u);j=l(ae,"Data2VecAudio"),ae.forEach(t),$=l(T,", "),v=o(T,"A",{href:!0});var oe=r(v);A=l(oe,"Hubert"),oe.forEach(t),Z=l(T,", "),k=o(T,"A",{href:!0});var he=r(k);E=l(he,"M-CTC-T"),he.forEach(t),G=l(T,", "),I=o(T,"A",{href:!0});var $e=r(I);Q=l($e,"SEW"),$e.forEach(t),B=l(T,", "),z=o(T,"A",{href:!0});var me=r(z);P=l(me,"SEW-D"),me.forEach(t),X=l(T,", "),C=o(T,"A",{href:!0});var re=r(C);L=l(re,"UniSpeech"),re.forEach(t),q=l(T,", "),Y=o(T,"A",{href:!0});var ve=r(Y);x=l(ve,"UniSpeechSat"),ve.forEach(t),F=l(T,", "),N=o(T,"A",{href:!0});var ue=r(N);M=l(ue,"Wav2Vec2"),ue.forEach(t),R=l(T,", "),H=o(T,"A",{href:!0});var pe=r(H);ne=l(pe,"Wav2Vec2-Conformer"),pe.forEach(t),S=l(T,", "),O=o(T,"A",{href:!0});var Te=r(O);K=l(Te,"WavLM"),Te.forEach(t),T.forEach(t),this.h()},h(){d(u,"href","../model_doc/data2vec-audio"),d(v,"href","../model_doc/hubert"),d(k,"href","../model_doc/mctct"),d(I,"href","../model_doc/sew"),d(z,"href","../model_doc/sew-d"),d(C,"href","../model_doc/unispeech"),d(Y,"href","../model_doc/unispeech-sat"),d(N,"href","../model_doc/wav2vec2"),d(H,"href","../model_doc/wav2vec2-conformer"),d(O,"href","../model_doc/wavlm")},m(ee,T){i(ee,m,T),i(ee,y,T),s(y,u),s(u,j),s(y,$),s(y,v),s(v,A),s(y,Z),s(y,k),s(k,E),s(y,G),s(y,I),s(I,Q),s(y,B),s(y,z),s(z,P),s(y,X),s(y,C),s(C,L),s(y,q),s(y,Y),s(Y,x),s(y,F),s(y,N),s(N,M),s(y,R),s(y,H),s(H,ne),s(y,S),s(y,O),s(O,K)},d(ee){ee&&t(m),ee&&t(y)}}}function er(D){let m,y,u,j,$,v,A,Z;return{c(){m=n("p"),y=a("If you aren\u2019t familiar with finetuning a model with the "),u=n("a"),j=a("Trainer"),$=a(", take a look at the basic tutorial "),v=n("a"),A=a("here"),Z=a("!"),this.h()},l(k){m=o(k,"P",{});var E=r(m);y=l(E,"If you aren\u2019t familiar with finetuning a model with the "),u=o(E,"A",{href:!0});var G=r(u);j=l(G,"Trainer"),G.forEach(t),$=l(E,", take a look at the basic tutorial "),v=o(E,"A",{href:!0});var I=r(v);A=l(I,"here"),I.forEach(t),Z=l(E,"!"),E.forEach(t),this.h()},h(){d(u,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer"),d(v,"href","../training#train-with-pytorch-trainer")},m(k,E){i(k,m,E),s(m,y),s(m,u),s(u,j),s(m,$),s(m,v),s(v,A),s(m,Z)},d(k){k&&t(m)}}}function sr(D){let m,y,u,j,$,v,A,Z,k,E,G,I,Q,B,z,P,X,C,L,q,Y,x,F,N,M,R,H,ne,S,O,K,ee,T,ae,oe,he,$e,me,re,ve,ue,pe,Te,ie,Qe,de,fe,ye,ge,be,Ae,Ee,ze,we,Fe,le,He;return m=new Sa({props:{$$slots:{default:[er]},$$scope:{ctx:D}}}),I=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNUQyUyQyUyMFRyYWluaW5nQXJndW1lbnRzJTJDJTIwVHJhaW5lciUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ1RDLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJmYWNlYm9vayUyRndhdjJ2ZWMyLWJhc2UlMjIlMkMlMEElMjAlMjAlMjAlMjBjdGNfbG9zc19yZWR1Y3Rpb24lM0QlMjJtZWFuJTIyJTJDJTBBJTIwJTIwJTIwJTIwcGFkX3Rva2VuX2lkJTNEcHJvY2Vzc29yLnRva2VuaXplci5wYWRfdG9rZW5faWQlMkMlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCTC, TrainingArguments, Trainer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCTC.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;facebook/wav2vec2-base&quot;</span>,
<span class="hljs-meta">... </span>    ctc_loss_reduction=<span class="hljs-string">&quot;mean&quot;</span>,
<span class="hljs-meta">... </span>    pad_token_id=processor.tokenizer.pad_token_id,
<span class="hljs-meta">... </span>)`}}),ye=new V({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJteV9hd2Vzb21lX2Fzcl9taW5kX21vZGVsJTIyJTJDJTBBJTIwJTIwJTIwJTIwcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTNEOCUyQyUwQSUyMCUyMCUyMCUyMGdyYWRpZW50X2FjY3VtdWxhdGlvbl9zdGVwcyUzRDIlMkMlMEElMjAlMjAlMjAlMjBsZWFybmluZ19yYXRlJTNEMWUtNSUyQyUwQSUyMCUyMCUyMCUyMHdhcm11cF9zdGVwcyUzRDUwMCUyQyUwQSUyMCUyMCUyMCUyMG1heF9zdGVwcyUzRDIwMDAlMkMlMEElMjAlMjAlMjAlMjBncmFkaWVudF9jaGVja3BvaW50aW5nJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMGZwMTYlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwZ3JvdXBfYnlfbGVuZ3RoJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMGV2YWx1YXRpb25fc3RyYXRlZ3klM0QlMjJzdGVwcyUyMiUyQyUwQSUyMCUyMCUyMCUyMHBlcl9kZXZpY2VfZXZhbF9iYXRjaF9zaXplJTNEOCUyQyUwQSUyMCUyMCUyMCUyMHNhdmVfc3RlcHMlM0QxMDAwJTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9zdGVwcyUzRDEwMDAlMkMlMEElMjAlMjAlMjAlMjBsb2dnaW5nX3N0ZXBzJTNEMjUlMkMlMEElMjAlMjAlMjAlMjBsb2FkX2Jlc3RfbW9kZWxfYXRfZW5kJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMG1ldHJpY19mb3JfYmVzdF9tb2RlbCUzRCUyMndlciUyMiUyQyUwQSUyMCUyMCUyMCUyMGdyZWF0ZXJfaXNfYmV0dGVyJTNERmFsc2UlMkMlMEElMjAlMjAlMjAlMjBwdXNoX3RvX2h1YiUzRFRydWUlMkMlMEEpJTBBJTBBdHJhaW5lciUyMCUzRCUyMFRyYWluZXIoJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0Rtb2RlbCUyQyUwQSUyMCUyMCUyMCUyMGFyZ3MlM0R0cmFpbmluZ19hcmdzJTJDJTBBJTIwJTIwJTIwJTIwdHJhaW5fZGF0YXNldCUzRGVuY29kZWRfbWluZHMlNUIlMjJ0cmFpbiUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMGV2YWxfZGF0YXNldCUzRGVuY29kZWRfbWluZHMlNUIlMjJ0ZXN0JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwdG9rZW5pemVyJTNEcHJvY2Vzc29yJTJDJTBBJTIwJTIwJTIwJTIwZGF0YV9jb2xsYXRvciUzRGRhdGFfY29sbGF0b3IlMkMlMEElMjAlMjAlMjAlMjBjb21wdXRlX21ldHJpY3MlM0Rjb21wdXRlX21ldHJpY3MlMkMlMEEpJTBBJTBBdHJhaW5lci50cmFpbigp",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_asr_mind_model&quot;</span>,
<span class="hljs-meta">... </span>    per_device_train_batch_size=<span class="hljs-number">8</span>,
<span class="hljs-meta">... </span>    gradient_accumulation_steps=<span class="hljs-number">2</span>,
<span class="hljs-meta">... </span>    learning_rate=<span class="hljs-number">1e-5</span>,
<span class="hljs-meta">... </span>    warmup_steps=<span class="hljs-number">500</span>,
<span class="hljs-meta">... </span>    max_steps=<span class="hljs-number">2000</span>,
<span class="hljs-meta">... </span>    gradient_checkpointing=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    fp16=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    group_by_length=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    evaluation_strategy=<span class="hljs-string">&quot;steps&quot;</span>,
<span class="hljs-meta">... </span>    per_device_eval_batch_size=<span class="hljs-number">8</span>,
<span class="hljs-meta">... </span>    save_steps=<span class="hljs-number">1000</span>,
<span class="hljs-meta">... </span>    eval_steps=<span class="hljs-number">1000</span>,
<span class="hljs-meta">... </span>    logging_steps=<span class="hljs-number">25</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;wer&quot;</span>,
<span class="hljs-meta">... </span>    greater_is_better=<span class="hljs-literal">False</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=processor,
<span class="hljs-meta">... </span>    data_collator=data_collator,
<span class="hljs-meta">... </span>    compute_metrics=compute_metrics,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.train()`}}),le=new V({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()'}}),{c(){g(m.$$.fragment),y=c(),u=n("p"),j=a("You\u2019re ready to start training your model now! Load Wav2Vec2 with "),$=n("a"),v=a("AutoModelForCTC"),A=a(". Specify the reduction to apply with the "),Z=n("code"),k=a("ctc_loss_reduction"),E=a(" parameter. It is often better to use the average instead of the default summation:"),G=c(),g(I.$$.fragment),Q=c(),B=n("p"),z=a("At this point, only three steps remain:"),P=c(),X=n("ol"),C=n("li"),L=a("Define your training hyperparameters in "),q=n("a"),Y=a("TrainingArguments"),x=a(". The only required parameter is "),F=n("code"),N=a("output_dir"),M=a(" which specifies where to save your model. You\u2019ll push this model to the Hub by setting "),R=n("code"),H=a("push_to_hub=True"),ne=a(" (you need to be signed in to Hugging Face to upload your model). At the end of each epoch, the "),S=n("a"),O=a("Trainer"),K=a(" will evaluate the WER and save the training checkpoint."),ee=c(),T=n("li"),ae=a("Pass the training arguments to "),oe=n("a"),he=a("Trainer"),$e=a(" along with the model, dataset, tokenizer, data collator, and "),me=n("code"),re=a("compute_metrics"),ve=a(" function."),ue=c(),pe=n("li"),Te=a("Call "),ie=n("a"),Qe=a("train()"),de=a(" to finetune your model."),fe=c(),g(ye.$$.fragment),ge=c(),be=n("p"),Ae=a("Once training is completed, share your model to the Hub with the "),Ee=n("a"),ze=a("push_to_hub()"),we=a(" method so everyone can use your model:"),Fe=c(),g(le.$$.fragment),this.h()},l(f){b(m.$$.fragment,f),y=h(f),u=o(f,"P",{});var W=r(u);j=l(W,"You\u2019re ready to start training your model now! Load Wav2Vec2 with "),$=o(W,"A",{href:!0});var Me=r($);v=l(Me,"AutoModelForCTC"),Me.forEach(t),A=l(W,". Specify the reduction to apply with the "),Z=o(W,"CODE",{});var ds=r(Z);k=l(ds,"ctc_loss_reduction"),ds.forEach(t),E=l(W," parameter. It is often better to use the average instead of the default summation:"),W.forEach(t),G=h(f),b(I.$$.fragment,f),Q=h(f),B=o(f,"P",{});var je=r(B);z=l(je,"At this point, only three steps remain:"),je.forEach(t),P=h(f),X=o(f,"OL",{});var ke=r(X);C=o(ke,"LI",{});var se=r(C);L=l(se,"Define your training hyperparameters in "),q=o(se,"A",{href:!0});var Fs=r(q);Y=l(Fs,"TrainingArguments"),Fs.forEach(t),x=l(se,". The only required parameter is "),F=o(se,"CODE",{});var Hs=r(F);N=l(Hs,"output_dir"),Hs.forEach(t),M=l(se," which specifies where to save your model. You\u2019ll push this model to the Hub by setting "),R=o(se,"CODE",{});var Se=r(R);H=l(Se,"push_to_hub=True"),Se.forEach(t),ne=l(se," (you need to be signed in to Hugging Face to upload your model). At the end of each epoch, the "),S=o(se,"A",{href:!0});var Ss=r(S);O=l(Ss,"Trainer"),Ss.forEach(t),K=l(se," will evaluate the WER and save the training checkpoint."),se.forEach(t),ee=h(ke),T=o(ke,"LI",{});var Ie=r(T);ae=l(Ie,"Pass the training arguments to "),oe=o(Ie,"A",{href:!0});var fs=r(oe);he=l(fs,"Trainer"),fs.forEach(t),$e=l(Ie," along with the model, dataset, tokenizer, data collator, and "),me=o(Ie,"CODE",{});var Ce=r(me);re=l(Ce,"compute_metrics"),Ce.forEach(t),ve=l(Ie," function."),Ie.forEach(t),ue=h(ke),pe=o(ke,"LI",{});var Ge=r(pe);Te=l(Ge,"Call "),ie=o(Ge,"A",{href:!0});var Be=r(ie);Qe=l(Be,"train()"),Be.forEach(t),de=l(Ge," to finetune your model."),Ge.forEach(t),ke.forEach(t),fe=h(f),b(ye.$$.fragment,f),ge=h(f),be=o(f,"P",{});var qe=r(be);Ae=l(qe,"Once training is completed, share your model to the Hub with the "),Ee=o(qe,"A",{href:!0});var ys=r(Ee);ze=l(ys,"push_to_hub()"),ys.forEach(t),we=l(qe," method so everyone can use your model:"),qe.forEach(t),Fe=h(f),b(le.$$.fragment,f),this.h()},h(){d($,"href","/docs/transformers/v4.33.0/en/model_doc/auto#transformers.AutoModelForCTC"),d(q,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.TrainingArguments"),d(S,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer"),d(oe,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer"),d(ie,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer.train"),d(Ee,"href","/docs/transformers/v4.33.0/en/main_classes/trainer#transformers.Trainer.push_to_hub")},m(f,W){w(m,f,W),i(f,y,W),i(f,u,W),s(u,j),s(u,$),s($,v),s(u,A),s(u,Z),s(Z,k),s(u,E),i(f,G,W),w(I,f,W),i(f,Q,W),i(f,B,W),s(B,z),i(f,P,W),i(f,X,W),s(X,C),s(C,L),s(C,q),s(q,Y),s(C,x),s(C,F),s(F,N),s(C,M),s(C,R),s(R,H),s(C,ne),s(C,S),s(S,O),s(C,K),s(X,ee),s(X,T),s(T,ae),s(T,oe),s(oe,he),s(T,$e),s(T,me),s(me,re),s(T,ve),s(X,ue),s(X,pe),s(pe,Te),s(pe,ie),s(ie,Qe),s(pe,de),i(f,fe,W),w(ye,f,W),i(f,ge,W),i(f,be,W),s(be,Ae),s(be,Ee),s(Ee,ze),s(be,we),i(f,Fe,W),w(le,f,W),He=!0},p(f,W){const Me={};W&2&&(Me.$$scope={dirty:W,ctx:f}),m.$set(Me)},i(f){He||(J(m.$$.fragment,f),J(I.$$.fragment,f),J(ye.$$.fragment,f),J(le.$$.fragment,f),He=!0)},o(f){_(m.$$.fragment,f),_(I.$$.fragment,f),_(ye.$$.fragment,f),_(le.$$.fragment,f),He=!1},d(f){U(m,f),f&&t(y),f&&t(u),f&&t(G),U(I,f),f&&t(Q),f&&t(B),f&&t(P),f&&t(X),f&&t(fe),U(ye,f),f&&t(ge),f&&t(be),f&&t(Fe),U(le,f)}}}function tr(D){let m,y;return m=new zo({props:{$$slots:{default:[sr]},$$scope:{ctx:D}}}),{c(){g(m.$$.fragment)},l(u){b(m.$$.fragment,u)},m(u,j){w(m,u,j),y=!0},p(u,j){const $={};j&2&&($.$$scope={dirty:j,ctx:u}),m.$set($)},i(u){y||(J(m.$$.fragment,u),y=!0)},o(u){_(m.$$.fragment,u),y=!1},d(u){U(m,u)}}}function ar(D){let m,y,u,j,$,v,A,Z;return{c(){m=n("p"),y=a("For a more in-depth example of how to finetune a model for automatic speech recognition, take a look at this blog "),u=n("a"),j=a("post"),$=a(" for English ASR and this "),v=n("a"),A=a("post"),Z=a(" for multilingual ASR."),this.h()},l(k){m=o(k,"P",{});var E=r(m);y=l(E,"For a more in-depth example of how to finetune a model for automatic speech recognition, take a look at this blog "),u=o(E,"A",{href:!0,rel:!0});var G=r(u);j=l(G,"post"),G.forEach(t),$=l(E," for English ASR and this "),v=o(E,"A",{href:!0,rel:!0});var I=r(v);A=l(I,"post"),I.forEach(t),Z=l(E," for multilingual ASR."),E.forEach(t),this.h()},h(){d(u,"href","https://huggingface.co/blog/fine-tune-wav2vec2-english"),d(u,"rel","nofollow"),d(v,"href","https://huggingface.co/blog/fine-tune-xlsr-wav2vec2"),d(v,"rel","nofollow")},m(k,E){i(k,m,E),s(m,y),s(m,u),s(u,j),s(m,$),s(m,v),s(v,A),s(m,Z)},d(k){k&&t(m)}}}function lr(D){let m,y;return{c(){m=n("p"),y=a("The transcription is decent, but it could be better! Try finetuning your model on more examples to get even better results!")},l(u){m=o(u,"P",{});var j=r(m);y=l(j,"The transcription is decent, but it could be better! Try finetuning your model on more examples to get even better results!"),j.forEach(t)},m(u,j){i(u,m,j),s(m,y)},d(u){u&&t(m)}}}function nr(D){let m,y,u,j,$,v,A,Z,k,E,G,I,Q,B,z,P,X,C,L,q,Y,x,F,N;return A=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJzdGV2aGxpdSUyRm15X2F3ZXNvbWVfYXNyX21pbmRfbW9kZWwlMjIpJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGRhdGFzZXQlNUIwJTVEJTVCJTIyYXVkaW8lMjIlNUQlNUIlMjJhcnJheSUyMiU1RCUyQyUyMHNhbXBsaW5nX3JhdGUlM0RzYW1wbGluZ19yYXRlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;stevhliu/my_awesome_asr_mind_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(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>)`}}),I=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNUQyUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ1RDLmZyb21fcHJldHJhaW5lZCglMjJzdGV2aGxpdSUyRm15X2F3ZXNvbWVfYXNyX21pbmRfbW9kZWwlMjIpJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHM=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCTC

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCTC.from_pretrained(<span class="hljs-string">&quot;stevhliu/my_awesome_asr_mind_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`}}),F=new V({props:{code:"aW1wb3J0JTIwdG9yY2glMEElMEFwcmVkaWN0ZWRfaWRzJTIwJTNEJTIwdG9yY2guYXJnbWF4KGxvZ2l0cyUyQyUyMGRpbSUzRC0xKSUwQXRyYW5zY3JpcHRpb24lMjAlM0QlMjBwcm9jZXNzb3IuYmF0Y2hfZGVjb2RlKHByZWRpY3RlZF9pZHMpJTBBdHJhbnNjcmlwdGlvbg==",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_ids = torch.argmax(logits, dim=-<span class="hljs-number">1</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>transcription = processor.batch_decode(predicted_ids)
<span class="hljs-meta">&gt;&gt;&gt; </span>transcription
[<span class="hljs-string">&#x27;I WOUL LIKE O SET UP JOINT ACOUNT WTH Y PARTNER&#x27;</span>]`}}),{c(){m=n("p"),y=a("Load a processor to preprocess the audio file and transcription and return the "),u=n("code"),j=a("input"),$=a(" as PyTorch tensors:"),v=c(),g(A.$$.fragment),Z=c(),k=n("p"),E=a("Pass your inputs to the model and return the logits:"),G=c(),g(I.$$.fragment),Q=c(),B=n("p"),z=a("Get the predicted "),P=n("code"),X=a("input_ids"),C=a(" with the highest probability, and use the processor to decode the predicted "),L=n("code"),q=a("input_ids"),Y=a(" back into text:"),x=c(),g(F.$$.fragment)},l(M){m=o(M,"P",{});var R=r(m);y=l(R,"Load a processor to preprocess the audio file and transcription and return the "),u=o(R,"CODE",{});var H=r(u);j=l(H,"input"),H.forEach(t),$=l(R," as PyTorch tensors:"),R.forEach(t),v=h(M),b(A.$$.fragment,M),Z=h(M),k=o(M,"P",{});var ne=r(k);E=l(ne,"Pass your inputs to the model and return the logits:"),ne.forEach(t),G=h(M),b(I.$$.fragment,M),Q=h(M),B=o(M,"P",{});var S=r(B);z=l(S,"Get the predicted "),P=o(S,"CODE",{});var O=r(P);X=l(O,"input_ids"),O.forEach(t),C=l(S," with the highest probability, and use the processor to decode the predicted "),L=o(S,"CODE",{});var K=r(L);q=l(K,"input_ids"),K.forEach(t),Y=l(S," back into text:"),S.forEach(t),x=h(M),b(F.$$.fragment,M)},m(M,R){i(M,m,R),s(m,y),s(m,u),s(u,j),s(m,$),i(M,v,R),w(A,M,R),i(M,Z,R),i(M,k,R),s(k,E),i(M,G,R),w(I,M,R),i(M,Q,R),i(M,B,R),s(B,z),s(B,P),s(P,X),s(B,C),s(B,L),s(L,q),s(B,Y),i(M,x,R),w(F,M,R),N=!0},p:Po,i(M){N||(J(A.$$.fragment,M),J(I.$$.fragment,M),J(F.$$.fragment,M),N=!0)},o(M){_(A.$$.fragment,M),_(I.$$.fragment,M),_(F.$$.fragment,M),N=!1},d(M){M&&t(m),M&&t(v),U(A,M),M&&t(Z),M&&t(k),M&&t(G),U(I,M),M&&t(Q),M&&t(B),M&&t(x),U(F,M)}}}function or(D){let m,y;return m=new zo({props:{$$slots:{default:[nr]},$$scope:{ctx:D}}}),{c(){g(m.$$.fragment)},l(u){b(m.$$.fragment,u)},m(u,j){w(m,u,j),y=!0},p(u,j){const $={};j&2&&($.$$scope={dirty:j,ctx:u}),m.$set($)},i(u){y||(J(m.$$.fragment,u),y=!0)},o(u){_(m.$$.fragment,u),y=!1},d(u){U(m,u)}}}function rr(D){let m,y,u,j,$,v,A,Z,k,E,G,I,Q,B,z,P,X,C,L,q,Y,x,F,N,M,R,H,ne,S,O,K,ee,T,ae,oe,he,$e,me,re,ve,ue,pe,Te,ie,Qe,de,fe,ye,ge,be,Ae,Ee,ze,we,Fe,le,He,f,W,Me,ds,je,ke,se,Fs,Hs,Se,Ss,Ie,fs,Ce,Ge,Be,qe,ys,Ms,Qt,te,qa,it,Da,Pa,ct,La,Oa,ht,Ka,el,mt,sl,tl,js,al,ll,zt,gs,Ft,qs,nl,Ht,bs,St,Ds,ol,qt,De,Pe,ut,rl,pl,dt,il,cl,hl,Ps,ft,ml,ul,Dt,Ve,Le,yt,ws,dl,Mt,fl,Pt,Ls,yl,Lt,Js,Ot,Oe,Ml,_s,jl,gl,Kt,Us,ea,Ke,bl,jt,wl,Jl,sa,vs,ta,Os,_l,aa,es,Ts,Ul,gt,vl,Tl,$l,Xe,El,bt,kl,Il,wt,Cl,Rl,la,$s,na,ce,Wl,Es,Zl,Al,Jt,Gl,Bl,_t,Vl,Xl,ks,Yl,Nl,oa,Is,ra,Je,xl,Ks,Ql,zl,Ut,Fl,Hl,vt,Sl,ql,pa,Re,Dl,Tt,Pl,Ll,$t,Ol,Kl,ia,Cs,ca,ss,en,Et,sn,tn,ha,Rs,ma,Ye,ts,kt,Ws,an,It,ln,ua,_e,nn,Zs,on,rn,As,pn,cn,Gs,hn,mn,da,Bs,fa,as,un,Vs,dn,fn,ya,Xs,Ma,ls,yn,Ct,Mn,jn,ja,Ne,ns,Rt,Ys,gn,Wt,bn,ga,os,ba,rs,wa,xe,ps,Zt,Ns,wn,At,Jn,Ja,et,_n,_a,st,Un,Ua,xs,va,We,vn,tt,Tn,$n,Gt,En,kn,Ta,Qs,$a,is,Ea,cs,In,Bt,Cn,Rn,ka,hs,Ia;return v=new pt({}),G=new Oo({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/asr.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/asr.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/tensorflow/asr.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/asr.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/asr.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/tensorflow/asr.ipynb"}]}}),Q=new Lo({props:{id:"TksaY_FDgnk"}}),ae=new Sa({props:{$$slots:{default:[Ko]},$$scope:{ctx:D}}}),re=new V({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGUlMjBqaXdlcg==",highlighted:"pip install transformers datasets evaluate jiwer"}}),ie=new V({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMG5vdGVib29rX2xvZ2luJTBBJTBBbm90ZWJvb2tfbG9naW4oKQ==",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()`}}),ge=new pt({}),Me=new V({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTJDJTIwQXVkaW8lMEElMEFtaW5kcyUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJQb2x5QUklMkZtaW5kczE0JTIyJTJDJTIwbmFtZSUzRCUyMmVuLVVTJTIyJTJDJTIwc3BsaXQlM0QlMjJ0cmFpbiU1QiUzQTEwMCU1RCUyMik=",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[:100]&quot;</span>)`}}),Ce=new V({props:{code:"bWluZHMlMjAlM0QlMjBtaW5kcy50cmFpbl90ZXN0X3NwbGl0KHRlc3Rfc2l6ZSUzRDAuMik=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>minds = minds.train_test_split(test_size=<span class="hljs-number">0.2</span>)'}}),Ms=new V({props:{code:"bWluZHM=",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">16</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">4</span>
    })
})`}}),gs=new V({props:{code:"bWluZHMlMjAlM0QlMjBtaW5kcy5yZW1vdmVfY29sdW1ucyglNUIlMjJlbmdsaXNoX3RyYW5zY3JpcHRpb24lMjIlMkMlMjAlMjJpbnRlbnRfY2xhc3MlMjIlMkMlMjAlMjJsYW5nX2lkJTIyJTVEKQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>minds = minds.remove_columns([<span class="hljs-string">&quot;english_transcription&quot;</span>, <span class="hljs-string">&quot;intent_class&quot;</span>, <span class="hljs-string">&quot;lang_id&quot;</span>])'}}),bs=new V({props:{code:"bWluZHMlNUIlMjJ0cmFpbiUyMiU1RCU1QjAlNUQ=",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.00024414</span>,  <span class="hljs-number">0.</span>        ,  <span class="hljs-number">0.</span>        , ...,  <span class="hljs-number">0.00024414</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/602ba9e2963e11ccd901cd4f.wav&#x27;</span>,
  <span class="hljs-string">&#x27;sampling_rate&#x27;</span>: <span class="hljs-number">8000</span>},
 <span class="hljs-string">&#x27;path&#x27;</span>: <span class="hljs-string">&#x27;/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~APP_ERROR/602ba9e2963e11ccd901cd4f.wav&#x27;</span>,
 <span class="hljs-string">&#x27;transcription&#x27;</span>: <span class="hljs-string">&quot;hi I&#x27;m trying to use the banking app on my phone and currently my checking and savings account balance is not refreshing&quot;</span>}`}}),ws=new pt({}),Js=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Qcm9jZXNzb3IlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRndhdjJ2ZWMyLWJhc2UlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;facebook/wav2vec2-base&quot;</span>)`}}),Us=new V({props:{code:"bWluZHMlMjAlM0QlMjBtaW5kcy5jYXN0X2NvbHVtbiglMjJhdWRpbyUyMiUyQyUyMEF1ZGlvKHNhbXBsaW5nX3JhdGUlM0QxNl8wMDApKSUwQW1pbmRzJTVCJTIydHJhaW4lMjIlNUQlNUIwJTVE",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.38064706e-04</span>, -<span class="hljs-number">1.58618059e-04</span>, -<span class="hljs-number">5.43987835e-06</span>, ...,
          <span class="hljs-number">2.78103951e-04</span>,  <span class="hljs-number">2.38446111e-04</span>,  <span class="hljs-number">1.18740834e-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/602ba9e2963e11ccd901cd4f.wav&#x27;</span>,
  <span class="hljs-string">&#x27;sampling_rate&#x27;</span>: <span class="hljs-number">16000</span>},
 <span class="hljs-string">&#x27;path&#x27;</span>: <span class="hljs-string">&#x27;/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~APP_ERROR/602ba9e2963e11ccd901cd4f.wav&#x27;</span>,
 <span class="hljs-string">&#x27;transcription&#x27;</span>: <span class="hljs-string">&quot;hi I&#x27;m trying to use the banking app on my phone and currently my checking and savings account balance is not refreshing&quot;</span>}`}}),vs=new V({props:{code:"ZGVmJTIwdXBwZXJjYXNlKGV4YW1wbGUpJTNBJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwJTdCJTIydHJhbnNjcmlwdGlvbiUyMiUzQSUyMGV4YW1wbGUlNUIlMjJ0cmFuc2NyaXB0aW9uJTIyJTVELnVwcGVyKCklN0QlMEElMEElMEFtaW5kcyUyMCUzRCUyMG1pbmRzLm1hcCh1cHBlcmNhc2Up",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">uppercase</span>(<span class="hljs-params">example</span>):
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> {<span class="hljs-string">&quot;transcription&quot;</span>: example[<span class="hljs-string">&quot;transcription&quot;</span>].upper()}


<span class="hljs-meta">&gt;&gt;&gt; </span>minds = minds.<span class="hljs-built_in">map</span>(uppercase)`}}),$s=new V({props:{code:"ZGVmJTIwcHJlcGFyZV9kYXRhc2V0KGJhdGNoKSUzQSUwQSUyMCUyMCUyMCUyMGF1ZGlvJTIwJTNEJTIwYmF0Y2glNUIlMjJhdWRpbyUyMiU1RCUwQSUyMCUyMCUyMCUyMGJhdGNoJTIwJTNEJTIwcHJvY2Vzc29yKGF1ZGlvJTVCJTIyYXJyYXklMjIlNUQlMkMlMjBzYW1wbGluZ19yYXRlJTNEYXVkaW8lNUIlMjJzYW1wbGluZ19yYXRlJTIyJTVEJTJDJTIwdGV4dCUzRGJhdGNoJTVCJTIydHJhbnNjcmlwdGlvbiUyMiU1RCklMEElMjAlMjAlMjAlMjBiYXRjaCU1QiUyMmlucHV0X2xlbmd0aCUyMiU1RCUyMCUzRCUyMGxlbihiYXRjaCU1QiUyMmlucHV0X3ZhbHVlcyUyMiU1RCU1QjAlNUQpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwYmF0Y2g=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">prepare_dataset</span>(<span class="hljs-params">batch</span>):
<span class="hljs-meta">... </span>    audio = batch[<span class="hljs-string">&quot;audio&quot;</span>]
<span class="hljs-meta">... </span>    batch = processor(audio[<span class="hljs-string">&quot;array&quot;</span>], sampling_rate=audio[<span class="hljs-string">&quot;sampling_rate&quot;</span>], text=batch[<span class="hljs-string">&quot;transcription&quot;</span>])
<span class="hljs-meta">... </span>    batch[<span class="hljs-string">&quot;input_length&quot;</span>] = <span class="hljs-built_in">len</span>(batch[<span class="hljs-string">&quot;input_values&quot;</span>][<span class="hljs-number">0</span>])
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> batch`}}),Is=new V({props:{code:"ZW5jb2RlZF9taW5kcyUyMCUzRCUyMG1pbmRzLm1hcChwcmVwYXJlX2RhdGFzZXQlMkMlMjByZW1vdmVfY29sdW1ucyUzRG1pbmRzLmNvbHVtbl9uYW1lcyU1QiUyMnRyYWluJTIyJTVEJTJDJTIwbnVtX3Byb2MlM0Q0KQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>encoded_minds = minds.<span class="hljs-built_in">map</span>(prepare_dataset, remove_columns=minds.column_names[<span class="hljs-string">&quot;train&quot;</span>], num_proc=<span class="hljs-number">4</span>)'}}),Cs=new V({props:{code:"aW1wb3J0JTIwdG9yY2glMEElMEFmcm9tJTIwZGF0YWNsYXNzZXMlMjBpbXBvcnQlMjBkYXRhY2xhc3MlMkMlMjBmaWVsZCUwQWZyb20lMjB0eXBpbmclMjBpbXBvcnQlMjBBbnklMkMlMjBEaWN0JTJDJTIwTGlzdCUyQyUyME9wdGlvbmFsJTJDJTIwVW5pb24lMEElMEElMEElNDBkYXRhY2xhc3MlMEFjbGFzcyUyMERhdGFDb2xsYXRvckNUQ1dpdGhQYWRkaW5nJTNBJTBBJTIwJTIwJTIwJTIwcHJvY2Vzc29yJTNBJTIwQXV0b1Byb2Nlc3NvciUwQSUyMCUyMCUyMCUyMHBhZGRpbmclM0ElMjBVbmlvbiU1QmJvb2wlMkMlMjBzdHIlNUQlMjAlM0QlMjAlMjJsb25nZXN0JTIyJTBBJTBBJTIwJTIwJTIwJTIwZGVmJTIwX19jYWxsX18oc2VsZiUyQyUyMGZlYXR1cmVzJTNBJTIwTGlzdCU1QkRpY3QlNUJzdHIlMkMlMjBVbmlvbiU1Qkxpc3QlNUJpbnQlNUQlMkMlMjB0b3JjaC5UZW5zb3IlNUQlNUQlNUQpJTIwLSUzRSUyMERpY3QlNUJzdHIlMkMlMjB0b3JjaC5UZW5zb3IlNUQlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjBzcGxpdCUyMGlucHV0cyUyMGFuZCUyMGxhYmVscyUyMHNpbmNlJTIwdGhleSUyMGhhdmUlMjB0byUyMGJlJTIwb2YlMjBkaWZmZXJlbnQlMjBsZW5ndGhzJTIwYW5kJTIwbmVlZCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMyUyMGRpZmZlcmVudCUyMHBhZGRpbmclMjBtZXRob2RzJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwaW5wdXRfZmVhdHVyZXMlMjAlM0QlMjAlNUIlN0IlMjJpbnB1dF92YWx1ZXMlMjIlM0ElMjBmZWF0dXJlJTVCJTIyaW5wdXRfdmFsdWVzJTIyJTVEJTVCMCU1RCU3RCUyMGZvciUyMGZlYXR1cmUlMjBpbiUyMGZlYXR1cmVzJTVEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbGFiZWxfZmVhdHVyZXMlMjAlM0QlMjAlNUIlN0IlMjJpbnB1dF9pZHMlMjIlM0ElMjBmZWF0dXJlJTVCJTIybGFiZWxzJTIyJTVEJTdEJTIwZm9yJTIwZmVhdHVyZSUyMGluJTIwZmVhdHVyZXMlNUQlMEElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBiYXRjaCUyMCUzRCUyMHNlbGYucHJvY2Vzc29yLnBhZChpbnB1dF9mZWF0dXJlcyUyQyUyMHBhZGRpbmclM0RzZWxmLnBhZGRpbmclMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxhYmVsc19iYXRjaCUyMCUzRCUyMHNlbGYucHJvY2Vzc29yLnBhZChsYWJlbHMlM0RsYWJlbF9mZWF0dXJlcyUyQyUyMHBhZGRpbmclM0RzZWxmLnBhZGRpbmclMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMyUyMHJlcGxhY2UlMjBwYWRkaW5nJTIwd2l0aCUyMC0xMDAlMjB0byUyMGlnbm9yZSUyMGxvc3MlMjBjb3JyZWN0bHklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsYWJlbHMlMjAlM0QlMjBsYWJlbHNfYmF0Y2glNUIlMjJpbnB1dF9pZHMlMjIlNUQubWFza2VkX2ZpbGwobGFiZWxzX2JhdGNoLmF0dGVudGlvbl9tYXNrLm5lKDEpJTJDJTIwLTEwMCklMEElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBiYXRjaCU1QiUyMmxhYmVscyUyMiU1RCUyMCUzRCUyMGxhYmVscyUwQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldHVybiUyMGJhdGNo",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> dataclasses <span class="hljs-keyword">import</span> dataclass, field
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> typing <span class="hljs-keyword">import</span> <span class="hljs-type">Any</span>, <span class="hljs-type">Dict</span>, <span class="hljs-type">List</span>, <span class="hljs-type">Optional</span>, <span class="hljs-type">Union</span>


<span class="hljs-meta">&gt;&gt;&gt; </span>@dataclass
<span class="hljs-meta">... </span><span class="hljs-keyword">class</span> <span class="hljs-title class_">DataCollatorCTCWithPadding</span>:
<span class="hljs-meta">... </span>    processor: AutoProcessor
<span class="hljs-meta">... </span>    padding: <span class="hljs-type">Union</span>[<span class="hljs-built_in">bool</span>, <span class="hljs-built_in">str</span>] = <span class="hljs-string">&quot;longest&quot;</span>

<span class="hljs-meta">... </span>    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__call__</span>(<span class="hljs-params">self, features: <span class="hljs-type">List</span>[<span class="hljs-type">Dict</span>[<span class="hljs-built_in">str</span>, <span class="hljs-type">Union</span>[<span class="hljs-type">List</span>[<span class="hljs-built_in">int</span>], torch.Tensor]]]</span>) -&gt; <span class="hljs-type">Dict</span>[<span class="hljs-built_in">str</span>, torch.Tensor]:
<span class="hljs-meta">... </span>        <span class="hljs-comment"># split inputs and labels since they have to be of different lengths and need</span>
<span class="hljs-meta">... </span>        <span class="hljs-comment"># different padding methods</span>
<span class="hljs-meta">... </span>        input_features = [{<span class="hljs-string">&quot;input_values&quot;</span>: feature[<span class="hljs-string">&quot;input_values&quot;</span>][<span class="hljs-number">0</span>]} <span class="hljs-keyword">for</span> feature <span class="hljs-keyword">in</span> features]
<span class="hljs-meta">... </span>        label_features = [{<span class="hljs-string">&quot;input_ids&quot;</span>: feature[<span class="hljs-string">&quot;labels&quot;</span>]} <span class="hljs-keyword">for</span> feature <span class="hljs-keyword">in</span> features]

<span class="hljs-meta">... </span>        batch = self.processor.pad(input_features, padding=self.padding, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">... </span>        labels_batch = self.processor.pad(labels=label_features, padding=self.padding, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">... </span>        <span class="hljs-comment"># replace padding with -100 to ignore loss correctly</span>
<span class="hljs-meta">... </span>        labels = labels_batch[<span class="hljs-string">&quot;input_ids&quot;</span>].masked_fill(labels_batch.attention_mask.ne(<span class="hljs-number">1</span>), -<span class="hljs-number">100</span>)

<span class="hljs-meta">... </span>        batch[<span class="hljs-string">&quot;labels&quot;</span>] = labels

<span class="hljs-meta">... </span>        <span class="hljs-keyword">return</span> batch`}}),Rs=new V({props:{code:"ZGF0YV9jb2xsYXRvciUyMCUzRCUyMERhdGFDb2xsYXRvckNUQ1dpdGhQYWRkaW5nKHByb2Nlc3NvciUzRHByb2Nlc3NvciUyQyUyMHBhZGRpbmclM0QlMjJsb25nZXN0JTIyKQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorCTCWithPadding(processor=processor, padding=<span class="hljs-string">&quot;longest&quot;</span>)'}}),Ws=new pt({}),Bs=new V({props:{code:"aW1wb3J0JTIwZXZhbHVhdGUlMEElMEF3ZXIlMjAlM0QlMjBldmFsdWF0ZS5sb2FkKCUyMndlciUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> evaluate

<span class="hljs-meta">&gt;&gt;&gt; </span>wer = evaluate.load(<span class="hljs-string">&quot;wer&quot;</span>)`}}),Xs=new V({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBJTBBJTBBZGVmJTIwY29tcHV0ZV9tZXRyaWNzKHByZWQpJTNBJTBBJTIwJTIwJTIwJTIwcHJlZF9sb2dpdHMlMjAlM0QlMjBwcmVkLnByZWRpY3Rpb25zJTBBJTIwJTIwJTIwJTIwcHJlZF9pZHMlMjAlM0QlMjBucC5hcmdtYXgocHJlZF9sb2dpdHMlMkMlMjBheGlzJTNELTEpJTBBJTBBJTIwJTIwJTIwJTIwcHJlZC5sYWJlbF9pZHMlNUJwcmVkLmxhYmVsX2lkcyUyMCUzRCUzRCUyMC0xMDAlNUQlMjAlM0QlMjBwcm9jZXNzb3IudG9rZW5pemVyLnBhZF90b2tlbl9pZCUwQSUwQSUyMCUyMCUyMCUyMHByZWRfc3RyJTIwJTNEJTIwcHJvY2Vzc29yLmJhdGNoX2RlY29kZShwcmVkX2lkcyklMEElMjAlMjAlMjAlMjBsYWJlbF9zdHIlMjAlM0QlMjBwcm9jZXNzb3IuYmF0Y2hfZGVjb2RlKHByZWQubGFiZWxfaWRzJTJDJTIwZ3JvdXBfdG9rZW5zJTNERmFsc2UpJTBBJTBBJTIwJTIwJTIwJTIwd2VyJTIwJTNEJTIwd2VyLmNvbXB1dGUocHJlZGljdGlvbnMlM0RwcmVkX3N0ciUyQyUyMHJlZmVyZW5jZXMlM0RsYWJlbF9zdHIpJTBBJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwJTdCJTIyd2VyJTIyJTNBJTIwd2VyJTdE",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">pred</span>):
<span class="hljs-meta">... </span>    pred_logits = pred.predictions
<span class="hljs-meta">... </span>    pred_ids = np.argmax(pred_logits, axis=-<span class="hljs-number">1</span>)

<span class="hljs-meta">... </span>    pred.label_ids[pred.label_ids == -<span class="hljs-number">100</span>] = processor.tokenizer.pad_token_id

<span class="hljs-meta">... </span>    pred_str = processor.batch_decode(pred_ids)
<span class="hljs-meta">... </span>    label_str = processor.batch_decode(pred.label_ids, group_tokens=<span class="hljs-literal">False</span>)

<span class="hljs-meta">... </span>    wer = wer.compute(predictions=pred_str, references=label_str)

<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> {<span class="hljs-string">&quot;wer&quot;</span>: wer}`}}),Ys=new pt({}),os=new Qo({props:{pytorch:!0,tensorflow:!1,jax:!1,$$slots:{pytorch:[tr]},$$scope:{ctx:D}}}),rs=new Sa({props:{$$slots:{default:[ar]},$$scope:{ctx:D}}}),Ns=new pt({}),xs=new V({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTJDJTIwQXVkaW8lMEElMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMlBvbHlBSSUyRm1pbmRzMTQlMjIlMkMlMjAlMjJlbi1VUyUyMiUyQyUyMHNwbGl0JTNEJTIydHJhaW4lMjIpJTBBZGF0YXNldCUyMCUzRCUyMGRhdGFzZXQuY2FzdF9jb2x1bW4oJTIyYXVkaW8lMjIlMkMlMjBBdWRpbyhzYW1wbGluZ19yYXRlJTNEMTYwMDApKSUwQXNhbXBsaW5nX3JhdGUlMjAlM0QlMjBkYXRhc2V0LmZlYXR1cmVzJTVCJTIyYXVkaW8lMjIlNUQuc2FtcGxpbmdfcmF0ZSUwQWF1ZGlvX2ZpbGUlMjAlM0QlMjBkYXRhc2V0JTVCMCU1RCU1QiUyMmF1ZGlvJTIyJTVEJTVCJTIycGF0aCUyMiU1RA==",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>, <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>]`}}),Qs=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBdHJhbnNjcmliZXIlMjAlM0QlMjBwaXBlbGluZSglMjJhdXRvbWF0aWMtc3BlZWNoLXJlY29nbml0aW9uJTIyJTJDJTIwbW9kZWwlM0QlMjJzdGV2aGxpdSUyRm15X2F3ZXNvbWVfYXNyX21pbmRzX21vZGVsJTIyKSUwQXRyYW5zY3JpYmVyKGF1ZGlvX2ZpbGUp",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>transcriber = pipeline(<span class="hljs-string">&quot;automatic-speech-recognition&quot;</span>, model=<span class="hljs-string">&quot;stevhliu/my_awesome_asr_minds_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>transcriber(audio_file)
{<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;I WOUD LIKE O SET UP JOINT ACOUNT WTH Y PARTNER&#x27;</span>}`}}),is=new Sa({props:{$$slots:{default:[lr]},$$scope:{ctx:D}}}),hs=new Qo({props:{pytorch:!0,tensorflow:!1,jax:!1,$$slots:{pytorch:[or]},$$scope:{ctx:D}}}),{c(){m=n("meta"),y=c(),u=n("h1"),j=n("a"),$=n("span"),g(v.$$.fragment),A=c(),Z=n("span"),k=a("Automatic speech recognition"),E=c(),g(G.$$.fragment),I=c(),g(Q.$$.fragment),B=c(),z=n("p"),P=a("Automatic speech recognition (ASR) converts a speech signal to text, mapping a sequence of audio inputs to text outputs. Virtual assistants like Siri and Alexa use ASR models to help users everyday, and there are many other useful user-facing applications like live captioning and note-taking during meetings."),X=c(),C=n("p"),L=a("This guide will show you how to:"),q=c(),Y=n("ol"),x=n("li"),F=a("Finetune "),N=n("a"),M=a("Wav2Vec2"),R=a(" on the "),H=n("a"),ne=a("MInDS-14"),S=a(" dataset to transcribe audio to text."),O=c(),K=n("li"),ee=a("Use your finetuned model for inference."),T=c(),g(ae.$$.fragment),oe=c(),he=n("p"),$e=a("Before you begin, make sure you have all the necessary libraries installed:"),me=c(),g(re.$$.fragment),ve=c(),ue=n("p"),pe=a("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:"),Te=c(),g(ie.$$.fragment),Qe=c(),de=n("h2"),fe=n("a"),ye=n("span"),g(ge.$$.fragment),be=c(),Ae=n("span"),Ee=a("Load MInDS-14 dataset"),ze=c(),we=n("p"),Fe=a("Start by loading a smaller subset of the "),le=n("a"),He=a("MInDS-14"),f=a(" dataset from the \u{1F917} Datasets library. This\u2019ll give you a chance to experiment and make sure everything works before spending more time training on the full dataset."),W=c(),g(Me.$$.fragment),ds=c(),je=n("p"),ke=a("Split the dataset\u2019s "),se=n("code"),Fs=a("train"),Hs=a(" split into a train and test set with the "),Se=n("code"),Ss=a("~Dataset.train_test_split"),Ie=a(" method:"),fs=c(),g(Ce.$$.fragment),Ge=c(),Be=n("p"),qe=a("Then take a look at the dataset:"),ys=c(),g(Ms.$$.fragment),Qt=c(),te=n("p"),qa=a("While the dataset contains a lot of useful information, like "),it=n("code"),Da=a("lang_id"),Pa=a(" and "),ct=n("code"),La=a("english_transcription"),Oa=a(", you\u2019ll focus on the "),ht=n("code"),Ka=a("audio"),el=a(" and "),mt=n("code"),sl=a("transcription"),tl=a(" in this guide. Remove the other columns with the "),js=n("a"),al=a("remove_columns"),ll=a(" method:"),zt=c(),g(gs.$$.fragment),Ft=c(),qs=n("p"),nl=a("Take a look at the example again:"),Ht=c(),g(bs.$$.fragment),St=c(),Ds=n("p"),ol=a("There are two fields:"),qt=c(),De=n("ul"),Pe=n("li"),ut=n("code"),rl=a("audio"),pl=a(": a 1-dimensional "),dt=n("code"),il=a("array"),cl=a(" of the speech signal that must be called to load and resample the audio file."),hl=c(),Ps=n("li"),ft=n("code"),ml=a("transcription"),ul=a(": the target text."),Dt=c(),Ve=n("h2"),Le=n("a"),yt=n("span"),g(ws.$$.fragment),dl=c(),Mt=n("span"),fl=a("Preprocess"),Pt=c(),Ls=n("p"),yl=a("The next step is to load a Wav2Vec2 processor to process the audio signal:"),Lt=c(),g(Js.$$.fragment),Ot=c(),Oe=n("p"),Ml=a("The MInDS-14 dataset has a sampling rate of 8000kHz (you can find this information in its "),_s=n("a"),jl=a("dataset card"),gl=a("), which means you\u2019ll need to resample the dataset to 16000kHz to use the pretrained Wav2Vec2 model:"),Kt=c(),g(Us.$$.fragment),ea=c(),Ke=n("p"),bl=a("As you can see in the "),jt=n("code"),wl=a("transcription"),Jl=a(" above, the text contains a mix of upper and lowercase characters. The Wav2Vec2 tokenizer is only trained on uppercase characters so you\u2019ll need to make sure the text matches the tokenizer\u2019s vocabulary:"),sa=c(),g(vs.$$.fragment),ta=c(),Os=n("p"),_l=a("Now create a preprocessing function that:"),aa=c(),es=n("ol"),Ts=n("li"),Ul=a("Calls the "),gt=n("code"),vl=a("audio"),Tl=a(" column to load and resample the audio file."),$l=c(),Xe=n("li"),El=a("Extracts the "),bt=n("code"),kl=a("input_values"),Il=a(" from the audio file and tokenize the "),wt=n("code"),Cl=a("transcription"),Rl=a(" column with the processor."),la=c(),g($s.$$.fragment),na=c(),ce=n("p"),Wl=a("To apply the preprocessing function over the entire dataset, use \u{1F917} Datasets "),Es=n("a"),Zl=a("map"),Al=a(" function. You can speed up "),Jt=n("code"),Gl=a("map"),Bl=a(" by increasing the number of processes with the "),_t=n("code"),Vl=a("num_proc"),Xl=a(" parameter. Remove the columns you don\u2019t need with the "),ks=n("a"),Yl=a("remove_columns"),Nl=a(" method:"),oa=c(),g(Is.$$.fragment),ra=c(),Je=n("p"),xl=a("\u{1F917} Transformers doesn\u2019t have a data collator for ASR, so you\u2019ll need to adapt the "),Ks=n("a"),Ql=a("DataCollatorWithPadding"),zl=a(" to create a batch of examples. It\u2019ll also dynamically pad your text and labels to the length of the longest element in its batch (instead of the entire dataset) so they are a uniform length. While it is possible to pad your text in the "),Ut=n("code"),Fl=a("tokenizer"),Hl=a(" function by setting "),vt=n("code"),Sl=a("padding=True"),ql=a(", dynamic padding is more efficient."),pa=c(),Re=n("p"),Dl=a("Unlike other data collators, this specific data collator needs to apply a different padding method to "),Tt=n("code"),Pl=a("input_values"),Ll=a(" and "),$t=n("code"),Ol=a("labels"),Kl=a(":"),ia=c(),g(Cs.$$.fragment),ca=c(),ss=n("p"),en=a("Now instantiate your "),Et=n("code"),sn=a("DataCollatorForCTCWithPadding"),tn=a(":"),ha=c(),g(Rs.$$.fragment),ma=c(),Ye=n("h2"),ts=n("a"),kt=n("span"),g(Ws.$$.fragment),an=c(),It=n("span"),ln=a("Evaluate"),ua=c(),_e=n("p"),nn=a("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} "),Zs=n("a"),on=a("Evaluate"),rn=a(" library. For this task, load the "),As=n("a"),pn=a("word error rate"),cn=a(" (WER) metric (see the \u{1F917} Evaluate "),Gs=n("a"),hn=a("quick tour"),mn=a(" to learn more about how to load and compute a metric):"),da=c(),g(Bs.$$.fragment),fa=c(),as=n("p"),un=a("Then create a function that passes your predictions and labels to "),Vs=n("a"),dn=a("compute"),fn=a(" to calculate the WER:"),ya=c(),g(Xs.$$.fragment),Ma=c(),ls=n("p"),yn=a("Your "),Ct=n("code"),Mn=a("compute_metrics"),jn=a(" function is ready to go now, and you\u2019ll return to it when you setup your training."),ja=c(),Ne=n("h2"),ns=n("a"),Rt=n("span"),g(Ys.$$.fragment),gn=c(),Wt=n("span"),bn=a("Train"),ga=c(),g(os.$$.fragment),ba=c(),g(rs.$$.fragment),wa=c(),xe=n("h2"),ps=n("a"),Zt=n("span"),g(Ns.$$.fragment),wn=c(),At=n("span"),Jn=a("Inference"),Ja=c(),et=n("p"),_n=a("Great, now that you\u2019ve finetuned a model, you can use it for inference!"),_a=c(),st=n("p"),Un=a("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!"),Ua=c(),g(xs.$$.fragment),va=c(),We=n("p"),vn=a("The simplest way to try out your finetuned model for inference is to use it in a "),tt=n("a"),Tn=a("pipeline()"),$n=a(". Instantiate a "),Gt=n("code"),En=a("pipeline"),kn=a(" for automatic speech recognition with your model, and pass your audio file to it:"),Ta=c(),g(Qs.$$.fragment),$a=c(),g(is.$$.fragment),Ea=c(),cs=n("p"),In=a("You can also manually replicate the results of the "),Bt=n("code"),Cn=a("pipeline"),Rn=a(" if you\u2019d like:"),ka=c(),g(hs.$$.fragment),this.h()},l(e){const p=qo('[data-svelte="svelte-1phssyn"]',document.head);m=o(p,"META",{name:!0,content:!0}),p.forEach(t),y=h(e),u=o(e,"H1",{class:!0});var zs=r(u);j=o(zs,"A",{id:!0,class:!0,href:!0});var Vt=r(j);$=o(Vt,"SPAN",{});var Xt=r($);b(v.$$.fragment,Xt),Xt.forEach(t),Vt.forEach(t),A=h(zs),Z=o(zs,"SPAN",{});var Yt=r(Z);k=l(Yt,"Automatic speech recognition"),Yt.forEach(t),zs.forEach(t),E=h(e),b(G.$$.fragment,e),I=h(e),b(Q.$$.fragment,e),B=h(e),z=o(e,"P",{});var Nt=r(z);P=l(Nt,"Automatic speech recognition (ASR) converts a speech signal to text, mapping a sequence of audio inputs to text outputs. Virtual assistants like Siri and Alexa use ASR models to help users everyday, and there are many other useful user-facing applications like live captioning and note-taking during meetings."),Nt.forEach(t),X=h(e),C=o(e,"P",{});var Zn=r(C);L=l(Zn,"This guide will show you how to:"),Zn.forEach(t),q=h(e),Y=o(e,"OL",{});var Ca=r(Y);x=o(Ca,"LI",{});var at=r(x);F=l(at,"Finetune "),N=o(at,"A",{href:!0,rel:!0});var An=r(N);M=l(An,"Wav2Vec2"),An.forEach(t),R=l(at," on the "),H=o(at,"A",{href:!0,rel:!0});var Gn=r(H);ne=l(Gn,"MInDS-14"),Gn.forEach(t),S=l(at," dataset to transcribe audio to text."),at.forEach(t),O=h(Ca),K=o(Ca,"LI",{});var Bn=r(K);ee=l(Bn,"Use your finetuned model for inference."),Bn.forEach(t),Ca.forEach(t),T=h(e),b(ae.$$.fragment,e),oe=h(e),he=o(e,"P",{});var Vn=r(he);$e=l(Vn,"Before you begin, make sure you have all the necessary libraries installed:"),Vn.forEach(t),me=h(e),b(re.$$.fragment,e),ve=h(e),ue=o(e,"P",{});var Xn=r(ue);pe=l(Xn,"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:"),Xn.forEach(t),Te=h(e),b(ie.$$.fragment,e),Qe=h(e),de=o(e,"H2",{class:!0});var Ra=r(de);fe=o(Ra,"A",{id:!0,class:!0,href:!0});var Yn=r(fe);ye=o(Yn,"SPAN",{});var Nn=r(ye);b(ge.$$.fragment,Nn),Nn.forEach(t),Yn.forEach(t),be=h(Ra),Ae=o(Ra,"SPAN",{});var xn=r(Ae);Ee=l(xn,"Load MInDS-14 dataset"),xn.forEach(t),Ra.forEach(t),ze=h(e),we=o(e,"P",{});var Wa=r(we);Fe=l(Wa,"Start by loading a smaller subset of the "),le=o(Wa,"A",{href:!0,rel:!0});var Qn=r(le);He=l(Qn,"MInDS-14"),Qn.forEach(t),f=l(Wa," dataset from the \u{1F917} Datasets library. This\u2019ll give you a chance to experiment and make sure everything works before spending more time training on the full dataset."),Wa.forEach(t),W=h(e),b(Me.$$.fragment,e),ds=h(e),je=o(e,"P",{});var lt=r(je);ke=l(lt,"Split the dataset\u2019s "),se=o(lt,"CODE",{});var zn=r(se);Fs=l(zn,"train"),zn.forEach(t),Hs=l(lt," split into a train and test set with the "),Se=o(lt,"CODE",{});var Fn=r(Se);Ss=l(Fn,"~Dataset.train_test_split"),Fn.forEach(t),Ie=l(lt," method:"),lt.forEach(t),fs=h(e),b(Ce.$$.fragment,e),Ge=h(e),Be=o(e,"P",{});var Hn=r(Be);qe=l(Hn,"Then take a look at the dataset:"),Hn.forEach(t),ys=h(e),b(Ms.$$.fragment,e),Qt=h(e),te=o(e,"P",{});var Ue=r(te);qa=l(Ue,"While the dataset contains a lot of useful information, like "),it=o(Ue,"CODE",{});var Sn=r(it);Da=l(Sn,"lang_id"),Sn.forEach(t),Pa=l(Ue," and "),ct=o(Ue,"CODE",{});var qn=r(ct);La=l(qn,"english_transcription"),qn.forEach(t),Oa=l(Ue,", you\u2019ll focus on the "),ht=o(Ue,"CODE",{});var Dn=r(ht);Ka=l(Dn,"audio"),Dn.forEach(t),el=l(Ue," and "),mt=o(Ue,"CODE",{});var Pn=r(mt);sl=l(Pn,"transcription"),Pn.forEach(t),tl=l(Ue," in this guide. Remove the other columns with the "),js=o(Ue,"A",{href:!0,rel:!0});var Ln=r(js);al=l(Ln,"remove_columns"),Ln.forEach(t),ll=l(Ue," method:"),Ue.forEach(t),zt=h(e),b(gs.$$.fragment,e),Ft=h(e),qs=o(e,"P",{});var On=r(qs);nl=l(On,"Take a look at the example again:"),On.forEach(t),Ht=h(e),b(bs.$$.fragment,e),St=h(e),Ds=o(e,"P",{});var Kn=r(Ds);ol=l(Kn,"There are two fields:"),Kn.forEach(t),qt=h(e),De=o(e,"UL",{});var Za=r(De);Pe=o(Za,"LI",{});var xt=r(Pe);ut=o(xt,"CODE",{});var eo=r(ut);rl=l(eo,"audio"),eo.forEach(t),pl=l(xt,": a 1-dimensional "),dt=o(xt,"CODE",{});var so=r(dt);il=l(so,"array"),so.forEach(t),cl=l(xt," of the speech signal that must be called to load and resample the audio file."),xt.forEach(t),hl=h(Za),Ps=o(Za,"LI",{});var Wn=r(Ps);ft=o(Wn,"CODE",{});var to=r(ft);ml=l(to,"transcription"),to.forEach(t),ul=l(Wn,": the target text."),Wn.forEach(t),Za.forEach(t),Dt=h(e),Ve=o(e,"H2",{class:!0});var Aa=r(Ve);Le=o(Aa,"A",{id:!0,class:!0,href:!0});var ao=r(Le);yt=o(ao,"SPAN",{});var lo=r(yt);b(ws.$$.fragment,lo),lo.forEach(t),ao.forEach(t),dl=h(Aa),Mt=o(Aa,"SPAN",{});var no=r(Mt);fl=l(no,"Preprocess"),no.forEach(t),Aa.forEach(t),Pt=h(e),Ls=o(e,"P",{});var oo=r(Ls);yl=l(oo,"The next step is to load a Wav2Vec2 processor to process the audio signal:"),oo.forEach(t),Lt=h(e),b(Js.$$.fragment,e),Ot=h(e),Oe=o(e,"P",{});var Ga=r(Oe);Ml=l(Ga,"The MInDS-14 dataset has a sampling rate of 8000kHz (you can find this information in its "),_s=o(Ga,"A",{href:!0,rel:!0});var ro=r(_s);jl=l(ro,"dataset card"),ro.forEach(t),gl=l(Ga,"), which means you\u2019ll need to resample the dataset to 16000kHz to use the pretrained Wav2Vec2 model:"),Ga.forEach(t),Kt=h(e),b(Us.$$.fragment,e),ea=h(e),Ke=o(e,"P",{});var Ba=r(Ke);bl=l(Ba,"As you can see in the "),jt=o(Ba,"CODE",{});var po=r(jt);wl=l(po,"transcription"),po.forEach(t),Jl=l(Ba," above, the text contains a mix of upper and lowercase characters. The Wav2Vec2 tokenizer is only trained on uppercase characters so you\u2019ll need to make sure the text matches the tokenizer\u2019s vocabulary:"),Ba.forEach(t),sa=h(e),b(vs.$$.fragment,e),ta=h(e),Os=o(e,"P",{});var io=r(Os);_l=l(io,"Now create a preprocessing function that:"),io.forEach(t),aa=h(e),es=o(e,"OL",{});var Va=r(es);Ts=o(Va,"LI",{});var Xa=r(Ts);Ul=l(Xa,"Calls the "),gt=o(Xa,"CODE",{});var co=r(gt);vl=l(co,"audio"),co.forEach(t),Tl=l(Xa," column to load and resample the audio file."),Xa.forEach(t),$l=h(Va),Xe=o(Va,"LI",{});var nt=r(Xe);El=l(nt,"Extracts the "),bt=o(nt,"CODE",{});var ho=r(bt);kl=l(ho,"input_values"),ho.forEach(t),Il=l(nt," from the audio file and tokenize the "),wt=o(nt,"CODE",{});var mo=r(wt);Cl=l(mo,"transcription"),mo.forEach(t),Rl=l(nt," column with the processor."),nt.forEach(t),Va.forEach(t),la=h(e),b($s.$$.fragment,e),na=h(e),ce=o(e,"P",{});var Ze=r(ce);Wl=l(Ze,"To apply the preprocessing function over the entire dataset, use \u{1F917} Datasets "),Es=o(Ze,"A",{href:!0,rel:!0});var uo=r(Es);Zl=l(uo,"map"),uo.forEach(t),Al=l(Ze," function. You can speed up "),Jt=o(Ze,"CODE",{});var fo=r(Jt);Gl=l(fo,"map"),fo.forEach(t),Bl=l(Ze," by increasing the number of processes with the "),_t=o(Ze,"CODE",{});var yo=r(_t);Vl=l(yo,"num_proc"),yo.forEach(t),Xl=l(Ze," parameter. Remove the columns you don\u2019t need with the "),ks=o(Ze,"A",{href:!0,rel:!0});var Mo=r(ks);Yl=l(Mo,"remove_columns"),Mo.forEach(t),Nl=l(Ze," method:"),Ze.forEach(t),oa=h(e),b(Is.$$.fragment,e),ra=h(e),Je=o(e,"P",{});var ms=r(Je);xl=l(ms,"\u{1F917} Transformers doesn\u2019t have a data collator for ASR, so you\u2019ll need to adapt the "),Ks=o(ms,"A",{href:!0});var jo=r(Ks);Ql=l(jo,"DataCollatorWithPadding"),jo.forEach(t),zl=l(ms," to create a batch of examples. It\u2019ll also dynamically pad your text and labels to the length of the longest element in its batch (instead of the entire dataset) so they are a uniform length. While it is possible to pad your text in the "),Ut=o(ms,"CODE",{});var go=r(Ut);Fl=l(go,"tokenizer"),go.forEach(t),Hl=l(ms," function by setting "),vt=o(ms,"CODE",{});var bo=r(vt);Sl=l(bo,"padding=True"),bo.forEach(t),ql=l(ms,", dynamic padding is more efficient."),ms.forEach(t),pa=h(e),Re=o(e,"P",{});var ot=r(Re);Dl=l(ot,"Unlike other data collators, this specific data collator needs to apply a different padding method to "),Tt=o(ot,"CODE",{});var wo=r(Tt);Pl=l(wo,"input_values"),wo.forEach(t),Ll=l(ot," and "),$t=o(ot,"CODE",{});var Jo=r($t);Ol=l(Jo,"labels"),Jo.forEach(t),Kl=l(ot,":"),ot.forEach(t),ia=h(e),b(Cs.$$.fragment,e),ca=h(e),ss=o(e,"P",{});var Ya=r(ss);en=l(Ya,"Now instantiate your "),Et=o(Ya,"CODE",{});var _o=r(Et);sn=l(_o,"DataCollatorForCTCWithPadding"),_o.forEach(t),tn=l(Ya,":"),Ya.forEach(t),ha=h(e),b(Rs.$$.fragment,e),ma=h(e),Ye=o(e,"H2",{class:!0});var Na=r(Ye);ts=o(Na,"A",{id:!0,class:!0,href:!0});var Uo=r(ts);kt=o(Uo,"SPAN",{});var vo=r(kt);b(Ws.$$.fragment,vo),vo.forEach(t),Uo.forEach(t),an=h(Na),It=o(Na,"SPAN",{});var To=r(It);ln=l(To,"Evaluate"),To.forEach(t),Na.forEach(t),ua=h(e),_e=o(e,"P",{});var us=r(_e);nn=l(us,"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} "),Zs=o(us,"A",{href:!0,rel:!0});var $o=r(Zs);on=l($o,"Evaluate"),$o.forEach(t),rn=l(us," library. For this task, load the "),As=o(us,"A",{href:!0,rel:!0});var Eo=r(As);pn=l(Eo,"word error rate"),Eo.forEach(t),cn=l(us," (WER) metric (see the \u{1F917} Evaluate "),Gs=o(us,"A",{href:!0,rel:!0});var ko=r(Gs);hn=l(ko,"quick tour"),ko.forEach(t),mn=l(us," to learn more about how to load and compute a metric):"),us.forEach(t),da=h(e),b(Bs.$$.fragment,e),fa=h(e),as=o(e,"P",{});var xa=r(as);un=l(xa,"Then create a function that passes your predictions and labels to "),Vs=o(xa,"A",{href:!0,rel:!0});var Io=r(Vs);dn=l(Io,"compute"),Io.forEach(t),fn=l(xa," to calculate the WER:"),xa.forEach(t),ya=h(e),b(Xs.$$.fragment,e),Ma=h(e),ls=o(e,"P",{});var Qa=r(ls);yn=l(Qa,"Your "),Ct=o(Qa,"CODE",{});var Co=r(Ct);Mn=l(Co,"compute_metrics"),Co.forEach(t),jn=l(Qa," function is ready to go now, and you\u2019ll return to it when you setup your training."),Qa.forEach(t),ja=h(e),Ne=o(e,"H2",{class:!0});var za=r(Ne);ns=o(za,"A",{id:!0,class:!0,href:!0});var Ro=r(ns);Rt=o(Ro,"SPAN",{});var Wo=r(Rt);b(Ys.$$.fragment,Wo),Wo.forEach(t),Ro.forEach(t),gn=h(za),Wt=o(za,"SPAN",{});var Zo=r(Wt);bn=l(Zo,"Train"),Zo.forEach(t),za.forEach(t),ga=h(e),b(os.$$.fragment,e),ba=h(e),b(rs.$$.fragment,e),wa=h(e),xe=o(e,"H2",{class:!0});var Fa=r(xe);ps=o(Fa,"A",{id:!0,class:!0,href:!0});var Ao=r(ps);Zt=o(Ao,"SPAN",{});var Go=r(Zt);b(Ns.$$.fragment,Go),Go.forEach(t),Ao.forEach(t),wn=h(Fa),At=o(Fa,"SPAN",{});var Bo=r(At);Jn=l(Bo,"Inference"),Bo.forEach(t),Fa.forEach(t),Ja=h(e),et=o(e,"P",{});var Vo=r(et);_n=l(Vo,"Great, now that you\u2019ve finetuned a model, you can use it for inference!"),Vo.forEach(t),_a=h(e),st=o(e,"P",{});var Xo=r(st);Un=l(Xo,"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!"),Xo.forEach(t),Ua=h(e),b(xs.$$.fragment,e),va=h(e),We=o(e,"P",{});var rt=r(We);vn=l(rt,"The simplest way to try out your finetuned model for inference is to use it in a "),tt=o(rt,"A",{href:!0});var Yo=r(tt);Tn=l(Yo,"pipeline()"),Yo.forEach(t),$n=l(rt,". Instantiate a "),Gt=o(rt,"CODE",{});var No=r(Gt);En=l(No,"pipeline"),No.forEach(t),kn=l(rt," for automatic speech recognition with your model, and pass your audio file to it:"),rt.forEach(t),Ta=h(e),b(Qs.$$.fragment,e),$a=h(e),b(is.$$.fragment,e),Ea=h(e),cs=o(e,"P",{});var Ha=r(cs);In=l(Ha,"You can also manually replicate the results of the "),Bt=o(Ha,"CODE",{});var xo=r(Bt);Cn=l(xo,"pipeline"),xo.forEach(t),Rn=l(Ha," if you\u2019d like:"),Ha.forEach(t),ka=h(e),b(hs.$$.fragment,e),this.h()},h(){d(m,"name","hf:doc:metadata"),d(m,"content",JSON.stringify(pr)),d(j,"id","automatic-speech-recognition"),d(j,"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(j,"href","#automatic-speech-recognition"),d(u,"class","relative group"),d(N,"href","https://huggingface.co/facebook/wav2vec2-base"),d(N,"rel","nofollow"),d(H,"href","https://huggingface.co/datasets/PolyAI/minds14"),d(H,"rel","nofollow"),d(fe,"id","load-minds14-dataset"),d(fe,"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(fe,"href","#load-minds14-dataset"),d(de,"class","relative group"),d(le,"href","https://huggingface.co/datasets/PolyAI/minds14"),d(le,"rel","nofollow"),d(js,"href","https://huggingface.co/docs/datasets/v2.14.4/en/package_reference/main_classes#datasets.Dataset.remove_columns"),d(js,"rel","nofollow"),d(Le,"id","preprocess"),d(Le,"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(Le,"href","#preprocess"),d(Ve,"class","relative group"),d(_s,"href","https://huggingface.co/datasets/PolyAI/minds14"),d(_s,"rel","nofollow"),d(Es,"href","https://huggingface.co/docs/datasets/v2.14.4/en/package_reference/main_classes#datasets.Dataset.map"),d(Es,"rel","nofollow"),d(ks,"href","https://huggingface.co/docs/datasets/v2.14.4/en/package_reference/main_classes#datasets.Dataset.remove_columns"),d(ks,"rel","nofollow"),d(Ks,"href","/docs/transformers/v4.33.0/en/main_classes/data_collator#transformers.DataCollatorWithPadding"),d(ts,"id","evaluate"),d(ts,"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(ts,"href","#evaluate"),d(Ye,"class","relative group"),d(Zs,"href","https://huggingface.co/docs/evaluate/index"),d(Zs,"rel","nofollow"),d(As,"href","https://huggingface.co/spaces/evaluate-metric/wer"),d(As,"rel","nofollow"),d(Gs,"href","https://huggingface.co/docs/evaluate/a_quick_tour"),d(Gs,"rel","nofollow"),d(Vs,"href","https://huggingface.co/docs/evaluate/v0.4.0/en/package_reference/main_classes#evaluate.EvaluationModule.compute"),d(Vs,"rel","nofollow"),d(ns,"id","train"),d(ns,"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(ns,"href","#train"),d(Ne,"class","relative group"),d(ps,"id","inference"),d(ps,"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(ps,"href","#inference"),d(xe,"class","relative group"),d(tt,"href","/docs/transformers/v4.33.0/en/main_classes/pipelines#transformers.pipeline")},m(e,p){s(document.head,m),i(e,y,p),i(e,u,p),s(u,j),s(j,$),w(v,$,null),s(u,A),s(u,Z),s(Z,k),i(e,E,p),w(G,e,p),i(e,I,p),w(Q,e,p),i(e,B,p),i(e,z,p),s(z,P),i(e,X,p),i(e,C,p),s(C,L),i(e,q,p),i(e,Y,p),s(Y,x),s(x,F),s(x,N),s(N,M),s(x,R),s(x,H),s(H,ne),s(x,S),s(Y,O),s(Y,K),s(K,ee),i(e,T,p),w(ae,e,p),i(e,oe,p),i(e,he,p),s(he,$e),i(e,me,p),w(re,e,p),i(e,ve,p),i(e,ue,p),s(ue,pe),i(e,Te,p),w(ie,e,p),i(e,Qe,p),i(e,de,p),s(de,fe),s(fe,ye),w(ge,ye,null),s(de,be),s(de,Ae),s(Ae,Ee),i(e,ze,p),i(e,we,p),s(we,Fe),s(we,le),s(le,He),s(we,f),i(e,W,p),w(Me,e,p),i(e,ds,p),i(e,je,p),s(je,ke),s(je,se),s(se,Fs),s(je,Hs),s(je,Se),s(Se,Ss),s(je,Ie),i(e,fs,p),w(Ce,e,p),i(e,Ge,p),i(e,Be,p),s(Be,qe),i(e,ys,p),w(Ms,e,p),i(e,Qt,p),i(e,te,p),s(te,qa),s(te,it),s(it,Da),s(te,Pa),s(te,ct),s(ct,La),s(te,Oa),s(te,ht),s(ht,Ka),s(te,el),s(te,mt),s(mt,sl),s(te,tl),s(te,js),s(js,al),s(te,ll),i(e,zt,p),w(gs,e,p),i(e,Ft,p),i(e,qs,p),s(qs,nl),i(e,Ht,p),w(bs,e,p),i(e,St,p),i(e,Ds,p),s(Ds,ol),i(e,qt,p),i(e,De,p),s(De,Pe),s(Pe,ut),s(ut,rl),s(Pe,pl),s(Pe,dt),s(dt,il),s(Pe,cl),s(De,hl),s(De,Ps),s(Ps,ft),s(ft,ml),s(Ps,ul),i(e,Dt,p),i(e,Ve,p),s(Ve,Le),s(Le,yt),w(ws,yt,null),s(Ve,dl),s(Ve,Mt),s(Mt,fl),i(e,Pt,p),i(e,Ls,p),s(Ls,yl),i(e,Lt,p),w(Js,e,p),i(e,Ot,p),i(e,Oe,p),s(Oe,Ml),s(Oe,_s),s(_s,jl),s(Oe,gl),i(e,Kt,p),w(Us,e,p),i(e,ea,p),i(e,Ke,p),s(Ke,bl),s(Ke,jt),s(jt,wl),s(Ke,Jl),i(e,sa,p),w(vs,e,p),i(e,ta,p),i(e,Os,p),s(Os,_l),i(e,aa,p),i(e,es,p),s(es,Ts),s(Ts,Ul),s(Ts,gt),s(gt,vl),s(Ts,Tl),s(es,$l),s(es,Xe),s(Xe,El),s(Xe,bt),s(bt,kl),s(Xe,Il),s(Xe,wt),s(wt,Cl),s(Xe,Rl),i(e,la,p),w($s,e,p),i(e,na,p),i(e,ce,p),s(ce,Wl),s(ce,Es),s(Es,Zl),s(ce,Al),s(ce,Jt),s(Jt,Gl),s(ce,Bl),s(ce,_t),s(_t,Vl),s(ce,Xl),s(ce,ks),s(ks,Yl),s(ce,Nl),i(e,oa,p),w(Is,e,p),i(e,ra,p),i(e,Je,p),s(Je,xl),s(Je,Ks),s(Ks,Ql),s(Je,zl),s(Je,Ut),s(Ut,Fl),s(Je,Hl),s(Je,vt),s(vt,Sl),s(Je,ql),i(e,pa,p),i(e,Re,p),s(Re,Dl),s(Re,Tt),s(Tt,Pl),s(Re,Ll),s(Re,$t),s($t,Ol),s(Re,Kl),i(e,ia,p),w(Cs,e,p),i(e,ca,p),i(e,ss,p),s(ss,en),s(ss,Et),s(Et,sn),s(ss,tn),i(e,ha,p),w(Rs,e,p),i(e,ma,p),i(e,Ye,p),s(Ye,ts),s(ts,kt),w(Ws,kt,null),s(Ye,an),s(Ye,It),s(It,ln),i(e,ua,p),i(e,_e,p),s(_e,nn),s(_e,Zs),s(Zs,on),s(_e,rn),s(_e,As),s(As,pn),s(_e,cn),s(_e,Gs),s(Gs,hn),s(_e,mn),i(e,da,p),w(Bs,e,p),i(e,fa,p),i(e,as,p),s(as,un),s(as,Vs),s(Vs,dn),s(as,fn),i(e,ya,p),w(Xs,e,p),i(e,Ma,p),i(e,ls,p),s(ls,yn),s(ls,Ct),s(Ct,Mn),s(ls,jn),i(e,ja,p),i(e,Ne,p),s(Ne,ns),s(ns,Rt),w(Ys,Rt,null),s(Ne,gn),s(Ne,Wt),s(Wt,bn),i(e,ga,p),w(os,e,p),i(e,ba,p),w(rs,e,p),i(e,wa,p),i(e,xe,p),s(xe,ps),s(ps,Zt),w(Ns,Zt,null),s(xe,wn),s(xe,At),s(At,Jn),i(e,Ja,p),i(e,et,p),s(et,_n),i(e,_a,p),i(e,st,p),s(st,Un),i(e,Ua,p),w(xs,e,p),i(e,va,p),i(e,We,p),s(We,vn),s(We,tt),s(tt,Tn),s(We,$n),s(We,Gt),s(Gt,En),s(We,kn),i(e,Ta,p),w(Qs,e,p),i(e,$a,p),w(is,e,p),i(e,Ea,p),i(e,cs,p),s(cs,In),s(cs,Bt),s(Bt,Cn),s(cs,Rn),i(e,ka,p),w(hs,e,p),Ia=!0},p(e,[p]){const zs={};p&2&&(zs.$$scope={dirty:p,ctx:e}),ae.$set(zs);const Vt={};p&2&&(Vt.$$scope={dirty:p,ctx:e}),os.$set(Vt);const Xt={};p&2&&(Xt.$$scope={dirty:p,ctx:e}),rs.$set(Xt);const Yt={};p&2&&(Yt.$$scope={dirty:p,ctx:e}),is.$set(Yt);const Nt={};p&2&&(Nt.$$scope={dirty:p,ctx:e}),hs.$set(Nt)},i(e){Ia||(J(v.$$.fragment,e),J(G.$$.fragment,e),J(Q.$$.fragment,e),J(ae.$$.fragment,e),J(re.$$.fragment,e),J(ie.$$.fragment,e),J(ge.$$.fragment,e),J(Me.$$.fragment,e),J(Ce.$$.fragment,e),J(Ms.$$.fragment,e),J(gs.$$.fragment,e),J(bs.$$.fragment,e),J(ws.$$.fragment,e),J(Js.$$.fragment,e),J(Us.$$.fragment,e),J(vs.$$.fragment,e),J($s.$$.fragment,e),J(Is.$$.fragment,e),J(Cs.$$.fragment,e),J(Rs.$$.fragment,e),J(Ws.$$.fragment,e),J(Bs.$$.fragment,e),J(Xs.$$.fragment,e),J(Ys.$$.fragment,e),J(os.$$.fragment,e),J(rs.$$.fragment,e),J(Ns.$$.fragment,e),J(xs.$$.fragment,e),J(Qs.$$.fragment,e),J(is.$$.fragment,e),J(hs.$$.fragment,e),Ia=!0)},o(e){_(v.$$.fragment,e),_(G.$$.fragment,e),_(Q.$$.fragment,e),_(ae.$$.fragment,e),_(re.$$.fragment,e),_(ie.$$.fragment,e),_(ge.$$.fragment,e),_(Me.$$.fragment,e),_(Ce.$$.fragment,e),_(Ms.$$.fragment,e),_(gs.$$.fragment,e),_(bs.$$.fragment,e),_(ws.$$.fragment,e),_(Js.$$.fragment,e),_(Us.$$.fragment,e),_(vs.$$.fragment,e),_($s.$$.fragment,e),_(Is.$$.fragment,e),_(Cs.$$.fragment,e),_(Rs.$$.fragment,e),_(Ws.$$.fragment,e),_(Bs.$$.fragment,e),_(Xs.$$.fragment,e),_(Ys.$$.fragment,e),_(os.$$.fragment,e),_(rs.$$.fragment,e),_(Ns.$$.fragment,e),_(xs.$$.fragment,e),_(Qs.$$.fragment,e),_(is.$$.fragment,e),_(hs.$$.fragment,e),Ia=!1},d(e){t(m),e&&t(y),e&&t(u),U(v),e&&t(E),U(G,e),e&&t(I),U(Q,e),e&&t(B),e&&t(z),e&&t(X),e&&t(C),e&&t(q),e&&t(Y),e&&t(T),U(ae,e),e&&t(oe),e&&t(he),e&&t(me),U(re,e),e&&t(ve),e&&t(ue),e&&t(Te),U(ie,e),e&&t(Qe),e&&t(de),U(ge),e&&t(ze),e&&t(we),e&&t(W),U(Me,e),e&&t(ds),e&&t(je),e&&t(fs),U(Ce,e),e&&t(Ge),e&&t(Be),e&&t(ys),U(Ms,e),e&&t(Qt),e&&t(te),e&&t(zt),U(gs,e),e&&t(Ft),e&&t(qs),e&&t(Ht),U(bs,e),e&&t(St),e&&t(Ds),e&&t(qt),e&&t(De),e&&t(Dt),e&&t(Ve),U(ws),e&&t(Pt),e&&t(Ls),e&&t(Lt),U(Js,e),e&&t(Ot),e&&t(Oe),e&&t(Kt),U(Us,e),e&&t(ea),e&&t(Ke),e&&t(sa),U(vs,e),e&&t(ta),e&&t(Os),e&&t(aa),e&&t(es),e&&t(la),U($s,e),e&&t(na),e&&t(ce),e&&t(oa),U(Is,e),e&&t(ra),e&&t(Je),e&&t(pa),e&&t(Re),e&&t(ia),U(Cs,e),e&&t(ca),e&&t(ss),e&&t(ha),U(Rs,e),e&&t(ma),e&&t(Ye),U(Ws),e&&t(ua),e&&t(_e),e&&t(da),U(Bs,e),e&&t(fa),e&&t(as),e&&t(ya),U(Xs,e),e&&t(Ma),e&&t(ls),e&&t(ja),e&&t(Ne),U(Ys),e&&t(ga),U(os,e),e&&t(ba),U(rs,e),e&&t(wa),e&&t(xe),U(Ns),e&&t(Ja),e&&t(et),e&&t(_a),e&&t(st),e&&t(Ua),U(xs,e),e&&t(va),e&&t(We),e&&t(Ta),U(Qs,e),e&&t($a),U(is,e),e&&t(Ea),e&&t(cs),e&&t(ka),U(hs,e)}}}const pr={local:"automatic-speech-recognition",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:"Automatic speech recognition"};function ir(D){return Do(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Mr extends Fo{constructor(m){super();Ho(this,m,ir,rr,So,{})}}export{Mr as default,pr as metadata};
