import{s as ba,a as Ia,o as Aa,n as Jl}from"../chunks/scheduler.cd324960.js";import{S as $a,i as ka,e as i,s as a,c as p,h as va,a as r,d as s,b as n,f as Tl,g as o,j as M,k as J,l as xa,m as l,n as u,t as y,o as c,p as m,q as Za,r as Wa}from"../chunks/index.d5c3adcc.js";import{T as jt}from"../chunks/Tip.889bec11.js";import{C as _a,H as k,E as Ba}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.92ea4747.js";import{C as h}from"../chunks/CodeBlock.bef85339.js";function Na(f){let d,T=`One of the recordings in GTZAN is corrupted, so it’s been removed from the dataset. That’s why we have 999 examples
instead of 1,000.`;return{c(){d=i("p"),d.textContent=T},l(w){d=r(w,"P",{"data-svelte-h":!0}),M(d)!=="svelte-1nwrvx0"&&(d.textContent=T)},m(w,g){l(w,d,g)},p:Jl,d(w){w&&s(d)}}}function Qa(f){let d,T=`Note how we’ve passed the sampling rate of our audio data to our feature extractor. This is good practice, as the feature
extractor performs a check under-the-hood to make sure the sampling rate of our audio data matches the sampling rate
expected by the model. If the sampling rate of our audio data did not match the sampling rate of our model, we’d need to
up-sample or down-sample the audio data to the correct sampling rate.`;return{c(){d=i("p"),d.textContent=T},l(w){d=r(w,"P",{"data-svelte-h":!0}),M(d)!=="svelte-rzi9hx"&&(d.textContent=T)},m(w,g){l(w,d,g)},p:Jl,d(w){w&&s(d)}}}function Ea(f){let d;return{c(){d=Za("If you exhaust your device's RAM executing the above code, you can adjust the batch parameters to reduce the peak\n    RAM usage. In particular, the following two arguments can be modified:\n    * `batch_size`: defaults to 1000, but set to 100 above. Try reducing by a factor of 2 again to 50\n    * `writer_batch_size`: defaults to 1000. Try reducing it to 500, and if that doesn't work, then reduce it by a factor of 2 again to 250")},l(T){d=Wa(T,"If you exhaust your device's RAM executing the above code, you can adjust the batch parameters to reduce the peak\n    RAM usage. In particular, the following two arguments can be modified:\n    * `batch_size`: defaults to 1000, but set to 100 above. Try reducing by a factor of 2 again to 50\n    * `writer_batch_size`: defaults to 1000. Try reducing it to 500, and if that doesn't work, then reduce it by a factor of 2 again to 250")},m(T,w){l(T,d,w)},d(T){T&&s(d)}}}function Ra(f){let d,T=`Here we have set <code>push_to_hub=True</code> to enable automatic upload of our fine-tuned checkpoints during training. Should you
not wish for your checkpoints to be uploaded to the Hub, you can set this to <code>False</code>.`;return{c(){d=i("p"),d.innerHTML=T},l(w){d=r(w,"P",{"data-svelte-h":!0}),M(d)!=="svelte-1ts6au6"&&(d.innerHTML=T)},m(w,g){l(w,d,g)},p:Jl,d(w){w&&s(d)}}}function Ga(f){let d,T=`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>batch_size</code> incrementally by factors of 2 and employ <a href="https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments.gradient_accumulation_steps" rel="nofollow"><code>gradient_accumulation_steps</code></a>
to compensate.`;return{c(){d=i("p"),d.innerHTML=T},l(w){d=r(w,"P",{"data-svelte-h":!0}),M(d)!=="svelte-1icakx9"&&(d.innerHTML=T)},m(w,g){l(w,d,g)},p:Jl,d(w){w&&s(d)}}}function za(f){let d,T,w,g,v,Ut,x,ft,Z,jl=`In this section, we’ll present a step-by-step guide on fine-tuning an encoder-only transformer model for music classification.
We’ll use a lightweight model for this demonstration and fairly small dataset, meaning the code is runnable end-to-end
on any consumer grade GPU, including the T4 16GB GPU provided in the Google Colab free tier. The section includes various
tips that you can try should you have a smaller GPU and encounter memory issues along the way.`,gt,W,Ct,_,Ul=`To train our model, we’ll use the <a href="https://huggingface.co/datasets/marsyas/gtzan" rel="nofollow">GTZAN</a> dataset, which is a popular
dataset of 1,000 songs for music genre classification. Each song is a 30-second clip from one of 10 genres of music,
spanning disco to metal. We can get the audio files and their corresponding labels from the Hugging Face Hub with the
<code>load_dataset()</code> function from 🤗 Datasets:`,It,B,bt,N,fl="<strong>Output:</strong>",At,Q,$t,C,kt,E,gl=`GTZAN doesn’t provide a predefined validation set, so we’ll have to create one ourselves. The dataset is balanced across
genres, so we can use the <code>train_test_split()</code> method to quickly create a 90/10 split as follows:`,vt,R,xt,G,Cl="<strong>Output:</strong>",Zt,z,Wt,Y,Il="Great, now that we’ve got our training and validation sets, let’s take a look at one of the audio files:",_t,F,Bt,V,bl="<strong>Output:</strong>",Nt,X,Qt,H,Al=`As we saw in <a href="../chapter1/audio_data">Unit 1</a>, the audio files are represented as 1-dimensional NumPy arrays,
where the value of the array represents the amplitude at that timestep. For these songs, the sampling rate is 22,050 Hz,
meaning there are 22,050 amplitude values sampled per second. We’ll have to keep this in mind when using a pretrained model
with a different sampling rate, converting the sampling rates ourselves to ensure they match. We can also see the genre
is represented as an integer, or <em>class label</em>, which is the format the model will make it’s predictions in. Let’s use the
<code>int2str()</code> method of the <code>genre</code> feature to map these integers to human-readable names:`,Et,S,Rt,D,$l="<strong>Output:</strong>",Gt,q,zt,L,kl=`This label looks correct, since it matches the filename of the audio file. Let’s now listen to a few more examples by
using Gradio to create a simple interface with the <code>Blocks</code> API:`,Yt,P,Ft,j,vl,Vt,O,xl=`From these samples we can certainly hear the difference between genres, but can a transformer do this too? Let’s train a
model to find out! First, we’ll need to find a suitable pretrained model for this task. Let’s see how we can do that.`,Xt,K,Ht,ee,Zl=`To get started, let’s pick a suitable pretrained model for audio classification. In this domain, pretraining is typically
carried out on large amounts of unlabeled audio data, using datasets like <a href="https://huggingface.co/datasets/librispeech_asr" rel="nofollow">LibriSpeech</a>
and <a href="https://huggingface.co/datasets/facebook/voxpopuli" rel="nofollow">Voxpopuli</a>. The best way to find these models on the Hugging
Face Hub is to use the “Audio Classification” filter, as described in the previous section. Although models like Wav2Vec2 and
HuBERT are very popular, we’ll use a model called <em>DistilHuBERT</em>. This is a much smaller (or <em>distilled</em>) version of the <a href="https://huggingface.co/docs/transformers/model_doc/hubert" rel="nofollow">HuBERT</a>
model, which trains around 73% faster, yet preserves most of the performance.`,St,U,Wl,Dt,te,qt,se,Lt,le,_l=`Similar to tokenization in NLP, audio and speech models require the input to be encoded in a format that the model
can process. In 🤗 Transformers, the conversion from audio to the input format is handled by the <em>feature extractor</em> of
the model. Similar to tokenizers, 🤗 Transformers provides a convenient <code>AutoFeatureExtractor</code> class that can automatically
select the correct feature extractor for a given model. To see how we can process our audio files, let’s begin by instantiating
the feature extractor for DistilHuBERT from the pre-trained checkpoint:`,Pt,ae,Ot,ne,Bl=`Since the sampling rate of the model and the dataset are different, we’ll have to resample the audio file to 16,000
Hz before passing it to the feature extractor. We can do this by first obtaining the model’s sample rate from the feature
extractor:`,Kt,ie,es,re,Nl="<strong>Output:</strong>",ts,Me,ss,pe,Ql="Next, we resample the dataset using the <code>cast_column()</code> method and <code>Audio</code> feature from 🤗 Datasets:",ls,oe,as,ue,El=`We can now check the first sample of the train-split of our dataset to verify that it is indeed at 16,000 Hz. 🤗 Datasets
will resample the audio file <em>on-the-fly</em> when we load each audio sample:`,ns,ye,is,ce,Rl="<strong>Output:</strong>",rs,me,Ms,de,Gl=`Great! We can see that the sampling rate has been downsampled to 16kHz. The array values are also different, as we’ve
now only got approximately one amplitude value for every 1.5 that we had before.`,ps,he,zl=`A defining feature of Wav2Vec2 and HuBERT like models is that they accept a float array corresponding to the raw waveform
of the speech signal as an input. This is in contrast to other models, like Whisper, where we pre-process the raw audio waveform
to spectrogram format.`,os,we,Yl=`We mentioned that the audio data is represented as a 1-dimensional array, so it’s already in the right format to be read
by the model (a set of continuous inputs at discrete time steps). So, what exactly does the feature extractor do?`,us,Te,Fl=`Well, the audio data is in the right format, but we’ve imposed no restrictions on the values it can take. For our model to
work optimally, we want to keep all the inputs within the same dynamic range. This is going to make sure we get a similar
range of activations and gradients for our samples, helping with stability and convergence during training.`,ys,Je,Vl=`To do this, we <em>normalise</em> our audio data, by rescaling each sample to zero mean and unit variance, a process called
<em>feature scaling</em>. It’s exactly this feature normalisation that our feature extractor performs!`,cs,je,Xl=`We can take a look at the feature extractor in operation by applying it to our first audio sample. First, let’s compute
the mean and variance of our raw audio data:`,ms,Ue,ds,fe,Hl="<strong>Output:</strong>",hs,ge,ws,Ce,Sl=`We can see that the mean is close to zero already, but the variance is closer to 0.05. If the variance for the sample was
larger, it could cause our model problems, since the dynamic range of the audio data would be very small and thus difficult to
separate. Let’s apply the feature extractor and see what the outputs look like:`,Ts,Ie,Js,be,Dl="<strong>Output:</strong>",js,Ae,Us,$e,ql=`Alright! Our feature extractor returns a dictionary of two arrays: <code>input_values</code> and <code>attention_mask</code>. The <code>input_values</code>
are the preprocessed audio inputs that we’d pass to the HuBERT model. The <a href="https://huggingface.co/docs/transformers/glossary#attention-mask" rel="nofollow"><code>attention_mask</code></a>
is used when we process a <em>batch</em> of audio inputs at once - it is used to tell the model where we have padded inputs of
different lengths.`,fs,ke,Ll=`We can see that the mean value is now very much closer to zero, and the variance bang-on one! This is exactly the form we
want our audio samples in prior to feeding them to the HuBERT model.`,gs,I,Cs,ve,Pl=`Great, so now we know how to process our resampled audio files, the last thing to do is define a function that we can
apply to all the examples in the dataset. Since we expect the audio clips to be 30 seconds in length, we’ll also
truncate any longer clips by using the <code>max_length</code> and <code>truncation</code> arguments of the feature extractor as follows:`,Is,xe,bs,Ze,Ol=`With this function defined, we can now apply it to the dataset using the <a href="https://huggingface.co/docs/datasets/v2.14.0/en/package_reference/main_classes#datasets.Dataset.map" rel="nofollow"><code>map()</code></a>
method. The <code>.map()</code> method supports working with batches of examples, which we’ll enable by setting <code>batched=True</code>.
The default batch size is 1000, but we’ll reduce it to 100 to ensure the peak RAM stays within a sensible range for
Google Colab’s free tier:`,As,We,$s,_e,Kl="<strong>Output:</strong>",ks,Be,vs,b,xs,Ne,ea=`To simplify the training, we’ve removed the <code>audio</code> and <code>file</code> columns from the dataset. The <code>input_values</code> column contains
the encoded audio files, the <code>attention_mask</code> a binary mask of 0/1 values that indicate where we have padded the audio input,
and the <code>genre</code> column contains the corresponding labels (or targets). To enable the <code>Trainer</code> to process the class labels,
we need to rename the <code>genre</code> column to <code>label</code>:`,Zs,Qe,Ws,Ee,ta=`Finally, we need to obtain the label mappings from the dataset. This mapping will take us from integer ids (e.g. <code>7</code>) to
human-readable class labels (e.g. <code>&quot;pop&quot;</code>) and back again. In doing so, we can convert our model’s integer id prediction
into human-readable format, enabling us to use the model in any downstream application. We can do this by using the <code>int2str()</code>
method as follows:`,_s,Re,Bs,Ge,Ns,ze,sa="OK, we’ve now got a dataset that’s ready for training! Let’s take a look at how we can train a model on this dataset.",Qs,Ye,Es,Fe,la=`To fine-tune the model, we’ll use the <code>Trainer</code> class from 🤗 Transformers. As we’ve seen in other chapters, the <code>Trainer</code>
is a high-level API that is designed to handle the most common training scenarios. In this case, we’ll use the <code>Trainer</code>
to fine-tune the model on GTZAN. To do this, we’ll first need to load a model for this task. We can do this by using the
<code>AutoModelForAudioClassification</code> class, which will automatically add the appropriate classification head to our pretrained
DistilHuBERT model. Let’s go ahead and instantiate the model:`,Rs,Ve,Gs,Xe,aa=`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:`,zs,He,na="<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>",Ys,Se,ia=`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>:`,Fs,De,Vs,qe,ra="<strong>Output:</strong>",Xs,Le,Hs,Pe,Ma=`The next step is to define the training arguments, including the batch size, gradient accumulation steps, number of
training epochs and learning rate:`,Ss,Oe,Ds,A,qs,Ke,pa=`The last thing we need to do is define the metrics. Since the dataset is balanced, we’ll use accuracy as our metric and
load it using the 🤗 Evaluate library:`,Ls,et,Ps,tt,oa="We’ve now got all the pieces! Let’s instantiate the <code>Trainer</code> and train the model:",Os,st,Ks,$,el,lt,ua="<strong>Output:</strong>",tl,at,sl,nt,ya=`Training will take approximately 1 hour depending on your GPU or the one allocated to the Google Colab. Our best
evaluation accuracy is 83% - not bad for just 10 epochs with 899 examples of training data! We could certainly improve
upon this result by training for more epochs, using regularisation techniques such as <em>dropout</em>, or sub-diving each
audio example from 30s into 15s segments to use a more efficient data pre-processing strategy.`,ll,it,ca=`The big question is how this compares to other music classification systems 🤔
For that, we can view the <a href="https://huggingface.co/spaces/autoevaluate/leaderboards?dataset=marsyas%2Fgtzan&amp;only_verified=0&amp;task=audio-classification&amp;config=all&amp;split=train&amp;metric=accuracy" rel="nofollow">autoevaluate leaderboard</a>,
a leaderboard that categorises models by language and dataset, and subsequently ranks them according to their accuracy.`,al,rt,ma=`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:`,nl,Mt,il,pt,da="The training results can now be uploaded to the Hub. To do so, execute the <code>.push_to_hub</code> command:",rl,ot,Ml,ut,ha=`This will save the training logs and model weights under <code>&quot;your-username/distilhubert-finetuned-gtzan&quot;</code>. For this example,
check out the upload at <a href="https://huggingface.co/sanchit-gandhi/distilhubert-finetuned-gtzan" rel="nofollow"><code>&quot;sanchit-gandhi/distilhubert-finetuned-gtzan&quot;</code></a>.`,pl,yt,ol,ct,wa=`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/distilhubert-finetuned-gtzan&quot;</code>
directly into the <code>pipeline()</code> class. For instance, to load the fine-tuned checkpoint <a href="https://huggingface.co/sanchit-gandhi/distilhubert-finetuned-gtzan" rel="nofollow"><code>&quot;sanchit-gandhi/distilhubert-finetuned-gtzan&quot;</code></a>:`,ul,mt,yl,dt,cl,ht,Ta=`In this section, we’ve covered a step-by-step guide for fine-tuning the DistilHuBERT model for music classification. While
we focussed on the task of music classification and the GTZAN dataset, the steps presented here apply more generally to any
audio classification task - the same script can be used for spoken language audio classification tasks like keyword spotting
or language identification. You just need to swap out the dataset for one that corresponds to your task of interest! If
you’re interested in fine-tuning other Hugging Face Hub models for audio classification, we encourage you to check out the
other <a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/audio-classification" rel="nofollow">examples</a> in the 🤗
Transformers repository.`,ml,wt,Ja=`In the next section, we’ll take the model that you just fine-tuned and build a music classification demo that you can share
on the Hugging Face Hub.`,dl,Tt,hl,Jt,wl;return v=new _a({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),x=new k({props:{title:"Fine-tuning a model for music classification",local:"fine-tuning-a-model-for-music-classification",headingTag:"h1"}}),W=new k({props:{title:"The Dataset",local:"the-dataset",headingTag:"h2"}}),B=new h({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZ3R6YW4lMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIybWFyc3lhcyUyRmd0emFuJTIyJTJDJTIwJTIyYWxsJTIyKSUwQWd0emFu",highlighted:`<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

gtzan = load_dataset(<span class="hljs-string">&quot;marsyas/gtzan&quot;</span>, <span class="hljs-string">&quot;all&quot;</span>)
gtzan`,wrap:!1}}),Q=new h({props:{code:"RGF0YXNldCglN0IlMEElMjAlMjAlMjAlMjBmZWF0dXJlcyUzQSUyMCU1QidmaWxlJyUyQyUyMCdhdWRpbyclMkMlMjAnZ2VucmUnJTVEJTJDJTBBJTIwJTIwJTIwJTIwbnVtX3Jvd3MlM0ElMjA5OTklMEElN0Qp",highlighted:`<span class="hljs-title function_ invoke__">Dataset</span>({
    <span class="hljs-attr">features</span>: [<span class="hljs-string">&#x27;file&#x27;</span>, <span class="hljs-string">&#x27;audio&#x27;</span>, <span class="hljs-string">&#x27;genre&#x27;</span>],
    <span class="hljs-attr">num_rows</span>: <span class="hljs-number">999</span>
})`,wrap:!1}}),C=new jt({props:{warning:!0,$$slots:{default:[Na]},$$scope:{ctx:f}}}),R=new h({props:{code:"Z3R6YW4lMjAlM0QlMjBndHphbiU1QiUyMnRyYWluJTIyJTVELnRyYWluX3Rlc3Rfc3BsaXQoc2VlZCUzRDQyJTJDJTIwc2h1ZmZsZSUzRFRydWUlMkMlMjB0ZXN0X3NpemUlM0QwLjEpJTBBZ3R6YW4=",highlighted:`gtzan = gtzan[<span class="hljs-string">&quot;train&quot;</span>].train_test_split(seed=<span class="hljs-number">42</span>, shuffle=<span class="hljs-literal">True</span>, test_size=<span class="hljs-number">0.1</span>)
gtzan`,wrap:!1}}),z=new h({props:{code:"RGF0YXNldERpY3QoJTdCJTBBJTIwJTIwJTIwJTIwdHJhaW4lM0ElMjBEYXRhc2V0KCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGZlYXR1cmVzJTNBJTIwJTVCJ2ZpbGUnJTJDJTIwJ2F1ZGlvJyUyQyUyMCdnZW5yZSclNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBudW1fcm93cyUzQSUyMDg5OSUwQSUyMCUyMCUyMCUyMCU3RCklMEElMjAlMjAlMjAlMjB0ZXN0JTNBJTIwRGF0YXNldCglN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBmZWF0dXJlcyUzQSUyMCU1QidmaWxlJyUyQyUyMCdhdWRpbyclMkMlMjAnZ2VucmUnJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbnVtX3Jvd3MlM0ElMjAxMDAlMEElMjAlMjAlMjAlMjAlN0QpJTBBJTdEKQ==",highlighted:`DatasetDict({
    train: <span class="hljs-built_in">Dataset</span>({
        features: [<span class="hljs-string">&#x27;file&#x27;</span>, <span class="hljs-string">&#x27;audio&#x27;</span>, <span class="hljs-string">&#x27;genre&#x27;</span>],
        num_rows: <span class="hljs-number">899</span>
    })
    test: <span class="hljs-built_in">Dataset</span>({
        features: [<span class="hljs-string">&#x27;file&#x27;</span>, <span class="hljs-string">&#x27;audio&#x27;</span>, <span class="hljs-string">&#x27;genre&#x27;</span>],
        num_rows: <span class="hljs-number">100</span>
    })
})`,wrap:!1}}),F=new h({props:{code:"Z3R6YW4lNUIlMjJ0cmFpbiUyMiU1RCU1QjAlNUQ=",highlighted:'gtzan[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]',wrap:!1}}),X=new h({props:{code:"JTdCJTBBJTIwJTIwJTIwJTIwJTIyZmlsZSUyMiUzQSUyMCUyMn4lMkYuY2FjaGUlMkZodWdnaW5nZmFjZSUyRmRhdGFzZXRzJTJGZG93bmxvYWRzJTJGZXh0cmFjdGVkJTJGZmEwNmNlNDYxMzBkMzQ2NzY4MzEwMGFjYTk0NWQ2ZGVhZmI2NDIzMTU3NjVhNzg0NDU2ZTFkODFjOTQ3MTVhOCUyRmdlbnJlcyUyRnBvcCUyRnBvcC4wMDA5OC53YXYlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjJhdWRpbyUyMiUzQSUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnBhdGglMjIlM0ElMjAlMjJ+JTJGLmNhY2hlJTJGaHVnZ2luZ2ZhY2UlMkZkYXRhc2V0cyUyRmRvd25sb2FkcyUyRmV4dHJhY3RlZCUyRmZhMDZjZTQ2MTMwZDM0Njc2ODMxMDBhY2E5NDVkNmRlYWZiNjQyMzE1NzY1YTc4NDQ1NmUxZDgxYzk0NzE1YTglMkZnZW5yZXMlMkZwb3AlMkZwb3AuMDAwOTgud2F2JTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyYXJyYXklMjIlM0ElMjBhcnJheSglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAwLjEwNzIwODI1JTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwMC4xNjEyMjQzNyUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMDAuMjg1ODU4MTUlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAuLi4lMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAtMC4yMjkyNDgwNSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMC0wLjIwNjI5ODgzJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwLTAuMTEzMzQyMjklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBkdHlwZSUzRGZsb2F0MzIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjApJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyc2FtcGxpbmdfcmF0ZSUyMiUzQSUyMDIyMDUwJTJDJTBBJTIwJTIwJTIwJTIwJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIyZ2VucmUlMjIlM0ElMjA3JTJDJTBBJTdE",highlighted:`{
    <span class="hljs-string">&quot;file&quot;</span>: <span class="hljs-string">&quot;~/.cache/huggingface/datasets/downloads/extracted/fa06ce46130d3467683100aca945d6deafb642315765a784456e1d81c94715a8/genres/pop/pop.00098.wav&quot;</span>,
    <span class="hljs-string">&quot;audio&quot;</span>: {
        <span class="hljs-string">&quot;path&quot;</span>: <span class="hljs-string">&quot;~/.cache/huggingface/datasets/downloads/extracted/fa06ce46130d3467683100aca945d6deafb642315765a784456e1d81c94715a8/genres/pop/pop.00098.wav&quot;</span>,
        <span class="hljs-string">&quot;array&quot;</span>: array(
            [
                <span class="hljs-number">0.10720825</span>,
                <span class="hljs-number">0.16122437</span>,
                <span class="hljs-number">0.28585815</span>,
                ...,
                <span class="hljs-number">-0.22924805</span>,
                <span class="hljs-number">-0.20629883</span>,
                <span class="hljs-number">-0.11334229</span>,
            ],
            d<span class="hljs-keyword">type</span>=float32,
        ),
        <span class="hljs-string">&quot;sampling_rate&quot;</span>: <span class="hljs-number">22050</span>,
    },
    <span class="hljs-string">&quot;genre&quot;</span>: <span class="hljs-number">7</span>,
}`,wrap:!1}}),S=new h({props:{code:"aWQybGFiZWxfZm4lMjAlM0QlMjBndHphbiU1QiUyMnRyYWluJTIyJTVELmZlYXR1cmVzJTVCJTIyZ2VucmUlMjIlNUQuaW50MnN0ciUwQWlkMmxhYmVsX2ZuKGd0emFuJTVCJTIydHJhaW4lMjIlNUQlNUIwJTVEJTVCJTIyZ2VucmUlMjIlNUQp",highlighted:`id2label_fn = gtzan[<span class="hljs-string">&quot;train&quot;</span>].features[<span class="hljs-string">&quot;genre&quot;</span>].int2str
id2label_fn(gtzan[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>][<span class="hljs-string">&quot;genre&quot;</span>])`,wrap:!1}}),q=new h({props:{code:"J3BvcCc=",highlighted:'<span class="hljs-symbol">&#x27;pop</span>&#x27;',wrap:!1}}),P=new h({props:{code:"aW1wb3J0JTIwZ3JhZGlvJTIwYXMlMjBnciUwQSUwQSUwQWRlZiUyMGdlbmVyYXRlX2F1ZGlvKCklM0ElMEElMjAlMjAlMjAlMjBleGFtcGxlJTIwJTNEJTIwZ3R6YW4lNUIlMjJ0cmFpbiUyMiU1RC5zaHVmZmxlKCklNUIwJTVEJTBBJTIwJTIwJTIwJTIwYXVkaW8lMjAlM0QlMjBleGFtcGxlJTVCJTIyYXVkaW8lMjIlNUQlMEElMjAlMjAlMjAlMjByZXR1cm4lMjAoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYXVkaW8lNUIlMjJzYW1wbGluZ19yYXRlJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYXVkaW8lNUIlMjJhcnJheSUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMCklMkMlMjBpZDJsYWJlbF9mbihleGFtcGxlJTVCJTIyZ2VucmUlMjIlNUQpJTBBJTBBJTBBd2l0aCUyMGdyLkJsb2NrcygpJTIwYXMlMjBkZW1vJTNBJTBBJTIwJTIwJTIwJTIwd2l0aCUyMGdyLkNvbHVtbigpJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZm9yJTIwXyUyMGluJTIwcmFuZ2UoNCklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBhdWRpbyUyQyUyMGxhYmVsJTIwJTNEJTIwZ2VuZXJhdGVfYXVkaW8oKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG91dHB1dCUyMCUzRCUyMGdyLkF1ZGlvKGF1ZGlvJTJDJTIwbGFiZWwlM0RsYWJlbCklMEElMEFkZW1vLmxhdW5jaChkZWJ1ZyUzRFRydWUp",highlighted:`<span class="hljs-keyword">import</span> gradio <span class="hljs-keyword">as</span> gr


<span class="hljs-keyword">def</span> <span class="hljs-title function_">generate_audio</span>():
    example = gtzan[<span class="hljs-string">&quot;train&quot;</span>].shuffle()[<span class="hljs-number">0</span>]
    audio = example[<span class="hljs-string">&quot;audio&quot;</span>]
    <span class="hljs-keyword">return</span> (
        audio[<span class="hljs-string">&quot;sampling_rate&quot;</span>],
        audio[<span class="hljs-string">&quot;array&quot;</span>],
    ), id2label_fn(example[<span class="hljs-string">&quot;genre&quot;</span>])


<span class="hljs-keyword">with</span> gr.Blocks() <span class="hljs-keyword">as</span> demo:
    <span class="hljs-keyword">with</span> gr.Column():
        <span class="hljs-keyword">for</span> _ <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">4</span>):
            audio, label = generate_audio()
            output = gr.Audio(audio, label=label)

demo.launch(debug=<span class="hljs-literal">True</span>)`,wrap:!1}}),K=new k({props:{title:"Picking a pretrained model for audio classification",local:"picking-a-pretrained-model-for-audio-classification",headingTag:"h2"}}),te=new k({props:{title:"From audio to machine learning features",local:"from-audio-to-machine-learning-features",headingTag:"h2"}}),se=new k({props:{title:"Preprocessing the data",local:"preprocessing-the-data",headingTag:"h2"}}),ae=new h({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9GZWF0dXJlRXh0cmFjdG9yJTBBJTBBbW9kZWxfaWQlMjAlM0QlMjAlMjJudHUtc3BtbCUyRmRpc3RpbGh1YmVydCUyMiUwQWZlYXR1cmVfZXh0cmFjdG9yJTIwJTNEJTIwQXV0b0ZlYXR1cmVFeHRyYWN0b3IuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMG1vZGVsX2lkJTJDJTIwZG9fbm9ybWFsaXplJTNEVHJ1ZSUyQyUyMHJldHVybl9hdHRlbnRpb25fbWFzayUzRFRydWUlMEEp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoFeatureExtractor

model_id = <span class="hljs-string">&quot;ntu-spml/distilhubert&quot;</span>
feature_extractor = AutoFeatureExtractor.from_pretrained(
    model_id, do_normalize=<span class="hljs-literal">True</span>, return_attention_mask=<span class="hljs-literal">True</span>
)`,wrap:!1}}),ie=new h({props:{code:"c2FtcGxpbmdfcmF0ZSUyMCUzRCUyMGZlYXR1cmVfZXh0cmFjdG9yLnNhbXBsaW5nX3JhdGUlMEFzYW1wbGluZ19yYXRl",highlighted:`sampling_rate = feature_extractor.sampling_rate
sampling_rate`,wrap:!1}}),Me=new h({props:{code:"MTYwMDA=",highlighted:"16000",wrap:!1}}),oe=new h({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwQXVkaW8lMEElMEFndHphbiUyMCUzRCUyMGd0emFuLmNhc3RfY29sdW1uKCUyMmF1ZGlvJTIyJTJDJTIwQXVkaW8oc2FtcGxpbmdfcmF0ZSUzRHNhbXBsaW5nX3JhdGUpKQ==",highlighted:`<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> Audio

gtzan = gtzan.cast_column(<span class="hljs-string">&quot;audio&quot;</span>, Audio(sampling_rate=sampling_rate))`,wrap:!1}}),ye=new h({props:{code:"Z3R6YW4lNUIlMjJ0cmFpbiUyMiU1RCU1QjAlNUQ=",highlighted:'gtzan[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]',wrap:!1}}),me=new h({props:{code:"JTdCJTBBJTIwJTIwJTIwJTIwJTIyZmlsZSUyMiUzQSUyMCUyMn4lMkYuY2FjaGUlMkZodWdnaW5nZmFjZSUyRmRhdGFzZXRzJTJGZG93bmxvYWRzJTJGZXh0cmFjdGVkJTJGZmEwNmNlNDYxMzBkMzQ2NzY4MzEwMGFjYTk0NWQ2ZGVhZmI2NDIzMTU3NjVhNzg0NDU2ZTFkODFjOTQ3MTVhOCUyRmdlbnJlcyUyRnBvcCUyRnBvcC4wMDA5OC53YXYlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjJhdWRpbyUyMiUzQSUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnBhdGglMjIlM0ElMjAlMjJ+JTJGLmNhY2hlJTJGaHVnZ2luZ2ZhY2UlMkZkYXRhc2V0cyUyRmRvd25sb2FkcyUyRmV4dHJhY3RlZCUyRmZhMDZjZTQ2MTMwZDM0Njc2ODMxMDBhY2E5NDVkNmRlYWZiNjQyMzE1NzY1YTc4NDQ1NmUxZDgxYzk0NzE1YTglMkZnZW5yZXMlMkZwb3AlMkZwb3AuMDAwOTgud2F2JTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyYXJyYXklMjIlM0ElMjBhcnJheSglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAwLjA4NzM1MDklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAwLjIwMTgzMzg0JTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwMC40NzkwODY3JTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwLi4uJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwLTAuMTg3NDMxNzglMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAtMC4yMzI5NDQwMSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMC0wLjEzNTE3NDI3JTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZHR5cGUlM0RmbG9hdDMyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwKSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnNhbXBsaW5nX3JhdGUlMjIlM0ElMjAxNjAwMCUyQyUwQSUyMCUyMCUyMCUyMCU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMmdlbnJlJTIyJTNBJTIwNyUyQyUwQSU3RA==",highlighted:`{
    <span class="hljs-string">&quot;file&quot;</span>: <span class="hljs-string">&quot;~/.cache/huggingface/datasets/downloads/extracted/fa06ce46130d3467683100aca945d6deafb642315765a784456e1d81c94715a8/genres/pop/pop.00098.wav&quot;</span>,
    <span class="hljs-string">&quot;audio&quot;</span>: {
        <span class="hljs-string">&quot;path&quot;</span>: <span class="hljs-string">&quot;~/.cache/huggingface/datasets/downloads/extracted/fa06ce46130d3467683100aca945d6deafb642315765a784456e1d81c94715a8/genres/pop/pop.00098.wav&quot;</span>,
        <span class="hljs-string">&quot;array&quot;</span>: array(
            [
                <span class="hljs-number">0.0873509</span>,
                <span class="hljs-number">0.20183384</span>,
                <span class="hljs-number">0.4790867</span>,
                ...,
                <span class="hljs-number">-0.18743178</span>,
                <span class="hljs-number">-0.23294401</span>,
                <span class="hljs-number">-0.13517427</span>,
            ],
            d<span class="hljs-keyword">type</span>=float32,
        ),
        <span class="hljs-string">&quot;sampling_rate&quot;</span>: <span class="hljs-number">16000</span>,
    },
    <span class="hljs-string">&quot;genre&quot;</span>: <span class="hljs-number">7</span>,
}`,wrap:!1}}),Ue=new h({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBJTBBc2FtcGxlJTIwJTNEJTIwZ3R6YW4lNUIlMjJ0cmFpbiUyMiU1RCU1QjAlNUQlNUIlMjJhdWRpbyUyMiU1RCUwQSUwQXByaW50KGYlMjJNZWFuJTNBJTIwJTdCbnAubWVhbihzYW1wbGUlNUInYXJyYXknJTVEKSUzQS4zJTdEJTJDJTIwVmFyaWFuY2UlM0ElMjAlN0JucC52YXIoc2FtcGxlJTVCJ2FycmF5JyU1RCklM0EuMyU3RCUyMik=",highlighted:`<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

sample = gtzan[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>][<span class="hljs-string">&quot;audio&quot;</span>]

<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Mean: <span class="hljs-subst">{np.mean(sample[<span class="hljs-string">&#x27;array&#x27;</span>]):<span class="hljs-number">.3</span>}</span>, Variance: <span class="hljs-subst">{np.var(sample[<span class="hljs-string">&#x27;array&#x27;</span>]):<span class="hljs-number">.3</span>}</span>&quot;</span>)`,wrap:!1}}),ge=new h({props:{code:"TWVhbiUzQSUyMDAuMDAwMTg1JTJDJTIwVmFyaWFuY2UlM0ElMjAwLjA0OTM=",highlighted:'<span class="hljs-attribute">Mean</span>: <span class="hljs-number">0</span>.<span class="hljs-number">000185</span>, Variance: <span class="hljs-number">0</span>.<span class="hljs-number">0493</span>',wrap:!1}}),Ie=new h({props:{code:"aW5wdXRzJTIwJTNEJTIwZmVhdHVyZV9leHRyYWN0b3Ioc2FtcGxlJTVCJTIyYXJyYXklMjIlNUQlMkMlMjBzYW1wbGluZ19yYXRlJTNEc2FtcGxlJTVCJTIyc2FtcGxpbmdfcmF0ZSUyMiU1RCklMEElMEFwcmludChmJTIyaW5wdXRzJTIwa2V5cyUzQSUyMCU3Qmxpc3QoaW5wdXRzLmtleXMoKSklN0QlMjIpJTBBJTBBcHJpbnQoJTBBJTIwJTIwJTIwJTIwZiUyMk1lYW4lM0ElMjAlN0JucC5tZWFuKGlucHV0cyU1QidpbnB1dF92YWx1ZXMnJTVEKSUzQS4zJTdEJTJDJTIwVmFyaWFuY2UlM0ElMjAlN0JucC52YXIoaW5wdXRzJTVCJ2lucHV0X3ZhbHVlcyclNUQpJTNBLjMlN0QlMjIlMEEp",highlighted:`inputs = feature_extractor(sample[<span class="hljs-string">&quot;array&quot;</span>], sampling_rate=sample[<span class="hljs-string">&quot;sampling_rate&quot;</span>])

<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;inputs keys: <span class="hljs-subst">{<span class="hljs-built_in">list</span>(inputs.keys())}</span>&quot;</span>)

<span class="hljs-built_in">print</span>(
    <span class="hljs-string">f&quot;Mean: <span class="hljs-subst">{np.mean(inputs[<span class="hljs-string">&#x27;input_values&#x27;</span>]):<span class="hljs-number">.3</span>}</span>, Variance: <span class="hljs-subst">{np.var(inputs[<span class="hljs-string">&#x27;input_values&#x27;</span>]):<span class="hljs-number">.3</span>}</span>&quot;</span>
)`,wrap:!1}}),Ae=new h({props:{code:"aW5wdXRzJTIwa2V5cyUzQSUyMCU1QidpbnB1dF92YWx1ZXMnJTJDJTIwJ2F0dGVudGlvbl9tYXNrJyU1RCUwQU1lYW4lM0ElMjAtNC41M2UtMDklMkMlMjBWYXJpYW5jZSUzQSUyMDEuMA==",highlighted:`<span class="hljs-attribute">inputs</span> keys:<span class="hljs-meta"> [&#x27;input_values&#x27;, &#x27;attention_mask&#x27;]</span>
<span class="hljs-attribute">Mean</span>: -<span class="hljs-number">4</span>.<span class="hljs-number">53</span>e-<span class="hljs-number">09</span>, Variance: <span class="hljs-number">1</span>.<span class="hljs-number">0</span>`,wrap:!1}}),I=new jt({props:{warning:!0,$$slots:{default:[Qa]},$$scope:{ctx:f}}}),xe=new h({props:{code:"bWF4X2R1cmF0aW9uJTIwJTNEJTIwMzAuMCUwQSUwQSUwQWRlZiUyMHByZXByb2Nlc3NfZnVuY3Rpb24oZXhhbXBsZXMpJTNBJTBBJTIwJTIwJTIwJTIwYXVkaW9fYXJyYXlzJTIwJTNEJTIwJTVCeCU1QiUyMmFycmF5JTIyJTVEJTIwZm9yJTIweCUyMGluJTIwZXhhbXBsZXMlNUIlMjJhdWRpbyUyMiU1RCU1RCUwQSUyMCUyMCUyMCUyMGlucHV0cyUyMCUzRCUyMGZlYXR1cmVfZXh0cmFjdG9yKCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGF1ZGlvX2FycmF5cyUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHNhbXBsaW5nX3JhdGUlM0RmZWF0dXJlX2V4dHJhY3Rvci5zYW1wbGluZ19yYXRlJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbWF4X2xlbmd0aCUzRGludChmZWF0dXJlX2V4dHJhY3Rvci5zYW1wbGluZ19yYXRlJTIwKiUyMG1heF9kdXJhdGlvbiklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB0cnVuY2F0aW9uJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldHVybl9hdHRlbnRpb25fbWFzayUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjApJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwaW5wdXRz",highlighted:`max_duration = <span class="hljs-number">30.0</span>


<span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_function</span>(<span class="hljs-params">examples</span>):
    audio_arrays = [x[<span class="hljs-string">&quot;array&quot;</span>] <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> examples[<span class="hljs-string">&quot;audio&quot;</span>]]
    inputs = feature_extractor(
        audio_arrays,
        sampling_rate=feature_extractor.sampling_rate,
        max_length=<span class="hljs-built_in">int</span>(feature_extractor.sampling_rate * max_duration),
        truncation=<span class="hljs-literal">True</span>,
        return_attention_mask=<span class="hljs-literal">True</span>,
    )
    <span class="hljs-keyword">return</span> inputs`,wrap:!1}}),We=new h({props:{code:"Z3R6YW5fZW5jb2RlZCUyMCUzRCUyMGd0emFuLm1hcCglMEElMjAlMjAlMjAlMjBwcmVwcm9jZXNzX2Z1bmN0aW9uJTJDJTBBJTIwJTIwJTIwJTIwcmVtb3ZlX2NvbHVtbnMlM0QlNUIlMjJhdWRpbyUyMiUyQyUyMCUyMmZpbGUlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBiYXRjaGVkJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMGJhdGNoX3NpemUlM0QxMDAlMkMlMEElMjAlMjAlMjAlMjBudW1fcHJvYyUzRDElMkMlMEEpJTBBZ3R6YW5fZW5jb2RlZA==",highlighted:`gtzan_encoded = gtzan.<span class="hljs-built_in">map</span>(
    preprocess_function,
    remove_columns=[<span class="hljs-string">&quot;audio&quot;</span>, <span class="hljs-string">&quot;file&quot;</span>],
    batched=<span class="hljs-literal">True</span>,
    batch_size=<span class="hljs-number">100</span>,
    num_proc=<span class="hljs-number">1</span>,
)
gtzan_encoded`,wrap:!1}}),Be=new h({props:{code:"RGF0YXNldERpY3QoJTdCJTBBJTIwJTIwJTIwJTIwdHJhaW4lM0ElMjBEYXRhc2V0KCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGZlYXR1cmVzJTNBJTIwJTVCJ2dlbnJlJyUyQyUyMCdpbnB1dF92YWx1ZXMnJTJDJ2F0dGVudGlvbl9tYXNrJyU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG51bV9yb3dzJTNBJTIwODk5JTBBJTIwJTIwJTIwJTIwJTdEKSUwQSUyMCUyMCUyMCUyMHRlc3QlM0ElMjBEYXRhc2V0KCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGZlYXR1cmVzJTNBJTIwJTVCJ2dlbnJlJyUyQyUyMCdpbnB1dF92YWx1ZXMnJTJDJ2F0dGVudGlvbl9tYXNrJyU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG51bV9yb3dzJTNBJTIwMTAwJTBBJTIwJTIwJTIwJTIwJTdEKSUwQSU3RCk=",highlighted:`DatasetDict({
    train: <span class="hljs-built_in">Dataset</span>({
        features: [<span class="hljs-string">&#x27;genre&#x27;</span>, <span class="hljs-string">&#x27;input_values&#x27;</span>,<span class="hljs-string">&#x27;attention_mask&#x27;</span>],
        num_rows: <span class="hljs-number">899</span>
    })
    test: <span class="hljs-built_in">Dataset</span>({
        features: [<span class="hljs-string">&#x27;genre&#x27;</span>, <span class="hljs-string">&#x27;input_values&#x27;</span>,<span class="hljs-string">&#x27;attention_mask&#x27;</span>],
        num_rows: <span class="hljs-number">100</span>
    })
})`,wrap:!1}}),b=new jt({props:{warning:!0,$$slots:{default:[Ea]},$$scope:{ctx:f}}}),Qe=new h({props:{code:"Z3R6YW5fZW5jb2RlZCUyMCUzRCUyMGd0emFuX2VuY29kZWQucmVuYW1lX2NvbHVtbiglMjJnZW5yZSUyMiUyQyUyMCUyMmxhYmVsJTIyKQ==",highlighted:'gtzan_encoded = gtzan_encoded.rename_column(<span class="hljs-string">&quot;genre&quot;</span>, <span class="hljs-string">&quot;label&quot;</span>)',wrap:!1}}),Re=new h({props:{code:"aWQybGFiZWwlMjAlM0QlMjAlN0IlMEElMjAlMjAlMjAlMjBzdHIoaSklM0ElMjBpZDJsYWJlbF9mbihpKSUwQSUyMCUyMCUyMCUyMGZvciUyMGklMjBpbiUyMHJhbmdlKGxlbihndHphbl9lbmNvZGVkJTVCJTIydHJhaW4lMjIlNUQuZmVhdHVyZXMlNUIlMjJsYWJlbCUyMiU1RC5uYW1lcykpJTBBJTdEJTBBbGFiZWwyaWQlMjAlM0QlMjAlN0J2JTNBJTIwayUyMGZvciUyMGslMkMlMjB2JTIwaW4lMjBpZDJsYWJlbC5pdGVtcygpJTdEJTBBJTBBaWQybGFiZWwlNUIlMjI3JTIyJTVE",highlighted:`id2label = {
    <span class="hljs-built_in">str</span>(i): id2label_fn(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>(gtzan_encoded[<span class="hljs-string">&quot;train&quot;</span>].features[<span class="hljs-string">&quot;label&quot;</span>].names))
}
label2id = {v: k <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> id2label.items()}

id2label[<span class="hljs-string">&quot;7&quot;</span>]`,wrap:!1}}),Ge=new h({props:{code:"J3BvcCc=",highlighted:'<span class="hljs-symbol">&#x27;pop</span>&#x27;',wrap:!1}}),Ye=new k({props:{title:"Fine-tuning the model",local:"fine-tuning-the-model",headingTag:"h2"}}),Ve=new h({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckF1ZGlvQ2xhc3NpZmljYXRpb24lMEElMEFudW1fbGFiZWxzJTIwJTNEJTIwbGVuKGlkMmxhYmVsKSUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQXVkaW9DbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwbW9kZWxfaWQlMkMlMEElMjAlMjAlMjAlMjBudW1fbGFiZWxzJTNEbnVtX2xhYmVscyUyQyUwQSUyMCUyMCUyMCUyMGxhYmVsMmlkJTNEbGFiZWwyaWQlMkMlMEElMjAlMjAlMjAlMjBpZDJsYWJlbCUzRGlkMmxhYmVsJTJDJTBBKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForAudioClassification

num_labels = <span class="hljs-built_in">len</span>(id2label)

model = AutoModelForAudioClassification.from_pretrained(
    model_id,
    num_labels=num_labels,
    label2id=label2id,
    id2label=id2label,
)`,wrap:!1}}),De=new h({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMG5vdGVib29rX2xvZ2luJTBBJTBBbm90ZWJvb2tfbG9naW4oKQ==",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> notebook_login

notebook_login()`,wrap:!1}}),Le=new h({props:{code:"TG9naW4lMjBzdWNjZXNzZnVsJTBBWW91ciUyMHRva2VuJTIwaGFzJTIwYmVlbiUyMHNhdmVkJTIwdG8lMjAlMkZyb290JTJGLmh1Z2dpbmdmYWNlJTJGdG9rZW4=",highlighted:`Login successful
Your token has been saved to /root/.huggingface/token`,wrap:!1}}),Oe=new h({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRyYWluaW5nQXJndW1lbnRzJTBBJTBBbW9kZWxfbmFtZSUyMCUzRCUyMG1vZGVsX2lkLnNwbGl0KCUyMiUyRiUyMiklNUItMSU1RCUwQWJhdGNoX3NpemUlMjAlM0QlMjA4JTBBZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTIwJTNEJTIwMSUwQW51bV90cmFpbl9lcG9jaHMlMjAlM0QlMjAxMCUwQSUwQXRyYWluaW5nX2FyZ3MlMjAlM0QlMjBUcmFpbmluZ0FyZ3VtZW50cyglMEElMjAlMjAlMjAlMjBmJTIyJTdCbW9kZWxfbmFtZSU3RC1maW5ldHVuZWQtZ3R6YW4lMjIlMkMlMEElMjAlMjAlMjAlMjBldmFsdWF0aW9uX3N0cmF0ZWd5JTNEJTIyZXBvY2glMjIlMkMlMEElMjAlMjAlMjAlMjBzYXZlX3N0cmF0ZWd5JTNEJTIyZXBvY2glMjIlMkMlMEElMjAlMjAlMjAlMjBsZWFybmluZ19yYXRlJTNENWUtNSUyQyUwQSUyMCUyMCUyMCUyMHBlcl9kZXZpY2VfdHJhaW5fYmF0Y2hfc2l6ZSUzRGJhdGNoX3NpemUlMkMlMEElMjAlMjAlMjAlMjBncmFkaWVudF9hY2N1bXVsYXRpb25fc3RlcHMlM0RncmFkaWVudF9hY2N1bXVsYXRpb25fc3RlcHMlMkMlMEElMjAlMjAlMjAlMjBwZXJfZGV2aWNlX2V2YWxfYmF0Y2hfc2l6ZSUzRGJhdGNoX3NpemUlMkMlMEElMjAlMjAlMjAlMjBudW1fdHJhaW5fZXBvY2hzJTNEbnVtX3RyYWluX2Vwb2NocyUyQyUwQSUyMCUyMCUyMCUyMHdhcm11cF9yYXRpbyUzRDAuMSUyQyUwQSUyMCUyMCUyMCUyMGxvZ2dpbmdfc3RlcHMlM0Q1JTJDJTBBJTIwJTIwJTIwJTIwbG9hZF9iZXN0X21vZGVsX2F0X2VuZCUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBtZXRyaWNfZm9yX2Jlc3RfbW9kZWwlM0QlMjJhY2N1cmFjeSUyMiUyQyUwQSUyMCUyMCUyMCUyMGZwMTYlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwcHVzaF90b19odWIlM0RUcnVlJTJDJTBBKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments

model_name = model_id.split(<span class="hljs-string">&quot;/&quot;</span>)[-<span class="hljs-number">1</span>]
batch_size = <span class="hljs-number">8</span>
gradient_accumulation_steps = <span class="hljs-number">1</span>
num_train_epochs = <span class="hljs-number">10</span>

training_args = TrainingArguments(
    <span class="hljs-string">f&quot;<span class="hljs-subst">{model_name}</span>-finetuned-gtzan&quot;</span>,
    evaluation_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
    save_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
    learning_rate=<span class="hljs-number">5e-5</span>,
    per_device_train_batch_size=batch_size,
    gradient_accumulation_steps=gradient_accumulation_steps,
    per_device_eval_batch_size=batch_size,
    num_train_epochs=num_train_epochs,
    warmup_ratio=<span class="hljs-number">0.1</span>,
    logging_steps=<span class="hljs-number">5</span>,
    load_best_model_at_end=<span class="hljs-literal">True</span>,
    metric_for_best_model=<span class="hljs-string">&quot;accuracy&quot;</span>,
    fp16=<span class="hljs-literal">True</span>,
    push_to_hub=<span class="hljs-literal">True</span>,
)`,wrap:!1}}),A=new jt({props:{warning:!0,$$slots:{default:[Ra]},$$scope:{ctx:f}}}),et=new h({props:{code:"aW1wb3J0JTIwZXZhbHVhdGUlMEFpbXBvcnQlMjBudW1weSUyMGFzJTIwbnAlMEElMEFtZXRyaWMlMjAlM0QlMjBldmFsdWF0ZS5sb2FkKCUyMmFjY3VyYWN5JTIyKSUwQSUwQSUwQWRlZiUyMGNvbXB1dGVfbWV0cmljcyhldmFsX3ByZWQpJTNBJTBBJTIwJTIwJTIwJTIwJTIyJTIyJTIyQ29tcHV0ZXMlMjBhY2N1cmFjeSUyMG9uJTIwYSUyMGJhdGNoJTIwb2YlMjBwcmVkaWN0aW9ucyUyMiUyMiUyMiUwQSUyMCUyMCUyMCUyMHByZWRpY3Rpb25zJTIwJTNEJTIwbnAuYXJnbWF4KGV2YWxfcHJlZC5wcmVkaWN0aW9ucyUyQyUyMGF4aXMlM0QxKSUwQSUyMCUyMCUyMCUyMHJldHVybiUyMG1ldHJpYy5jb21wdXRlKHByZWRpY3Rpb25zJTNEcHJlZGljdGlvbnMlMkMlMjByZWZlcmVuY2VzJTNEZXZhbF9wcmVkLmxhYmVsX2lkcyk=",highlighted:`<span class="hljs-keyword">import</span> evaluate
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

metric = evaluate.load(<span class="hljs-string">&quot;accuracy&quot;</span>)


<span class="hljs-keyword">def</span> <span class="hljs-title function_">compute_metrics</span>(<span class="hljs-params">eval_pred</span>):
    <span class="hljs-string">&quot;&quot;&quot;Computes accuracy on a batch of predictions&quot;&quot;&quot;</span>
    predictions = np.argmax(eval_pred.predictions, axis=<span class="hljs-number">1</span>)
    <span class="hljs-keyword">return</span> metric.compute(predictions=predictions, references=eval_pred.label_ids)`,wrap:!1}}),st=new h({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRyYWluZXIlMEElMEF0cmFpbmVyJTIwJTNEJTIwVHJhaW5lciglMEElMjAlMjAlMjAlMjBtb2RlbCUyQyUwQSUyMCUyMCUyMCUyMHRyYWluaW5nX2FyZ3MlMkMlMEElMjAlMjAlMjAlMjB0cmFpbl9kYXRhc2V0JTNEZ3R6YW5fZW5jb2RlZCU1QiUyMnRyYWluJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9kYXRhc2V0JTNEZ3R6YW5fZW5jb2RlZCU1QiUyMnRlc3QlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0RmZWF0dXJlX2V4dHJhY3RvciUyQyUwQSUyMCUyMCUyMCUyMGNvbXB1dGVfbWV0cmljcyUzRGNvbXB1dGVfbWV0cmljcyUyQyUwQSklMEElMEF0cmFpbmVyLnRyYWluKCk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Trainer

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

trainer.train()`,wrap:!1}}),$=new jt({props:{warning:!0,$$slots:{default:[Ga]},$$scope:{ctx:f}}}),at=new h({props:{code:"JTdDJTIwVHJhaW5pbmclMjBMb3NzJTIwJTdDJTIwRXBvY2glMjAlN0MlMjBTdGVwJTIwJTdDJTIwVmFsaWRhdGlvbiUyMExvc3MlMjAlN0MlMjBBY2N1cmFjeSUyMCU3QyUwQSU3QyUzQS0tLS0tLS0tLS0tLS0lM0ElN0MlM0EtLS0tLSUzQSU3QyUzQS0tLS0lM0ElN0MlM0EtLS0tLS0tLS0tLS0tLS0lM0ElN0MlM0EtLS0tLS0tLSUzQSU3QyUwQSU3QyUyMDEuNzI5NyUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QyUyMDEuMCUyMCUyMCUyMCU3QyUyMDExMyUyMCUyMCU3QyUyMDEuODAxMSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QyUyMDAuNDQlMjAlMjAlMjAlMjAlMjAlN0MlMEElN0MlMjAxLjI0JTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdDJTIwMi4wJTIwJTIwJTIwJTdDJTIwMjI2JTIwJTIwJTdDJTIwMS4zMDQ1JTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdDJTIwMC42NCUyMCUyMCUyMCUyMCUyMCU3QyUwQSU3QyUyMDAuOTgwNSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QyUyMDMuMCUyMCUyMCUyMCU3QyUyMDMzOSUyMCUyMCU3QyUyMDAuOTg4OCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QyUyMDAuNyUyMCUyMCUyMCUyMCUyMCUyMCU3QyUwQSU3QyUyMDAuNjg1MyUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QyUyMDQuMCUyMCUyMCUyMCU3QyUyMDQ1MiUyMCUyMCU3QyUyMDAuNzUwOCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QyUyMDAuNzklMjAlMjAlMjAlMjAlMjAlN0MlMEElN0MlMjAwLjQ1MDIlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0MlMjA1LjAlMjAlMjAlMjAlN0MlMjA1NjUlMjAlMjAlN0MlMjAwLjYyMjQlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0MlMjAwLjgxJTIwJTIwJTIwJTIwJTIwJTdDJTBBJTdDJTIwMC4zMDE1JTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdDJTIwNi4wJTIwJTIwJTIwJTdDJTIwNjc4JTIwJTIwJTdDJTIwMC41NDExJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdDJTIwMC44MyUyMCUyMCUyMCUyMCUyMCU3QyUwQSU3QyUyMDAuMjI0NCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QyUyMDcuMCUyMCUyMCUyMCU3QyUyMDc5MSUyMCUyMCU3QyUyMDAuNjI5MyUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QyUyMDAuNzglMjAlMjAlMjAlMjAlMjAlN0MlMEElN0MlMjAwLjMxMDglMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0MlMjA4LjAlMjAlMjAlMjAlN0MlMjA5MDQlMjAlMjAlN0MlMjAwLjU4NTclMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0MlMjAwLjgxJTIwJTIwJTIwJTIwJTIwJTdDJTBBJTdDJTIwMC4xNjQ0JTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdDJTIwOS4wJTIwJTIwJTIwJTdDJTIwMTAxNyUyMCU3QyUyMDAuNTM1NSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QyUyMDAuODMlMjAlMjAlMjAlMjAlMjAlN0MlMEElN0MlMjAwLjExOTglMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0MlMjAxMC4wJTIwJTIwJTdDJTIwMTEzMCUyMCU3QyUyMDAuNTcxNiUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU3QyUyMDAuODIlMjAlMjAlMjAlMjAlMjAlN0M=",highlighted:`|<span class="hljs-string"> Training Loss </span>|<span class="hljs-string"> Epoch </span>|<span class="hljs-string"> Step </span>|<span class="hljs-string"> Validation Loss </span>|<span class="hljs-string"> Accuracy </span>|
|<span class="hljs-string">:-------------:</span>|<span class="hljs-string">:-----:</span>|<span class="hljs-string">:----:</span>|<span class="hljs-string">:---------------:</span>|<span class="hljs-string">:--------:</span>|
|<span class="hljs-string"> 1.7297        </span>|<span class="hljs-string"> 1.0   </span>|<span class="hljs-string"> 113  </span>|<span class="hljs-string"> 1.8011          </span>|<span class="hljs-string"> 0.44     </span>|
|<span class="hljs-string"> 1.24          </span>|<span class="hljs-string"> 2.0   </span>|<span class="hljs-string"> 226  </span>|<span class="hljs-string"> 1.3045          </span>|<span class="hljs-string"> 0.64     </span>|
|<span class="hljs-string"> 0.9805        </span>|<span class="hljs-string"> 3.0   </span>|<span class="hljs-string"> 339  </span>|<span class="hljs-string"> 0.9888          </span>|<span class="hljs-string"> 0.7      </span>|
|<span class="hljs-string"> 0.6853        </span>|<span class="hljs-string"> 4.0   </span>|<span class="hljs-string"> 452  </span>|<span class="hljs-string"> 0.7508          </span>|<span class="hljs-string"> 0.79     </span>|
|<span class="hljs-string"> 0.4502        </span>|<span class="hljs-string"> 5.0   </span>|<span class="hljs-string"> 565  </span>|<span class="hljs-string"> 0.6224          </span>|<span class="hljs-string"> 0.81     </span>|
|<span class="hljs-string"> 0.3015        </span>|<span class="hljs-string"> 6.0   </span>|<span class="hljs-string"> 678  </span>|<span class="hljs-string"> 0.5411          </span>|<span class="hljs-string"> 0.83     </span>|
|<span class="hljs-string"> 0.2244        </span>|<span class="hljs-string"> 7.0   </span>|<span class="hljs-string"> 791  </span>|<span class="hljs-string"> 0.6293          </span>|<span class="hljs-string"> 0.78     </span>|
|<span class="hljs-string"> 0.3108        </span>|<span class="hljs-string"> 8.0   </span>|<span class="hljs-string"> 904  </span>|<span class="hljs-string"> 0.5857          </span>|<span class="hljs-string"> 0.81     </span>|
|<span class="hljs-string"> 0.1644        </span>|<span class="hljs-string"> 9.0   </span>|<span class="hljs-string"> 1017 </span>|<span class="hljs-string"> 0.5355          </span>|<span class="hljs-string"> 0.83     </span>|
|<span class="hljs-string"> 0.1198        </span>|<span class="hljs-string"> 10.0  </span>|<span class="hljs-string"> 1130 </span>|<span class="hljs-string"> 0.5716          </span>|<span class="hljs-string"> 0.82     </span>|`,wrap:!1}}),Mt=new h({props:{code:"a3dhcmdzJTIwJTNEJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIyZGF0YXNldF90YWdzJTIyJTNBJTIwJTIybWFyc3lhcyUyRmd0emFuJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIyZGF0YXNldCUyMiUzQSUyMCUyMkdUWkFOJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIybW9kZWxfbmFtZSUyMiUzQSUyMGYlMjIlN0Jtb2RlbF9uYW1lJTdELWZpbmV0dW5lZC1ndHphbiUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMmZpbmV0dW5lZF9mcm9tJTIyJTNBJTIwbW9kZWxfaWQlMkMlMEElMjAlMjAlMjAlMjAlMjJ0YXNrcyUyMiUzQSUyMCUyMmF1ZGlvLWNsYXNzaWZpY2F0aW9uJTIyJTJDJTBBJTdE",highlighted:`kwargs = {
    <span class="hljs-string">&quot;dataset_tags&quot;</span>: <span class="hljs-string">&quot;marsyas/gtzan&quot;</span>,
    <span class="hljs-string">&quot;dataset&quot;</span>: <span class="hljs-string">&quot;GTZAN&quot;</span>,
    <span class="hljs-string">&quot;model_name&quot;</span>: <span class="hljs-string">f&quot;<span class="hljs-subst">{model_name}</span>-finetuned-gtzan&quot;</span>,
    <span class="hljs-string">&quot;finetuned_from&quot;</span>: model_id,
    <span class="hljs-string">&quot;tasks&quot;</span>: <span class="hljs-string">&quot;audio-classification&quot;</span>,
}`,wrap:!1}}),ot=new h({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1YigqKmt3YXJncyk=",highlighted:"trainer.push_to_hub(**kwargs)",wrap:!1}}),yt=new k({props:{title:"Share Model",local:"share-model",headingTag:"h2"}}),mt=new h({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBcGlwZSUyMCUzRCUyMHBpcGVsaW5lKCUwQSUyMCUyMCUyMCUyMCUyMmF1ZGlvLWNsYXNzaWZpY2F0aW9uJTIyJTJDJTIwbW9kZWwlM0QlMjJzYW5jaGl0LWdhbmRoaSUyRmRpc3RpbGh1YmVydC1maW5ldHVuZWQtZ3R6YW4lMjIlMEEp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

pipe = pipeline(
    <span class="hljs-string">&quot;audio-classification&quot;</span>, model=<span class="hljs-string">&quot;sanchit-gandhi/distilhubert-finetuned-gtzan&quot;</span>
)`,wrap:!1}}),dt=new k({props:{title:"Conclusion",local:"conclusion",headingTag:"h2"}}),Tt=new Ba({props:{source:"https://github.com/huggingface/audio-transformers-course/blob/main/chapters/en/chapter4/fine-tuning.mdx"}}),{c(){d=i("meta"),T=a(),w=i("p"),g=a(),p(v.$$.fragment),Ut=a(),p(x.$$.fragment),ft=a(),Z=i("p"),Z.textContent=jl,gt=a(),p(W.$$.fragment),Ct=a(),_=i("p"),_.innerHTML=Ul,It=a(),p(B.$$.fragment),bt=a(),N=i("p"),N.innerHTML=fl,At=a(),p(Q.$$.fragment),$t=a(),p(C.$$.fragment),kt=a(),E=i("p"),E.innerHTML=gl,vt=a(),p(R.$$.fragment),xt=a(),G=i("p"),G.innerHTML=Cl,Zt=a(),p(z.$$.fragment),Wt=a(),Y=i("p"),Y.textContent=Il,_t=a(),p(F.$$.fragment),Bt=a(),V=i("p"),V.innerHTML=bl,Nt=a(),p(X.$$.fragment),Qt=a(),H=i("p"),H.innerHTML=Al,Et=a(),p(S.$$.fragment),Rt=a(),D=i("p"),D.innerHTML=$l,Gt=a(),p(q.$$.fragment),zt=a(),L=i("p"),L.innerHTML=kl,Yt=a(),p(P.$$.fragment),Ft=a(),j=i("iframe"),Vt=a(),O=i("p"),O.textContent=xl,Xt=a(),p(K.$$.fragment),Ht=a(),ee=i("p"),ee.innerHTML=Zl,St=a(),U=i("iframe"),Dt=a(),p(te.$$.fragment),qt=a(),p(se.$$.fragment),Lt=a(),le=i("p"),le.innerHTML=_l,Pt=a(),p(ae.$$.fragment),Ot=a(),ne=i("p"),ne.textContent=Bl,Kt=a(),p(ie.$$.fragment),es=a(),re=i("p"),re.innerHTML=Nl,ts=a(),p(Me.$$.fragment),ss=a(),pe=i("p"),pe.innerHTML=Ql,ls=a(),p(oe.$$.fragment),as=a(),ue=i("p"),ue.innerHTML=El,ns=a(),p(ye.$$.fragment),is=a(),ce=i("p"),ce.innerHTML=Rl,rs=a(),p(me.$$.fragment),Ms=a(),de=i("p"),de.textContent=Gl,ps=a(),he=i("p"),he.textContent=zl,os=a(),we=i("p"),we.textContent=Yl,us=a(),Te=i("p"),Te.textContent=Fl,ys=a(),Je=i("p"),Je.innerHTML=Vl,cs=a(),je=i("p"),je.textContent=Xl,ms=a(),p(Ue.$$.fragment),ds=a(),fe=i("p"),fe.innerHTML=Hl,hs=a(),p(ge.$$.fragment),ws=a(),Ce=i("p"),Ce.textContent=Sl,Ts=a(),p(Ie.$$.fragment),Js=a(),be=i("p"),be.innerHTML=Dl,js=a(),p(Ae.$$.fragment),Us=a(),$e=i("p"),$e.innerHTML=ql,fs=a(),ke=i("p"),ke.textContent=Ll,gs=a(),p(I.$$.fragment),Cs=a(),ve=i("p"),ve.innerHTML=Pl,Is=a(),p(xe.$$.fragment),bs=a(),Ze=i("p"),Ze.innerHTML=Ol,As=a(),p(We.$$.fragment),$s=a(),_e=i("p"),_e.innerHTML=Kl,ks=a(),p(Be.$$.fragment),vs=a(),p(b.$$.fragment),xs=a(),Ne=i("p"),Ne.innerHTML=ea,Zs=a(),p(Qe.$$.fragment),Ws=a(),Ee=i("p"),Ee.innerHTML=ta,_s=a(),p(Re.$$.fragment),Bs=a(),p(Ge.$$.fragment),Ns=a(),ze=i("p"),ze.textContent=sa,Qs=a(),p(Ye.$$.fragment),Es=a(),Fe=i("p"),Fe.innerHTML=la,Rs=a(),p(Ve.$$.fragment),Gs=a(),Xe=i("p"),Xe.innerHTML=aa,zs=a(),He=i("ul"),He.innerHTML=na,Ys=a(),Se=i("p"),Se.innerHTML=ia,Fs=a(),p(De.$$.fragment),Vs=a(),qe=i("p"),qe.innerHTML=ra,Xs=a(),p(Le.$$.fragment),Hs=a(),Pe=i("p"),Pe.textContent=Ma,Ss=a(),p(Oe.$$.fragment),Ds=a(),p(A.$$.fragment),qs=a(),Ke=i("p"),Ke.textContent=pa,Ls=a(),p(et.$$.fragment),Ps=a(),tt=i("p"),tt.innerHTML=oa,Os=a(),p(st.$$.fragment),Ks=a(),p($.$$.fragment),el=a(),lt=i("p"),lt.innerHTML=ua,tl=a(),p(at.$$.fragment),sl=a(),nt=i("p"),nt.innerHTML=ya,ll=a(),it=i("p"),it.innerHTML=ca,al=a(),rt=i("p"),rt.textContent=ma,nl=a(),p(Mt.$$.fragment),il=a(),pt=i("p"),pt.innerHTML=da,rl=a(),p(ot.$$.fragment),Ml=a(),ut=i("p"),ut.innerHTML=ha,pl=a(),p(yt.$$.fragment),ol=a(),ct=i("p"),ct.innerHTML=wa,ul=a(),p(mt.$$.fragment),yl=a(),p(dt.$$.fragment),cl=a(),ht=i("p"),ht.innerHTML=Ta,ml=a(),wt=i("p"),wt.textContent=Ja,dl=a(),p(Tt.$$.fragment),hl=a(),Jt=i("p"),this.h()},l(e){const t=va("svelte-u9bgzb",document.head);d=r(t,"META",{name:!0,content:!0}),t.forEach(s),T=n(e),w=r(e,"P",{}),Tl(w).forEach(s),g=n(e),o(v.$$.fragment,e),Ut=n(e),o(x.$$.fragment,e),ft=n(e),Z=r(e,"P",{"data-svelte-h":!0}),M(Z)!=="svelte-1leazec"&&(Z.textContent=jl),gt=n(e),o(W.$$.fragment,e),Ct=n(e),_=r(e,"P",{"data-svelte-h":!0}),M(_)!=="svelte-rk5isb"&&(_.innerHTML=Ul),It=n(e),o(B.$$.fragment,e),bt=n(e),N=r(e,"P",{"data-svelte-h":!0}),M(N)!=="svelte-1mvdyro"&&(N.innerHTML=fl),At=n(e),o(Q.$$.fragment,e),$t=n(e),o(C.$$.fragment,e),kt=n(e),E=r(e,"P",{"data-svelte-h":!0}),M(E)!=="svelte-1eeg74r"&&(E.innerHTML=gl),vt=n(e),o(R.$$.fragment,e),xt=n(e),G=r(e,"P",{"data-svelte-h":!0}),M(G)!=="svelte-1mvdyro"&&(G.innerHTML=Cl),Zt=n(e),o(z.$$.fragment,e),Wt=n(e),Y=r(e,"P",{"data-svelte-h":!0}),M(Y)!=="svelte-a6sfr7"&&(Y.textContent=Il),_t=n(e),o(F.$$.fragment,e),Bt=n(e),V=r(e,"P",{"data-svelte-h":!0}),M(V)!=="svelte-1mvdyro"&&(V.innerHTML=bl),Nt=n(e),o(X.$$.fragment,e),Qt=n(e),H=r(e,"P",{"data-svelte-h":!0}),M(H)!=="svelte-13jeh9r"&&(H.innerHTML=Al),Et=n(e),o(S.$$.fragment,e),Rt=n(e),D=r(e,"P",{"data-svelte-h":!0}),M(D)!=="svelte-1mvdyro"&&(D.innerHTML=$l),Gt=n(e),o(q.$$.fragment,e),zt=n(e),L=r(e,"P",{"data-svelte-h":!0}),M(L)!=="svelte-ewk6mi"&&(L.innerHTML=kl),Yt=n(e),o(P.$$.fragment,e),Ft=n(e),j=r(e,"IFRAME",{src:!0,frameborder:!0,height:!0,title:!0,class:!0,allow:!0,sandbox:!0}),Tl(j).forEach(s),Vt=n(e),O=r(e,"P",{"data-svelte-h":!0}),M(O)!=="svelte-1o9i97o"&&(O.textContent=xl),Xt=n(e),o(K.$$.fragment,e),Ht=n(e),ee=r(e,"P",{"data-svelte-h":!0}),M(ee)!=="svelte-iivxt"&&(ee.innerHTML=Zl),St=n(e),U=r(e,"IFRAME",{src:!0,frameborder:!0,height:!0,title:!0,class:!0,allow:!0,sandbox:!0}),Tl(U).forEach(s),Dt=n(e),o(te.$$.fragment,e),qt=n(e),o(se.$$.fragment,e),Lt=n(e),le=r(e,"P",{"data-svelte-h":!0}),M(le)!=="svelte-rlkncr"&&(le.innerHTML=_l),Pt=n(e),o(ae.$$.fragment,e),Ot=n(e),ne=r(e,"P",{"data-svelte-h":!0}),M(ne)!=="svelte-c2frcd"&&(ne.textContent=Bl),Kt=n(e),o(ie.$$.fragment,e),es=n(e),re=r(e,"P",{"data-svelte-h":!0}),M(re)!=="svelte-1mvdyro"&&(re.innerHTML=Nl),ts=n(e),o(Me.$$.fragment,e),ss=n(e),pe=r(e,"P",{"data-svelte-h":!0}),M(pe)!=="svelte-1rpvjq7"&&(pe.innerHTML=Ql),ls=n(e),o(oe.$$.fragment,e),as=n(e),ue=r(e,"P",{"data-svelte-h":!0}),M(ue)!=="svelte-1tkp903"&&(ue.innerHTML=El),ns=n(e),o(ye.$$.fragment,e),is=n(e),ce=r(e,"P",{"data-svelte-h":!0}),M(ce)!=="svelte-1mvdyro"&&(ce.innerHTML=Rl),rs=n(e),o(me.$$.fragment,e),Ms=n(e),de=r(e,"P",{"data-svelte-h":!0}),M(de)!=="svelte-7uqj3l"&&(de.textContent=Gl),ps=n(e),he=r(e,"P",{"data-svelte-h":!0}),M(he)!=="svelte-1azahu4"&&(he.textContent=zl),os=n(e),we=r(e,"P",{"data-svelte-h":!0}),M(we)!=="svelte-3gbyxr"&&(we.textContent=Yl),us=n(e),Te=r(e,"P",{"data-svelte-h":!0}),M(Te)!=="svelte-1xxbe6o"&&(Te.textContent=Fl),ys=n(e),Je=r(e,"P",{"data-svelte-h":!0}),M(Je)!=="svelte-1oai2nn"&&(Je.innerHTML=Vl),cs=n(e),je=r(e,"P",{"data-svelte-h":!0}),M(je)!=="svelte-2wrc8b"&&(je.textContent=Xl),ms=n(e),o(Ue.$$.fragment,e),ds=n(e),fe=r(e,"P",{"data-svelte-h":!0}),M(fe)!=="svelte-1mvdyro"&&(fe.innerHTML=Hl),hs=n(e),o(ge.$$.fragment,e),ws=n(e),Ce=r(e,"P",{"data-svelte-h":!0}),M(Ce)!=="svelte-vl18rt"&&(Ce.textContent=Sl),Ts=n(e),o(Ie.$$.fragment,e),Js=n(e),be=r(e,"P",{"data-svelte-h":!0}),M(be)!=="svelte-1mvdyro"&&(be.innerHTML=Dl),js=n(e),o(Ae.$$.fragment,e),Us=n(e),$e=r(e,"P",{"data-svelte-h":!0}),M($e)!=="svelte-1g6lntp"&&($e.innerHTML=ql),fs=n(e),ke=r(e,"P",{"data-svelte-h":!0}),M(ke)!=="svelte-jbcmza"&&(ke.textContent=Ll),gs=n(e),o(I.$$.fragment,e),Cs=n(e),ve=r(e,"P",{"data-svelte-h":!0}),M(ve)!=="svelte-fnovuz"&&(ve.innerHTML=Pl),Is=n(e),o(xe.$$.fragment,e),bs=n(e),Ze=r(e,"P",{"data-svelte-h":!0}),M(Ze)!=="svelte-1bmnpnl"&&(Ze.innerHTML=Ol),As=n(e),o(We.$$.fragment,e),$s=n(e),_e=r(e,"P",{"data-svelte-h":!0}),M(_e)!=="svelte-1mvdyro"&&(_e.innerHTML=Kl),ks=n(e),o(Be.$$.fragment,e),vs=n(e),o(b.$$.fragment,e),xs=n(e),Ne=r(e,"P",{"data-svelte-h":!0}),M(Ne)!=="svelte-1r54nk8"&&(Ne.innerHTML=ea),Zs=n(e),o(Qe.$$.fragment,e),Ws=n(e),Ee=r(e,"P",{"data-svelte-h":!0}),M(Ee)!=="svelte-9mel5l"&&(Ee.innerHTML=ta),_s=n(e),o(Re.$$.fragment,e),Bs=n(e),o(Ge.$$.fragment,e),Ns=n(e),ze=r(e,"P",{"data-svelte-h":!0}),M(ze)!=="svelte-1yt0a8x"&&(ze.textContent=sa),Qs=n(e),o(Ye.$$.fragment,e),Es=n(e),Fe=r(e,"P",{"data-svelte-h":!0}),M(Fe)!=="svelte-fhl4ex"&&(Fe.innerHTML=la),Rs=n(e),o(Ve.$$.fragment,e),Gs=n(e),Xe=r(e,"P",{"data-svelte-h":!0}),M(Xe)!=="svelte-lavash"&&(Xe.innerHTML=aa),zs=n(e),He=r(e,"UL",{"data-svelte-h":!0}),M(He)!=="svelte-1vhmuwk"&&(He.innerHTML=na),Ys=n(e),Se=r(e,"P",{"data-svelte-h":!0}),M(Se)!=="svelte-14s52of"&&(Se.innerHTML=ia),Fs=n(e),o(De.$$.fragment,e),Vs=n(e),qe=r(e,"P",{"data-svelte-h":!0}),M(qe)!=="svelte-1mvdyro"&&(qe.innerHTML=ra),Xs=n(e),o(Le.$$.fragment,e),Hs=n(e),Pe=r(e,"P",{"data-svelte-h":!0}),M(Pe)!=="svelte-50ips3"&&(Pe.textContent=Ma),Ss=n(e),o(Oe.$$.fragment,e),Ds=n(e),o(A.$$.fragment,e),qs=n(e),Ke=r(e,"P",{"data-svelte-h":!0}),M(Ke)!=="svelte-ptp3v8"&&(Ke.textContent=pa),Ls=n(e),o(et.$$.fragment,e),Ps=n(e),tt=r(e,"P",{"data-svelte-h":!0}),M(tt)!=="svelte-1lpo0k9"&&(tt.innerHTML=oa),Os=n(e),o(st.$$.fragment,e),Ks=n(e),o($.$$.fragment,e),el=n(e),lt=r(e,"P",{"data-svelte-h":!0}),M(lt)!=="svelte-1mvdyro"&&(lt.innerHTML=ua),tl=n(e),o(at.$$.fragment,e),sl=n(e),nt=r(e,"P",{"data-svelte-h":!0}),M(nt)!=="svelte-k6is36"&&(nt.innerHTML=ya),ll=n(e),it=r(e,"P",{"data-svelte-h":!0}),M(it)!=="svelte-1wkhb5r"&&(it.innerHTML=ca),al=n(e),rt=r(e,"P",{"data-svelte-h":!0}),M(rt)!=="svelte-ctyspf"&&(rt.textContent=ma),nl=n(e),o(Mt.$$.fragment,e),il=n(e),pt=r(e,"P",{"data-svelte-h":!0}),M(pt)!=="svelte-1d7zqbn"&&(pt.innerHTML=da),rl=n(e),o(ot.$$.fragment,e),Ml=n(e),ut=r(e,"P",{"data-svelte-h":!0}),M(ut)!=="svelte-97i0fv"&&(ut.innerHTML=ha),pl=n(e),o(yt.$$.fragment,e),ol=n(e),ct=r(e,"P",{"data-svelte-h":!0}),M(ct)!=="svelte-8fi8q3"&&(ct.innerHTML=wa),ul=n(e),o(mt.$$.fragment,e),yl=n(e),o(dt.$$.fragment,e),cl=n(e),ht=r(e,"P",{"data-svelte-h":!0}),M(ht)!=="svelte-zl8n4l"&&(ht.innerHTML=Ta),ml=n(e),wt=r(e,"P",{"data-svelte-h":!0}),M(wt)!=="svelte-1d2pb2r"&&(wt.textContent=Ja),dl=n(e),o(Tt.$$.fragment,e),hl=n(e),Jt=r(e,"P",{}),Tl(Jt).forEach(s),this.h()},h(){J(d,"name","hf:doc:metadata"),J(d,"content",Ya),Ia(j.src,vl="https://course-demos-gtzan-samples.hf.space")||J(j,"src",vl),J(j,"frameborder","0"),J(j,"height","450"),J(j,"title","Gradio app"),J(j,"class","container p-0 flex-grow space-iframe"),J(j,"allow","accelerometer; ambient-light-sensor; autoplay; battery; camera; document-domain; encrypted-media; fullscreen; geolocation; gyroscope; layout-animations; legacy-image-formats; magnetometer; microphone; midi; oversized-images; payment; picture-in-picture; publickey-credentials-get; sync-xhr; usb; vr ; wake-lock; xr-spatial-tracking"),J(j,"sandbox","allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads"),Ia(U.src,Wl="https://autoevaluate-leaderboards.hf.space")||J(U,"src",Wl),J(U,"frameborder","0"),J(U,"height","450"),J(U,"title","Gradio app"),J(U,"class","container p-0 flex-grow space-iframe"),J(U,"allow","accelerometer; ambient-light-sensor; autoplay; battery; camera; document-domain; encrypted-media; fullscreen; geolocation; gyroscope; layout-animations; legacy-image-formats; magnetometer; microphone; midi; oversized-images; payment; picture-in-picture; publickey-credentials-get; sync-xhr; usb; vr ; wake-lock; xr-spatial-tracking"),J(U,"sandbox","allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads")},m(e,t){xa(document.head,d),l(e,T,t),l(e,w,t),l(e,g,t),u(v,e,t),l(e,Ut,t),u(x,e,t),l(e,ft,t),l(e,Z,t),l(e,gt,t),u(W,e,t),l(e,Ct,t),l(e,_,t),l(e,It,t),u(B,e,t),l(e,bt,t),l(e,N,t),l(e,At,t),u(Q,e,t),l(e,$t,t),u(C,e,t),l(e,kt,t),l(e,E,t),l(e,vt,t),u(R,e,t),l(e,xt,t),l(e,G,t),l(e,Zt,t),u(z,e,t),l(e,Wt,t),l(e,Y,t),l(e,_t,t),u(F,e,t),l(e,Bt,t),l(e,V,t),l(e,Nt,t),u(X,e,t),l(e,Qt,t),l(e,H,t),l(e,Et,t),u(S,e,t),l(e,Rt,t),l(e,D,t),l(e,Gt,t),u(q,e,t),l(e,zt,t),l(e,L,t),l(e,Yt,t),u(P,e,t),l(e,Ft,t),l(e,j,t),l(e,Vt,t),l(e,O,t),l(e,Xt,t),u(K,e,t),l(e,Ht,t),l(e,ee,t),l(e,St,t),l(e,U,t),l(e,Dt,t),u(te,e,t),l(e,qt,t),u(se,e,t),l(e,Lt,t),l(e,le,t),l(e,Pt,t),u(ae,e,t),l(e,Ot,t),l(e,ne,t),l(e,Kt,t),u(ie,e,t),l(e,es,t),l(e,re,t),l(e,ts,t),u(Me,e,t),l(e,ss,t),l(e,pe,t),l(e,ls,t),u(oe,e,t),l(e,as,t),l(e,ue,t),l(e,ns,t),u(ye,e,t),l(e,is,t),l(e,ce,t),l(e,rs,t),u(me,e,t),l(e,Ms,t),l(e,de,t),l(e,ps,t),l(e,he,t),l(e,os,t),l(e,we,t),l(e,us,t),l(e,Te,t),l(e,ys,t),l(e,Je,t),l(e,cs,t),l(e,je,t),l(e,ms,t),u(Ue,e,t),l(e,ds,t),l(e,fe,t),l(e,hs,t),u(ge,e,t),l(e,ws,t),l(e,Ce,t),l(e,Ts,t),u(Ie,e,t),l(e,Js,t),l(e,be,t),l(e,js,t),u(Ae,e,t),l(e,Us,t),l(e,$e,t),l(e,fs,t),l(e,ke,t),l(e,gs,t),u(I,e,t),l(e,Cs,t),l(e,ve,t),l(e,Is,t),u(xe,e,t),l(e,bs,t),l(e,Ze,t),l(e,As,t),u(We,e,t),l(e,$s,t),l(e,_e,t),l(e,ks,t),u(Be,e,t),l(e,vs,t),u(b,e,t),l(e,xs,t),l(e,Ne,t),l(e,Zs,t),u(Qe,e,t),l(e,Ws,t),l(e,Ee,t),l(e,_s,t),u(Re,e,t),l(e,Bs,t),u(Ge,e,t),l(e,Ns,t),l(e,ze,t),l(e,Qs,t),u(Ye,e,t),l(e,Es,t),l(e,Fe,t),l(e,Rs,t),u(Ve,e,t),l(e,Gs,t),l(e,Xe,t),l(e,zs,t),l(e,He,t),l(e,Ys,t),l(e,Se,t),l(e,Fs,t),u(De,e,t),l(e,Vs,t),l(e,qe,t),l(e,Xs,t),u(Le,e,t),l(e,Hs,t),l(e,Pe,t),l(e,Ss,t),u(Oe,e,t),l(e,Ds,t),u(A,e,t),l(e,qs,t),l(e,Ke,t),l(e,Ls,t),u(et,e,t),l(e,Ps,t),l(e,tt,t),l(e,Os,t),u(st,e,t),l(e,Ks,t),u($,e,t),l(e,el,t),l(e,lt,t),l(e,tl,t),u(at,e,t),l(e,sl,t),l(e,nt,t),l(e,ll,t),l(e,it,t),l(e,al,t),l(e,rt,t),l(e,nl,t),u(Mt,e,t),l(e,il,t),l(e,pt,t),l(e,rl,t),u(ot,e,t),l(e,Ml,t),l(e,ut,t),l(e,pl,t),u(yt,e,t),l(e,ol,t),l(e,ct,t),l(e,ul,t),u(mt,e,t),l(e,yl,t),u(dt,e,t),l(e,cl,t),l(e,ht,t),l(e,ml,t),l(e,wt,t),l(e,dl,t),u(Tt,e,t),l(e,hl,t),l(e,Jt,t),wl=!0},p(e,[t]){const ja={};t&2&&(ja.$$scope={dirty:t,ctx:e}),C.$set(ja);const Ua={};t&2&&(Ua.$$scope={dirty:t,ctx:e}),I.$set(Ua);const fa={};t&2&&(fa.$$scope={dirty:t,ctx:e}),b.$set(fa);const ga={};t&2&&(ga.$$scope={dirty:t,ctx:e}),A.$set(ga);const Ca={};t&2&&(Ca.$$scope={dirty:t,ctx:e}),$.$set(Ca)},i(e){wl||(y(v.$$.fragment,e),y(x.$$.fragment,e),y(W.$$.fragment,e),y(B.$$.fragment,e),y(Q.$$.fragment,e),y(C.$$.fragment,e),y(R.$$.fragment,e),y(z.$$.fragment,e),y(F.$$.fragment,e),y(X.$$.fragment,e),y(S.$$.fragment,e),y(q.$$.fragment,e),y(P.$$.fragment,e),y(K.$$.fragment,e),y(te.$$.fragment,e),y(se.$$.fragment,e),y(ae.$$.fragment,e),y(ie.$$.fragment,e),y(Me.$$.fragment,e),y(oe.$$.fragment,e),y(ye.$$.fragment,e),y(me.$$.fragment,e),y(Ue.$$.fragment,e),y(ge.$$.fragment,e),y(Ie.$$.fragment,e),y(Ae.$$.fragment,e),y(I.$$.fragment,e),y(xe.$$.fragment,e),y(We.$$.fragment,e),y(Be.$$.fragment,e),y(b.$$.fragment,e),y(Qe.$$.fragment,e),y(Re.$$.fragment,e),y(Ge.$$.fragment,e),y(Ye.$$.fragment,e),y(Ve.$$.fragment,e),y(De.$$.fragment,e),y(Le.$$.fragment,e),y(Oe.$$.fragment,e),y(A.$$.fragment,e),y(et.$$.fragment,e),y(st.$$.fragment,e),y($.$$.fragment,e),y(at.$$.fragment,e),y(Mt.$$.fragment,e),y(ot.$$.fragment,e),y(yt.$$.fragment,e),y(mt.$$.fragment,e),y(dt.$$.fragment,e),y(Tt.$$.fragment,e),wl=!0)},o(e){c(v.$$.fragment,e),c(x.$$.fragment,e),c(W.$$.fragment,e),c(B.$$.fragment,e),c(Q.$$.fragment,e),c(C.$$.fragment,e),c(R.$$.fragment,e),c(z.$$.fragment,e),c(F.$$.fragment,e),c(X.$$.fragment,e),c(S.$$.fragment,e),c(q.$$.fragment,e),c(P.$$.fragment,e),c(K.$$.fragment,e),c(te.$$.fragment,e),c(se.$$.fragment,e),c(ae.$$.fragment,e),c(ie.$$.fragment,e),c(Me.$$.fragment,e),c(oe.$$.fragment,e),c(ye.$$.fragment,e),c(me.$$.fragment,e),c(Ue.$$.fragment,e),c(ge.$$.fragment,e),c(Ie.$$.fragment,e),c(Ae.$$.fragment,e),c(I.$$.fragment,e),c(xe.$$.fragment,e),c(We.$$.fragment,e),c(Be.$$.fragment,e),c(b.$$.fragment,e),c(Qe.$$.fragment,e),c(Re.$$.fragment,e),c(Ge.$$.fragment,e),c(Ye.$$.fragment,e),c(Ve.$$.fragment,e),c(De.$$.fragment,e),c(Le.$$.fragment,e),c(Oe.$$.fragment,e),c(A.$$.fragment,e),c(et.$$.fragment,e),c(st.$$.fragment,e),c($.$$.fragment,e),c(at.$$.fragment,e),c(Mt.$$.fragment,e),c(ot.$$.fragment,e),c(yt.$$.fragment,e),c(mt.$$.fragment,e),c(dt.$$.fragment,e),c(Tt.$$.fragment,e),wl=!1},d(e){e&&(s(T),s(w),s(g),s(Ut),s(ft),s(Z),s(gt),s(Ct),s(_),s(It),s(bt),s(N),s(At),s($t),s(kt),s(E),s(vt),s(xt),s(G),s(Zt),s(Wt),s(Y),s(_t),s(Bt),s(V),s(Nt),s(Qt),s(H),s(Et),s(Rt),s(D),s(Gt),s(zt),s(L),s(Yt),s(Ft),s(j),s(Vt),s(O),s(Xt),s(Ht),s(ee),s(St),s(U),s(Dt),s(qt),s(Lt),s(le),s(Pt),s(Ot),s(ne),s(Kt),s(es),s(re),s(ts),s(ss),s(pe),s(ls),s(as),s(ue),s(ns),s(is),s(ce),s(rs),s(Ms),s(de),s(ps),s(he),s(os),s(we),s(us),s(Te),s(ys),s(Je),s(cs),s(je),s(ms),s(ds),s(fe),s(hs),s(ws),s(Ce),s(Ts),s(Js),s(be),s(js),s(Us),s($e),s(fs),s(ke),s(gs),s(Cs),s(ve),s(Is),s(bs),s(Ze),s(As),s($s),s(_e),s(ks),s(vs),s(xs),s(Ne),s(Zs),s(Ws),s(Ee),s(_s),s(Bs),s(Ns),s(ze),s(Qs),s(Es),s(Fe),s(Rs),s(Gs),s(Xe),s(zs),s(He),s(Ys),s(Se),s(Fs),s(Vs),s(qe),s(Xs),s(Hs),s(Pe),s(Ss),s(Ds),s(qs),s(Ke),s(Ls),s(Ps),s(tt),s(Os),s(Ks),s(el),s(lt),s(tl),s(sl),s(nt),s(ll),s(it),s(al),s(rt),s(nl),s(il),s(pt),s(rl),s(Ml),s(ut),s(pl),s(ol),s(ct),s(ul),s(yl),s(cl),s(ht),s(ml),s(wt),s(dl),s(hl),s(Jt)),s(d),m(v,e),m(x,e),m(W,e),m(B,e),m(Q,e),m(C,e),m(R,e),m(z,e),m(F,e),m(X,e),m(S,e),m(q,e),m(P,e),m(K,e),m(te,e),m(se,e),m(ae,e),m(ie,e),m(Me,e),m(oe,e),m(ye,e),m(me,e),m(Ue,e),m(ge,e),m(Ie,e),m(Ae,e),m(I,e),m(xe,e),m(We,e),m(Be,e),m(b,e),m(Qe,e),m(Re,e),m(Ge,e),m(Ye,e),m(Ve,e),m(De,e),m(Le,e),m(Oe,e),m(A,e),m(et,e),m(st,e),m($,e),m(at,e),m(Mt,e),m(ot,e),m(yt,e),m(mt,e),m(dt,e),m(Tt,e)}}}const Ya='{"title":"Fine-tuning a model for music classification","local":"fine-tuning-a-model-for-music-classification","sections":[{"title":"The Dataset","local":"the-dataset","sections":[],"depth":2},{"title":"Picking a pretrained model for audio classification","local":"picking-a-pretrained-model-for-audio-classification","sections":[],"depth":2},{"title":"From audio to machine learning features","local":"from-audio-to-machine-learning-features","sections":[],"depth":2},{"title":"Preprocessing the data","local":"preprocessing-the-data","sections":[],"depth":2},{"title":"Fine-tuning the model","local":"fine-tuning-the-model","sections":[],"depth":2},{"title":"Share Model","local":"share-model","sections":[],"depth":2},{"title":"Conclusion","local":"conclusion","sections":[],"depth":2}],"depth":1}';function Fa(f){return Aa(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class qa extends $a{constructor(d){super(),ka(this,d,Fa,za,ba,{})}}export{qa as component};
