import{s as Kn,o as On}from"../chunks/scheduler.f7e1785c.js";import{S as ea,i as ta,g as i,s as n,r as p,A as la,h as o,f as l,c as a,j as qn,u as c,x as r,k as Sn,y as sa,a as s,v as h,d,t as M,w as u,m as Dn,n as Pn}from"../chunks/index.9f8f0838.js";import{T as Ln}from"../chunks/Tip.4575d9cf.js";import{C as m}from"../chunks/CodeBlock.b3510e34.js";import{H as T}from"../chunks/Heading.6643a2f7.js";function na(gt){let y;return{c(){y=Dn('You can change the language identifier from `"dv"` to a language identifier of your choice. To see all possible languages\n    in Common Voice 13, check out the dataset card on the Hugging Face Hub: https://huggingface.co/datasets/mozilla-foundation/common_voice_13_0')},l(w){y=Pn(w,'You can change the language identifier from `"dv"` to a language identifier of your choice. To see all possible languages\n    in Common Voice 13, check out the dataset card on the Hugging Face Hub: https://huggingface.co/datasets/mozilla-foundation/common_voice_13_0')},m(w,J){s(w,y,J)},d(w){w&&l(y)}}}function aa(gt){let y;return{c(){y=Dn("If you do not want to upload the model checkpoints to the Hub, set `push_to_hub=False`.")},l(w){y=Pn(w,"If you do not want to upload the model checkpoints to the Hub, set `push_to_hub=False`.")},m(w,J){s(w,y,J)},d(w){w&&l(y)}}}function ia(gt){let y,w,J,Ct,U,It,g,ks=`In this section, we’ll cover a step-by-step guide on fine-tuning Whisper for speech recognition on the Common Voice 13
dataset. We’ll use the ‘small’ version of the model and a relatively lightweight dataset, enabling you to run fine-tuning
fairly quickly on any 16GB+ GPU with low disk space requirements, such as the 16GB T4 GPU provided in the Google Colab free
tier.`,vt,b,$s=`Should you have a smaller GPU or encounter memory issues during training, you can follow the suggestions provided for
reducing memory usage. Conversely, should you have access to a larger GPU, you can amend the training arguments to maximise
your throughput. Thus, this guide is accessible regardless of your GPU specifications!`,Wt,C,xs=`Likewise, this guide outlines how to fine-tune the Whisper model for the Dhivehi language. However, the steps covered here
generalise to any language in the Common Voice dataset, and more generally to any ASR dataset on the Hugging Face Hub.
You can tweak the code to quickly switch to a language of your choice and fine-tune a Whisper model in your native tongue 🌍`,_t,I,Gs="Right! Now that’s out the way, let’s get started and kick-off our fine-tuning pipeline!",kt,v,$t,W,Zs=`We strongly advise you to upload model checkpoints directly the <a href="https://huggingface.co/" rel="nofollow">Hugging Face Hub</a> while training.
The Hub provides:`,xt,_,Bs="<li>Integrated version control: you can be sure that no model checkpoint is lost during training.</li> <li>Tensorboard logs: track important metrics over the course of training.</li> <li>Model cards: document what a model does and its intended use cases.</li> <li>Community: an easy way to share and collaborate with the community! 🤗</li>",Gt,k,Xs=`Linking the notebook to the Hub is straightforward - it simply requires entering your Hub authentication token when prompted.
Find your Hub authentication token <a href="https://huggingface.co/settings/tokens" rel="nofollow">here</a> and enter it when prompted:`,Zt,$,Bt,x,Vs="<strong>Output:</strong>",Xt,G,Vt,Z,Rt,B,Rs=`<a href="https://huggingface.co/datasets/mozilla-foundation/common_voice_13_0" rel="nofollow">Common Voice 13</a> contains approximately ten
hours of labelled Dhivehi data, three of which is held-out test data. This is extremely little data for fine-tuning, so
we’ll be relying on leveraging the extensive multilingual ASR knowledge acquired by Whisper during pre-training for the
low-resource Dhivehi language.`,Ht,X,Hs=`Using 🤗 Datasets, downloading and preparing data is extremely simple. We can download and prepare the Common Voice 13
splits in just one line of code. Since Dhivehi is very low-resource, we’ll combine the <code>train</code> and <code>validation</code> splits
to give approximately seven hours of training data. We’ll use the three hours of <code>test</code> data as our held-out test set:`,Nt,V,At,R,Ns="<strong>Output:</strong>",Et,H,Yt,f,Ft,N,As=`Most ASR datasets only provide input audio samples (<code>audio</code>) and the corresponding transcribed text (<code>sentence</code>).
Common Voice contains additional metadata information, such as <code>accent</code> and <code>locale</code>, which we can disregard for ASR.
Keeping the notebook as general as possible, we only consider the input audio and transcribed text for fine-tuning,
discarding the additional metadata information:`,zt,A,Qt,E,qt,Y,Es="The ASR pipeline can be de-composed into three stages:",St,F,Ys="<li>The feature extractor which pre-processes the raw audio-inputs to log-mel spectrograms</li> <li>The model which performs the sequence-to-sequence mapping</li> <li>The tokenizer which post-processes the predicted tokens to text</li>",Lt,z,Fs=`In 🤗 Transformers, the Whisper model has an associated feature extractor and tokenizer, called <a href="https://huggingface.co/docs/transformers/main/model_doc/whisper#transformers.WhisperFeatureExtractor" rel="nofollow">WhisperFeatureExtractor</a> and <a href="https://huggingface.co/docs/transformers/main/model_doc/whisper#transformers.WhisperTokenizer" rel="nofollow">WhisperTokenizer</a>
respectively. To make our lives simple, these two objects are wrapped under a single class, called the <a href="https://huggingface.co/docs/transformers/model_doc/whisper#transformers.WhisperProcessor" rel="nofollow">WhisperProcessor</a>.
We can call the WhisperProcessor to perform both the audio pre-processing and the text token post-processing. In doing
so, we only need to keep track of two objects during training: the processor and the model.`,Dt,Q,zs=`When performing multilingual fine-tuning, we need to set the <code>&quot;language&quot;</code> and <code>&quot;task&quot;</code> when instantiating the processor.
The <code>&quot;language&quot;</code> should be set to the source audio language, and the task to <code>&quot;transcribe&quot;</code> for speech recognition or
<code>&quot;translate&quot;</code> for speech translation. These arguments modify the behaviour of the tokenizer, and should be set correctly
to ensure the target labels are encoded properly.`,Pt,q,Qs="We can see all possible languages supported by Whisper by importing the list of languages:",Kt,S,Ot,L,qs=`If you scroll through this list, you’ll notice that many languages are present, but Dhivehi is one of few that is not!
This means that Whisper was not pre-trained on Dhivehi. However, this doesn’t mean that we can’t fine tune Whisper on it.
In doing so, we’ll be teaching Whisper a new language, one that the pre-trained checkpoint does not support. That’s pretty
cool, right!`,el,D,Ss=`When you fine-tune it on a new language, Whisper does a good job at leveraging its knowledge of the other 96 languages
it’s pre-trained on. Largely speaking, all modern languages will be linguistically similar to at least one of the
96 languages Whisper already knows, so we’ll fall under this paradigm of cross-lingual knowledge representation.`,tl,P,Ls=`What we need to do to fine-tune Whisper on a new language is find the language <strong>most similar</strong> that Whisper was
pre-trained on. The Wikipedia article for Dhivehi states that Dhivehi is closely related to the Sinhalese language of Sri Lanka.
If we check the language codes again, we can see that Sinhalese is present in the Whisper language set,
so we can safely set our language argument to <code>&quot;sinhalese&quot;</code>.`,ll,K,Ds=`Right! We’ll load our processor from the pre-trained checkpoint, setting the language to <code>&quot;sinhalese&quot;</code> and task to <code>&quot;transcribe&quot;</code>
as explained above:`,sl,O,nl,ee,Ps=`It’s worth reiterating that in most circumstances, you’ll find that the language you want to fine-tune on is in the set of
pre-training languages, in which case you can simply set the language directly as your source audio language! Note that
both of these arguments should be omitted for English-only fine-tuning, where there is only one option for the language
(<code>&quot;English&quot;</code>) and task (<code>&quot;transcribe&quot;</code>).`,al,te,il,le,Ks=`Let’s have a look at the dataset features. Pay particular attention to the <code>&quot;audio&quot;</code> column - this details the sampling
rate of our audio inputs:`,ol,se,rl,ne,Os="<strong>Output:</strong>",pl,ae,cl,ie,en=`Since our input audio is sampled at 48kHz, we need to <em>downsample</em> it to 16kHz prior to passing it to the Whisper feature
extractor, 16kHz being the sampling rate expected by the Whisper model.`,hl,oe,tn=`We’ll set the audio inputs to the correct sampling rate using dataset’s <a href="https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.Dataset.cast_column" rel="nofollow"><code>cast_column</code></a>
method. This operation does not change the audio in-place, but rather signals to datasets to resample audio samples
on-the-fly when they are loaded:`,dl,re,Ml,pe,ln="Now we can write a function to prepare our data ready for the model:",ul,ce,sn="<li>We load and resample the audio data on a sample-by-sample basis by calling <code>sample[&quot;audio&quot;]</code>. As explained above, 🤗 Datasets performs any necessary resampling operations on the fly.</li> <li>We use the feature extractor to compute the log-mel spectrogram input features from our 1-dimensional audio array.</li> <li>We encode the transcriptions to label ids through the use of the tokenizer.</li>",ml,he,yl,de,nn=`We can apply the data preparation function to all of our training examples using 🤗 Datasets’ <code>.map</code> method. We’ll
remove the columns from the raw training data (the audio and text), leaving just the columns returned by the
<code>prepare_dataset</code> function:`,wl,Me,Tl,ue,an=`Finally, we filter any training data with audio samples longer than 30s. These samples would otherwise be truncated by
the Whisper feature-extractor which could affect the stability of training. We define a function that returns <code>True</code> for
samples that are less than 30s, and <code>False</code> for those that are longer:`,Jl,me,fl,ye,on="We apply our filter function to all samples of our training dataset through 🤗 Datasets’ <code>.filter</code> method:",jl,we,Ul,Te,rn="Let’s check how much training data we removed through this filtering step:",gl,Je,bl,fe,pn="<strong>Output</strong>",Cl,je,Il,Ue,cn=`Alright! In this case we actually have the same number of samples as before, so there were no samples longer than 30s.
This might not be the case if you switch languages, so it’s best to keep this filter step in-place for robustness. With
that, we have our data fully prepared for training! Let’s continue and take a look at how we can use this data to fine-tune
Whisper.`,vl,ge,Wl,be,hn=`Now that we’ve prepared our data, we’re ready to dive into the training pipeline.
The <a href="https://huggingface.co/transformers/master/main_classes/trainer.html?highlight=trainer" rel="nofollow">🤗 Trainer</a>
will do much of the heavy lifting for us. All we have to do is:`,_l,Ce,dn="<li><p>Define a data collator: the data collator takes our pre-processed data and prepares PyTorch tensors ready for the model.</p></li> <li><p>Evaluation metrics: during evaluation, we want to evaluate the model using the word error rate (WER) metric. We need to define a <code>compute_metrics</code> function that handles this computation.</p></li> <li><p>Load a pre-trained checkpoint: we need to load a pre-trained checkpoint and configure it correctly for training.</p></li> <li><p>Define the training arguments: these will be used by the 🤗 Trainer in constructing the training schedule.</p></li>",kl,Ie,Mn=`Once we’ve fine-tuned the model, we will evaluate it on the test data to verify that we have correctly trained it
to transcribe speech in Dhivehi.`,$l,ve,xl,We,un=`The data collator for a sequence-to-sequence speech model is unique in the sense that it treats the <code>input_features</code>
and <code>labels</code> independently: the  <code>input_features</code> must be handled by the feature extractor and the <code>labels</code> by the tokenizer.`,Gl,_e,mn=`The <code>input_features</code> are already padded to 30s and converted to a log-Mel spectrogram of fixed dimension, so all we
have to do is convert them to batched PyTorch tensors. We do this using the feature extractor’s <code>.pad</code> method with
<code>return_tensors=pt</code>. Note that no additional padding is applied here since the inputs are of fixed dimension, the
<code>input_features</code> are simply converted to PyTorch tensors.`,Zl,ke,yn=`On the other hand, the <code>labels</code> are un-padded. We first pad the sequences to the maximum length in the batch using
the tokenizer’s <code>.pad</code> method. The padding tokens are then replaced by <code>-100</code> so that these tokens are <strong>not</strong> taken
into account when computing the loss. We then cut the start of transcript token from the beginning of the label sequence
as we append it later during training.`,Bl,$e,wn="We can leverage the <code>WhisperProcessor</code> we defined earlier to perform both the feature extractor and the tokenizer operations:",Xl,xe,Vl,Ge,Tn="We can now initialise the data collator we’ve just defined:",Rl,Ze,Hl,Be,Jn="Onwards!",Nl,Xe,Al,Ve,fn=`Next, we define the evaluation metric we’ll use on our evaluation set. We’ll use the Word Error Rate (WER) metric introduced
in the section on <a href="evaluation">Evaluation</a>, the ‘de-facto’ metric for assessing ASR systems.`,El,Re,jn="We’ll load the WER metric from 🤗 Evaluate:",Yl,He,Fl,Ne,Un=`We then simply have to define a function that takes our model predictions and returns the WER metric. This function, called
<code>compute_metrics</code>, first replaces <code>-100</code> with the <code>pad_token_id</code> in the <code>label_ids</code> (undoing the step we applied in the
data collator to ignore padded tokens correctly in the loss). It then decodes the predicted and label ids to strings. Finally,
it computes the WER between the predictions and reference labels. Here, we have the option of evaluating with the ‘normalised’
transcriptions and predictions, which have punctuation and casing removed. We recommend you follow this to benefit
from the WER improvement obtained by normalising the transcriptions.`,zl,Ae,Ql,Ee,ql,Ye,gn="Now let’s load the pre-trained Whisper small checkpoint. Again, this is trivial through use of 🤗 Transformers!",Sl,Fe,Ll,ze,bn=`We’ll set <code>use_cache</code> to <code>False</code> for training since we’re using <a href="https://huggingface.co/docs/transformers/v4.18.0/en/performance#gradient-checkpointing" rel="nofollow">gradient checkpointing</a>
and the two are incompatible. We’ll also override two generation arguments to control the behaviour of the model during inference:
we’ll force the language and task tokens during generation by setting the <code>language</code> and <code>task</code> arguments, and also re-enable
cache for generation to speed-up inference time:`,Dl,Qe,Pl,qe,Kl,Se,Cn=`In the final step, we define all the parameters related to training. Here, we set the number of training steps to 500.
This is enough steps to see a big WER improvement compared to the pre-trained Whisper model, while ensuring that fine-tuning can
be run in approximately 45 minutes on a Google Colab free tier. For more detail on the training arguments, refer to the
Seq2SeqTrainingArguments <a href="https://huggingface.co/docs/transformers/main_classes/trainer#transformers.Seq2SeqTrainingArguments" rel="nofollow">docs</a>.`,Ol,Le,es,j,ts,De,In="We can forward the training arguments to the 🤗 Trainer along with our model, dataset, data collator and <code>compute_metrics</code> function:",ls,Pe,ss,Ke,vn="And with that, we’re ready to start training!",ns,Oe,as,et,Wn="To launch training, simply execute:",is,tt,os,lt,_n=`Training will take approximately 45 minutes depending on your GPU or the one allocated to the Google Colab. Depending on
your GPU, it is possible that you will encounter a CUDA <code>&quot;out-of-memory&quot;</code> error when you start training. In this case,
you can reduce the <code>per_device_train_batch_size</code> incrementally by factors of 2 and employ <a href="https://huggingface.co/docs/transformers/main_classes/trainer#transformers.Seq2SeqTrainingArguments.gradient_accumulation_steps" rel="nofollow"><code>gradient_accumulation_steps</code></a>
to compensate.`,rs,st,kn="<strong>Output:</strong>",ps,nt,$n='<thead><tr><th align="center">Training Loss</th> <th align="center">Epoch</th> <th align="center">Step</th> <th align="center">Validation Loss</th> <th align="center">Wer Ortho</th> <th align="center">Wer</th></tr></thead> <tbody><tr><td align="center">0.136</td> <td align="center">1.63</td> <td align="center">500</td> <td align="center">0.1727</td> <td align="center">63.8972</td> <td align="center">14.0661</td></tr></tbody>',cs,at,xn=`Our final WER is 14.1% - not bad for seven hours of training data and just 500 training steps! That amounts to a 112%
improvement versus the pre-trained model! That means we’ve taken a model that previously had no knowledge about Dhivehi,
and fine-tuned it to recognise Dhivehi speech with adequate accuracy in under one hour 🤯`,hs,it,Gn=`The big question is how this compares to other ASR systems. For that, we can view the autoevaluate <a href="https://huggingface.co/spaces/autoevaluate/leaderboards?dataset=mozilla-foundation%2Fcommon_voice_13_0&amp;only_verified=0&amp;task=automatic-speech-recognition&amp;config=dv&amp;split=test&amp;metric=wer" rel="nofollow">leaderboard</a>,
a leaderboard that categorises models by language and dataset, and subsequently ranks them according to their WER.`,ds,ot,Zn=`Looking at the leaderboard, we see that our model trained for 500 steps convincingly beats the pre-trained <a href="https://huggingface.co/openai/whisper-small" rel="nofollow">Whisper Small</a>
checkpoint that we evaluated in the previous section. Nice job 👏`,Ms,rt,Bn=`We see that there are a few checkpoints that do better than the one we trained. The beauty of the Hugging Face Hub is that
it’s a <em>collaborative</em> platform - if we don’t have the time or resources to perform a longer training run ourselves, we
can load a checkpoint that someone else in the community has trained and been kind enough to share (making sure to thank them for it!).
You’ll be able to load these checkpoints in exactly the same way as the pre-trained ones using the <code>pipeline</code> class as we
did previously! So there’s nothing stopping you cherry-picking the best model on the leaderboard to use for your task!`,us,pt,Xn=`We can automatically submit our checkpoint to the leaderboard when we push the training results to the Hub - we simply
have to set the appropriate key-word arguments (kwargs). You can change these values to match your dataset, language and
model name accordingly:`,ms,ct,ys,ht,Vn="The training results can now be uploaded to the Hub. To do so, execute the <code>push_to_hub</code> command:",ws,dt,Ts,Mt,Rn=`This will save the training logs and model weights under <code>&quot;your-username/the-name-you-picked&quot;</code>. For this example, check
out the upload at <code>sanchit-gandhi/whisper-small-dv</code>.`,Js,ut,Hn=`While the fine-tuned model yields satisfactory results on the Common Voice 13 Dhivehi test data, it is by no means optimal.
The purpose of this guide is to demonstrate how to fine-tune an ASR model using the 🤗 Trainer for multilingual speech
recognition.`,fs,mt,Nn=`If you have access to your own GPU or are subscribed to a Google Colab paid plan, you can increase <code>max_steps</code> to 4000 steps
to improve the WER further by training for more steps. Training for 4000 steps will take approximately 3-5 hours depending
on your GPU and yield WER results approximately 3% lower than training for 500 steps. If you decide to train for 4000 steps,
we also recommend changing the learning rate scheduler to a <em>linear</em> schedule (set <code>lr_scheduler_type=&quot;linear&quot;</code>), as this will
yield an additional performance boost over long training runs.`,js,yt,An=`The results could likely be improved further by optimising the training hyperparameters, such as <em>learning rate</em> and
<em>dropout</em>, and using a larger pre-trained checkpoint (<code>medium</code> or <code>large</code>). We leave this as an exercise to the reader.`,Us,wt,gs,Tt,En=`You can now share this model with anyone using the link on the Hub. They can load it with the identifier <code>&quot;your-username/the-name-you-picked&quot;</code>
directly into the <code>pipeline()</code> object. For instance, to load the fine-tuned checkpoint <a href="https://huggingface.co/sanchit-gandhi/whisper-small-dv" rel="nofollow">“sanchit-gandhi/whisper-small-dv”</a>:`,bs,Jt,Cs,ft,Is,jt,Yn=`In this section, we covered a step-by-step guide on fine-tuning the Whisper model for speech recognition 🤗 Datasets,
Transformers and the Hugging Face Hub. We first loaded the Dhivehi subset of the Common Voice 13 dataset and pre-processed
it by computing log-mel spectrograms and tokenising the text. We then defined a data collator, evaluation metric and
training arguments, before using the 🤗 Trainer to train and evaluate our model. We finished by uploading the fine-tuned
model to the Hugging Face Hub, and showcased how to share and use it with the <code>pipeline()</code> class.`,vs,Ut,Fn=`If you followed through to this point, you should now have a fine-tuned checkpoint for speech recognition, well done! 🥳
Even more importantly, you’re equipped with all the tools you need to fine-tune the Whisper model on any speech recognition
dataset or domain. So what are you waiting for! Pick one of the datasets covered in the section <a href="choosing_dataset">Choosing a Dataset</a>
or select a dataset of your own, and see whether you can get state-of-the-art performance! The leaderboard is waiting for you…`,Ws,bt,_s;return U=new T({props:{title:"Fine-tuning the ASR model",local:"fine-tuning-the-asr-model",headingTag:"h1"}}),v=new T({props:{title:"Prepare Environment",local:"prepare-environment",headingTag:"h2"}}),$=new m({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMG5vdGVib29rX2xvZ2luJTBBJTBBbm90ZWJvb2tfbG9naW4oKQ==",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> notebook_login

notebook_login()`,wrap:!1}}),G=new m({props:{code:"TG9naW4lMjBzdWNjZXNzZnVsJTBBWW91ciUyMHRva2VuJTIwaGFzJTIwYmVlbiUyMHNhdmVkJTIwdG8lMjAlMkZyb290JTJGLmh1Z2dpbmdmYWNlJTJGdG9rZW4=",highlighted:`Login successful
Your token has been saved to /root/.huggingface/token`,wrap:!1}}),Z=new T({props:{title:"Load Dataset",local:"load-dataset",headingTag:"h2"}}),V=new m({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTJDJTIwRGF0YXNldERpY3QlMEElMEFjb21tb25fdm9pY2UlMjAlM0QlMjBEYXRhc2V0RGljdCgpJTBBJTBBY29tbW9uX3ZvaWNlJTVCJTIydHJhaW4lMjIlNUQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTBBJTIwJTIwJTIwJTIwJTIybW96aWxsYS1mb3VuZGF0aW9uJTJGY29tbW9uX3ZvaWNlXzEzXzAlMjIlMkMlMjAlMjJkdiUyMiUyQyUyMHNwbGl0JTNEJTIydHJhaW4lMkJ2YWxpZGF0aW9uJTIyJTBBKSUwQWNvbW1vbl92b2ljZSU1QiUyMnRlc3QlMjIlNUQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTBBJTIwJTIwJTIwJTIwJTIybW96aWxsYS1mb3VuZGF0aW9uJTJGY29tbW9uX3ZvaWNlXzEzXzAlMjIlMkMlMjAlMjJkdiUyMiUyQyUyMHNwbGl0JTNEJTIydGVzdCUyMiUwQSklMEElMEFwcmludChjb21tb25fdm9pY2Up",highlighted:`<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset, DatasetDict

common_voice = DatasetDict()

common_voice[<span class="hljs-string">&quot;train&quot;</span>] = load_dataset(
    <span class="hljs-string">&quot;mozilla-foundation/common_voice_13_0&quot;</span>, <span class="hljs-string">&quot;dv&quot;</span>, split=<span class="hljs-string">&quot;train+validation&quot;</span>
)
common_voice[<span class="hljs-string">&quot;test&quot;</span>] = load_dataset(
    <span class="hljs-string">&quot;mozilla-foundation/common_voice_13_0&quot;</span>, <span class="hljs-string">&quot;dv&quot;</span>, split=<span class="hljs-string">&quot;test&quot;</span>
)

<span class="hljs-built_in">print</span>(common_voice)`,wrap:!1}}),H=new m({props:{code:"RGF0YXNldERpY3QoJTdCJTBBJTIwJTIwJTIwJTIwdHJhaW4lM0ElMjBEYXRhc2V0KCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGZlYXR1cmVzJTNBJTIwJTVCJ2NsaWVudF9pZCclMkMlMjAncGF0aCclMkMlMjAnYXVkaW8nJTJDJTIwJ3NlbnRlbmNlJyUyQyUyMCd1cF92b3RlcyclMkMlMjAnZG93bl92b3RlcyclMkMlMjAnYWdlJyUyQyUyMCdnZW5kZXInJTJDJTIwJ2FjY2VudCclMkMlMjAnbG9jYWxlJyUyQyUyMCdzZWdtZW50JyUyQyUyMCd2YXJpYW50JyU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG51bV9yb3dzJTNBJTIwNDkwNCUwQSUyMCUyMCUyMCUyMCU3RCklMEElMjAlMjAlMjAlMjB0ZXN0JTNBJTIwRGF0YXNldCglN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBmZWF0dXJlcyUzQSUyMCU1QidjbGllbnRfaWQnJTJDJTIwJ3BhdGgnJTJDJTIwJ2F1ZGlvJyUyQyUyMCdzZW50ZW5jZSclMkMlMjAndXBfdm90ZXMnJTJDJTIwJ2Rvd25fdm90ZXMnJTJDJTIwJ2FnZSclMkMlMjAnZ2VuZGVyJyUyQyUyMCdhY2NlbnQnJTJDJTIwJ2xvY2FsZSclMkMlMjAnc2VnbWVudCclMkMlMjAndmFyaWFudCclNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBudW1fcm93cyUzQSUyMDIyMTIlMEElMjAlMjAlMjAlMjAlN0QpJTBBJTdEKQ==",highlighted:`DatasetDict({
    train: <span class="hljs-built_in">Dataset</span>({
        features: [<span class="hljs-string">&#x27;client_id&#x27;</span>, <span class="hljs-string">&#x27;path&#x27;</span>, <span class="hljs-string">&#x27;audio&#x27;</span>, <span class="hljs-string">&#x27;sentence&#x27;</span>, <span class="hljs-string">&#x27;up_votes&#x27;</span>, <span class="hljs-string">&#x27;down_votes&#x27;</span>, <span class="hljs-string">&#x27;age&#x27;</span>, <span class="hljs-string">&#x27;gender&#x27;</span>, <span class="hljs-string">&#x27;accent&#x27;</span>, <span class="hljs-string">&#x27;locale&#x27;</span>, <span class="hljs-string">&#x27;segment&#x27;</span>, <span class="hljs-string">&#x27;variant&#x27;</span>],
        num_rows: <span class="hljs-number">4904</span>
    })
    test: <span class="hljs-built_in">Dataset</span>({
        features: [<span class="hljs-string">&#x27;client_id&#x27;</span>, <span class="hljs-string">&#x27;path&#x27;</span>, <span class="hljs-string">&#x27;audio&#x27;</span>, <span class="hljs-string">&#x27;sentence&#x27;</span>, <span class="hljs-string">&#x27;up_votes&#x27;</span>, <span class="hljs-string">&#x27;down_votes&#x27;</span>, <span class="hljs-string">&#x27;age&#x27;</span>, <span class="hljs-string">&#x27;gender&#x27;</span>, <span class="hljs-string">&#x27;accent&#x27;</span>, <span class="hljs-string">&#x27;locale&#x27;</span>, <span class="hljs-string">&#x27;segment&#x27;</span>, <span class="hljs-string">&#x27;variant&#x27;</span>],
        num_rows: <span class="hljs-number">2212</span>
    })
})`,wrap:!1}}),f=new Ln({props:{$$slots:{default:[na]},$$scope:{ctx:gt}}}),A=new m({props:{code:"Y29tbW9uX3ZvaWNlJTIwJTNEJTIwY29tbW9uX3ZvaWNlLnNlbGVjdF9jb2x1bW5zKCU1QiUyMmF1ZGlvJTIyJTJDJTIwJTIyc2VudGVuY2UlMjIlNUQp",highlighted:'common_voice = common_voice.select_columns([<span class="hljs-string">&quot;audio&quot;</span>, <span class="hljs-string">&quot;sentence&quot;</span>])',wrap:!1}}),E=new T({props:{title:"Feature Extractor, Tokenizer and Processor",local:"feature-extractor-tokenizer-and-processor",headingTag:"h2"}}),S=new m({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5tb2RlbHMud2hpc3Blci50b2tlbml6YXRpb25fd2hpc3BlciUyMGltcG9ydCUyMFRPX0xBTkdVQUdFX0NPREUlMEElMEFUT19MQU5HVUFHRV9DT0RF",highlighted:`<span class="hljs-keyword">from</span> transformers.models.whisper.tokenization_whisper <span class="hljs-keyword">import</span> TO_LANGUAGE_CODE

TO_LANGUAGE_CODE`,wrap:!1}}),O=new m({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFdoaXNwZXJQcm9jZXNzb3IlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBXaGlzcGVyUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJvcGVuYWklMkZ3aGlzcGVyLXNtYWxsJTIyJTJDJTIwbGFuZ3VhZ2UlM0QlMjJzaW5oYWxlc2UlMjIlMkMlMjB0YXNrJTNEJTIydHJhbnNjcmliZSUyMiUwQSk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> WhisperProcessor

processor = WhisperProcessor.from_pretrained(
    <span class="hljs-string">&quot;openai/whisper-small&quot;</span>, language=<span class="hljs-string">&quot;sinhalese&quot;</span>, task=<span class="hljs-string">&quot;transcribe&quot;</span>
)`,wrap:!1}}),te=new T({props:{title:"Pre-Process the Data",local:"pre-process-the-data",headingTag:"h2"}}),se=new m({props:{code:"Y29tbW9uX3ZvaWNlJTVCJTIydHJhaW4lMjIlNUQuZmVhdHVyZXM=",highlighted:'common_voice[<span class="hljs-string">&quot;train&quot;</span>].features',wrap:!1}}),ae=new m({props:{code:"JTdCJ2F1ZGlvJyUzQSUyMEF1ZGlvKHNhbXBsaW5nX3JhdGUlM0Q0ODAwMCUyQyUyMG1vbm8lM0RUcnVlJTJDJTIwZGVjb2RlJTNEVHJ1ZSUyQyUyMGlkJTNETm9uZSklMkMlMEElMjAnc2VudGVuY2UnJTNBJTIwVmFsdWUoZHR5cGUlM0Qnc3RyaW5nJyUyQyUyMGlkJTNETm9uZSklN0Q=",highlighted:`{<span class="hljs-string">&#x27;audio&#x27;</span>: Audio(<span class="hljs-attribute">sampling_rate</span>=48000, <span class="hljs-attribute">mono</span>=<span class="hljs-literal">True</span>, <span class="hljs-attribute">decode</span>=<span class="hljs-literal">True</span>, <span class="hljs-attribute">id</span>=None),
 <span class="hljs-string">&#x27;sentence&#x27;</span>: Value(<span class="hljs-attribute">dtype</span>=<span class="hljs-string">&#x27;string&#x27;</span>, <span class="hljs-attribute">id</span>=None)}`,wrap:!1}}),re=new m({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwQXVkaW8lMEElMEFzYW1wbGluZ19yYXRlJTIwJTNEJTIwcHJvY2Vzc29yLmZlYXR1cmVfZXh0cmFjdG9yLnNhbXBsaW5nX3JhdGUlMEFjb21tb25fdm9pY2UlMjAlM0QlMjBjb21tb25fdm9pY2UuY2FzdF9jb2x1bW4oJTIyYXVkaW8lMjIlMkMlMjBBdWRpbyhzYW1wbGluZ19yYXRlJTNEc2FtcGxpbmdfcmF0ZSkp",highlighted:`<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> Audio

sampling_rate = processor.feature_extractor.sampling_rate
common_voice = common_voice.cast_column(<span class="hljs-string">&quot;audio&quot;</span>, Audio(sampling_rate=sampling_rate))`,wrap:!1}}),he=new m({props:{code:"ZGVmJTIwcHJlcGFyZV9kYXRhc2V0KGV4YW1wbGUpJTNBJTBBJTIwJTIwJTIwJTIwYXVkaW8lMjAlM0QlMjBleGFtcGxlJTVCJTIyYXVkaW8lMjIlNUQlMEElMEElMjAlMjAlMjAlMjBleGFtcGxlJTIwJTNEJTIwcHJvY2Vzc29yKCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGF1ZGlvJTNEYXVkaW8lNUIlMjJhcnJheSUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHNhbXBsaW5nX3JhdGUlM0RhdWRpbyU1QiUyMnNhbXBsaW5nX3JhdGUlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB0ZXh0JTNEZXhhbXBsZSU1QiUyMnNlbnRlbmNlJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwKSUwQSUwQSUyMCUyMCUyMCUyMCUyMyUyMGNvbXB1dGUlMjBpbnB1dCUyMGxlbmd0aCUyMG9mJTIwYXVkaW8lMjBzYW1wbGUlMjBpbiUyMHNlY29uZHMlMEElMjAlMjAlMjAlMjBleGFtcGxlJTVCJTIyaW5wdXRfbGVuZ3RoJTIyJTVEJTIwJTNEJTIwbGVuKGF1ZGlvJTVCJTIyYXJyYXklMjIlNUQpJTIwJTJGJTIwYXVkaW8lNUIlMjJzYW1wbGluZ19yYXRlJTIyJTVEJTBBJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwZXhhbXBsZQ==",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">prepare_dataset</span>(<span class="hljs-params">example</span>):
    audio = example[<span class="hljs-string">&quot;audio&quot;</span>]

    example = processor(
        audio=audio[<span class="hljs-string">&quot;array&quot;</span>],
        sampling_rate=audio[<span class="hljs-string">&quot;sampling_rate&quot;</span>],
        text=example[<span class="hljs-string">&quot;sentence&quot;</span>],
    )

    <span class="hljs-comment"># compute input length of audio sample in seconds</span>
    example[<span class="hljs-string">&quot;input_length&quot;</span>] = <span class="hljs-built_in">len</span>(audio[<span class="hljs-string">&quot;array&quot;</span>]) / audio[<span class="hljs-string">&quot;sampling_rate&quot;</span>]

    <span class="hljs-keyword">return</span> example`,wrap:!1}}),Me=new m({props:{code:"Y29tbW9uX3ZvaWNlJTIwJTNEJTIwY29tbW9uX3ZvaWNlLm1hcCglMEElMjAlMjAlMjAlMjBwcmVwYXJlX2RhdGFzZXQlMkMlMjByZW1vdmVfY29sdW1ucyUzRGNvbW1vbl92b2ljZS5jb2x1bW5fbmFtZXMlNUIlMjJ0cmFpbiUyMiU1RCUyQyUyMG51bV9wcm9jJTNEMSUwQSk=",highlighted:`common_voice = common_voice.<span class="hljs-built_in">map</span>(
    prepare_dataset, remove_columns=common_voice.column_names[<span class="hljs-string">&quot;train&quot;</span>], num_proc=<span class="hljs-number">1</span>
)`,wrap:!1}}),me=new m({props:{code:"bWF4X2lucHV0X2xlbmd0aCUyMCUzRCUyMDMwLjAlMEElMEElMEFkZWYlMjBpc19hdWRpb19pbl9sZW5ndGhfcmFuZ2UobGVuZ3RoKSUzQSUwQSUyMCUyMCUyMCUyMHJldHVybiUyMGxlbmd0aCUyMCUzQyUyMG1heF9pbnB1dF9sZW5ndGg=",highlighted:`max_input_length = <span class="hljs-number">30.0</span>


<span class="hljs-keyword">def</span> <span class="hljs-title function_">is_audio_in_length_range</span>(<span class="hljs-params">length</span>):
    <span class="hljs-keyword">return</span> length &lt; max_input_length`,wrap:!1}}),we=new m({props:{code:"Y29tbW9uX3ZvaWNlJTVCJTIydHJhaW4lMjIlNUQlMjAlM0QlMjBjb21tb25fdm9pY2UlNUIlMjJ0cmFpbiUyMiU1RC5maWx0ZXIoJTBBJTIwJTIwJTIwJTIwaXNfYXVkaW9faW5fbGVuZ3RoX3JhbmdlJTJDJTBBJTIwJTIwJTIwJTIwaW5wdXRfY29sdW1ucyUzRCU1QiUyMmlucHV0X2xlbmd0aCUyMiU1RCUyQyUwQSk=",highlighted:`common_voice[<span class="hljs-string">&quot;train&quot;</span>] = common_voice[<span class="hljs-string">&quot;train&quot;</span>].<span class="hljs-built_in">filter</span>(
    is_audio_in_length_range,
    input_columns=[<span class="hljs-string">&quot;input_length&quot;</span>],
)`,wrap:!1}}),Je=new m({props:{code:"Y29tbW9uX3ZvaWNlJTVCJTIydHJhaW4lMjIlNUQ=",highlighted:'common_voice[<span class="hljs-string">&quot;train&quot;</span>]',wrap:!1}}),je=new m({props:{code:"RGF0YXNldCglN0IlMEElMjAlMjAlMjAlMjBmZWF0dXJlcyUzQSUyMCU1QidpbnB1dF9mZWF0dXJlcyclMkMlMjAnbGFiZWxzJyUyQyUyMCdpbnB1dF9sZW5ndGgnJTVEJTJDJTBBJTIwJTIwJTIwJTIwbnVtX3Jvd3MlM0ElMjA0OTA0JTBBJTdEKQ==",highlighted:`<span class="hljs-title function_ invoke__">Dataset</span>({
    <span class="hljs-attr">features</span>: [<span class="hljs-string">&#x27;input_features&#x27;</span>, <span class="hljs-string">&#x27;labels&#x27;</span>, <span class="hljs-string">&#x27;input_length&#x27;</span>],
    <span class="hljs-attr">num_rows</span>: <span class="hljs-number">4904</span>
})`,wrap:!1}}),ge=new T({props:{title:"Training and Evaluation",local:"training-and-evaluation",headingTag:"h2"}}),ve=new T({props:{title:"Define a Data Collator",local:"define-a-data-collator",headingTag:"h3"}}),xe=new m({props:{code:"aW1wb3J0JTIwdG9yY2glMEElMEFmcm9tJTIwZGF0YWNsYXNzZXMlMjBpbXBvcnQlMjBkYXRhY2xhc3MlMEFmcm9tJTIwdHlwaW5nJTIwaW1wb3J0JTIwQW55JTJDJTIwRGljdCUyQyUyMExpc3QlMkMlMjBVbmlvbiUwQSUwQSUwQSU0MGRhdGFjbGFzcyUwQWNsYXNzJTIwRGF0YUNvbGxhdG9yU3BlZWNoU2VxMlNlcVdpdGhQYWRkaW5nJTNBJTBBJTIwJTIwJTIwJTIwcHJvY2Vzc29yJTNBJTIwQW55JTBBJTBBJTIwJTIwJTIwJTIwZGVmJTIwX19jYWxsX18oJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwc2VsZiUyQyUyMGZlYXR1cmVzJTNBJTIwTGlzdCU1QkRpY3QlNUJzdHIlMkMlMjBVbmlvbiU1Qkxpc3QlNUJpbnQlNUQlMkMlMjB0b3JjaC5UZW5zb3IlNUQlNUQlNUQlMEElMjAlMjAlMjAlMjApJTIwLSUzRSUyMERpY3QlNUJzdHIlMkMlMjB0b3JjaC5UZW5zb3IlNUQlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjBzcGxpdCUyMGlucHV0cyUyMGFuZCUyMGxhYmVscyUyMHNpbmNlJTIwdGhleSUyMGhhdmUlMjB0byUyMGJlJTIwb2YlMjBkaWZmZXJlbnQlMjBsZW5ndGhzJTIwYW5kJTIwbmVlZCUyMGRpZmZlcmVudCUyMHBhZGRpbmclMjBtZXRob2RzJTBBJTIwJTIw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M0ElNUQlMEElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBiYXRjaCU1QiUyMmxhYmVscyUyMiU1RCUyMCUzRCUyMGxhYmVscyUwQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldHVybiUyMGJhdGNo",highlighted:`<span class="hljs-keyword">import</span> torch

<span class="hljs-keyword">from</span> dataclasses <span class="hljs-keyword">import</span> dataclass
<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">Union</span>


<span class="hljs-meta">@dataclass</span>
<span class="hljs-keyword">class</span> <span class="hljs-title class_">DataCollatorSpeechSeq2SeqWithPadding</span>:
    processor: <span class="hljs-type">Any</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-comment"># split inputs and labels since they have to be of different lengths and need different padding methods</span>
        <span class="hljs-comment"># first treat the audio inputs by simply returning torch tensors</span>
        input_features = [
            {<span class="hljs-string">&quot;input_features&quot;</span>: feature[<span class="hljs-string">&quot;input_features&quot;</span>][<span class="hljs-number">0</span>]} <span class="hljs-keyword">for</span> feature <span class="hljs-keyword">in</span> features
        ]
        batch = self.processor.feature_extractor.pad(input_features, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

        <span class="hljs-comment"># get the tokenized label sequences</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-comment"># pad the labels to max length</span>
        labels_batch = self.processor.tokenizer.pad(label_features, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

        <span class="hljs-comment"># replace padding with -100 to ignore loss correctly</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-comment"># if bos token is appended in previous tokenization step,</span>
        <span class="hljs-comment"># cut bos token here as it&#x27;s append later anyways</span>
        <span class="hljs-keyword">if</span> (labels[:, <span class="hljs-number">0</span>] == self.processor.tokenizer.bos_token_id).<span class="hljs-built_in">all</span>().cpu().item():
            labels = labels[:, <span class="hljs-number">1</span>:]

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

        <span class="hljs-keyword">return</span> batch`,wrap:!1}}),Ze=new m({props:{code:"ZGF0YV9jb2xsYXRvciUyMCUzRCUyMERhdGFDb2xsYXRvclNwZWVjaFNlcTJTZXFXaXRoUGFkZGluZyhwcm9jZXNzb3IlM0Rwcm9jZXNzb3Ip",highlighted:"data_collator = DataCollatorSpeechSeq2SeqWithPadding(processor=processor)",wrap:!1}}),Xe=new T({props:{title:"Evaluation Metrics",local:"evaluation-metrics",headingTag:"h3"}}),He=new m({props:{code:"aW1wb3J0JTIwZXZhbHVhdGUlMEElMEFtZXRyaWMlMjAlM0QlMjBldmFsdWF0ZS5sb2FkKCUyMndlciUyMik=",highlighted:`<span class="hljs-keyword">import</span> evaluate

metric = evaluate.load(<span class="hljs-string">&quot;wer&quot;</span>)`,wrap:!1}}),Ae=new m({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5tb2RlbHMud2hpc3Blci5lbmdsaXNoX25vcm1hbGl6ZXIlMjBpbXBvcnQlMjBCYXNpY1RleHROb3JtYWxpemVyJTBBJTBBbm9ybWFsaXplciUyMCUzRCUyMEJhc2ljVGV4dE5vcm1hbGl6ZXIoKSUwQSUwQSUwQWRlZiUyMGNvbXB1dGVfbWV0cmljcyh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cmVkaWN0aW9ucyUzRHByZWRfc3RyX25vcm0lMkMlMjByZWZlcmVuY2VzJTNEbGFiZWxfc3RyX25vcm0pJTBBJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwJTdCJTIyd2VyX29ydGhvJTIyJTNBJTIwd2VyX29ydGhvJTJDJTIwJTIyd2VyJTIyJTNBJTIwd2VyJTdE",highlighted:`<span class="hljs-keyword">from</span> transformers.models.whisper.english_normalizer <span class="hljs-keyword">import</span> BasicTextNormalizer

normalizer = BasicTextNormalizer()


<span class="hljs-keyword">def</span> <span class="hljs-title function_">compute_metrics</span>(<span class="hljs-params">pred</span>):
    pred_ids = pred.predictions
    label_ids = pred.label_ids

    <span class="hljs-comment"># replace -100 with the pad_token_id</span>
    label_ids[label_ids == -<span class="hljs-number">100</span>] = processor.tokenizer.pad_token_id

    <span class="hljs-comment"># we do not want to group tokens when computing the metrics</span>
    pred_str = processor.batch_decode(pred_ids, skip_special_tokens=<span class="hljs-literal">True</span>)
    label_str = processor.batch_decode(label_ids, skip_special_tokens=<span class="hljs-literal">True</span>)

    <span class="hljs-comment"># compute orthographic wer</span>
    wer_ortho = <span class="hljs-number">100</span> * metric.compute(predictions=pred_str, references=label_str)

    <span class="hljs-comment"># compute normalised WER</span>
    pred_str_norm = [normalizer(pred) <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> pred_str]
    label_str_norm = [normalizer(label) <span class="hljs-keyword">for</span> label <span class="hljs-keyword">in</span> label_str]
    <span class="hljs-comment"># filtering step to only evaluate the samples that correspond to non-zero references:</span>
    pred_str_norm = [
        pred_str_norm[i] <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-built_in">len</span>(pred_str_norm)) <span class="hljs-keyword">if</span> <span class="hljs-built_in">len</span>(label_str_norm[i]) &gt; <span class="hljs-number">0</span>
    ]
    label_str_norm = [
        label_str_norm[i]
        <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-built_in">len</span>(label_str_norm))
        <span class="hljs-keyword">if</span> <span class="hljs-built_in">len</span>(label_str_norm[i]) &gt; <span class="hljs-number">0</span>
    ]

    wer = <span class="hljs-number">100</span> * metric.compute(predictions=pred_str_norm, references=label_str_norm)

    <span class="hljs-keyword">return</span> {<span class="hljs-string">&quot;wer_ortho&quot;</span>: wer_ortho, <span class="hljs-string">&quot;wer&quot;</span>: wer}`,wrap:!1}}),Ee=new T({props:{title:"Load a Pre-Trained Checkpoint",local:"load-a-pre-trained-checkpoint",headingTag:"h3"}}),Fe=new m({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFdoaXNwZXJGb3JDb25kaXRpb25hbEdlbmVyYXRpb24lMEElMEFtb2RlbCUyMCUzRCUyMFdoaXNwZXJGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMm9wZW5haSUyRndoaXNwZXItc21hbGwlMjIp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> WhisperForConditionalGeneration

model = WhisperForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;openai/whisper-small&quot;</span>)`,wrap:!1}}),Qe=new m({props:{code:"ZnJvbSUyMGZ1bmN0b29scyUyMGltcG9ydCUyMHBhcnRpYWwlMEElMEElMjMlMjBkaXNhYmxlJTIwY2FjaGUlMjBkdXJpbmclMjB0cmFpbmluZyUyMHNpbmNlJTIwaXQncyUyMGluY29tcGF0aWJsZSUyMHdpdGglMjBncmFkaWVudCUyMGNoZWNrcG9pbnRpbmclMEFtb2RlbC5jb25maWcudXNlX2NhY2hlJTIwJTNEJTIwRmFsc2UlMEElMEElMjMlMjBzZXQlMjBsYW5ndWFnZSUyMGFuZCUyMHRhc2slMjBmb3IlMjBnZW5lcmF0aW9uJTIwYW5kJTIwcmUtZW5hYmxlJTIwY2FjaGUlMEFtb2RlbC5nZW5lcmF0ZSUyMCUzRCUyMHBhcnRpYWwoJTBBJTIwJTIwJTIwJTIwbW9kZWwuZ2VuZXJhdGUlMkMlMjBsYW5ndWFnZSUzRCUyMnNpbmhhbGVzZSUyMiUyQyUyMHRhc2slM0QlMjJ0cmFuc2NyaWJlJTIyJTJDJTIwdXNlX2NhY2hlJTNEVHJ1ZSUwQSk=",highlighted:`<span class="hljs-keyword">from</span> functools <span class="hljs-keyword">import</span> partial

<span class="hljs-comment"># disable cache during training since it&#x27;s incompatible with gradient checkpointing</span>
model.config.use_cache = <span class="hljs-literal">False</span>

<span class="hljs-comment"># set language and task for generation and re-enable cache</span>
model.generate = partial(
    model.generate, language=<span class="hljs-string">&quot;sinhalese&quot;</span>, task=<span class="hljs-string">&quot;transcribe&quot;</span>, use_cache=<span class="hljs-literal">True</span>
)`,wrap:!1}}),qe=new T({props:{title:"Define the Training Configuration",local:"define-the-training-configuration",headingTag:"h2"}}),Le=new m({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFNlcTJTZXFUcmFpbmluZ0FyZ3VtZW50cyUwQSUwQXRyYWluaW5nX2FyZ3MlMjAlM0QlMjBTZXEyU2VxVHJhaW5pbmdBcmd1bWVudHMoJTBBJTIwJTIwJTIwJTIwb3V0cHV0X2RpciUzRCUyMi4lMkZ3aGlzcGVyLXNtYWxsLWR2JTIyJTJDJTIwJTIwJTIzJTIwbmFtZSUyMG9uJTIwdGhlJTIwSEYlMjBIdWIlMEElMjAlMjAlMjAlMjBwZXJfZGV2aWNlX3RyYWluX2JhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMGdyYWRpZW50X2FjY3VtdWxhdGlvbl9zdGVwcyUzRDElMkMlMjAlMjAlMjMlMjBpbmNyZWFzZSUyMGJ5JTIwMnglMjBmb3IlMjBldmVyeSUyMDJ4JTIwZGVjcmVhc2UlMjBpbiUyMGJhdGNoJTIwc2l6ZSUwQSUyMCUyMCUyMCUyMGxlYXJuaW5nX3JhdGUlM0Q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9tb2RlbCUzRCUyMndlciUyMiUyQyUwQSUyMCUyMCUyMCUyMGdyZWF0ZXJfaXNfYmV0dGVyJTNERmFsc2UlMkMlMEElMjAlMjAlMjAlMjBwdXNoX3RvX2h1YiUzRFRydWUlMkMlMEEp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Seq2SeqTrainingArguments

training_args = Seq2SeqTrainingArguments(
    output_dir=<span class="hljs-string">&quot;./whisper-small-dv&quot;</span>,  <span class="hljs-comment"># name on the HF Hub</span>
    per_device_train_batch_size=<span class="hljs-number">16</span>,
    gradient_accumulation_steps=<span class="hljs-number">1</span>,  <span class="hljs-comment"># increase by 2x for every 2x decrease in batch size</span>
    learning_rate=<span class="hljs-number">1e-5</span>,
    lr_scheduler_type=<span class="hljs-string">&quot;constant_with_warmup&quot;</span>,
    warmup_steps=<span class="hljs-number">50</span>,
    max_steps=<span class="hljs-number">500</span>,  <span class="hljs-comment"># increase to 4000 if you have your own GPU or a Colab paid plan</span>
    gradient_checkpointing=<span class="hljs-literal">True</span>,
    fp16=<span class="hljs-literal">True</span>,
    fp16_full_eval=<span class="hljs-literal">True</span>,
    evaluation_strategy=<span class="hljs-string">&quot;steps&quot;</span>,
    per_device_eval_batch_size=<span class="hljs-number">16</span>,
    predict_with_generate=<span class="hljs-literal">True</span>,
    generation_max_length=<span class="hljs-number">225</span>,
    save_steps=<span class="hljs-number">500</span>,
    eval_steps=<span class="hljs-number">500</span>,
    logging_steps=<span class="hljs-number">25</span>,
    report_to=[<span class="hljs-string">&quot;tensorboard&quot;</span>],
    load_best_model_at_end=<span class="hljs-literal">True</span>,
    metric_for_best_model=<span class="hljs-string">&quot;wer&quot;</span>,
    greater_is_better=<span class="hljs-literal">False</span>,
    push_to_hub=<span class="hljs-literal">True</span>,
)`,wrap:!1}}),j=new Ln({props:{$$slots:{default:[aa]},$$scope:{ctx:gt}}}),Pe=new m({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFNlcTJTZXFUcmFpbmVyJTBBJTBBdHJhaW5lciUyMCUzRCUyMFNlcTJTZXFUcmFpbmVyKCUwQSUyMCUyMCUyMCUyMGFyZ3MlM0R0cmFpbmluZ19hcmdzJTJDJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0Rtb2RlbCUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0Rjb21tb25fdm9pY2UlNUIlMjJ0cmFpbiUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMGV2YWxfZGF0YXNldCUzRGNvbW1vbl92b2ljZSU1QiUyMnRlc3QlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBkYXRhX2NvbGxhdG9yJTNEZGF0YV9jb2xsYXRvciUyQyUwQSUyMCUyMCUyMCUyMGNvbXB1dGVfbWV0cmljcyUzRGNvbXB1dGVfbWV0cmljcyUyQyUwQSUyMCUyMCUyMCUyMHRva2VuaXplciUzRHByb2Nlc3NvciUyQyUwQSk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Seq2SeqTrainer

trainer = Seq2SeqTrainer(
    args=training_args,
    model=model,
    train_dataset=common_voice[<span class="hljs-string">&quot;train&quot;</span>],
    eval_dataset=common_voice[<span class="hljs-string">&quot;test&quot;</span>],
    data_collator=data_collator,
    compute_metrics=compute_metrics,
    tokenizer=processor,
)`,wrap:!1}}),Oe=new T({props:{title:"Training",local:"training",headingTag:"h3"}}),tt=new m({props:{code:"dHJhaW5lci50cmFpbigp",highlighted:"trainer.train()",wrap:!1}}),ct=new m({props:{code:"a3dhcmdzJTIwJTNEJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIyZGF0YXNldF90YWdzJTIyJTNBJTIwJTIybW96aWxsYS1mb3VuZGF0aW9uJTJGY29tbW9uX3ZvaWNlXzEzXzAlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjJkYXRhc2V0JTIyJTNBJTIwJTIyQ29tbW9uJTIwVm9pY2UlMjAxMyUyMiUyQyUyMCUyMCUyMyUyMGElMjAncHJldHR5JyUyMG5hbWUlMjBmb3IlMjB0aGUlMjB0cmFpbmluZyUyMGRhdGFzZXQlMEElMjAlMjAlMjAlMjAlMjJsYW5ndWFnZSUyMiUzQSUyMCUyMmR2JTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIybW9kZWxfbmFtZSUyMiUzQSUyMCUyMldoaXNwZXIlMjBTbWFsbCUyMER2JTIwLSUyMFNhbmNoaXQlMjBHYW5kaGklMjIlMkMlMjAlMjAlMjMlMjBhJTIwJ3ByZXR0eSclMjBuYW1lJTIwZm9yJTIweW91ciUyMG1vZGVsJTBBJTIwJTIwJTIwJTIwJTIyZmluZXR1bmVkX2Zyb20lMjIlM0ElMjAlMjJvcGVuYWklMkZ3aGlzcGVyLXNtYWxsJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIydGFza3MlMjIlM0ElMjAlMjJhdXRvbWF0aWMtc3BlZWNoLXJlY29nbml0aW9uJTIyJTJDJTBBJTdE",highlighted:`kwargs = {
    <span class="hljs-string">&quot;dataset_tags&quot;</span>: <span class="hljs-string">&quot;mozilla-foundation/common_voice_13_0&quot;</span>,
    <span class="hljs-string">&quot;dataset&quot;</span>: <span class="hljs-string">&quot;Common Voice 13&quot;</span>,  <span class="hljs-comment"># a &#x27;pretty&#x27; name for the training dataset</span>
    <span class="hljs-string">&quot;language&quot;</span>: <span class="hljs-string">&quot;dv&quot;</span>,
    <span class="hljs-string">&quot;model_name&quot;</span>: <span class="hljs-string">&quot;Whisper Small Dv - Sanchit Gandhi&quot;</span>,  <span class="hljs-comment"># a &#x27;pretty&#x27; name for your model</span>
    <span class="hljs-string">&quot;finetuned_from&quot;</span>: <span class="hljs-string">&quot;openai/whisper-small&quot;</span>,
    <span class="hljs-string">&quot;tasks&quot;</span>: <span class="hljs-string">&quot;automatic-speech-recognition&quot;</span>,
}`,wrap:!1}}),dt=new m({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1YigqKmt3YXJncyk=",highlighted:"trainer.push_to_hub(**kwargs)",wrap:!1}}),wt=new T({props:{title:"Sharing Your Model",local:"sharing-your-model",headingTag:"h2"}}),Jt=new m({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBcGlwZSUyMCUzRCUyMHBpcGVsaW5lKCUyMmF1dG9tYXRpYy1zcGVlY2gtcmVjb2duaXRpb24lMjIlMkMlMjBtb2RlbCUzRCUyMnNhbmNoaXQtZ2FuZGhpJTJGd2hpc3Blci1zbWFsbC1kdiUyMik=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

pipe = pipeline(<span class="hljs-string">&quot;automatic-speech-recognition&quot;</span>, model=<span class="hljs-string">&quot;sanchit-gandhi/whisper-small-dv&quot;</span>)`,wrap:!1}}),ft=new T({props:{title:"Conclusion",local:"conclusion",headingTag:"h2"}}),{c(){y=i("meta"),w=n(),J=i("p"),Ct=n(),p(U.$$.fragment),It=n(),g=i("p"),g.textContent=ks,vt=n(),b=i("p"),b.textContent=$s,Wt=n(),C=i("p"),C.textContent=xs,_t=n(),I=i("p"),I.textContent=Gs,kt=n(),p(v.$$.fragment),$t=n(),W=i("p"),W.innerHTML=Zs,xt=n(),_=i("ul"),_.innerHTML=Bs,Gt=n(),k=i("p"),k.innerHTML=Xs,Zt=n(),p($.$$.fragment),Bt=n(),x=i("p"),x.innerHTML=Vs,Xt=n(),p(G.$$.fragment),Vt=n(),p(Z.$$.fragment),Rt=n(),B=i("p"),B.innerHTML=Rs,Ht=n(),X=i("p"),X.innerHTML=Hs,Nt=n(),p(V.$$.fragment),At=n(),R=i("p"),R.innerHTML=Ns,Et=n(),p(H.$$.fragment),Yt=n(),p(f.$$.fragment),Ft=n(),N=i("p"),N.innerHTML=As,zt=n(),p(A.$$.fragment),Qt=n(),p(E.$$.fragment),qt=n(),Y=i("p"),Y.textContent=Es,St=n(),F=i("ol"),F.innerHTML=Ys,Lt=n(),z=i("p"),z.innerHTML=Fs,Dt=n(),Q=i("p"),Q.innerHTML=zs,Pt=n(),q=i("p"),q.textContent=Qs,Kt=n(),p(S.$$.fragment),Ot=n(),L=i("p"),L.textContent=qs,el=n(),D=i("p"),D.textContent=Ss,tl=n(),P=i("p"),P.innerHTML=Ls,ll=n(),K=i("p"),K.innerHTML=Ds,sl=n(),p(O.$$.fragment),nl=n(),ee=i("p"),ee.innerHTML=Ps,al=n(),p(te.$$.fragment),il=n(),le=i("p"),le.innerHTML=Ks,ol=n(),p(se.$$.fragment),rl=n(),ne=i("p"),ne.innerHTML=Os,pl=n(),p(ae.$$.fragment),cl=n(),ie=i("p"),ie.innerHTML=en,hl=n(),oe=i("p"),oe.innerHTML=tn,dl=n(),p(re.$$.fragment),Ml=n(),pe=i("p"),pe.textContent=ln,ul=n(),ce=i("ol"),ce.innerHTML=sn,ml=n(),p(he.$$.fragment),yl=n(),de=i("p"),de.innerHTML=nn,wl=n(),p(Me.$$.fragment),Tl=n(),ue=i("p"),ue.innerHTML=an,Jl=n(),p(me.$$.fragment),fl=n(),ye=i("p"),ye.innerHTML=on,jl=n(),p(we.$$.fragment),Ul=n(),Te=i("p"),Te.textContent=rn,gl=n(),p(Je.$$.fragment),bl=n(),fe=i("p"),fe.innerHTML=pn,Cl=n(),p(je.$$.fragment),Il=n(),Ue=i("p"),Ue.textContent=cn,vl=n(),p(ge.$$.fragment),Wl=n(),be=i("p"),be.innerHTML=hn,_l=n(),Ce=i("ul"),Ce.innerHTML=dn,kl=n(),Ie=i("p"),Ie.textContent=Mn,$l=n(),p(ve.$$.fragment),xl=n(),We=i("p"),We.innerHTML=un,Gl=n(),_e=i("p"),_e.innerHTML=mn,Zl=n(),ke=i("p"),ke.innerHTML=yn,Bl=n(),$e=i("p"),$e.innerHTML=wn,Xl=n(),p(xe.$$.fragment),Vl=n(),Ge=i("p"),Ge.textContent=Tn,Rl=n(),p(Ze.$$.fragment),Hl=n(),Be=i("p"),Be.textContent=Jn,Nl=n(),p(Xe.$$.fragment),Al=n(),Ve=i("p"),Ve.innerHTML=fn,El=n(),Re=i("p"),Re.textContent=jn,Yl=n(),p(He.$$.fragment),Fl=n(),Ne=i("p"),Ne.innerHTML=Un,zl=n(),p(Ae.$$.fragment),Ql=n(),p(Ee.$$.fragment),ql=n(),Ye=i("p"),Ye.textContent=gn,Sl=n(),p(Fe.$$.fragment),Ll=n(),ze=i("p"),ze.innerHTML=bn,Dl=n(),p(Qe.$$.fragment),Pl=n(),p(qe.$$.fragment),Kl=n(),Se=i("p"),Se.innerHTML=Cn,Ol=n(),p(Le.$$.fragment),es=n(),p(j.$$.fragment),ts=n(),De=i("p"),De.innerHTML=In,ls=n(),p(Pe.$$.fragment),ss=n(),Ke=i("p"),Ke.textContent=vn,ns=n(),p(Oe.$$.fragment),as=n(),et=i("p"),et.textContent=Wn,is=n(),p(tt.$$.fragment),os=n(),lt=i("p"),lt.innerHTML=_n,rs=n(),st=i("p"),st.innerHTML=kn,ps=n(),nt=i("table"),nt.innerHTML=$n,cs=n(),at=i("p"),at.textContent=xn,hs=n(),it=i("p"),it.innerHTML=Gn,ds=n(),ot=i("p"),ot.innerHTML=Zn,Ms=n(),rt=i("p"),rt.innerHTML=Bn,us=n(),pt=i("p"),pt.textContent=Xn,ms=n(),p(ct.$$.fragment),ys=n(),ht=i("p"),ht.innerHTML=Vn,ws=n(),p(dt.$$.fragment),Ts=n(),Mt=i("p"),Mt.innerHTML=Rn,Js=n(),ut=i("p"),ut.textContent=Hn,fs=n(),mt=i("p"),mt.innerHTML=Nn,js=n(),yt=i("p"),yt.innerHTML=An,Us=n(),p(wt.$$.fragment),gs=n(),Tt=i("p"),Tt.innerHTML=En,bs=n(),p(Jt.$$.fragment),Cs=n(),p(ft.$$.fragment),Is=n(),jt=i("p"),jt.innerHTML=Yn,vs=n(),Ut=i("p"),Ut.innerHTML=Fn,Ws=n(),bt=i("p"),this.h()},l(e){const t=la("svelte-u9bgzb",document.head);y=o(t,"META",{name:!0,content:!0}),t.forEach(l),w=a(e),J=o(e,"P",{}),qn(J).forEach(l),Ct=a(e),c(U.$$.fragment,e),It=a(e),g=o(e,"P",{"data-svelte-h":!0}),r(g)!=="svelte-y7r5mv"&&(g.textContent=ks),vt=a(e),b=o(e,"P",{"data-svelte-h":!0}),r(b)!=="svelte-15djjoq"&&(b.textContent=$s),Wt=a(e),C=o(e,"P",{"data-svelte-h":!0}),r(C)!=="svelte-1qs2xtc"&&(C.textContent=xs),_t=a(e),I=o(e,"P",{"data-svelte-h":!0}),r(I)!=="svelte-vn1gx2"&&(I.textContent=Gs),kt=a(e),c(v.$$.fragment,e),$t=a(e),W=o(e,"P",{"data-svelte-h":!0}),r(W)!=="svelte-lavash"&&(W.innerHTML=Zs),xt=a(e),_=o(e,"UL",{"data-svelte-h":!0}),r(_)!=="svelte-1vhmuwk"&&(_.innerHTML=Bs),Gt=a(e),k=o(e,"P",{"data-svelte-h":!0}),r(k)!=="svelte-dngs6s"&&(k.innerHTML=Xs),Zt=a(e),c($.$$.fragment,e),Bt=a(e),x=o(e,"P",{"data-svelte-h":!0}),r(x)!=="svelte-1mvdyro"&&(x.innerHTML=Vs),Xt=a(e),c(G.$$.fragment,e),Vt=a(e),c(Z.$$.fragment,e),Rt=a(e),B=o(e,"P",{"data-svelte-h":!0}),r(B)!=="svelte-9bh3m8"&&(B.innerHTML=Rs),Ht=a(e),X=o(e,"P",{"data-svelte-h":!0}),r(X)!=="svelte-1d296ko"&&(X.innerHTML=Hs),Nt=a(e),c(V.$$.fragment,e),At=a(e),R=o(e,"P",{"data-svelte-h":!0}),r(R)!=="svelte-1mvdyro"&&(R.innerHTML=Ns),Et=a(e),c(H.$$.fragment,e),Yt=a(e),c(f.$$.fragment,e),Ft=a(e),N=o(e,"P",{"data-svelte-h":!0}),r(N)!=="svelte-amnv42"&&(N.innerHTML=As),zt=a(e),c(A.$$.fragment,e),Qt=a(e),c(E.$$.fragment,e),qt=a(e),Y=o(e,"P",{"data-svelte-h":!0}),r(Y)!=="svelte-1iebir5"&&(Y.textContent=Es),St=a(e),F=o(e,"OL",{"data-svelte-h":!0}),r(F)!=="svelte-peruey"&&(F.innerHTML=Ys),Lt=a(e),z=o(e,"P",{"data-svelte-h":!0}),r(z)!=="svelte-1al0blu"&&(z.innerHTML=Fs),Dt=a(e),Q=o(e,"P",{"data-svelte-h":!0}),r(Q)!=="svelte-zcpfiu"&&(Q.innerHTML=zs),Pt=a(e),q=o(e,"P",{"data-svelte-h":!0}),r(q)!=="svelte-1o6e7as"&&(q.textContent=Qs),Kt=a(e),c(S.$$.fragment,e),Ot=a(e),L=o(e,"P",{"data-svelte-h":!0}),r(L)!=="svelte-bbew1u"&&(L.textContent=qs),el=a(e),D=o(e,"P",{"data-svelte-h":!0}),r(D)!=="svelte-1c5pwr8"&&(D.textContent=Ss),tl=a(e),P=o(e,"P",{"data-svelte-h":!0}),r(P)!=="svelte-nq5sit"&&(P.innerHTML=Ls),ll=a(e),K=o(e,"P",{"data-svelte-h":!0}),r(K)!=="svelte-14p5mnr"&&(K.innerHTML=Ds),sl=a(e),c(O.$$.fragment,e),nl=a(e),ee=o(e,"P",{"data-svelte-h":!0}),r(ee)!=="svelte-kof0c9"&&(ee.innerHTML=Ps),al=a(e),c(te.$$.fragment,e),il=a(e),le=o(e,"P",{"data-svelte-h":!0}),r(le)!=="svelte-1h5ivu3"&&(le.innerHTML=Ks),ol=a(e),c(se.$$.fragment,e),rl=a(e),ne=o(e,"P",{"data-svelte-h":!0}),r(ne)!=="svelte-1mvdyro"&&(ne.innerHTML=Os),pl=a(e),c(ae.$$.fragment,e),cl=a(e),ie=o(e,"P",{"data-svelte-h":!0}),r(ie)!=="svelte-1k18r6h"&&(ie.innerHTML=en),hl=a(e),oe=o(e,"P",{"data-svelte-h":!0}),r(oe)!=="svelte-17pt1y2"&&(oe.innerHTML=tn),dl=a(e),c(re.$$.fragment,e),Ml=a(e),pe=o(e,"P",{"data-svelte-h":!0}),r(pe)!=="svelte-93po82"&&(pe.textContent=ln),ul=a(e),ce=o(e,"OL",{"data-svelte-h":!0}),r(ce)!=="svelte-51y4cn"&&(ce.innerHTML=sn),ml=a(e),c(he.$$.fragment,e),yl=a(e),de=o(e,"P",{"data-svelte-h":!0}),r(de)!=="svelte-c2eyft"&&(de.innerHTML=nn),wl=a(e),c(Me.$$.fragment,e),Tl=a(e),ue=o(e,"P",{"data-svelte-h":!0}),r(ue)!=="svelte-1a11l7s"&&(ue.innerHTML=an),Jl=a(e),c(me.$$.fragment,e),fl=a(e),ye=o(e,"P",{"data-svelte-h":!0}),r(ye)!=="svelte-1mmculc"&&(ye.innerHTML=on),jl=a(e),c(we.$$.fragment,e),Ul=a(e),Te=o(e,"P",{"data-svelte-h":!0}),r(Te)!=="svelte-184pc3h"&&(Te.textContent=rn),gl=a(e),c(Je.$$.fragment,e),bl=a(e),fe=o(e,"P",{"data-svelte-h":!0}),r(fe)!=="svelte-1ga3zr2"&&(fe.innerHTML=pn),Cl=a(e),c(je.$$.fragment,e),Il=a(e),Ue=o(e,"P",{"data-svelte-h":!0}),r(Ue)!=="svelte-6oin7m"&&(Ue.textContent=cn),vl=a(e),c(ge.$$.fragment,e),Wl=a(e),be=o(e,"P",{"data-svelte-h":!0}),r(be)!=="svelte-1ei1tif"&&(be.innerHTML=hn),_l=a(e),Ce=o(e,"UL",{"data-svelte-h":!0}),r(Ce)!=="svelte-1osxt83"&&(Ce.innerHTML=dn),kl=a(e),Ie=o(e,"P",{"data-svelte-h":!0}),r(Ie)!=="svelte-pvjt36"&&(Ie.textContent=Mn),$l=a(e),c(ve.$$.fragment,e),xl=a(e),We=o(e,"P",{"data-svelte-h":!0}),r(We)!=="svelte-3d3hl2"&&(We.innerHTML=un),Gl=a(e),_e=o(e,"P",{"data-svelte-h":!0}),r(_e)!=="svelte-1r84vh4"&&(_e.innerHTML=mn),Zl=a(e),ke=o(e,"P",{"data-svelte-h":!0}),r(ke)!=="svelte-e9pzmh"&&(ke.innerHTML=yn),Bl=a(e),$e=o(e,"P",{"data-svelte-h":!0}),r($e)!=="svelte-ah9f4t"&&($e.innerHTML=wn),Xl=a(e),c(xe.$$.fragment,e),Vl=a(e),Ge=o(e,"P",{"data-svelte-h":!0}),r(Ge)!=="svelte-14k5ead"&&(Ge.textContent=Tn),Rl=a(e),c(Ze.$$.fragment,e),Hl=a(e),Be=o(e,"P",{"data-svelte-h":!0}),r(Be)!=="svelte-hg8uw5"&&(Be.textContent=Jn),Nl=a(e),c(Xe.$$.fragment,e),Al=a(e),Ve=o(e,"P",{"data-svelte-h":!0}),r(Ve)!=="svelte-1dqtuem"&&(Ve.innerHTML=fn),El=a(e),Re=o(e,"P",{"data-svelte-h":!0}),r(Re)!=="svelte-16pkeis"&&(Re.textContent=jn),Yl=a(e),c(He.$$.fragment,e),Fl=a(e),Ne=o(e,"P",{"data-svelte-h":!0}),r(Ne)!=="svelte-wtclzb"&&(Ne.innerHTML=Un),zl=a(e),c(Ae.$$.fragment,e),Ql=a(e),c(Ee.$$.fragment,e),ql=a(e),Ye=o(e,"P",{"data-svelte-h":!0}),r(Ye)!=="svelte-1xesvxe"&&(Ye.textContent=gn),Sl=a(e),c(Fe.$$.fragment,e),Ll=a(e),ze=o(e,"P",{"data-svelte-h":!0}),r(ze)!=="svelte-1fuw0bw"&&(ze.innerHTML=bn),Dl=a(e),c(Qe.$$.fragment,e),Pl=a(e),c(qe.$$.fragment,e),Kl=a(e),Se=o(e,"P",{"data-svelte-h":!0}),r(Se)!=="svelte-1h5nxlm"&&(Se.innerHTML=Cn),Ol=a(e),c(Le.$$.fragment,e),es=a(e),c(j.$$.fragment,e),ts=a(e),De=o(e,"P",{"data-svelte-h":!0}),r(De)!=="svelte-1i53tjj"&&(De.innerHTML=In),ls=a(e),c(Pe.$$.fragment,e),ss=a(e),Ke=o(e,"P",{"data-svelte-h":!0}),r(Ke)!=="svelte-rljiwv"&&(Ke.textContent=vn),ns=a(e),c(Oe.$$.fragment,e),as=a(e),et=o(e,"P",{"data-svelte-h":!0}),r(et)!=="svelte-1ary2hj"&&(et.textContent=Wn),is=a(e),c(tt.$$.fragment,e),os=a(e),lt=o(e,"P",{"data-svelte-h":!0}),r(lt)!=="svelte-k1eeda"&&(lt.innerHTML=_n),rs=a(e),st=o(e,"P",{"data-svelte-h":!0}),r(st)!=="svelte-1mvdyro"&&(st.innerHTML=kn),ps=a(e),nt=o(e,"TABLE",{"data-svelte-h":!0}),r(nt)!=="svelte-10vryw9"&&(nt.innerHTML=$n),cs=a(e),at=o(e,"P",{"data-svelte-h":!0}),r(at)!=="svelte-1w06i7z"&&(at.textContent=xn),hs=a(e),it=o(e,"P",{"data-svelte-h":!0}),r(it)!=="svelte-1ryvxjm"&&(it.innerHTML=Gn),ds=a(e),ot=o(e,"P",{"data-svelte-h":!0}),r(ot)!=="svelte-yo8880"&&(ot.innerHTML=Zn),Ms=a(e),rt=o(e,"P",{"data-svelte-h":!0}),r(rt)!=="svelte-nt4ns1"&&(rt.innerHTML=Bn),us=a(e),pt=o(e,"P",{"data-svelte-h":!0}),r(pt)!=="svelte-1jhde3j"&&(pt.textContent=Xn),ms=a(e),c(ct.$$.fragment,e),ys=a(e),ht=o(e,"P",{"data-svelte-h":!0}),r(ht)!=="svelte-14z2x03"&&(ht.innerHTML=Vn),ws=a(e),c(dt.$$.fragment,e),Ts=a(e),Mt=o(e,"P",{"data-svelte-h":!0}),r(Mt)!=="svelte-1m7wkzz"&&(Mt.innerHTML=Rn),Js=a(e),ut=o(e,"P",{"data-svelte-h":!0}),r(ut)!=="svelte-ywnn18"&&(ut.textContent=Hn),fs=a(e),mt=o(e,"P",{"data-svelte-h":!0}),r(mt)!=="svelte-7mks79"&&(mt.innerHTML=Nn),js=a(e),yt=o(e,"P",{"data-svelte-h":!0}),r(yt)!=="svelte-1i1ixy0"&&(yt.innerHTML=An),Us=a(e),c(wt.$$.fragment,e),gs=a(e),Tt=o(e,"P",{"data-svelte-h":!0}),r(Tt)!=="svelte-5ekp45"&&(Tt.innerHTML=En),bs=a(e),c(Jt.$$.fragment,e),Cs=a(e),c(ft.$$.fragment,e),Is=a(e),jt=o(e,"P",{"data-svelte-h":!0}),r(jt)!=="svelte-z4yljy"&&(jt.innerHTML=Yn),vs=a(e),Ut=o(e,"P",{"data-svelte-h":!0}),r(Ut)!=="svelte-1kap55g"&&(Ut.innerHTML=Fn),Ws=a(e),bt=o(e,"P",{}),qn(bt).forEach(l),this.h()},h(){Sn(y,"name","hf:doc:metadata"),Sn(y,"content",oa)},m(e,t){sa(document.head,y),s(e,w,t),s(e,J,t),s(e,Ct,t),h(U,e,t),s(e,It,t),s(e,g,t),s(e,vt,t),s(e,b,t),s(e,Wt,t),s(e,C,t),s(e,_t,t),s(e,I,t),s(e,kt,t),h(v,e,t),s(e,$t,t),s(e,W,t),s(e,xt,t),s(e,_,t),s(e,Gt,t),s(e,k,t),s(e,Zt,t),h($,e,t),s(e,Bt,t),s(e,x,t),s(e,Xt,t),h(G,e,t),s(e,Vt,t),h(Z,e,t),s(e,Rt,t),s(e,B,t),s(e,Ht,t),s(e,X,t),s(e,Nt,t),h(V,e,t),s(e,At,t),s(e,R,t),s(e,Et,t),h(H,e,t),s(e,Yt,t),h(f,e,t),s(e,Ft,t),s(e,N,t),s(e,zt,t),h(A,e,t),s(e,Qt,t),h(E,e,t),s(e,qt,t),s(e,Y,t),s(e,St,t),s(e,F,t),s(e,Lt,t),s(e,z,t),s(e,Dt,t),s(e,Q,t),s(e,Pt,t),s(e,q,t),s(e,Kt,t),h(S,e,t),s(e,Ot,t),s(e,L,t),s(e,el,t),s(e,D,t),s(e,tl,t),s(e,P,t),s(e,ll,t),s(e,K,t),s(e,sl,t),h(O,e,t),s(e,nl,t),s(e,ee,t),s(e,al,t),h(te,e,t),s(e,il,t),s(e,le,t),s(e,ol,t),h(se,e,t),s(e,rl,t),s(e,ne,t),s(e,pl,t),h(ae,e,t),s(e,cl,t),s(e,ie,t),s(e,hl,t),s(e,oe,t),s(e,dl,t),h(re,e,t),s(e,Ml,t),s(e,p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ct,e,t),s(e,ys,t),s(e,ht,t),s(e,ws,t),h(dt,e,t),s(e,Ts,t),s(e,Mt,t),s(e,Js,t),s(e,ut,t),s(e,fs,t),s(e,mt,t),s(e,js,t),s(e,yt,t),s(e,Us,t),h(wt,e,t),s(e,gs,t),s(e,Tt,t),s(e,bs,t),h(Jt,e,t),s(e,Cs,t),h(ft,e,t),s(e,Is,t),s(e,jt,t),s(e,vs,t),s(e,Ut,t),s(e,Ws,t),s(e,bt,t),_s=!0},p(e,[t]){const zn={};t&2&&(zn.$$scope={dirty:t,ctx:e}),f.$set(zn);const Qn={};t&2&&(Qn.$$scope={dirty:t,ctx:e}),j.$set(Qn)},i(e){_s||(d(U.$$.fragment,e),d(v.$$.fragment,e),d($.$$.fragment,e),d(G.$$.fragment,e),d(Z.$$.fragment,e),d(V.$$.fragment,e),d(H.$$.fragment,e),d(f.$$.fragment,e),d(A.$$.fragment,e),d(E.$$.fragment,e),d(S.$$.fragment,e),d(O.$$.fragment,e),d(te.$$.fragment,e),d(se.$$.fragment,e),d(ae.$$.fragment,e),d(re.$$.fragment,e),d(he.$$.fragment,e),d(Me.$$.fragment,e),d(me.$$.fragment,e),d(we.$$.fragment,e),d(Je.$$.fragment,e),d(je.$$.fragment,e),d(ge.$$.fragment,e),d(ve.$$.fragment,e),d(xe.$$.fragment,e),d(Ze.$$.fragment,e),d(Xe.$$.fragment,e),d(He.$$.fragment,e),d(Ae.$$.fragment,e),d(Ee.$$.fragment,e),d(Fe.$$.fragment,e),d(Qe.$$.fragment,e),d(qe.$$.fragment,e),d(Le.$$.fragment,e),d(j.$$.fragment,e),d(Pe.$$.fragment,e),d(Oe.$$.fragment,e),d(tt.$$.fragment,e),d(ct.$$.fragment,e),d(dt.$$.fragment,e),d(wt.$$.fragment,e),d(Jt.$$.fragment,e),d(ft.$$.fragment,e),_s=!0)},o(e){M(U.$$.fragment,e),M(v.$$.fragment,e),M($.$$.fragment,e),M(G.$$.fragment,e),M(Z.$$.fragment,e),M(V.$$.fragment,e),M(H.$$.fragment,e),M(f.$$.fragment,e),M(A.$$.fragment,e),M(E.$$.fragment,e),M(S.$$.fragment,e),M(O.$$.fragment,e),M(te.$$.fragment,e),M(se.$$.fragment,e),M(ae.$$.fragment,e),M(re.$$.fragment,e),M(he.$$.fragment,e),M(Me.$$.fragment,e),M(me.$$.fragment,e),M(we.$$.fragment,e),M(Je.$$.fragment,e),M(je.$$.fragment,e),M(ge.$$.fragment,e),M(ve.$$.fragment,e),M(xe.$$.fragment,e),M(Ze.$$.fragment,e),M(Xe.$$.fragment,e),M(He.$$.fragment,e),M(Ae.$$.fragment,e),M(Ee.$$.fragment,e),M(Fe.$$.fragment,e),M(Qe.$$.fragment,e),M(qe.$$.fragment,e),M(Le.$$.fragment,e),M(j.$$.fragment,e),M(Pe.$$.fragment,e),M(Oe.$$.fragment,e),M(tt.$$.fragment,e),M(ct.$$.fragment,e),M(dt.$$.fragment,e),M(wt.$$.fragment,e),M(Jt.$$.fragment,e),M(ft.$$.fragment,e),_s=!1},d(e){e&&(l(w),l(J),l(Ct),l(It),l(g),l(vt),l(b),l(Wt),l(C),l(_t),l(I),l(kt),l($t),l(W),l(xt),l(_),l(Gt),l(k),l(Zt),l(Bt),l(x),l(Xt),l(Vt),l(Rt),l(B),l(Ht),l(X),l(Nt),l(At),l(R),l(Et),l(Yt),l(Ft),l(N),l(zt),l(Qt),l(qt),l(Y),l(St),l(F),l(Lt),l(z),l(Dt),l(Q),l(Pt),l(q),l(Kt),l(Ot),l(L),l(el),l(D),l(tl),l(P),l(ll),l(K),l(sl),l(nl),l(ee),l(al),l(il),l(le),l(ol),l(rl),l(ne),l(pl),l(cl),l(ie),l(hl),l(oe),l(dl),l(Ml),l(pe),l(ul),l(ce),l(ml),l(yl),l(de),l(wl),l(Tl),l(ue),l(Jl),l(fl),l(ye),l(jl),l(Ul),l(Te),l(gl),l(bl),l(fe),l(Cl),l(Il),l(Ue),l(vl),l(Wl),l(be),l(_l),l(Ce),l(kl),l(Ie),l($l),l(xl),l(We),l(Gl),l(_e),l(Zl),l(ke),l(Bl),l($e),l(Xl),l(Vl),l(Ge),l(Rl),l(Hl),l(Be),l(Nl),l(Al),l(Ve),l(El),l(Re),l(Yl),l(Fl),l(Ne),l(zl),l(Ql),l(ql),l(Ye),l(Sl),l(Ll),l(ze),l(Dl),l(Pl),l(Kl),l(Se),l(Ol),l(es),l(ts),l(De),l(ls),l(ss),l(Ke),l(ns),l(as),l(et),l(is),l(os),l(lt),l(rs),l(st),l(ps),l(nt),l(cs),l(at),l(hs),l(it),l(ds),l(ot),l(Ms),l(rt),l(us),l(pt),l(ms),l(ys),l(ht),l(ws),l(Ts),l(Mt),l(Js),l(ut),l(fs),l(mt),l(js),l(yt),l(Us),l(gs),l(Tt),l(bs),l(Cs),l(Is),l(jt),l(vs),l(Ut),l(Ws),l(bt)),l(y),u(U,e),u(v,e),u($,e),u(G,e),u(Z,e),u(V,e),u(H,e),u(f,e),u(A,e),u(E,e),u(S,e),u(O,e),u(te,e),u(se,e),u(ae,e),u(re,e),u(he,e),u(Me,e),u(me,e),u(we,e),u(Je,e),u(je,e),u(ge,e),u(ve,e),u(xe,e),u(Ze,e),u(Xe,e),u(He,e),u(Ae,e),u(Ee,e),u(Fe,e),u(Qe,e),u(qe,e),u(Le,e),u(j,e),u(Pe,e),u(Oe,e),u(tt,e),u(ct,e),u(dt,e),u(wt,e),u(Jt,e),u(ft,e)}}}const oa='{"title":"Fine-tuning the ASR model","local":"fine-tuning-the-asr-model","sections":[{"title":"Prepare Environment","local":"prepare-environment","sections":[],"depth":2},{"title":"Load Dataset","local":"load-dataset","sections":[],"depth":2},{"title":"Feature Extractor, Tokenizer and Processor","local":"feature-extractor-tokenizer-and-processor","sections":[],"depth":2},{"title":"Pre-Process the Data","local":"pre-process-the-data","sections":[],"depth":2},{"title":"Training and Evaluation","local":"training-and-evaluation","sections":[{"title":"Define a Data Collator","local":"define-a-data-collator","sections":[],"depth":3},{"title":"Evaluation Metrics","local":"evaluation-metrics","sections":[],"depth":3},{"title":"Load a Pre-Trained Checkpoint","local":"load-a-pre-trained-checkpoint","sections":[],"depth":3}],"depth":2},{"title":"Define the Training Configuration","local":"define-the-training-configuration","sections":[{"title":"Training","local":"training","sections":[],"depth":3}],"depth":2},{"title":"Sharing Your Model","local":"sharing-your-model","sections":[],"depth":2},{"title":"Conclusion","local":"conclusion","sections":[],"depth":2}],"depth":1}';function ra(gt){return On(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ua extends ea{constructor(y){super(),ta(this,y,ra,ia,Kn,{})}}export{ua as component};
