import{s as Ft,o as Qt,n as re}from"../chunks/scheduler.9bc65507.js";import{S as Lt,i as qt,g as $,s as i,r as d,A as St,h as w,f as s,c as p,j as Ht,u as h,x as T,k as Nt,y as At,a as l,v as u,d as y,t as g,w as b,m as Et,n as zt}from"../chunks/index.707bf1b6.js";import{T as Fe}from"../chunks/Tip.c2ecdbf4.js";import{Y as Pt}from"../chunks/Youtube.e1129c6f.js";import{C}from"../chunks/CodeBlock.54a9f38d.js";import{D as Dt}from"../chunks/DocNotebookDropdown.41f65cb5.js";import{F as _t,M as Ne}from"../chunks/Markdown.fef84341.js";import{H as He,E as Kt}from"../chunks/EditOnGithub.922df6ba.js";function Ot(k){let t,m,a='<a href="../model_doc/albert">ALBERT</a>, <a href="../model_doc/bart">BART</a>, <a href="../model_doc/bert">BERT</a>, <a href="../model_doc/big_bird">BigBird</a>, <a href="../model_doc/bigbird_pegasus">BigBird-Pegasus</a>, <a href="../model_doc/biogpt">BioGpt</a>, <a href="../model_doc/bloom">BLOOM</a>, <a href="../model_doc/camembert">CamemBERT</a>, <a href="../model_doc/canine">CANINE</a>, <a href="../model_doc/code_llama">CodeLlama</a>, <a href="../model_doc/convbert">ConvBERT</a>, <a href="../model_doc/ctrl">CTRL</a>, <a href="../model_doc/data2vec-text">Data2VecText</a>, <a href="../model_doc/deberta">DeBERTa</a>, <a href="../model_doc/deberta-v2">DeBERTa-v2</a>, <a href="../model_doc/distilbert">DistilBERT</a>, <a href="../model_doc/electra">ELECTRA</a>, <a href="../model_doc/ernie">ERNIE</a>, <a href="../model_doc/ernie_m">ErnieM</a>, <a href="../model_doc/esm">ESM</a>, <a href="../model_doc/falcon">Falcon</a>, <a href="../model_doc/flaubert">FlauBERT</a>, <a href="../model_doc/fnet">FNet</a>, <a href="../model_doc/funnel">Funnel Transformer</a>, <a href="../model_doc/gemma">Gemma</a>, <a href="../model_doc/gpt-sw3">GPT-Sw3</a>, <a href="../model_doc/gpt2">OpenAI GPT-2</a>, <a href="../model_doc/gpt_bigcode">GPTBigCode</a>, <a href="../model_doc/gpt_neo">GPT Neo</a>, <a href="../model_doc/gpt_neox">GPT NeoX</a>, <a href="../model_doc/gptj">GPT-J</a>, <a href="../model_doc/ibert">I-BERT</a>, <a href="../model_doc/jamba">Jamba</a>, <a href="../model_doc/layoutlm">LayoutLM</a>, <a href="../model_doc/layoutlmv2">LayoutLMv2</a>, <a href="../model_doc/layoutlmv3">LayoutLMv3</a>, <a href="../model_doc/led">LED</a>, <a href="../model_doc/lilt">LiLT</a>, <a href="../model_doc/llama">LLaMA</a>, <a href="../model_doc/longformer">Longformer</a>, <a href="../model_doc/luke">LUKE</a>, <a href="../model_doc/markuplm">MarkupLM</a>, <a href="../model_doc/mbart">mBART</a>, <a href="../model_doc/mega">MEGA</a>, <a href="../model_doc/megatron-bert">Megatron-BERT</a>, <a href="../model_doc/mistral">Mistral</a>, <a href="../model_doc/mixtral">Mixtral</a>, <a href="../model_doc/mobilebert">MobileBERT</a>, <a href="../model_doc/mpnet">MPNet</a>, <a href="../model_doc/mpt">MPT</a>, <a href="../model_doc/mra">MRA</a>, <a href="../model_doc/mt5">MT5</a>, <a href="../model_doc/mvp">MVP</a>, <a href="../model_doc/nezha">Nezha</a>, <a href="../model_doc/nystromformer">Nyströmformer</a>, <a href="../model_doc/open-llama">OpenLlama</a>, <a href="../model_doc/openai-gpt">OpenAI GPT</a>, <a href="../model_doc/opt">OPT</a>, <a href="../model_doc/perceiver">Perceiver</a>, <a href="../model_doc/persimmon">Persimmon</a>, <a href="../model_doc/phi">Phi</a>, <a href="../model_doc/plbart">PLBart</a>, <a href="../model_doc/qdqbert">QDQBert</a>, <a href="../model_doc/qwen2">Qwen2</a>, <a href="../model_doc/qwen2_moe">Qwen2MoE</a>, <a href="../model_doc/reformer">Reformer</a>, <a href="../model_doc/rembert">RemBERT</a>, <a href="../model_doc/roberta">RoBERTa</a>, <a href="../model_doc/roberta-prelayernorm">RoBERTa-PreLayerNorm</a>, <a href="../model_doc/roc_bert">RoCBert</a>, <a href="../model_doc/roformer">RoFormer</a>, <a href="../model_doc/squeezebert">SqueezeBERT</a>, <a href="../model_doc/stablelm">StableLm</a>, <a href="../model_doc/starcoder2">Starcoder2</a>, <a href="../model_doc/t5">T5</a>, <a href="../model_doc/tapas">TAPAS</a>, <a href="../model_doc/transfo-xl">Transformer-XL</a>, <a href="../model_doc/umt5">UMT5</a>, <a href="../model_doc/xlm">XLM</a>, <a href="../model_doc/xlm-roberta">XLM-RoBERTa</a>, <a href="../model_doc/xlm-roberta-xl">XLM-RoBERTa-XL</a>, <a href="../model_doc/xlnet">XLNet</a>, <a href="../model_doc/xmod">X-MOD</a>, <a href="../model_doc/yoso">YOSO</a>';return{c(){t=Et(`The task illustrated in this tutorial is supported by the following model architectures:

`),m=$("p"),m.innerHTML=a},l(c){t=zt(c,`The task illustrated in this tutorial is supported by the following model architectures:

`),m=w(c,"P",{"data-svelte-h":!0}),T(m)!=="svelte-1byjawz"&&(m.innerHTML=a)},m(c,M){l(c,t,M),l(c,m,M)},p:re,d(c){c&&(s(t),s(m))}}}function ea(k){let t,m;return t=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvcldpdGhQYWRkaW5nJTBBJTBBZGF0YV9jb2xsYXRvciUyMCUzRCUyMERhdGFDb2xsYXRvcldpdGhQYWRkaW5nKHRva2VuaXplciUzRHRva2VuaXplcik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorWithPadding

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorWithPadding(tokenizer=tokenizer)`,wrap:!1}}),{c(){d(t.$$.fragment)},l(a){h(t.$$.fragment,a)},m(a,c){u(t,a,c),m=!0},p:re,i(a){m||(y(t.$$.fragment,a),m=!0)},o(a){g(t.$$.fragment,a),m=!1},d(a){b(t,a)}}}function ta(k){let t,m;return t=new Ne({props:{$$slots:{default:[ea]},$$scope:{ctx:k}}}),{c(){d(t.$$.fragment)},l(a){h(t.$$.fragment,a)},m(a,c){u(t,a,c),m=!0},p(a,c){const M={};c&2&&(M.$$scope={dirty:c,ctx:a}),t.$set(M)},i(a){m||(y(t.$$.fragment,a),m=!0)},o(a){g(t.$$.fragment,a),m=!1},d(a){b(t,a)}}}function aa(k){let t,m;return t=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvcldpdGhQYWRkaW5nJTBBJTBBZGF0YV9jb2xsYXRvciUyMCUzRCUyMERhdGFDb2xsYXRvcldpdGhQYWRkaW5nKHRva2VuaXplciUzRHRva2VuaXplciUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorWithPadding

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorWithPadding(tokenizer=tokenizer, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`,wrap:!1}}),{c(){d(t.$$.fragment)},l(a){h(t.$$.fragment,a)},m(a,c){u(t,a,c),m=!0},p:re,i(a){m||(y(t.$$.fragment,a),m=!0)},o(a){g(t.$$.fragment,a),m=!1},d(a){b(t,a)}}}function sa(k){let t,m;return t=new Ne({props:{$$slots:{default:[aa]},$$scope:{ctx:k}}}),{c(){d(t.$$.fragment)},l(a){h(t.$$.fragment,a)},m(a,c){u(t,a,c),m=!0},p(a,c){const M={};c&2&&(M.$$scope={dirty:c,ctx:a}),t.$set(M)},i(a){m||(y(t.$$.fragment,a),m=!0)},o(a){g(t.$$.fragment,a),m=!1},d(a){b(t,a)}}}function la(k){let t,m='If you aren’t familiar with finetuning a model with the <a href="/docs/transformers/v4.40.2/en/main_classes/trainer#transformers.Trainer">Trainer</a>, take a look at the basic tutorial <a href="../training#train-with-pytorch-trainer">here</a>!';return{c(){t=$("p"),t.innerHTML=m},l(a){t=w(a,"P",{"data-svelte-h":!0}),T(t)!=="svelte-k4rvf7"&&(t.innerHTML=m)},m(a,c){l(a,t,c)},p:re,d(a){a&&s(t)}}}function na(k){let t,m='<a href="/docs/transformers/v4.40.2/en/main_classes/trainer#transformers.Trainer">Trainer</a> applies dynamic padding by default when you pass <code>tokenizer</code> to it. In this case, you don’t need to specify a data collator explicitly.';return{c(){t=$("p"),t.innerHTML=m},l(a){t=w(a,"P",{"data-svelte-h":!0}),T(t)!=="svelte-345b95"&&(t.innerHTML=m)},m(a,c){l(a,t,c)},p:re,d(a){a&&s(t)}}}function ra(k){let t,m,a,c='You’re ready to start training your model now! Load DistilBERT with <a href="/docs/transformers/v4.40.2/en/model_doc/auto#transformers.AutoModelForSequenceClassification">AutoModelForSequenceClassification</a> along with the number of expected labels, and the label mappings:',M,v,V,W,Z="At this point, only three steps remain:",x,U,H='<li>Define your training hyperparameters in <a href="/docs/transformers/v4.40.2/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a>. The only required parameter is <code>output_dir</code> which specifies where to save your model. You’ll push this model to the Hub by setting <code>push_to_hub=True</code> (you need to be signed in to Hugging Face to upload your model). At the end of each epoch, the <a href="/docs/transformers/v4.40.2/en/main_classes/trainer#transformers.Trainer">Trainer</a> will evaluate the accuracy and save the training checkpoint.</li> <li>Pass the training arguments to <a href="/docs/transformers/v4.40.2/en/main_classes/trainer#transformers.Trainer">Trainer</a> along with the model, dataset, tokenizer, data collator, and <code>compute_metrics</code> function.</li> <li>Call <a href="/docs/transformers/v4.40.2/en/main_classes/trainer#transformers.Trainer.train">train()</a> to finetune your model.</li>',R,J,X,o,j,B,F='Once training is completed, share your model to the Hub with the <a href="/docs/transformers/v4.40.2/en/main_classes/trainer#transformers.Trainer.push_to_hub">push_to_hub()</a> method so everyone can use your model:',I,N,Y;return t=new Fe({props:{$$slots:{default:[la]},$$scope:{ctx:k}}}),v=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMkMlMjBUcmFpbmluZ0FyZ3VtZW50cyUyQyUyMFRyYWluZXIlMEElMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmRpc3RpbGJlcnQlMkZkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMiUyQyUyMG51bV9sYWJlbHMlM0QyJTJDJTIwaWQybGFiZWwlM0RpZDJsYWJlbCUyQyUyMGxhYmVsMmlkJTNEbGFiZWwyaWQlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForSequenceClassification, TrainingArguments, Trainer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;distilbert/distilbert-base-uncased&quot;</span>, num_labels=<span class="hljs-number">2</span>, id2label=id2label, label2id=label2id
<span class="hljs-meta">... </span>)`,wrap:!1}}),J=new C({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJteV9hd2Vzb21lX21vZGVsJTIyJTJDJTBBJTIwJTIwJTIwJTIwbGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMEElMjAlMjAlMjAlMjBwZXJfZGV2aWNlX3RyYWluX2JhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMHBlcl9kZXZpY2VfZXZhbF9iYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBudW1fdHJhaW5fZXBvY2hzJTNEMiUyQyUwQSUyMCUyMCUyMCUyMHdlaWdodF9kZWNheSUzRDAuMDElMkMlMEElMjAlMjAlMjAlMjBldmFsdWF0aW9uX3N0cmF0ZWd5JTNEJTIyZXBvY2glMjIlMkMlMEElMjAlMjAlMjAlMjBzYXZlX3N0cmF0ZWd5JTNEJTIyZXBvY2glMjIlMkMlMEElMjAlMjAlMjAlMjBsb2FkX2Jlc3RfbW9kZWxfYXRfZW5kJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMHB1c2hfdG9faHViJTNEVHJ1ZSUyQyUwQSklMEElMEF0cmFpbmVyJTIwJTNEJTIwVHJhaW5lciglMEElMjAlMjAlMjAlMjBtb2RlbCUzRG1vZGVsJTJDJTBBJTIwJTIwJTIwJTIwYXJncyUzRHRyYWluaW5nX2FyZ3MlMkMlMEElMjAlMjAlMjAlMjB0cmFpbl9kYXRhc2V0JTNEdG9rZW5pemVkX2ltZGIlNUIlMjJ0cmFpbiUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMGV2YWxfZGF0YXNldCUzRHRva2VuaXplZF9pbWRiJTVCJTIydGVzdCUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHRva2VuaXplciUzRHRva2VuaXplciUyQyUwQSUyMCUyMCUyMCUyMGRhdGFfY29sbGF0b3IlM0RkYXRhX2NvbGxhdG9yJTJDJTBBJTIwJTIwJTIwJTIwY29tcHV0ZV9tZXRyaWNzJTNEY29tcHV0ZV9tZXRyaWNzJTJDJTBBKSUwQSUwQXRyYWluZXIudHJhaW4oKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>training_args = TrainingArguments(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;my_awesome_model&quot;</span>,
<span class="hljs-meta">... </span>    learning_rate=<span class="hljs-number">2e-5</span>,
<span class="hljs-meta">... </span>    per_device_train_batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    per_device_eval_batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    num_train_epochs=<span class="hljs-number">2</span>,
<span class="hljs-meta">... </span>    weight_decay=<span class="hljs-number">0.01</span>,
<span class="hljs-meta">... </span>    evaluation_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
<span class="hljs-meta">... </span>    save_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
<span class="hljs-meta">... </span>    load_best_model_at_end=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    push_to_hub=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.train()`,wrap:!1}}),o=new Fe({props:{$$slots:{default:[na]},$$scope:{ctx:k}}}),N=new C({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){d(t.$$.fragment),m=i(),a=$("p"),a.innerHTML=c,M=i(),d(v.$$.fragment),V=i(),W=$("p"),W.textContent=Z,x=i(),U=$("ol"),U.innerHTML=H,R=i(),d(J.$$.fragment),X=i(),d(o.$$.fragment),j=i(),B=$("p"),B.innerHTML=F,I=i(),d(N.$$.fragment)},l(f){h(t.$$.fragment,f),m=p(f),a=w(f,"P",{"data-svelte-h":!0}),T(a)!=="svelte-1iud4vj"&&(a.innerHTML=c),M=p(f),h(v.$$.fragment,f),V=p(f),W=w(f,"P",{"data-svelte-h":!0}),T(W)!=="svelte-l42k0i"&&(W.textContent=Z),x=p(f),U=w(f,"OL",{"data-svelte-h":!0}),T(U)!=="svelte-1d8phhh"&&(U.innerHTML=H),R=p(f),h(J.$$.fragment,f),X=p(f),h(o.$$.fragment,f),j=p(f),B=w(f,"P",{"data-svelte-h":!0}),T(B)!=="svelte-4h48xz"&&(B.innerHTML=F),I=p(f),h(N.$$.fragment,f)},m(f,G){u(t,f,G),l(f,m,G),l(f,a,G),l(f,M,G),u(v,f,G),l(f,V,G),l(f,W,G),l(f,x,G),l(f,U,G),l(f,R,G),u(J,f,G),l(f,X,G),u(o,f,G),l(f,j,G),l(f,B,G),l(f,I,G),u(N,f,G),Y=!0},p(f,G){const E={};G&2&&(E.$$scope={dirty:G,ctx:f}),t.$set(E);const z={};G&2&&(z.$$scope={dirty:G,ctx:f}),o.$set(z)},i(f){Y||(y(t.$$.fragment,f),y(v.$$.fragment,f),y(J.$$.fragment,f),y(o.$$.fragment,f),y(N.$$.fragment,f),Y=!0)},o(f){g(t.$$.fragment,f),g(v.$$.fragment,f),g(J.$$.fragment,f),g(o.$$.fragment,f),g(N.$$.fragment,f),Y=!1},d(f){f&&(s(m),s(a),s(M),s(V),s(W),s(x),s(U),s(R),s(X),s(j),s(B),s(I)),b(t,f),b(v,f),b(J,f),b(o,f),b(N,f)}}}function oa(k){let t,m;return t=new Ne({props:{$$slots:{default:[ra]},$$scope:{ctx:k}}}),{c(){d(t.$$.fragment)},l(a){h(t.$$.fragment,a)},m(a,c){u(t,a,c),m=!0},p(a,c){const M={};c&2&&(M.$$scope={dirty:c,ctx:a}),t.$set(M)},i(a){m||(y(t.$$.fragment,a),m=!0)},o(a){g(t.$$.fragment,a),m=!1},d(a){b(t,a)}}}function ia(k){let t,m='If you aren’t familiar with finetuning a model with Keras, take a look at the basic tutorial <a href="../training#train-a-tensorflow-model-with-keras">here</a>!';return{c(){t=$("p"),t.innerHTML=m},l(a){t=w(a,"P",{"data-svelte-h":!0}),T(t)!=="svelte-1rd4nl8"&&(t.innerHTML=m)},m(a,c){l(a,t,c)},p:re,d(a){a&&s(t)}}}function pa(k){let t,m,a,c,M,v='Then you can load DistilBERT with <a href="/docs/transformers/v4.40.2/en/model_doc/auto#transformers.TFAutoModelForSequenceClassification">TFAutoModelForSequenceClassification</a> along with the number of expected labels, and the label mappings:',V,W,Z,x,U='Convert your datasets to the <code>tf.data.Dataset</code> format with <a href="/docs/transformers/v4.40.2/en/main_classes/model#transformers.TFPreTrainedModel.prepare_tf_dataset">prepare_tf_dataset()</a>:',H,R,J,X,o='Configure the model for training with <a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a>. Note that Transformers models all have a default task-relevant loss function, so you don’t need to specify one unless you want to:',j,B,F,I,N='The last two things to setup before you start training is to compute the accuracy from the predictions, and provide a way to push your model to the Hub. Both are done by using <a href="../main_classes/keras_callbacks">Keras callbacks</a>.',Y,f,G='Pass your <code>compute_metrics</code> function to <a href="/docs/transformers/v4.40.2/en/main_classes/keras_callbacks#transformers.KerasMetricCallback">KerasMetricCallback</a>:',E,z,Q,ae,ce='Specify where to push your model and tokenizer in the <a href="/docs/transformers/v4.40.2/en/main_classes/keras_callbacks#transformers.PushToHubCallback">PushToHubCallback</a>:',L,q,S,A,se="Then bundle your callbacks together:",fe,P,D,K,le='Finally, you’re ready to start training your model! Call <a href="https://keras.io/api/models/model_training_apis/#fit-method" rel="nofollow"><code>fit</code></a> with your training and validation datasets, the number of epochs, and your callbacks to finetune the model:',de,O,ee,te,ne="Once training is completed, your model is automatically uploaded to the Hub so everyone can use it!",he;return t=new Fe({props:{$$slots:{default:[ia]},$$scope:{ctx:k}}}),a=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMGNyZWF0ZV9vcHRpbWl6ZXIlMEFpbXBvcnQlMjB0ZW5zb3JmbG93JTIwYXMlMjB0ZiUwQSUwQWJhdGNoX3NpemUlMjAlM0QlMjAxNiUwQW51bV9lcG9jaHMlMjAlM0QlMjA1JTBBYmF0Y2hlc19wZXJfZXBvY2glMjAlM0QlMjBsZW4odG9rZW5pemVkX2ltZGIlNUIlMjJ0cmFpbiUyMiU1RCklMjAlMkYlMkYlMjBiYXRjaF9zaXplJTBBdG90YWxfdHJhaW5fc3RlcHMlMjAlM0QlMjBpbnQoYmF0Y2hlc19wZXJfZXBvY2glMjAqJTIwbnVtX2Vwb2NocyklMEFvcHRpbWl6ZXIlMkMlMjBzY2hlZHVsZSUyMCUzRCUyMGNyZWF0ZV9vcHRpbWl6ZXIoaW5pdF9sciUzRDJlLTUlMkMlMjBudW1fd2FybXVwX3N0ZXBzJTNEMCUyQyUyMG51bV90cmFpbl9zdGVwcyUzRHRvdGFsX3RyYWluX3N0ZXBzKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> create_optimizer
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

<span class="hljs-meta">&gt;&gt;&gt; </span>batch_size = <span class="hljs-number">16</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_epochs = <span class="hljs-number">5</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>batches_per_epoch = <span class="hljs-built_in">len</span>(tokenized_imdb[<span class="hljs-string">&quot;train&quot;</span>]) // batch_size
<span class="hljs-meta">&gt;&gt;&gt; </span>total_train_steps = <span class="hljs-built_in">int</span>(batches_per_epoch * num_epochs)
<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer, schedule = create_optimizer(init_lr=<span class="hljs-number">2e-5</span>, num_warmup_steps=<span class="hljs-number">0</span>, num_train_steps=total_train_steps)`,wrap:!1}}),W=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUwQSUwQW1vZGVsJTIwJTNEJTIwVEZBdXRvTW9kZWxGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJkaXN0aWxiZXJ0JTJGZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIlMkMlMjBudW1fbGFiZWxzJTNEMiUyQyUyMGlkMmxhYmVsJTNEaWQybGFiZWwlMkMlMjBsYWJlbDJpZCUzRGxhYmVsMmlkJTBBKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;distilbert/distilbert-base-uncased&quot;</span>, num_labels=<span class="hljs-number">2</span>, id2label=id2label, label2id=label2id
<span class="hljs-meta">... </span>)`,wrap:!1}}),R=new C({props:{code:"dGZfdHJhaW5fc2V0JTIwJTNEJTIwbW9kZWwucHJlcGFyZV90Zl9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMHRva2VuaXplZF9pbWRiJTVCJTIydHJhaW4lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBzaHVmZmxlJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMGJhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMGNvbGxhdGVfZm4lM0RkYXRhX2NvbGxhdG9yJTJDJTBBKSUwQSUwQXRmX3ZhbGlkYXRpb25fc2V0JTIwJTNEJTIwbW9kZWwucHJlcGFyZV90Zl9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMHRva2VuaXplZF9pbWRiJTVCJTIydGVzdCUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHNodWZmbGUlM0RGYWxzZSUyQyUwQSUyMCUyMCUyMCUyMGJhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMGNvbGxhdGVfZm4lM0RkYXRhX2NvbGxhdG9yJTJDJTBBKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tf_train_set = model.prepare_tf_dataset(
<span class="hljs-meta">... </span>    tokenized_imdb[<span class="hljs-string">&quot;train&quot;</span>],
<span class="hljs-meta">... </span>    shuffle=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    collate_fn=data_collator,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>tf_validation_set = model.prepare_tf_dataset(
<span class="hljs-meta">... </span>    tokenized_imdb[<span class="hljs-string">&quot;test&quot;</span>],
<span class="hljs-meta">... </span>    shuffle=<span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>    batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    collate_fn=data_collator,
<span class="hljs-meta">... </span>)`,wrap:!1}}),B=new C({props:{code:"aW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEFtb2RlbC5jb21waWxlKG9wdGltaXplciUzRG9wdGltaXplciklMjAlMjAlMjMlMjBObyUyMGxvc3MlMjBhcmd1bWVudCE=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

<span class="hljs-meta">&gt;&gt;&gt; </span>model.<span class="hljs-built_in">compile</span>(optimizer=optimizer)  <span class="hljs-comment"># No loss argument!</span>`,wrap:!1}}),z=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5rZXJhc19jYWxsYmFja3MlMjBpbXBvcnQlMjBLZXJhc01ldHJpY0NhbGxiYWNrJTBBJTBBbWV0cmljX2NhbGxiYWNrJTIwJTNEJTIwS2VyYXNNZXRyaWNDYWxsYmFjayhtZXRyaWNfZm4lM0Rjb21wdXRlX21ldHJpY3MlMkMlMjBldmFsX2RhdGFzZXQlM0R0Zl92YWxpZGF0aW9uX3NldCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.keras_callbacks <span class="hljs-keyword">import</span> KerasMetricCallback

<span class="hljs-meta">&gt;&gt;&gt; </span>metric_callback = KerasMetricCallback(metric_fn=compute_metrics, eval_dataset=tf_validation_set)`,wrap:!1}}),q=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5rZXJhc19jYWxsYmFja3MlMjBpbXBvcnQlMjBQdXNoVG9IdWJDYWxsYmFjayUwQSUwQXB1c2hfdG9faHViX2NhbGxiYWNrJTIwJTNEJTIwUHVzaFRvSHViQ2FsbGJhY2soJTBBJTIwJTIwJTIwJTIwb3V0cHV0X2RpciUzRCUyMm15X2F3ZXNvbWVfbW9kZWwlMjIlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.keras_callbacks <span class="hljs-keyword">import</span> PushToHubCallback

<span class="hljs-meta">&gt;&gt;&gt; </span>push_to_hub_callback = PushToHubCallback(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;my_awesome_model&quot;</span>,
<span class="hljs-meta">... </span>    tokenizer=tokenizer,
<span class="hljs-meta">... </span>)`,wrap:!1}}),P=new C({props:{code:"Y2FsbGJhY2tzJTIwJTNEJTIwJTVCbWV0cmljX2NhbGxiYWNrJTJDJTIwcHVzaF90b19odWJfY2FsbGJhY2slNUQ=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>callbacks = [metric_callback, push_to_hub_callback]',wrap:!1}}),O=new C({props:{code:"bW9kZWwuZml0KHglM0R0Zl90cmFpbl9zZXQlMkMlMjB2YWxpZGF0aW9uX2RhdGElM0R0Zl92YWxpZGF0aW9uX3NldCUyQyUyMGVwb2NocyUzRDMlMkMlMjBjYWxsYmFja3MlM0RjYWxsYmFja3Mp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model.fit(x=tf_train_set, validation_data=tf_validation_set, epochs=<span class="hljs-number">3</span>, callbacks=callbacks)',wrap:!1}}),{c(){d(t.$$.fragment),m=Et(`
To finetune a model in TensorFlow, start by setting up an optimizer function, learning rate schedule, and some training hyperparameters:

	`),d(a.$$.fragment),c=i(),M=$("p"),M.innerHTML=v,V=i(),d(W.$$.fragment),Z=i(),x=$("p"),x.innerHTML=U,H=i(),d(R.$$.fragment),J=i(),X=$("p"),X.innerHTML=o,j=i(),d(B.$$.fragment),F=i(),I=$("p"),I.innerHTML=N,Y=i(),f=$("p"),f.innerHTML=G,E=i(),d(z.$$.fragment),Q=i(),ae=$("p"),ae.innerHTML=ce,L=i(),d(q.$$.fragment),S=i(),A=$("p"),A.textContent=se,fe=i(),d(P.$$.fragment),D=i(),K=$("p"),K.innerHTML=le,de=i(),d(O.$$.fragment),ee=i(),te=$("p"),te.textContent=ne},l(r){h(t.$$.fragment,r),m=zt(r,`
To finetune a model in TensorFlow, start by setting up an optimizer function, learning rate schedule, and some training hyperparameters:

	`),h(a.$$.fragment,r),c=p(r),M=w(r,"P",{"data-svelte-h":!0}),T(M)!=="svelte-i9slip"&&(M.innerHTML=v),V=p(r),h(W.$$.fragment,r),Z=p(r),x=w(r,"P",{"data-svelte-h":!0}),T(x)!=="svelte-zrcny4"&&(x.innerHTML=U),H=p(r),h(R.$$.fragment,r),J=p(r),X=w(r,"P",{"data-svelte-h":!0}),T(X)!=="svelte-17cxx5e"&&(X.innerHTML=o),j=p(r),h(B.$$.fragment,r),F=p(r),I=w(r,"P",{"data-svelte-h":!0}),T(I)!=="svelte-6l1wkp"&&(I.innerHTML=N),Y=p(r),f=w(r,"P",{"data-svelte-h":!0}),T(f)!=="svelte-j3rmri"&&(f.innerHTML=G),E=p(r),h(z.$$.fragment,r),Q=p(r),ae=w(r,"P",{"data-svelte-h":!0}),T(ae)!=="svelte-2fuhy0"&&(ae.innerHTML=ce),L=p(r),h(q.$$.fragment,r),S=p(r),A=w(r,"P",{"data-svelte-h":!0}),T(A)!=="svelte-1lw9xm8"&&(A.textContent=se),fe=p(r),h(P.$$.fragment,r),D=p(r),K=w(r,"P",{"data-svelte-h":!0}),T(K)!=="svelte-1hrpv1v"&&(K.innerHTML=le),de=p(r),h(O.$$.fragment,r),ee=p(r),te=w(r,"P",{"data-svelte-h":!0}),T(te)!=="svelte-2s71om"&&(te.textContent=ne)},m(r,_){u(t,r,_),l(r,m,_),u(a,r,_),l(r,c,_),l(r,M,_),l(r,V,_),u(W,r,_),l(r,Z,_),l(r,x,_),l(r,H,_),u(R,r,_),l(r,J,_),l(r,X,_),l(r,j,_),u(B,r,_),l(r,F,_),l(r,I,_),l(r,Y,_),l(r,f,_),l(r,E,_),u(z,r,_),l(r,Q,_),l(r,ae,_),l(r,L,_),u(q,r,_),l(r,S,_),l(r,A,_),l(r,fe,_),u(P,r,_),l(r,D,_),l(r,K,_),l(r,de,_),u(O,r,_),l(r,ee,_),l(r,te,_),he=!0},p(r,_){const Ee={};_&2&&(Ee.$$scope={dirty:_,ctx:r}),t.$set(Ee)},i(r){he||(y(t.$$.fragment,r),y(a.$$.fragment,r),y(W.$$.fragment,r),y(R.$$.fragment,r),y(B.$$.fragment,r),y(z.$$.fragment,r),y(q.$$.fragment,r),y(P.$$.fragment,r),y(O.$$.fragment,r),he=!0)},o(r){g(t.$$.fragment,r),g(a.$$.fragment,r),g(W.$$.fragment,r),g(R.$$.fragment,r),g(B.$$.fragment,r),g(z.$$.fragment,r),g(q.$$.fragment,r),g(P.$$.fragment,r),g(O.$$.fragment,r),he=!1},d(r){r&&(s(m),s(c),s(M),s(V),s(Z),s(x),s(H),s(J),s(X),s(j),s(F),s(I),s(Y),s(f),s(E),s(Q),s(ae),s(L),s(S),s(A),s(fe),s(D),s(K),s(de),s(ee),s(te)),b(t,r),b(a,r),b(W,r),b(R,r),b(B,r),b(z,r),b(q,r),b(P,r),b(O,r)}}}function ma(k){let t,m;return t=new Ne({props:{$$slots:{default:[pa]},$$scope:{ctx:k}}}),{c(){d(t.$$.fragment)},l(a){h(t.$$.fragment,a)},m(a,c){u(t,a,c),m=!0},p(a,c){const M={};c&2&&(M.$$scope={dirty:c,ctx:a}),t.$set(M)},i(a){m||(y(t.$$.fragment,a),m=!0)},o(a){g(t.$$.fragment,a),m=!1},d(a){b(t,a)}}}function ca(k){let t,m=`For a more in-depth example of how to finetune a model for text classification, take a look at the corresponding
<a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification.ipynb" rel="nofollow">PyTorch notebook</a>
or <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification-tf.ipynb" rel="nofollow">TensorFlow notebook</a>.`;return{c(){t=$("p"),t.innerHTML=m},l(a){t=w(a,"P",{"data-svelte-h":!0}),T(t)!=="svelte-m6bho8"&&(t.innerHTML=m)},m(a,c){l(a,t,c)},p:re,d(a){a&&s(t)}}}function fa(k){let t,m="Tokenize the text and return PyTorch tensors:",a,c,M,v,V="Pass your inputs to the model and return the <code>logits</code>:",W,Z,x,U,H="Get the class with the highest probability, and use the model’s <code>id2label</code> mapping to convert it to a text label:",R,J,X;return c=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJzdGV2aGxpdSUyRm15X2F3ZXNvbWVfbW9kZWwlMjIpJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;stevhliu/my_awesome_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)`,wrap:!1}}),Z=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEElMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMnN0ZXZobGl1JTJGbXlfYXdlc29tZV9tb2RlbCUyMiklMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;stevhliu/my_awesome_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits`,wrap:!1}}),J=new C({props:{code:"cHJlZGljdGVkX2NsYXNzX2lkJTIwJTNEJTIwbG9naXRzLmFyZ21heCgpLml0ZW0oKSUwQW1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnByZWRpY3RlZF9jbGFzc19pZCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_id = logits.argmax().item()
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.id2label[predicted_class_id]
<span class="hljs-string">&#x27;POSITIVE&#x27;</span>`,wrap:!1}}),{c(){t=$("p"),t.textContent=m,a=i(),d(c.$$.fragment),M=i(),v=$("p"),v.innerHTML=V,W=i(),d(Z.$$.fragment),x=i(),U=$("p"),U.innerHTML=H,R=i(),d(J.$$.fragment)},l(o){t=w(o,"P",{"data-svelte-h":!0}),T(t)!=="svelte-1qcz1wr"&&(t.textContent=m),a=p(o),h(c.$$.fragment,o),M=p(o),v=w(o,"P",{"data-svelte-h":!0}),T(v)!=="svelte-f3g043"&&(v.innerHTML=V),W=p(o),h(Z.$$.fragment,o),x=p(o),U=w(o,"P",{"data-svelte-h":!0}),T(U)!=="svelte-6mgrol"&&(U.innerHTML=H),R=p(o),h(J.$$.fragment,o)},m(o,j){l(o,t,j),l(o,a,j),u(c,o,j),l(o,M,j),l(o,v,j),l(o,W,j),u(Z,o,j),l(o,x,j),l(o,U,j),l(o,R,j),u(J,o,j),X=!0},p:re,i(o){X||(y(c.$$.fragment,o),y(Z.$$.fragment,o),y(J.$$.fragment,o),X=!0)},o(o){g(c.$$.fragment,o),g(Z.$$.fragment,o),g(J.$$.fragment,o),X=!1},d(o){o&&(s(t),s(a),s(M),s(v),s(W),s(x),s(U),s(R)),b(c,o),b(Z,o),b(J,o)}}}function da(k){let t,m;return t=new Ne({props:{$$slots:{default:[fa]},$$scope:{ctx:k}}}),{c(){d(t.$$.fragment)},l(a){h(t.$$.fragment,a)},m(a,c){u(t,a,c),m=!0},p(a,c){const M={};c&2&&(M.$$scope={dirty:c,ctx:a}),t.$set(M)},i(a){m||(y(t.$$.fragment,a),m=!0)},o(a){g(t.$$.fragment,a),m=!1},d(a){b(t,a)}}}function ha(k){let t,m="Tokenize the text and return TensorFlow tensors:",a,c,M,v,V="Pass your inputs to the model and return the <code>logits</code>:",W,Z,x,U,H="Get the class with the highest probability, and use the model’s <code>id2label</code> mapping to convert it to a text label:",R,J,X;return c=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJzdGV2aGxpdSUyRm15X2F3ZXNvbWVfbW9kZWwlMjIpJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;stevhliu/my_awesome_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(text, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`,wrap:!1}}),Z=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUwQSUwQW1vZGVsJTIwJTNEJTIwVEZBdXRvTW9kZWxGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJzdGV2aGxpdSUyRm15X2F3ZXNvbWVfbW9kZWwlMjIpJTBBbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;stevhliu/my_awesome_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = model(**inputs).logits`,wrap:!1}}),J=new C({props:{code:"cHJlZGljdGVkX2NsYXNzX2lkJTIwJTNEJTIwaW50KHRmLm1hdGguYXJnbWF4KGxvZ2l0cyUyQyUyMGF4aXMlM0QtMSklNUIwJTVEKSUwQW1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnByZWRpY3RlZF9jbGFzc19pZCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_id = <span class="hljs-built_in">int</span>(tf.math.argmax(logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.id2label[predicted_class_id]
<span class="hljs-string">&#x27;POSITIVE&#x27;</span>`,wrap:!1}}),{c(){t=$("p"),t.textContent=m,a=i(),d(c.$$.fragment),M=i(),v=$("p"),v.innerHTML=V,W=i(),d(Z.$$.fragment),x=i(),U=$("p"),U.innerHTML=H,R=i(),d(J.$$.fragment)},l(o){t=w(o,"P",{"data-svelte-h":!0}),T(t)!=="svelte-s1qr7b"&&(t.textContent=m),a=p(o),h(c.$$.fragment,o),M=p(o),v=w(o,"P",{"data-svelte-h":!0}),T(v)!=="svelte-f3g043"&&(v.innerHTML=V),W=p(o),h(Z.$$.fragment,o),x=p(o),U=w(o,"P",{"data-svelte-h":!0}),T(U)!=="svelte-6mgrol"&&(U.innerHTML=H),R=p(o),h(J.$$.fragment,o)},m(o,j){l(o,t,j),l(o,a,j),u(c,o,j),l(o,M,j),l(o,v,j),l(o,W,j),u(Z,o,j),l(o,x,j),l(o,U,j),l(o,R,j),u(J,o,j),X=!0},p:re,i(o){X||(y(c.$$.fragment,o),y(Z.$$.fragment,o),y(J.$$.fragment,o),X=!0)},o(o){g(c.$$.fragment,o),g(Z.$$.fragment,o),g(J.$$.fragment,o),X=!1},d(o){o&&(s(t),s(a),s(M),s(v),s(W),s(x),s(U),s(R)),b(c,o),b(Z,o),b(J,o)}}}function ua(k){let t,m;return t=new Ne({props:{$$slots:{default:[ha]},$$scope:{ctx:k}}}),{c(){d(t.$$.fragment)},l(a){h(t.$$.fragment,a)},m(a,c){u(t,a,c),m=!0},p(a,c){const M={};c&2&&(M.$$scope={dirty:c,ctx:a}),t.$set(M)},i(a){m||(y(t.$$.fragment,a),m=!0)},o(a){g(t.$$.fragment,a),m=!1},d(a){b(t,a)}}}function ya(k){let t,m,a,c,M,v,V,W,Z,x,U,H="Text classification is a common NLP task that assigns a label or class to text. Some of the largest companies run text classification in production for a wide range of practical applications. One of the most popular forms of text classification is sentiment analysis, which assigns a label like 🙂 positive, 🙁 negative, or 😐 neutral to a sequence of text.",R,J,X="This guide will show you how to:",o,j,B='<li>Finetune <a href="https://huggingface.co/distilbert/distilbert-base-uncased" rel="nofollow">DistilBERT</a> on the <a href="https://huggingface.co/datasets/imdb" rel="nofollow">IMDb</a> dataset to determine whether a movie review is positive or negative.</li> <li>Use your finetuned model for inference.</li>',F,I,N,Y,f="Before you begin, make sure you have all the necessary libraries installed:",G,E,z,Q,ae="We encourage you to login to your Hugging Face account so you can upload and share your model with the community. When prompted, enter your token to login:",ce,L,q,S,A,se,fe="Start by loading the IMDb dataset from the 🤗 Datasets library:",P,D,K,le,de="Then take a look at an example:",O,ee,te,ne,he="There are two fields in this dataset:",r,_,Ee="<li><code>text</code>: the movie review text.</li> <li><code>label</code>: a value that is either <code>0</code> for a negative review or <code>1</code> for a positive review.</li>",Qe,ue,Le,ye,Tt="The next step is to load a DistilBERT tokenizer to preprocess the <code>text</code> field:",qe,ge,Se,be,jt="Create a preprocessing function to tokenize <code>text</code> and truncate sequences to be no longer than DistilBERT’s maximum input length:",Ae,Me,Pe,$e,Jt="To apply the preprocessing function over the entire dataset, use 🤗 Datasets <code>map</code> function. You can speed up <code>map</code> by setting <code>batched=True</code> to process multiple elements of the dataset at once:",De,we,Ke,_e,Ut='Now create a batch of examples using <a href="/docs/transformers/v4.40.2/en/main_classes/data_collator#transformers.DataCollatorWithPadding">DataCollatorWithPadding</a>. It’s more efficient to <em>dynamically pad</em> the sentences to the longest length in a batch during collation, instead of padding the whole dataset to the maximum length.',Oe,oe,et,Te,tt,je,kt='Including a metric during training is often helpful for evaluating your model’s performance. You can quickly load a evaluation method with the 🤗 <a href="https://huggingface.co/docs/evaluate/index" rel="nofollow">Evaluate</a> library. For this task, load the <a href="https://huggingface.co/spaces/evaluate-metric/accuracy" rel="nofollow">accuracy</a> metric (see the 🤗 Evaluate <a href="https://huggingface.co/docs/evaluate/a_quick_tour" rel="nofollow">quick tour</a> to learn more about how to load and compute a metric):',at,Je,st,Ue,vt="Then create a function that passes your predictions and labels to <code>compute</code> to calculate the accuracy:",lt,ke,nt,ve,Zt="Your <code>compute_metrics</code> function is ready to go now, and you’ll return to it when you setup your training.",rt,Ze,ot,Ce,Ct="Before you start training your model, create a map of the expected ids to their labels with <code>id2label</code> and <code>label2id</code>:",it,We,pt,ie,mt,pe,ct,Ge,ft,xe,Wt="Great, now that you’ve finetuned a model, you can use it for inference!",dt,Re,Gt="Grab some text you’d like to run inference on:",ht,Xe,ut,Ve,xt='The simplest way to try out your finetuned model for inference is to use it in a <a href="/docs/transformers/v4.40.2/en/main_classes/pipelines#transformers.pipeline">pipeline()</a>. Instantiate a <code>pipeline</code> for sentiment analysis with your model, and pass your text to it:',yt,Ie,gt,Be,Rt="You can also manually replicate the results of the <code>pipeline</code> if you’d like:",bt,me,Mt,Ye,$t,ze,wt;return M=new He({props:{title:"Text classification",local:"text-classification",headingTag:"h1"}}),V=new Dt({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/sequence_classification.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/sequence_classification.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/tensorflow/sequence_classification.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/sequence_classification.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/sequence_classification.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/tensorflow/sequence_classification.ipynb"}]}}),Z=new Pt({props:{id:"leNG9fN9FQU"}}),I=new Fe({props:{$$slots:{default:[Ot]},$$scope:{ctx:k}}}),E=new C({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGUlMjBhY2NlbGVyYXRl",highlighted:"pip install transformers datasets evaluate accelerate",wrap:!1}}),L=new C({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMG5vdGVib29rX2xvZ2luJTBBJTBBbm90ZWJvb2tfbG9naW4oKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> notebook_login

<span class="hljs-meta">&gt;&gt;&gt; </span>notebook_login()`,wrap:!1}}),S=new He({props:{title:"Load IMDb dataset",local:"load-imdb-dataset",headingTag:"h2"}}),D=new C({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBaW1kYiUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJpbWRiJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>imdb = load_dataset(<span class="hljs-string">&quot;imdb&quot;</span>)`,wrap:!1}}),ee=new C({props:{code:"aW1kYiU1QiUyMnRlc3QlMjIlNUQlNUIwJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>imdb[<span class="hljs-string">&quot;test&quot;</span>][<span class="hljs-number">0</span>]
{
    <span class="hljs-string">&quot;label&quot;</span>: <span class="hljs-number">0</span>,
    <span class="hljs-string">&quot;text&quot;</span>: <span class="hljs-string">&quot;I love sci-fi and am willing to put up with a lot. Sci-fi movies/TV are usually underfunded, under-appreciated and misunderstood. I tried to like this, I really did, but it is to good TV sci-fi as Babylon 5 is to Star Trek (the original). Silly prosthetics, cheap cardboard sets, stilted dialogues, CG that doesn&#x27;t match the background, and painfully one-dimensional characters cannot be overcome with a &#x27;sci-fi&#x27; setting. (I&#x27;m sure there are those of you out there who think Babylon 5 is good sci-fi TV. It&#x27;s not. It&#x27;s clichéd and uninspiring.) While US viewers might like emotion and character development, sci-fi is a genre that does not take itself seriously (cf. Star Trek). It may treat important issues, yet not as a serious philosophy. It&#x27;s really difficult to care about the characters here as they are not simply foolish, just missing a spark of life. Their actions and reactions are wooden and predictable, often painful to watch. The makers of Earth KNOW it&#x27;s rubbish as they have to always say \\&quot;Gene Roddenberry&#x27;s Earth...\\&quot; otherwise people would not continue watching. Roddenberry&#x27;s ashes must be turning in their orbit as this dull, cheap, poorly edited (watching it without advert breaks really brings this home) trudging Trabant of a show lumbers into space. Spoiler. So, kill off a main character. And then bring him back as another actor. Jeeez! Dallas all over again.&quot;</span>,
}`,wrap:!1}}),ue=new He({props:{title:"Preprocess",local:"preprocess",headingTag:"h2"}}),ge=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0JTJGZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;distilbert/distilbert-base-uncased&quot;</span>)`,wrap:!1}}),Me=new C({props:{code:"ZGVmJTIwcHJlcHJvY2Vzc19mdW5jdGlvbihleGFtcGxlcyklM0ElMEElMjAlMjAlMjAlMjByZXR1cm4lMjB0b2tlbml6ZXIoZXhhbXBsZXMlNUIlMjJ0ZXh0JTIyJTVEJTJDJTIwdHJ1bmNhdGlvbiUzRFRydWUp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_function</span>(<span class="hljs-params">examples</span>):
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> tokenizer(examples[<span class="hljs-string">&quot;text&quot;</span>], truncation=<span class="hljs-literal">True</span>)`,wrap:!1}}),we=new C({props:{code:"dG9rZW5pemVkX2ltZGIlMjAlM0QlMjBpbWRiLm1hcChwcmVwcm9jZXNzX2Z1bmN0aW9uJTJDJTIwYmF0Y2hlZCUzRFRydWUp",highlighted:'tokenized_imdb = imdb.<span class="hljs-built_in">map</span>(preprocess_function, batched=<span class="hljs-literal">True</span>)',wrap:!1}}),oe=new _t({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[sa],pytorch:[ta]},$$scope:{ctx:k}}}),Te=new He({props:{title:"Evaluate",local:"evaluate",headingTag:"h2"}}),Je=new C({props:{code:"aW1wb3J0JTIwZXZhbHVhdGUlMEElMEFhY2N1cmFjeSUyMCUzRCUyMGV2YWx1YXRlLmxvYWQoJTIyYWNjdXJhY3klMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> evaluate

<span class="hljs-meta">&gt;&gt;&gt; </span>accuracy = evaluate.load(<span class="hljs-string">&quot;accuracy&quot;</span>)`,wrap:!1}}),ke=new C({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBJTBBJTBBZGVmJTIwY29tcHV0ZV9tZXRyaWNzKGV2YWxfcHJlZCklM0ElMEElMjAlMjAlMjAlMjBwcmVkaWN0aW9ucyUyQyUyMGxhYmVscyUyMCUzRCUyMGV2YWxfcHJlZCUwQSUyMCUyMCUyMCUyMHByZWRpY3Rpb25zJTIwJTNEJTIwbnAuYXJnbWF4KHByZWRpY3Rpb25zJTJDJTIwYXhpcyUzRDEpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwYWNjdXJhY3kuY29tcHV0ZShwcmVkaWN0aW9ucyUzRHByZWRpY3Rpb25zJTJDJTIwcmVmZXJlbmNlcyUzRGxhYmVscyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">compute_metrics</span>(<span class="hljs-params">eval_pred</span>):
<span class="hljs-meta">... </span>    predictions, labels = eval_pred
<span class="hljs-meta">... </span>    predictions = np.argmax(predictions, axis=<span class="hljs-number">1</span>)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> accuracy.compute(predictions=predictions, references=labels)`,wrap:!1}}),Ze=new He({props:{title:"Train",local:"train",headingTag:"h2"}}),We=new C({props:{code:"aWQybGFiZWwlMjAlM0QlMjAlN0IwJTNBJTIwJTIyTkVHQVRJVkUlMjIlMkMlMjAxJTNBJTIwJTIyUE9TSVRJVkUlMjIlN0QlMEFsYWJlbDJpZCUyMCUzRCUyMCU3QiUyMk5FR0FUSVZFJTIyJTNBJTIwMCUyQyUyMCUyMlBPU0lUSVZFJTIyJTNBJTIwMSU3RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>id2label = {<span class="hljs-number">0</span>: <span class="hljs-string">&quot;NEGATIVE&quot;</span>, <span class="hljs-number">1</span>: <span class="hljs-string">&quot;POSITIVE&quot;</span>}
<span class="hljs-meta">&gt;&gt;&gt; </span>label2id = {<span class="hljs-string">&quot;NEGATIVE&quot;</span>: <span class="hljs-number">0</span>, <span class="hljs-string">&quot;POSITIVE&quot;</span>: <span class="hljs-number">1</span>}`,wrap:!1}}),ie=new _t({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[ma],pytorch:[oa]},$$scope:{ctx:k}}}),pe=new Fe({props:{$$slots:{default:[ca]},$$scope:{ctx:k}}}),Ge=new He({props:{title:"Inference",local:"inference",headingTag:"h2"}}),Xe=new C({props:{code:"dGV4dCUyMCUzRCUyMCUyMlRoaXMlMjB3YXMlMjBhJTIwbWFzdGVycGllY2UuJTIwTm90JTIwY29tcGxldGVseSUyMGZhaXRoZnVsJTIwdG8lMjB0aGUlMjBib29rcyUyQyUyMGJ1dCUyMGVudGhyYWxsaW5nJTIwZnJvbSUyMGJlZ2lubmluZyUyMHRvJTIwZW5kLiUyME1pZ2h0JTIwYmUlMjBteSUyMGZhdm9yaXRlJTIwb2YlMjB0aGUlMjB0aHJlZS4lMjI=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;This was a masterpiece. Not completely faithful to the books, but enthralling from beginning to end. Might be my favorite of the three.&quot;</span>',wrap:!1}}),Ie=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBY2xhc3NpZmllciUyMCUzRCUyMHBpcGVsaW5lKCUyMnNlbnRpbWVudC1hbmFseXNpcyUyMiUyQyUyMG1vZGVsJTNEJTIyc3RldmhsaXUlMkZteV9hd2Vzb21lX21vZGVsJTIyKSUwQWNsYXNzaWZpZXIodGV4dCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>classifier = pipeline(<span class="hljs-string">&quot;sentiment-analysis&quot;</span>, model=<span class="hljs-string">&quot;stevhliu/my_awesome_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>classifier(text)
[{<span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;POSITIVE&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9994940757751465</span>}]`,wrap:!1}}),me=new _t({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[ua],pytorch:[da]},$$scope:{ctx:k}}}),Ye=new Kt({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/tasks/sequence_classification.md"}}),{c(){t=$("meta"),m=i(),a=$("p"),c=i(),d(M.$$.fragment),v=i(),d(V.$$.fragment),W=i(),d(Z.$$.fragment),x=i(),U=$("p"),U.textContent=H,R=i(),J=$("p"),J.textContent=X,o=i(),j=$("ol"),j.innerHTML=B,F=i(),d(I.$$.fragment),N=i(),Y=$("p"),Y.textContent=f,G=i(),d(E.$$.fragment),z=i(),Q=$("p"),Q.textContent=ae,ce=i(),d(L.$$.fragment),q=i(),d(S.$$.fragment),A=i(),se=$("p"),se.textContent=fe,P=i(),d(D.$$.fragment),K=i(),le=$("p"),le.textContent=de,O=i(),d(ee.$$.fragment),te=i(),ne=$("p"),ne.textContent=he,r=i(),_=$("ul"),_.innerHTML=Ee,Qe=i(),d(ue.$$.fragment),Le=i(),ye=$("p"),ye.innerHTML=Tt,qe=i(),d(ge.$$.fragment),Se=i(),be=$("p"),be.innerHTML=jt,Ae=i(),d(Me.$$.fragment),Pe=i(),$e=$("p"),$e.innerHTML=Jt,De=i(),d(we.$$.fragment),Ke=i(),_e=$("p"),_e.innerHTML=Ut,Oe=i(),d(oe.$$.fragment),et=i(),d(Te.$$.fragment),tt=i(),je=$("p"),je.innerHTML=kt,at=i(),d(Je.$$.fragment),st=i(),Ue=$("p"),Ue.innerHTML=vt,lt=i(),d(ke.$$.fragment),nt=i(),ve=$("p"),ve.innerHTML=Zt,rt=i(),d(Ze.$$.fragment),ot=i(),Ce=$("p"),Ce.innerHTML=Ct,it=i(),d(We.$$.fragment),pt=i(),d(ie.$$.fragment),mt=i(),d(pe.$$.fragment),ct=i(),d(Ge.$$.fragment),ft=i(),xe=$("p"),xe.textContent=Wt,dt=i(),Re=$("p"),Re.textContent=Gt,ht=i(),d(Xe.$$.fragment),ut=i(),Ve=$("p"),Ve.innerHTML=xt,yt=i(),d(Ie.$$.fragment),gt=i(),Be=$("p"),Be.innerHTML=Rt,bt=i(),d(me.$$.fragment),Mt=i(),d(Ye.$$.fragment),$t=i(),ze=$("p"),this.h()},l(e){const n=St("svelte-u9bgzb",document.head);t=w(n,"META",{name:!0,content:!0}),n.forEach(s),m=p(e),a=w(e,"P",{}),Ht(a).forEach(s),c=p(e),h(M.$$.fragment,e),v=p(e),h(V.$$.fragment,e),W=p(e),h(Z.$$.fragment,e),x=p(e),U=w(e,"P",{"data-svelte-h":!0}),T(U)!=="svelte-a44la3"&&(U.textContent=H),R=p(e),J=w(e,"P",{"data-svelte-h":!0}),T(J)!=="svelte-1aff4p7"&&(J.textContent=X),o=p(e),j=w(e,"OL",{"data-svelte-h":!0}),T(j)!=="svelte-g478nj"&&(j.innerHTML=B),F=p(e),h(I.$$.fragment,e),N=p(e),Y=w(e,"P",{"data-svelte-h":!0}),T(Y)!=="svelte-1c9nexd"&&(Y.textContent=f),G=p(e),h(E.$$.fragment,e),z=p(e),Q=w(e,"P",{"data-svelte-h":!0}),T(Q)!=="svelte-k76o1m"&&(Q.textContent=ae),ce=p(e),h(L.$$.fragment,e),q=p(e),h(S.$$.fragment,e),A=p(e),se=w(e,"P",{"data-svelte-h":!0}),T(se)!=="svelte-cx4bj0"&&(se.textContent=fe),P=p(e),h(D.$$.fragment,e),K=p(e),le=w(e,"P",{"data-svelte-h":!0}),T(le)!=="svelte-1m91ua0"&&(le.textContent=de),O=p(e),h(ee.$$.fragment,e),te=p(e),ne=w(e,"P",{"data-svelte-h":!0}),T(ne)!=="svelte-q802b4"&&(ne.textContent=he),r=p(e),_=w(e,"UL",{"data-svelte-h":!0}),T(_)!=="svelte-4d5l79"&&(_.innerHTML=Ee),Qe=p(e),h(ue.$$.fragment,e),Le=p(e),ye=w(e,"P",{"data-svelte-h":!0}),T(ye)!=="svelte-1gepr51"&&(ye.innerHTML=Tt),qe=p(e),h(ge.$$.fragment,e),Se=p(e),be=w(e,"P",{"data-svelte-h":!0}),T(be)!=="svelte-1xsc197"&&(be.innerHTML=jt),Ae=p(e),h(Me.$$.fragment,e),Pe=p(e),$e=w(e,"P",{"data-svelte-h":!0}),T($e)!=="svelte-166xdzn"&&($e.innerHTML=Jt),De=p(e),h(we.$$.fragment,e),Ke=p(e),_e=w(e,"P",{"data-svelte-h":!0}),T(_e)!=="svelte-4tlfho"&&(_e.innerHTML=Ut),Oe=p(e),h(oe.$$.fragment,e),et=p(e),h(Te.$$.fragment,e),tt=p(e),je=w(e,"P",{"data-svelte-h":!0}),T(je)!=="svelte-j1ipe9"&&(je.innerHTML=kt),at=p(e),h(Je.$$.fragment,e),st=p(e),Ue=w(e,"P",{"data-svelte-h":!0}),T(Ue)!=="svelte-o3o85z"&&(Ue.innerHTML=vt),lt=p(e),h(ke.$$.fragment,e),nt=p(e),ve=w(e,"P",{"data-svelte-h":!0}),T(ve)!=="svelte-183aynn"&&(ve.innerHTML=Zt),rt=p(e),h(Ze.$$.fragment,e),ot=p(e),Ce=w(e,"P",{"data-svelte-h":!0}),T(Ce)!=="svelte-18c6io4"&&(Ce.innerHTML=Ct),it=p(e),h(We.$$.fragment,e),pt=p(e),h(ie.$$.fragment,e),mt=p(e),h(pe.$$.fragment,e),ct=p(e),h(Ge.$$.fragment,e),ft=p(e),xe=w(e,"P",{"data-svelte-h":!0}),T(xe)!=="svelte-633ppb"&&(xe.textContent=Wt),dt=p(e),Re=w(e,"P",{"data-svelte-h":!0}),T(Re)!=="svelte-o1jbfg"&&(Re.textContent=Gt),ht=p(e),h(Xe.$$.fragment,e),ut=p(e),Ve=w(e,"P",{"data-svelte-h":!0}),T(Ve)!=="svelte-1dnm3my"&&(Ve.innerHTML=xt),yt=p(e),h(Ie.$$.fragment,e),gt=p(e),Be=w(e,"P",{"data-svelte-h":!0}),T(Be)!=="svelte-1njl8vm"&&(Be.innerHTML=Rt),bt=p(e),h(me.$$.fragment,e),Mt=p(e),h(Ye.$$.fragment,e),$t=p(e),ze=w(e,"P",{}),Ht(ze).forEach(s),this.h()},h(){Nt(t,"name","hf:doc:metadata"),Nt(t,"content",ga)},m(e,n){At(document.head,t),l(e,m,n),l(e,a,n),l(e,c,n),u(M,e,n),l(e,v,n),u(V,e,n),l(e,W,n),u(Z,e,n),l(e,x,n),l(e,U,n),l(e,R,n),l(e,J,n),l(e,o,n),l(e,j,n),l(e,F,n),u(I,e,n),l(e,N,n),l(e,Y,n),l(e,G,n),u(E,e,n),l(e,z,n),l(e,Q,n),l(e,ce,n),u(L,e,n),l(e,q,n),u(S,e,n),l(e,A,n),l(e,se,n),l(e,P,n),u(D,e,n),l(e,K,n),l(e,le,n),l(e,O,n),u(ee,e,n),l(e,te,n),l(e,ne,n),l(e,r,n),l(e,_,n),l(e,Qe,n),u(ue,e,n),l(e,Le,n),l(e,ye,n),l(e,qe,n),u(ge,e,n),l(e,Se,n),l(e,be,n),l(e,Ae,n),u(Me,e,n),l(e,Pe,n),l(e,$e,n),l(e,De,n),u(we,e,n),l(e,Ke,n),l(e,_e,n),l(e,Oe,n),u(oe,e,n),l(e,et,n),u(Te,e,n),l(e,tt,n),l(e,je,n),l(e,at,n),u(Je,e,n),l(e,st,n),l(e,Ue,n),l(e,lt,n),u(ke,e,n),l(e,nt,n),l(e,ve,n),l(e,rt,n),u(Ze,e,n),l(e,ot,n),l(e,Ce,n),l(e,it,n),u(We,e,n),l(e,pt,n),u(ie,e,n),l(e,mt,n),u(pe,e,n),l(e,ct,n),u(Ge,e,n),l(e,ft,n),l(e,xe,n),l(e,dt,n),l(e,Re,n),l(e,ht,n),u(Xe,e,n),l(e,ut,n),l(e,Ve,n),l(e,yt,n),u(Ie,e,n),l(e,gt,n),l(e,Be,n),l(e,bt,n),u(me,e,n),l(e,Mt,n),u(Ye,e,n),l(e,$t,n),l(e,ze,n),wt=!0},p(e,[n]){const Xt={};n&2&&(Xt.$$scope={dirty:n,ctx:e}),I.$set(Xt);const Vt={};n&2&&(Vt.$$scope={dirty:n,ctx:e}),oe.$set(Vt);const It={};n&2&&(It.$$scope={dirty:n,ctx:e}),ie.$set(It);const Bt={};n&2&&(Bt.$$scope={dirty:n,ctx:e}),pe.$set(Bt);const Yt={};n&2&&(Yt.$$scope={dirty:n,ctx:e}),me.$set(Yt)},i(e){wt||(y(M.$$.fragment,e),y(V.$$.fragment,e),y(Z.$$.fragment,e),y(I.$$.fragment,e),y(E.$$.fragment,e),y(L.$$.fragment,e),y(S.$$.fragment,e),y(D.$$.fragment,e),y(ee.$$.fragment,e),y(ue.$$.fragment,e),y(ge.$$.fragment,e),y(Me.$$.fragment,e),y(we.$$.fragment,e),y(oe.$$.fragment,e),y(Te.$$.fragment,e),y(Je.$$.fragment,e),y(ke.$$.fragment,e),y(Ze.$$.fragment,e),y(We.$$.fragment,e),y(ie.$$.fragment,e),y(pe.$$.fragment,e),y(Ge.$$.fragment,e),y(Xe.$$.fragment,e),y(Ie.$$.fragment,e),y(me.$$.fragment,e),y(Ye.$$.fragment,e),wt=!0)},o(e){g(M.$$.fragment,e),g(V.$$.fragment,e),g(Z.$$.fragment,e),g(I.$$.fragment,e),g(E.$$.fragment,e),g(L.$$.fragment,e),g(S.$$.fragment,e),g(D.$$.fragment,e),g(ee.$$.fragment,e),g(ue.$$.fragment,e),g(ge.$$.fragment,e),g(Me.$$.fragment,e),g(we.$$.fragment,e),g(oe.$$.fragment,e),g(Te.$$.fragment,e),g(Je.$$.fragment,e),g(ke.$$.fragment,e),g(Ze.$$.fragment,e),g(We.$$.fragment,e),g(ie.$$.fragment,e),g(pe.$$.fragment,e),g(Ge.$$.fragment,e),g(Xe.$$.fragment,e),g(Ie.$$.fragment,e),g(me.$$.fragment,e),g(Ye.$$.fragment,e),wt=!1},d(e){e&&(s(m),s(a),s(c),s(v),s(W),s(x),s(U),s(R),s(J),s(o),s(j),s(F),s(N),s(Y),s(G),s(z),s(Q),s(ce),s(q),s(A),s(se),s(P),s(K),s(le),s(O),s(te),s(ne),s(r),s(_),s(Qe),s(Le),s(ye),s(qe),s(Se),s(be),s(Ae),s(Pe),s($e),s(De),s(Ke),s(_e),s(Oe),s(et),s(tt),s(je),s(at),s(st),s(Ue),s(lt),s(nt),s(ve),s(rt),s(ot),s(Ce),s(it),s(pt),s(mt),s(ct),s(ft),s(xe),s(dt),s(Re),s(ht),s(ut),s(Ve),s(yt),s(gt),s(Be),s(bt),s(Mt),s($t),s(ze)),s(t),b(M,e),b(V,e),b(Z,e),b(I,e),b(E,e),b(L,e),b(S,e),b(D,e),b(ee,e),b(ue,e),b(ge,e),b(Me,e),b(we,e),b(oe,e),b(Te,e),b(Je,e),b(ke,e),b(Ze,e),b(We,e),b(ie,e),b(pe,e),b(Ge,e),b(Xe,e),b(Ie,e),b(me,e),b(Ye,e)}}}const ga='{"title":"Text classification","local":"text-classification","sections":[{"title":"Load IMDb dataset","local":"load-imdb-dataset","sections":[],"depth":2},{"title":"Preprocess","local":"preprocess","sections":[],"depth":2},{"title":"Evaluate","local":"evaluate","sections":[],"depth":2},{"title":"Train","local":"train","sections":[],"depth":2},{"title":"Inference","local":"inference","sections":[],"depth":2}],"depth":1}';function ba(k){return Qt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ka extends Lt{constructor(t){super(),qt(this,t,ba,ya,Ft,{})}}export{ka as component};
