import{s as Zl,o as Il,n as Ts}from"../chunks/scheduler.9bc65507.js";import{S as vl,i as Gl,g as h,s as o,u as j,A as Rl,h as M,f as e,c as i,j as E,v as f,y,k as W,o as A,a,w,d as b,t as T,x as g,m as Cl,n as kl}from"../chunks/index.78c82d43.js";import{T as qe}from"../chunks/Tip.87d55b76.js";import{I as ae}from"../chunks/IconCopyLink.bedaa44d.js";import{C as R}from"../chunks/CodeBlock.73e038be.js";import{D as Vl}from"../chunks/DocNotebookDropdown.31840a23.js";import{F as Oe,M as ne}from"../chunks/Markdown.1b9b4e1c.js";function Xl(k){let t,c,l='<a href="../model_doc/albert">ALBERT</a>, <a href="../model_doc/bert">BERT</a>, <a href="../model_doc/big_bird">BigBird</a>, <a href="../model_doc/camembert">CamemBERT</a>, <a href="../model_doc/canine">CANINE</a>, <a href="../model_doc/convbert">ConvBERT</a>, <a href="../model_doc/data2vec-text">Data2VecText</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/flaubert">FlauBERT</a>, <a href="../model_doc/fnet">FNet</a>, <a href="../model_doc/funnel">Funnel Transformer</a>, <a href="../model_doc/ibert">I-BERT</a>, <a href="../model_doc/longformer">Longformer</a>, <a href="../model_doc/luke">LUKE</a>, <a href="../model_doc/mega">MEGA</a>, <a href="../model_doc/megatron-bert">Megatron-BERT</a>, <a href="../model_doc/mobilebert">MobileBERT</a>, <a href="../model_doc/mpnet">MPNet</a>, <a href="../model_doc/mra">MRA</a>, <a href="../model_doc/nezha">Nezha</a>, <a href="../model_doc/nystromformer">Nyströmformer</a>, <a href="../model_doc/qdqbert">QDQBert</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/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=Cl(`The task illustrated in this tutorial is supported by the following model architectures:

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

`),c=M(m,"P",{"data-svelte-h":!0}),y(c)!=="svelte-nxrbbi"&&(c.innerHTML=l)},m(m,u){a(m,t,u),a(m,c,u)},p:Ts,d(m){m&&(e(t),e(c))}}}function Wl(k){let t,c;return t=new R({props:{code:"ZnJvbSUyMGRhdGFjbGFzc2VzJTIwaW1wb3J0JTIwZGF0YWNsYXNzJTBBZnJvbSUyMHRyYW5zZm9ybWVycy50b2tlbml6YXRpb25fdXRpbHNfYmFzZSUyMGltcG9ydCUyMFByZVRyYWluZWRUb2tlbml6ZXJCYXNlJTJDJTIwUGFkZGluZ1N0cmF0ZWd5JTBBZnJvbSUyMHR5cGluZyUyMGltcG9ydCUyME9wdGlvbmFsJTJDJTIwVW5pb24lMEFpbXBvcnQlMjB0b3JjaCUwQSUwQSUwQSU0MGRhdGFjbGFzcyUwQWNsYXNzJTIwRGF0YUNvbGxhdG9yRm9yTXVsdGlwbGVDaG9pY2UlM0ElMEElMjAlMjAlMjAlMjAlMjIlMjIlMjIlMEElMjAlMjAlMjAlMjBEYXRhJTIwY29sbGF0b3IlMjB0aGF0JTIwd2lsbCUyMGR5bmFtaWNhbGx5JTIwcGFkJTIwdGhlJTIwaW5wdXRzJTIwZm9yJTIwbXVsdGlwbGUlMjBjaG9pY2UlMjByZWNlaXZlZC4lMEElMjAlMjAlMjAlMjAlMjIlMjIlMjIlMEElMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0ElMjBQcmVUcmFpbmVkVG9rZW5pemVyQmFzZSUwQSUyMCUyMCUyMCUyMHBhZGRpbmclM0ElMjBVbmlvbiU1QmJvb2wlMkMlMjBzdHIlMkMlMjBQYWRkaW5nU3RyYXRlZ3klNUQlMjAlM0QlMjBUcnVlJTBBJTIwJTIwJTIwJTIwbWF4X2xlbmd0aCUzQSUyME9wdGlvbmFsJTVCaW50JTVEJTIwJTNEJTIwTm9uZSUwQSUyMCUyMCUyMCUyMHBhZF90b19tdWx0aXBsZV9vZiUzQSUyME9wdGlvbmFsJTVCaW50JTVEJTIwJTNEJTIwTm9uZSUwQSUwQSUyMCUyMCUyMCUyMGRlZiUyMF9fY2FsbF9fKHNlbGYlMkMlMjBmZWF0dXJlcyklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsYWJlbF9uYW1lJTIwJTNEJTIwJTIybGFiZWwlMjIlMjBpZiUyMCUyMmxhYmVsJTIyJTIwaW4lMjBmZWF0dXJlcyU1QjAlNUQua2V5cygpJTIwZWxzZSUyMCUyMmxhYmVscyUyMiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxhYmVscyUyMCUzRCUyMCU1QmZlYXR1cmUucG9wKGxhYmVsX25hbWUpJTIwZm9yJTIwZmVhdHVyZSUyMGluJTIwZmVhdHVyZXMlNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBiYXRjaF9zaXplJTIwJTNEJTIwbGVuKGZlYXR1cmVzKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG51bV9jaG9pY2VzJTIwJTNEJTIwbGVuKGZlYXR1cmVzJTVCMCU1RCU1QiUyMmlucHV0X2lkcyUyMiU1RCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBmbGF0dGVuZWRfZmVhdHVyZXMlMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUIlN0JrJTNBJTIwdiU1QmklNUQlMjBmb3IlMjBrJTJDJTIwdiUyMGluJTIwZmVhdHVyZS5pdGVtcygpJTdEJTIwZm9yJTIwaSUyMGluJTIwcmFuZ2UobnVtX2Nob2ljZXMpJTVEJTIwZm9yJTIwZmVhdHVyZSUyMGluJTIwZmVhdHVyZXMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBmbGF0dGVuZWRfZmVhdHVyZXMlMjAlM0QlMjBzdW0oZmxhdHRlbmVkX2ZlYXR1cmVzJTJDJTIwJTVCJTVEKSUwQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGJhdGNoJTIwJTNEJTIwc2VsZi50b2tlbml6ZXIucGFkKCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGZsYXR0ZW5lZF9mZWF0dXJlcyUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHBhZGRpbmclM0RzZWxmLnBhZGRpbmclMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBtYXhfbGVuZ3RoJTNEc2VsZi5tYXhfbGVuZ3RoJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcGFkX3RvX211bHRpcGxlX29mJTNEc2VsZi5wYWRfdG9fbXVsdGlwbGVfb2YlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwKSUwQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGJhdGNoJTIwJTNEJTIwJTdCayUzQSUyMHYudmlldyhiYXRjaF9zaXplJTJDJTIwbnVtX2Nob2ljZXMlMkMlMjAtMSklMjBmb3IlMjBrJTJDJTIwdiUyMGluJTIwYmF0Y2guaXRlbXMoKSU3RCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGJhdGNoJTVCJTIybGFiZWxzJTIyJTVEJTIwJTNEJTIwdG9yY2gudGVuc29yKGxhYmVscyUyQyUyMGR0eXBlJTNEdG9yY2guaW50NjQpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcmV0dXJuJTIwYmF0Y2g=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> dataclasses <span class="hljs-keyword">import</span> dataclass
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.tokenization_utils_base <span class="hljs-keyword">import</span> PreTrainedTokenizerBase, PaddingStrategy
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> typing <span class="hljs-keyword">import</span> <span class="hljs-type">Optional</span>, <span class="hljs-type">Union</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch


<span class="hljs-meta">&gt;&gt;&gt; </span>@dataclass
<span class="hljs-meta">... </span><span class="hljs-keyword">class</span> <span class="hljs-title class_">DataCollatorForMultipleChoice</span>:
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;&quot;&quot;
<span class="hljs-meta">... </span>    Data collator that will dynamically pad the inputs for multiple choice received.
<span class="hljs-meta">... </span>    &quot;&quot;&quot;</span>

<span class="hljs-meta">... </span>    tokenizer: PreTrainedTokenizerBase
<span class="hljs-meta">... </span>    padding: <span class="hljs-type">Union</span>[<span class="hljs-built_in">bool</span>, <span class="hljs-built_in">str</span>, PaddingStrategy] = <span class="hljs-literal">True</span>
<span class="hljs-meta">... </span>    max_length: <span class="hljs-type">Optional</span>[<span class="hljs-built_in">int</span>] = <span class="hljs-literal">None</span>
<span class="hljs-meta">... </span>    pad_to_multiple_of: <span class="hljs-type">Optional</span>[<span class="hljs-built_in">int</span>] = <span class="hljs-literal">None</span>

<span class="hljs-meta">... </span>    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__call__</span>(<span class="hljs-params">self, features</span>):
<span class="hljs-meta">... </span>        label_name = <span class="hljs-string">&quot;label&quot;</span> <span class="hljs-keyword">if</span> <span class="hljs-string">&quot;label&quot;</span> <span class="hljs-keyword">in</span> features[<span class="hljs-number">0</span>].keys() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;labels&quot;</span>
<span class="hljs-meta">... </span>        labels = [feature.pop(label_name) <span class="hljs-keyword">for</span> feature <span class="hljs-keyword">in</span> features]
<span class="hljs-meta">... </span>        batch_size = <span class="hljs-built_in">len</span>(features)
<span class="hljs-meta">... </span>        num_choices = <span class="hljs-built_in">len</span>(features[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;input_ids&quot;</span>])
<span class="hljs-meta">... </span>        flattened_features = [
<span class="hljs-meta">... </span>            [{k: v[i] <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> feature.items()} <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(num_choices)] <span class="hljs-keyword">for</span> feature <span class="hljs-keyword">in</span> features
<span class="hljs-meta">... </span>        ]
<span class="hljs-meta">... </span>        flattened_features = <span class="hljs-built_in">sum</span>(flattened_features, [])

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

<span class="hljs-meta">... </span>        batch = {k: v.view(batch_size, num_choices, -<span class="hljs-number">1</span>) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> batch.items()}
<span class="hljs-meta">... </span>        batch[<span class="hljs-string">&quot;labels&quot;</span>] = torch.tensor(labels, dtype=torch.int64)
<span class="hljs-meta">... </span>        <span class="hljs-keyword">return</span> batch`,wrap:!1}}),{c(){j(t.$$.fragment)},l(l){f(t.$$.fragment,l)},m(l,m){w(t,l,m),c=!0},p:Ts,i(l){c||(b(t.$$.fragment,l),c=!0)},o(l){T(t.$$.fragment,l),c=!1},d(l){g(t,l)}}}function Al(k){let t,c;return t=new ne({props:{$$slots:{default:[Wl]},$$scope:{ctx:k}}}),{c(){j(t.$$.fragment)},l(l){f(t.$$.fragment,l)},m(l,m){w(t,l,m),c=!0},p(l,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:l}),t.$set(u)},i(l){c||(b(t.$$.fragment,l),c=!0)},o(l){T(t.$$.fragment,l),c=!1},d(l){g(t,l)}}}function Bl(k){let t,c;return t=new R({props:{code:"ZnJvbSUyMGRhdGFjbGFzc2VzJTIwaW1wb3J0JTIwZGF0YWNsYXNzJTBBZnJvbSUyMHRyYW5zZm9ybWVycy50b2tlbml6YXRpb25fdXRpbHNfYmFzZSUyMGltcG9ydCUyMFByZVRyYWluZWRUb2tlbml6ZXJCYXNlJTJDJTIwUGFkZGluZ1N0cmF0ZWd5JTBBZnJvbSUyMHR5cGluZyUyMGltcG9ydCUyME9wdGlvbmFsJTJDJTIwVW5pb24lMEFpbXBvcnQlMjB0ZW5zb3JmbG93JTIwYXMlMjB0ZiUwQSUwQSUwQSU0MGRhdGFjbGFzcyUwQWNsYXNzJTIwRGF0YUNvbGxhdG9yRm9yTXVsdGlwbGVDaG9pY2UlM0ElMEElMjAlMjAlMjAlMjAlMjIlMjIlMjIlMEElMjAlMjAlMjAlMjBEYXRhJTIwY29sbGF0b3IlMjB0aGF0JTIwd2lsbCUyMGR5bmFtaWNhbGx5JTIwcGFkJTIwdGhlJTIwaW5wdXRzJTIwZm9yJTIwbXVsdGlwbGUlMjBjaG9pY2UlMjByZWNlaXZlZC4lMEElMjAlMjAlMjAlMjAlMjIlMjIlMjIlMEElMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0ElMjBQcmVUcmFpbmVkVG9rZW5pemVyQmFzZSUwQSUyMCUyMCUyMCUyMHBhZGRpbmclM0ElMjBVbmlvbiU1QmJvb2wlMkMlMjBzdHIlMkMlMjBQYWRkaW5nU3RyYXRlZ3klNUQlMjAlM0QlMjBUcnVlJTBBJTIwJTIwJTIwJTIwbWF4X2xlbmd0aCUzQSUyME9wdGlvbmFsJTVCaW50JTVEJTIwJTNEJTIwTm9uZSUwQSUyMCUyMCUyMCUyMHBhZF90b19tdWx0aXBsZV9vZiUzQSUyME9wdGlvbmFsJTVCaW50JTVEJTIwJTNEJTIwTm9uZSUwQSUwQSUyMCUyMCUyMCUyMGRlZiUyMF9fY2FsbF9fKHNlbGYlMkMlMjBmZWF0dXJlcyklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsYWJlbF9uYW1lJTIwJTNEJTIwJTIybGFiZWwlMjIlMjBpZiUyMCUyMmxhYmVsJTIyJTIwaW4lMjBmZWF0dXJlcyU1QjAlNUQua2V5cygpJTIwZWxzZSUyMCUyMmxhYmVscyUyMiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxhYmVscyUyMCUzRCUyMCU1QmZlYXR1cmUucG9wKGxhYmVsX25hbWUpJTIwZm9yJTIwZmVhdHVyZSUyMGluJTIwZmVhdHVyZXMlNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBiYXRjaF9zaXplJTIwJTNEJTIwbGVuKGZlYXR1cmVzKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG51bV9jaG9pY2VzJTIwJTNEJTIwbGVuKGZlYXR1cmVzJTVCMCU1RCU1QiUyMmlucHV0X2lkcyUyMiU1RCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBmbGF0dGVuZWRfZmVhdHVyZXMlMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUIlN0JrJTNBJTIwdiU1QmklNUQlMjBmb3IlMjBrJTJDJTIwdiUyMGluJTIwZmVhdHVyZS5pdGVtcygpJTdEJTIwZm9yJTIwaSUyMGluJTIwcmFuZ2UobnVtX2Nob2ljZXMpJTVEJTIwZm9yJTIwZmVhdHVyZSUyMGluJTIwZmVhdHVyZXMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBmbGF0dGVuZWRfZmVhdHVyZXMlMjAlM0QlMjBzdW0oZmxhdHRlbmVkX2ZlYXR1cmVzJTJDJTIwJTVCJTVEKSUwQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGJhdGNoJTIwJTNEJTIwc2VsZi50b2tlbml6ZXIucGFkKCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGZsYXR0ZW5lZF9mZWF0dXJlcyUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHBhZGRpbmclM0RzZWxmLnBhZGRpbmclMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBtYXhfbGVuZ3RoJTNEc2VsZi5tYXhfbGVuZ3RoJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcGFkX3RvX211bHRpcGxlX29mJTNEc2VsZi5wYWRfdG9fbXVsdGlwbGVfb2YlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwKSUwQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGJhdGNoJTIwJTNEJTIwJTdCayUzQSUyMHRmLnJlc2hhcGUodiUyQyUyMChiYXRjaF9zaXplJTJDJTIwbnVtX2Nob2ljZXMlMkMlMjAtMSkpJTIwZm9yJTIwayUyQyUyMHYlMjBpbiUyMGJhdGNoLml0ZW1zKCklN0QlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBiYXRjaCU1QiUyMmxhYmVscyUyMiU1RCUyMCUzRCUyMHRmLmNvbnZlcnRfdG9fdGVuc29yKGxhYmVscyUyQyUyMGR0eXBlJTNEdGYuaW50NjQpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcmV0dXJuJTIwYmF0Y2g=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> dataclasses <span class="hljs-keyword">import</span> dataclass
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.tokenization_utils_base <span class="hljs-keyword">import</span> PreTrainedTokenizerBase, PaddingStrategy
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> typing <span class="hljs-keyword">import</span> <span class="hljs-type">Optional</span>, <span class="hljs-type">Union</span>
<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>@dataclass
<span class="hljs-meta">... </span><span class="hljs-keyword">class</span> <span class="hljs-title class_">DataCollatorForMultipleChoice</span>:
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;&quot;&quot;
<span class="hljs-meta">... </span>    Data collator that will dynamically pad the inputs for multiple choice received.
<span class="hljs-meta">... </span>    &quot;&quot;&quot;</span>

<span class="hljs-meta">... </span>    tokenizer: PreTrainedTokenizerBase
<span class="hljs-meta">... </span>    padding: <span class="hljs-type">Union</span>[<span class="hljs-built_in">bool</span>, <span class="hljs-built_in">str</span>, PaddingStrategy] = <span class="hljs-literal">True</span>
<span class="hljs-meta">... </span>    max_length: <span class="hljs-type">Optional</span>[<span class="hljs-built_in">int</span>] = <span class="hljs-literal">None</span>
<span class="hljs-meta">... </span>    pad_to_multiple_of: <span class="hljs-type">Optional</span>[<span class="hljs-built_in">int</span>] = <span class="hljs-literal">None</span>

<span class="hljs-meta">... </span>    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__call__</span>(<span class="hljs-params">self, features</span>):
<span class="hljs-meta">... </span>        label_name = <span class="hljs-string">&quot;label&quot;</span> <span class="hljs-keyword">if</span> <span class="hljs-string">&quot;label&quot;</span> <span class="hljs-keyword">in</span> features[<span class="hljs-number">0</span>].keys() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;labels&quot;</span>
<span class="hljs-meta">... </span>        labels = [feature.pop(label_name) <span class="hljs-keyword">for</span> feature <span class="hljs-keyword">in</span> features]
<span class="hljs-meta">... </span>        batch_size = <span class="hljs-built_in">len</span>(features)
<span class="hljs-meta">... </span>        num_choices = <span class="hljs-built_in">len</span>(features[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;input_ids&quot;</span>])
<span class="hljs-meta">... </span>        flattened_features = [
<span class="hljs-meta">... </span>            [{k: v[i] <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> feature.items()} <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(num_choices)] <span class="hljs-keyword">for</span> feature <span class="hljs-keyword">in</span> features
<span class="hljs-meta">... </span>        ]
<span class="hljs-meta">... </span>        flattened_features = <span class="hljs-built_in">sum</span>(flattened_features, [])

<span class="hljs-meta">... </span>        batch = self.tokenizer.pad(
<span class="hljs-meta">... </span>            flattened_features,
<span class="hljs-meta">... </span>            padding=self.padding,
<span class="hljs-meta">... </span>            max_length=self.max_length,
<span class="hljs-meta">... </span>            pad_to_multiple_of=self.pad_to_multiple_of,
<span class="hljs-meta">... </span>            return_tensors=<span class="hljs-string">&quot;tf&quot;</span>,
<span class="hljs-meta">... </span>        )

<span class="hljs-meta">... </span>        batch = {k: tf.reshape(v, (batch_size, num_choices, -<span class="hljs-number">1</span>)) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> batch.items()}
<span class="hljs-meta">... </span>        batch[<span class="hljs-string">&quot;labels&quot;</span>] = tf.convert_to_tensor(labels, dtype=tf.int64)
<span class="hljs-meta">... </span>        <span class="hljs-keyword">return</span> batch`,wrap:!1}}),{c(){j(t.$$.fragment)},l(l){f(t.$$.fragment,l)},m(l,m){w(t,l,m),c=!0},p:Ts,i(l){c||(b(t.$$.fragment,l),c=!0)},o(l){T(t.$$.fragment,l),c=!1},d(l){g(t,l)}}}function xl(k){let t,c;return t=new ne({props:{$$slots:{default:[Bl]},$$scope:{ctx:k}}}),{c(){j(t.$$.fragment)},l(l){f(t.$$.fragment,l)},m(l,m){w(t,l,m),c=!0},p(l,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:l}),t.$set(u)},i(l){c||(b(t.$$.fragment,l),c=!0)},o(l){T(t.$$.fragment,l),c=!1},d(l){g(t,l)}}}function El(k){let t,c='If you aren’t familiar with finetuning a model with the <a href="/docs/transformers/v4.34.0/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=h("p"),t.innerHTML=c},l(l){t=M(l,"P",{"data-svelte-h":!0}),y(t)!=="svelte-1ufp0ay"&&(t.innerHTML=c)},m(l,m){a(l,t,m)},p:Ts,d(l){l&&e(t)}}}function Yl(k){let t,c,l,m='You’re ready to start training your model now! Load BERT with <a href="/docs/transformers/v4.34.0/en/model_doc/auto#transformers.AutoModelForMultipleChoice">AutoModelForMultipleChoice</a>:',u,$,B,_,V="At this point, only three steps remain:",v,G,Y='<li>Define your training hyperparameters in <a href="/docs/transformers/v4.34.0/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.34.0/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.34.0/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.34.0/en/main_classes/trainer#transformers.Trainer.train">train()</a> to finetune your model.</li>',Z,C,I,r,U='Once training is completed, share your model to the Hub with the <a href="/docs/transformers/v4.34.0/en/main_classes/trainer#transformers.Trainer.push_to_hub">push_to_hub()</a> method so everyone can use your model:',x,z,N;return t=new qe({props:{$$slots:{default:[El]},$$scope:{ctx:k}}}),$=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvck11bHRpcGxlQ2hvaWNlJTJDJTIwVHJhaW5pbmdBcmd1bWVudHMlMkMlMjBUcmFpbmVyJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JNdWx0aXBsZUNob2ljZS5mcm9tX3ByZXRyYWluZWQoJTIyYmVydC1iYXNlLXVuY2FzZWQlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForMultipleChoice, TrainingArguments, Trainer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForMultipleChoice.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)`,wrap:!1}}),C=new R({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJteV9hd2Vzb21lX3N3YWdfbW9kZWwlMjIlMkMlMEElMjAlMjAlMjAlMjBldmFsdWF0aW9uX3N0cmF0ZWd5JTNEJTIyZXBvY2glMjIlMkMlMEElMjAlMjAlMjAlMjBzYXZlX3N0cmF0ZWd5JTNEJTIyZXBvY2glMjIlMkMlMEElMjAlMjAlMjAlMjBsb2FkX2Jlc3RfbW9kZWxfYXRfZW5kJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMGxlYXJuaW5nX3JhdGUlM0Q1ZS01JTJDJTBBJTIwJTIwJTIwJTIwcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBwZXJfZGV2aWNlX2V2YWxfYmF0Y2hfc2l6ZSUzRDE2JTJDJTBBJTIwJTIwJTIwJTIwbnVtX3RyYWluX2Vwb2NocyUzRDMlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfZGVjYXklM0QwLjAxJTJDJTBBJTIwJTIwJTIwJTIwcHVzaF90b19odWIlM0RUcnVlJTJDJTBBKSUwQSUwQXRyYWluZXIlMjAlM0QlMjBUcmFpbmVyKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEbW9kZWwlMkMlMEElMjAlMjAlMjAlMjBhcmdzJTNEdHJhaW5pbmdfYXJncyUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0R0b2tlbml6ZWRfc3dhZyU1QiUyMnRyYWluJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9kYXRhc2V0JTNEdG9rZW5pemVkX3N3YWclNUIlMjJ2YWxpZGF0aW9uJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwdG9rZW5pemVyJTNEdG9rZW5pemVyJTJDJTBBJTIwJTIwJTIwJTIwZGF0YV9jb2xsYXRvciUzRERhdGFDb2xsYXRvckZvck11bHRpcGxlQ2hvaWNlKHRva2VuaXplciUzRHRva2VuaXplciklMkMlMEElMjAlMjAlMjAlMjBjb21wdXRlX21ldHJpY3MlM0Rjb21wdXRlX21ldHJpY3MlMkMlMEEpJTBBJTBBdHJhaW5lci50cmFpbigp",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_swag_model&quot;</span>,
<span class="hljs-meta">... </span>    evaluation_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
<span class="hljs-meta">... </span>    save_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
<span class="hljs-meta">... </span>    load_best_model_at_end=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    learning_rate=<span class="hljs-number">5e-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">3</span>,
<span class="hljs-meta">... </span>    weight_decay=<span class="hljs-number">0.01</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_swag[<span class="hljs-string">&quot;train&quot;</span>],
<span class="hljs-meta">... </span>    eval_dataset=tokenized_swag[<span class="hljs-string">&quot;validation&quot;</span>],
<span class="hljs-meta">... </span>    tokenizer=tokenizer,
<span class="hljs-meta">... </span>    data_collator=DataCollatorForMultipleChoice(tokenizer=tokenizer),
<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}}),z=new R({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){j(t.$$.fragment),c=o(),l=h("p"),l.innerHTML=m,u=o(),j($.$$.fragment),B=o(),_=h("p"),_.textContent=V,v=o(),G=h("ol"),G.innerHTML=Y,Z=o(),j(C.$$.fragment),I=o(),r=h("p"),r.innerHTML=U,x=o(),j(z.$$.fragment)},l(d){f(t.$$.fragment,d),c=i(d),l=M(d,"P",{"data-svelte-h":!0}),y(l)!=="svelte-u7xjkb"&&(l.innerHTML=m),u=i(d),f($.$$.fragment,d),B=i(d),_=M(d,"P",{"data-svelte-h":!0}),y(_)!=="svelte-l42k0i"&&(_.textContent=V),v=i(d),G=M(d,"OL",{"data-svelte-h":!0}),y(G)!=="svelte-777kp9"&&(G.innerHTML=Y),Z=i(d),f(C.$$.fragment,d),I=i(d),r=M(d,"P",{"data-svelte-h":!0}),y(r)!=="svelte-cv8z08"&&(r.innerHTML=U),x=i(d),f(z.$$.fragment,d)},m(d,X){w(t,d,X),a(d,c,X),a(d,l,X),a(d,u,X),w($,d,X),a(d,B,X),a(d,_,X),a(d,v,X),a(d,G,X),a(d,Z,X),w(C,d,X),a(d,I,X),a(d,r,X),a(d,x,X),w(z,d,X),N=!0},p(d,X){const Q={};X&2&&(Q.$$scope={dirty:X,ctx:d}),t.$set(Q)},i(d){N||(b(t.$$.fragment,d),b($.$$.fragment,d),b(C.$$.fragment,d),b(z.$$.fragment,d),N=!0)},o(d){T(t.$$.fragment,d),T($.$$.fragment,d),T(C.$$.fragment,d),T(z.$$.fragment,d),N=!1},d(d){d&&(e(c),e(l),e(u),e(B),e(_),e(v),e(G),e(Z),e(I),e(r),e(x)),g(t,d),g($,d),g(C,d),g(z,d)}}}function Nl(k){let t,c;return t=new ne({props:{$$slots:{default:[Yl]},$$scope:{ctx:k}}}),{c(){j(t.$$.fragment)},l(l){f(t.$$.fragment,l)},m(l,m){w(t,l,m),c=!0},p(l,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:l}),t.$set(u)},i(l){c||(b(t.$$.fragment,l),c=!0)},o(l){T(t.$$.fragment,l),c=!1},d(l){g(t,l)}}}function Fl(k){let t,c='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=h("p"),t.innerHTML=c},l(l){t=M(l,"P",{"data-svelte-h":!0}),y(t)!=="svelte-1rd4nl8"&&(t.innerHTML=c)},m(l,m){a(l,t,m)},p:Ts,d(l){l&&e(t)}}}function zl(k){let t,c,l,m,u,$='Then you can load BERT with <a href="/docs/transformers/v4.34.0/en/model_doc/auto#transformers.TFAutoModelForMultipleChoice">TFAutoModelForMultipleChoice</a>:',B,_,V,v,G='Convert your datasets to the <code>tf.data.Dataset</code> format with <a href="/docs/transformers/v4.34.0/en/main_classes/model#transformers.TFPreTrainedModel.prepare_tf_dataset">prepare_tf_dataset()</a>:',Y,Z,C,I,r='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:',U,x,z,N,d='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>.',X,Q,ss='Pass your <code>compute_metrics</code> function to <a href="/docs/transformers/v4.34.0/en/main_classes/keras_callbacks#transformers.KerasMetricCallback">KerasMetricCallback</a>:',ns,H,gs,D,es='Specify where to push your model and tokenizer in the <a href="/docs/transformers/v4.34.0/en/main_classes/keras_callbacks#transformers.PushToHubCallback">PushToHubCallback</a>:',ps,S,Js,K,ls="Then bundle your callbacks together:",rs,F,L,P,ts='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:',hs,q,Us,O,as="Once training is completed, your model is automatically uploaded to the Hub so everyone can use it!",$s;return t=new qe({props:{$$slots:{default:[Fl]},$$scope:{ctx:k}}}),l=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMGNyZWF0ZV9vcHRpbWl6ZXIlMEElMEFiYXRjaF9zaXplJTIwJTNEJTIwMTYlMEFudW1fdHJhaW5fZXBvY2hzJTIwJTNEJTIwMiUwQXRvdGFsX3RyYWluX3N0ZXBzJTIwJTNEJTIwKGxlbih0b2tlbml6ZWRfc3dhZyU1QiUyMnRyYWluJTIyJTVEKSUyMCUyRiUyRiUyMGJhdGNoX3NpemUpJTIwKiUyMG51bV90cmFpbl9lcG9jaHMlMEFvcHRpbWl6ZXIlMkMlMjBzY2hlZHVsZSUyMCUzRCUyMGNyZWF0ZV9vcHRpbWl6ZXIoaW5pdF9sciUzRDVlLTUlMkMlMjBudW1fd2FybXVwX3N0ZXBzJTNEMCUyQyUyMG51bV90cmFpbl9zdGVwcyUzRHRvdGFsX3RyYWluX3N0ZXBzKQ==",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>batch_size = <span class="hljs-number">16</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_train_epochs = <span class="hljs-number">2</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>total_train_steps = (<span class="hljs-built_in">len</span>(tokenized_swag[<span class="hljs-string">&quot;train&quot;</span>]) // batch_size) * num_train_epochs
<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer, schedule = create_optimizer(init_lr=<span class="hljs-number">5e-5</span>, num_warmup_steps=<span class="hljs-number">0</span>, num_train_steps=total_train_steps)`,wrap:!1}}),_=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yTXVsdGlwbGVDaG9pY2UlMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yTXVsdGlwbGVDaG9pY2UuZnJvbV9wcmV0cmFpbmVkKCUyMmJlcnQtYmFzZS11bmNhc2VkJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForMultipleChoice

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForMultipleChoice.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)`,wrap:!1}}),Z=new R({props:{code:"ZGF0YV9jb2xsYXRvciUyMCUzRCUyMERhdGFDb2xsYXRvckZvck11bHRpcGxlQ2hvaWNlKHRva2VuaXplciUzRHRva2VuaXplciklMEF0Zl90cmFpbl9zZXQlMjAlM0QlMjBtb2RlbC5wcmVwYXJlX3RmX2RhdGFzZXQoJTBBJTIwJTIwJTIwJTIwdG9rZW5pemVkX3N3YWclNUIlMjJ0cmFpbiUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHNodWZmbGUlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwYmF0Y2hfc2l6ZSUzRGJhdGNoX3NpemUlMkMlMEElMjAlMjAlMjAlMjBjb2xsYXRlX2ZuJTNEZGF0YV9jb2xsYXRvciUyQyUwQSklMEElMEF0Zl92YWxpZGF0aW9uX3NldCUyMCUzRCUyMG1vZGVsLnByZXBhcmVfdGZfZGF0YXNldCglMEElMjAlMjAlMjAlMjB0b2tlbml6ZWRfc3dhZyU1QiUyMnZhbGlkYXRpb24lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBzaHVmZmxlJTNERmFsc2UlMkMlMEElMjAlMjAlMjAlMjBiYXRjaF9zaXplJTNEYmF0Y2hfc2l6ZSUyQyUwQSUyMCUyMCUyMCUyMGNvbGxhdGVfZm4lM0RkYXRhX2NvbGxhdG9yJTJDJTBBKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorForMultipleChoice(tokenizer=tokenizer)
<span class="hljs-meta">&gt;&gt;&gt; </span>tf_train_set = model.prepare_tf_dataset(
<span class="hljs-meta">... </span>    tokenized_swag[<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=batch_size,
<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_swag[<span class="hljs-string">&quot;validation&quot;</span>],
<span class="hljs-meta">... </span>    shuffle=<span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>    batch_size=batch_size,
<span class="hljs-meta">... </span>    collate_fn=data_collator,
<span class="hljs-meta">... </span>)`,wrap:!1}}),x=new R({props:{code:"bW9kZWwuY29tcGlsZShvcHRpbWl6ZXIlM0RvcHRpbWl6ZXIpJTIwJTIwJTIzJTIwTm8lMjBsb3NzJTIwYXJndW1lbnQh",highlighted:'<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}}),H=new R({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}}),S=new R({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}}),F=new R({props:{code:"Y2FsbGJhY2tzJTIwJTNEJTIwJTVCbWV0cmljX2NhbGxiYWNrJTJDJTIwcHVzaF90b19odWJfY2FsbGJhY2slNUQ=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>callbacks = [metric_callback, push_to_hub_callback]',wrap:!1}}),q=new R({props:{code:"bW9kZWwuZml0KHglM0R0Zl90cmFpbl9zZXQlMkMlMjB2YWxpZGF0aW9uX2RhdGElM0R0Zl92YWxpZGF0aW9uX3NldCUyQyUyMGVwb2NocyUzRDIlMkMlMjBjYWxsYmFja3MlM0RjYWxsYmFja3Mp",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">2</span>, callbacks=callbacks)',wrap:!1}}),{c(){j(t.$$.fragment),c=Cl(`
To finetune a model in TensorFlow, start by setting up an optimizer function, learning rate schedule, and some training hyperparameters:

	`),j(l.$$.fragment),m=o(),u=h("p"),u.innerHTML=$,B=o(),j(_.$$.fragment),V=o(),v=h("p"),v.innerHTML=G,Y=o(),j(Z.$$.fragment),C=o(),I=h("p"),I.innerHTML=r,U=o(),j(x.$$.fragment),z=o(),N=h("p"),N.innerHTML=d,X=o(),Q=h("p"),Q.innerHTML=ss,ns=o(),j(H.$$.fragment),gs=o(),D=h("p"),D.innerHTML=es,ps=o(),j(S.$$.fragment),Js=o(),K=h("p"),K.textContent=ls,rs=o(),j(F.$$.fragment),L=o(),P=h("p"),P.innerHTML=ts,hs=o(),j(q.$$.fragment),Us=o(),O=h("p"),O.textContent=as},l(n){f(t.$$.fragment,n),c=kl(n,`
To finetune a model in TensorFlow, start by setting up an optimizer function, learning rate schedule, and some training hyperparameters:

	`),f(l.$$.fragment,n),m=i(n),u=M(n,"P",{"data-svelte-h":!0}),y(u)!=="svelte-lbqn4t"&&(u.innerHTML=$),B=i(n),f(_.$$.fragment,n),V=i(n),v=M(n,"P",{"data-svelte-h":!0}),y(v)!=="svelte-qmwuyd"&&(v.innerHTML=G),Y=i(n),f(Z.$$.fragment,n),C=i(n),I=M(n,"P",{"data-svelte-h":!0}),y(I)!=="svelte-17cxx5e"&&(I.innerHTML=r),U=i(n),f(x.$$.fragment,n),z=i(n),N=M(n,"P",{"data-svelte-h":!0}),y(N)!=="svelte-6l1wkp"&&(N.innerHTML=d),X=i(n),Q=M(n,"P",{"data-svelte-h":!0}),y(Q)!=="svelte-6vs5z9"&&(Q.innerHTML=ss),ns=i(n),f(H.$$.fragment,n),gs=i(n),D=M(n,"P",{"data-svelte-h":!0}),y(D)!=="svelte-b2vwd"&&(D.innerHTML=es),ps=i(n),f(S.$$.fragment,n),Js=i(n),K=M(n,"P",{"data-svelte-h":!0}),y(K)!=="svelte-1lw9xm8"&&(K.textContent=ls),rs=i(n),f(F.$$.fragment,n),L=i(n),P=M(n,"P",{"data-svelte-h":!0}),y(P)!=="svelte-1hrpv1v"&&(P.innerHTML=ts),hs=i(n),f(q.$$.fragment,n),Us=i(n),O=M(n,"P",{"data-svelte-h":!0}),y(O)!=="svelte-2s71om"&&(O.textContent=as)},m(n,J){w(t,n,J),a(n,c,J),w(l,n,J),a(n,m,J),a(n,u,J),a(n,B,J),w(_,n,J),a(n,V,J),a(n,v,J),a(n,Y,J),w(Z,n,J),a(n,C,J),a(n,I,J),a(n,U,J),w(x,n,J),a(n,z,J),a(n,N,J),a(n,X,J),a(n,Q,J),a(n,ns,J),w(H,n,J),a(n,gs,J),a(n,D,J),a(n,ps,J),w(S,n,J),a(n,Js,J),a(n,K,J),a(n,rs,J),w(F,n,J),a(n,L,J),a(n,P,J),a(n,hs,J),w(q,n,J),a(n,Us,J),a(n,O,J),$s=!0},p(n,J){const _s={};J&2&&(_s.$$scope={dirty:J,ctx:n}),t.$set(_s)},i(n){$s||(b(t.$$.fragment,n),b(l.$$.fragment,n),b(_.$$.fragment,n),b(Z.$$.fragment,n),b(x.$$.fragment,n),b(H.$$.fragment,n),b(S.$$.fragment,n),b(F.$$.fragment,n),b(q.$$.fragment,n),$s=!0)},o(n){T(t.$$.fragment,n),T(l.$$.fragment,n),T(_.$$.fragment,n),T(Z.$$.fragment,n),T(x.$$.fragment,n),T(H.$$.fragment,n),T(S.$$.fragment,n),T(F.$$.fragment,n),T(q.$$.fragment,n),$s=!1},d(n){n&&(e(c),e(m),e(u),e(B),e(V),e(v),e(Y),e(C),e(I),e(U),e(z),e(N),e(X),e(Q),e(ns),e(gs),e(D),e(ps),e(Js),e(K),e(rs),e(L),e(P),e(hs),e(Us),e(O)),g(t,n),g(l,n),g(_,n),g(Z,n),g(x,n),g(H,n),g(S,n),g(F,n),g(q,n)}}}function Ql(k){let t,c;return t=new ne({props:{$$slots:{default:[zl]},$$scope:{ctx:k}}}),{c(){j(t.$$.fragment)},l(l){f(t.$$.fragment,l)},m(l,m){w(t,l,m),c=!0},p(l,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:l}),t.$set(u)},i(l){c||(b(t.$$.fragment,l),c=!0)},o(l){T(t.$$.fragment,l),c=!1},d(l){g(t,l)}}}function Hl(k){let t,c=`For a more in-depth example of how to finetune a model for multiple choice, take a look at the corresponding
<a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multiple_choice.ipynb" rel="nofollow">PyTorch notebook</a>
or <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multiple_choice-tf.ipynb" rel="nofollow">TensorFlow notebook</a>.`;return{c(){t=h("p"),t.innerHTML=c},l(l){t=M(l,"P",{"data-svelte-h":!0}),y(t)!=="svelte-1c9mh52"&&(t.innerHTML=c)},m(l,m){a(l,t,m)},p:Ts,d(l){l&&e(t)}}}function Sl(k){let t,c="Tokenize each prompt and candidate answer pair and return PyTorch tensors. You should also create some <code>labels</code>:",l,m,u,$,B="Pass your inputs and labels to the model and return the <code>logits</code>:",_,V,v,G,Y="Get the class with the highest probability:",Z,C,I;return m=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJteV9hd2Vzb21lX3N3YWdfbW9kZWwlMjIpJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCU1QiU1QnByb21wdCUyQyUyMGNhbmRpZGF0ZTElNUQlMkMlMjAlNUJwcm9tcHQlMkMlMjBjYW5kaWRhdGUyJTVEJTVEJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiUyQyUyMHBhZGRpbmclM0RUcnVlKSUwQWxhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvcigwKS51bnNxdWVlemUoMCk=",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;my_awesome_swag_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer([[prompt, candidate1], [prompt, candidate2]], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>, padding=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.tensor(<span class="hljs-number">0</span>).unsqueeze(<span class="hljs-number">0</span>)`,wrap:!1}}),V=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvck11bHRpcGxlQ2hvaWNlJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JNdWx0aXBsZUNob2ljZS5mcm9tX3ByZXRyYWluZWQoJTIybXlfYXdlc29tZV9zd2FnX21vZGVsJTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKiU3QmslM0ElMjB2LnVuc3F1ZWV6ZSgwKSUyMGZvciUyMGslMkMlMjB2JTIwaW4lMjBpbnB1dHMuaXRlbXMoKSU3RCUyQyUyMGxhYmVscyUzRGxhYmVscyklMEFsb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0cw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForMultipleChoice

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForMultipleChoice.from_pretrained(<span class="hljs-string">&quot;my_awesome_swag_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**{k: v.unsqueeze(<span class="hljs-number">0</span>) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> inputs.items()}, labels=labels)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`,wrap:!1}}),C=new R({props:{code:"cHJlZGljdGVkX2NsYXNzJTIwJTNEJTIwbG9naXRzLmFyZ21heCgpLml0ZW0oKSUwQXByZWRpY3RlZF9jbGFzcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class = logits.argmax().item()
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class
<span class="hljs-string">&#x27;0&#x27;</span>`,wrap:!1}}),{c(){t=h("p"),t.innerHTML=c,l=o(),j(m.$$.fragment),u=o(),$=h("p"),$.innerHTML=B,_=o(),j(V.$$.fragment),v=o(),G=h("p"),G.textContent=Y,Z=o(),j(C.$$.fragment)},l(r){t=M(r,"P",{"data-svelte-h":!0}),y(t)!=="svelte-1qxmddt"&&(t.innerHTML=c),l=i(r),f(m.$$.fragment,r),u=i(r),$=M(r,"P",{"data-svelte-h":!0}),y($)!=="svelte-10twm8n"&&($.innerHTML=B),_=i(r),f(V.$$.fragment,r),v=i(r),G=M(r,"P",{"data-svelte-h":!0}),y(G)!=="svelte-18e4iwl"&&(G.textContent=Y),Z=i(r),f(C.$$.fragment,r)},m(r,U){a(r,t,U),a(r,l,U),w(m,r,U),a(r,u,U),a(r,$,U),a(r,_,U),w(V,r,U),a(r,v,U),a(r,G,U),a(r,Z,U),w(C,r,U),I=!0},p:Ts,i(r){I||(b(m.$$.fragment,r),b(V.$$.fragment,r),b(C.$$.fragment,r),I=!0)},o(r){T(m.$$.fragment,r),T(V.$$.fragment,r),T(C.$$.fragment,r),I=!1},d(r){r&&(e(t),e(l),e(u),e($),e(_),e(v),e(G),e(Z)),g(m,r),g(V,r),g(C,r)}}}function ql(k){let t,c;return t=new ne({props:{$$slots:{default:[Sl]},$$scope:{ctx:k}}}),{c(){j(t.$$.fragment)},l(l){f(t.$$.fragment,l)},m(l,m){w(t,l,m),c=!0},p(l,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:l}),t.$set(u)},i(l){c||(b(t.$$.fragment,l),c=!0)},o(l){T(t.$$.fragment,l),c=!1},d(l){g(t,l)}}}function Ll(k){let t,c="Tokenize each prompt and candidate answer pair and return TensorFlow tensors:",l,m,u,$,B="Pass your inputs to the model and return the <code>logits</code>:",_,V,v,G,Y="Get the class with the highest probability:",Z,C,I;return m=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJteV9hd2Vzb21lX3N3YWdfbW9kZWwlMjIpJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCU1QiU1QnByb21wdCUyQyUyMGNhbmRpZGF0ZTElNUQlMkMlMjAlNUJwcm9tcHQlMkMlMjBjYW5kaWRhdGUyJTVEJTVEJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiUyQyUyMHBhZGRpbmclM0RUcnVlKQ==",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;my_awesome_swag_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer([[prompt, candidate1], [prompt, candidate2]], return_tensors=<span class="hljs-string">&quot;tf&quot;</span>, padding=<span class="hljs-literal">True</span>)`,wrap:!1}}),V=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yTXVsdGlwbGVDaG9pY2UlMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yTXVsdGlwbGVDaG9pY2UuZnJvbV9wcmV0cmFpbmVkKCUyMm15X2F3ZXNvbWVfc3dhZ19tb2RlbCUyMiklMEFpbnB1dHMlMjAlM0QlMjAlN0JrJTNBJTIwdGYuZXhwYW5kX2RpbXModiUyQyUyMDApJTIwZm9yJTIwayUyQyUyMHYlMjBpbiUyMGlucHV0cy5pdGVtcygpJTdEJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0cyklMEFsb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0cw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForMultipleChoice

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForMultipleChoice.from_pretrained(<span class="hljs-string">&quot;my_awesome_swag_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = {k: tf.expand_dims(v, <span class="hljs-number">0</span>) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> inputs.items()}
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`,wrap:!1}}),C=new R({props:{code:"cHJlZGljdGVkX2NsYXNzJTIwJTNEJTIwaW50KHRmLm1hdGguYXJnbWF4KGxvZ2l0cyUyQyUyMGF4aXMlM0QtMSklNUIwJTVEKSUwQXByZWRpY3RlZF9jbGFzcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class = <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>predicted_class
<span class="hljs-string">&#x27;0&#x27;</span>`,wrap:!1}}),{c(){t=h("p"),t.textContent=c,l=o(),j(m.$$.fragment),u=o(),$=h("p"),$.innerHTML=B,_=o(),j(V.$$.fragment),v=o(),G=h("p"),G.textContent=Y,Z=o(),j(C.$$.fragment)},l(r){t=M(r,"P",{"data-svelte-h":!0}),y(t)!=="svelte-q8vskg"&&(t.textContent=c),l=i(r),f(m.$$.fragment,r),u=i(r),$=M(r,"P",{"data-svelte-h":!0}),y($)!=="svelte-f3g043"&&($.innerHTML=B),_=i(r),f(V.$$.fragment,r),v=i(r),G=M(r,"P",{"data-svelte-h":!0}),y(G)!=="svelte-18e4iwl"&&(G.textContent=Y),Z=i(r),f(C.$$.fragment,r)},m(r,U){a(r,t,U),a(r,l,U),w(m,r,U),a(r,u,U),a(r,$,U),a(r,_,U),w(V,r,U),a(r,v,U),a(r,G,U),a(r,Z,U),w(C,r,U),I=!0},p:Ts,i(r){I||(b(m.$$.fragment,r),b(V.$$.fragment,r),b(C.$$.fragment,r),I=!0)},o(r){T(m.$$.fragment,r),T(V.$$.fragment,r),T(C.$$.fragment,r),I=!1},d(r){r&&(e(t),e(l),e(u),e($),e(_),e(v),e(G),e(Z)),g(m,r),g(V,r),g(C,r)}}}function Pl(k){let t,c;return t=new ne({props:{$$slots:{default:[Ll]},$$scope:{ctx:k}}}),{c(){j(t.$$.fragment)},l(l){f(t.$$.fragment,l)},m(l,m){w(t,l,m),c=!0},p(l,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:l}),t.$set(u)},i(l){c||(b(t.$$.fragment,l),c=!0)},o(l){T(t.$$.fragment,l),c=!1},d(l){g(t,l)}}}function Dl(k){let t,c,l,m,u,$,B,_,V,v,G="Multiple choice",Y,Z,C,I,r="A multiple choice task is similar to question answering, except several candidate answers are provided along with a context and the model is trained to select the correct answer.",U,x,z="This guide will show you how to:",N,d,X='<li>Finetune <a href="https://huggingface.co/bert-base-uncased" rel="nofollow">BERT</a> on the <code>regular</code> configuration of the <a href="https://huggingface.co/datasets/swag" rel="nofollow">SWAG</a> dataset to select the best answer given multiple options and some context.</li> <li>Use your finetuned model for inference.</li>',Q,ss,ns,H,gs="Before you begin, make sure you have all the necessary libraries installed:",D,es,ps,S,Js="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:",K,ls,rs,F,L,P,ts,hs,q,Us="Load SWAG dataset",O,as,$s="Start by loading the <code>regular</code> configuration of the SWAG dataset from the 🤗 Datasets library:",n,J,_s,Cs,sl="Then take a look at an example:",de,ks,ue,Zs,el="While it looks like there are a lot of fields here, it is actually pretty straightforward:",ye,Is,ll="<li><code>sent1</code> and <code>sent2</code>: these fields show how a sentence starts, and if you put the two together, you get the <code>startphrase</code> field.</li> <li><code>ending</code>: suggests a possible ending for how a sentence can end, but only one of them is correct.</li> <li><code>label</code>: identifies the correct sentence ending.</li>",je,os,Ms,pe,vs,Le,se,tl="Preprocess",fe,Gs,al="The next step is to load a BERT tokenizer to process the sentence starts and the four possible endings:",we,Rs,be,Vs,nl="The preprocessing function you want to create needs to:",Te,Xs,pl="<li>Make four copies of the <code>sent1</code> field and combine each of them with <code>sent2</code> to recreate how a sentence starts.</li> <li>Combine <code>sent2</code> with each of the four possible sentence endings.</li> <li>Flatten these two lists so you can tokenize them, and then unflatten them afterward so each example has a corresponding <code>input_ids</code>, <code>attention_mask</code>, and <code>labels</code> field.</li>",ge,Ws,Je,As,rl='To apply the preprocessing function over the entire dataset, use 🤗 Datasets <a href="https://huggingface.co/docs/datasets/v2.14.5/en/package_reference/main_classes#datasets.Dataset.map" rel="nofollow">map</a> method. You can speed up the <code>map</code> function by setting <code>batched=True</code> to process multiple elements of the dataset at once:',Ue,Bs,$e,xs,ol='🤗 Transformers doesn’t have a data collator for multiple choice, so you’ll need to adapt the <a href="/docs/transformers/v4.34.0/en/main_classes/data_collator#transformers.DataCollatorWithPadding">DataCollatorWithPadding</a> to create a batch of examples. 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.',_e,Es,il="<code>DataCollatorForMultipleChoice</code> flattens all the model inputs, applies padding, and then unflattens the results:",Ce,ds,ke,is,us,re,Ys,Pe,ee,cl="Evaluate",Ze,Ns,ml='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):',Ie,Fs,ve,zs,hl='Then create a function that passes your predictions and labels to <a href="https://huggingface.co/docs/evaluate/v0.4.0/en/package_reference/main_classes#evaluate.EvaluationModule.compute" rel="nofollow">compute</a> to calculate the accuracy:',Ge,Qs,Re,Hs,Ml="Your <code>compute_metrics</code> function is ready to go now, and you’ll return to it when you setup your training.",Ve,cs,ys,oe,Ss,De,le,dl="Train",Xe,js,We,fs,Ae,ms,ws,ie,qs,Ke,te,ul="Inference",Be,Ls,yl="Great, now that you’ve finetuned a model, you can use it for inference!",xe,Ps,jl="Come up with some text and two candidate answers:",Ee,Ds,Ye,bs,Ne,ce,Fe;return _=new ae({}),Z=new Vl({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/multiple_choice.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/multiple_choice.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/tensorflow/multiple_choice.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/multiple_choice.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/multiple_choice.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/tensorflow/multiple_choice.ipynb"}]}}),ss=new qe({props:{$$slots:{default:[Xl]},$$scope:{ctx:k}}}),es=new R({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGU=",highlighted:"pip install transformers datasets evaluate",wrap:!1}}),ls=new R({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}}),ts=new ae({}),J=new R({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBc3dhZyUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJzd2FnJTIyJTJDJTIwJTIycmVndWxhciUyMik=",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>swag = load_dataset(<span class="hljs-string">&quot;swag&quot;</span>, <span class="hljs-string">&quot;regular&quot;</span>)`,wrap:!1}}),ks=new R({props:{code:"c3dhZyU1QiUyMnRyYWluJTIyJTVEJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>swag[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;ending0&#x27;</span>: <span class="hljs-string">&#x27;passes by walking down the street playing their instruments.&#x27;</span>,
 <span class="hljs-string">&#x27;ending1&#x27;</span>: <span class="hljs-string">&#x27;has heard approaching them.&#x27;</span>,
 <span class="hljs-string">&#x27;ending2&#x27;</span>: <span class="hljs-string">&quot;arrives and they&#x27;re outside dancing and asleep.&quot;</span>,
 <span class="hljs-string">&#x27;ending3&#x27;</span>: <span class="hljs-string">&#x27;turns the lead singer watches the performance.&#x27;</span>,
 <span class="hljs-string">&#x27;fold-ind&#x27;</span>: <span class="hljs-string">&#x27;3416&#x27;</span>,
 <span class="hljs-string">&#x27;gold-source&#x27;</span>: <span class="hljs-string">&#x27;gold&#x27;</span>,
 <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-number">0</span>,
 <span class="hljs-string">&#x27;sent1&#x27;</span>: <span class="hljs-string">&#x27;Members of the procession walk down the street holding small horn brass instruments.&#x27;</span>,
 <span class="hljs-string">&#x27;sent2&#x27;</span>: <span class="hljs-string">&#x27;A drum line&#x27;</span>,
 <span class="hljs-string">&#x27;startphrase&#x27;</span>: <span class="hljs-string">&#x27;Members of the procession walk down the street holding small horn brass instruments. A drum line&#x27;</span>,
 <span class="hljs-string">&#x27;video-id&#x27;</span>: <span class="hljs-string">&#x27;anetv_jkn6uvmqwh4&#x27;</span>}`,wrap:!1}}),vs=new ae({}),Rs=new R({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJiZXJ0LWJhc2UtdW5jYXNlZCUyMik=",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;bert-base-uncased&quot;</span>)`,wrap:!1}}),Ws=new R({props:{code:"ZW5kaW5nX25hbWVzJTIwJTNEJTIwJTVCJTIyZW5kaW5nMCUyMiUyQyUyMCUyMmVuZGluZzElMjIlMkMlMjAlMjJlbmRpbmcyJTIyJTJDJTIwJTIyZW5kaW5nMyUyMiU1RCUwQSUwQSUwQWRlZiUyMHByZXByb2Nlc3NfZnVuY3Rpb24oZXhhbXBsZXMpJTNBJTBBJTIwJTIwJTIwJTIwZmlyc3Rfc2VudGVuY2VzJTIwJTNEJTIwJTVCJTVCY29udGV4dCU1RCUyMColMjA0JTIwZm9yJTIwY29udGV4dCUyMGluJTIwZXhhbXBsZXMlNUIlMjJzZW50MSUyMiU1RCU1RCUwQSUyMCUyMCUyMCUyMHF1ZXN0aW9uX2hlYWRlcnMlMjAlM0QlMjBleGFtcGxlcyU1QiUyMnNlbnQyJTIyJTVEJTBBJTIwJTIwJTIwJTIwc2Vjb25kX3NlbnRlbmNlcyUyMCUzRCUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1QmYlMjIlN0JoZWFkZXIlN0QlMjAlN0JleGFtcGxlcyU1QmVuZCU1RCU1QmklNUQlN0QlMjIlMjBmb3IlMjBlbmQlMjBpbiUyMGVuZGluZ19uYW1lcyU1RCUyMGZvciUyMGklMkMlMjBoZWFkZXIlMjBpbiUyMGVudW1lcmF0ZShxdWVzdGlvbl9oZWFkZXJzKSUwQSUyMCUyMCUyMCUyMCU1RCUwQSUwQSUyMCUyMCUyMCUyMGZpcnN0X3NlbnRlbmNlcyUyMCUzRCUyMHN1bShmaXJzdF9zZW50ZW5jZXMlMkMlMjAlNUIlNUQpJTBBJTIwJTIwJTIwJTIwc2Vjb25kX3NlbnRlbmNlcyUyMCUzRCUyMHN1bShzZWNvbmRfc2VudGVuY2VzJTJDJTIwJTVCJTVEKSUwQSUwQSUyMCUyMCUyMCUyMHRva2VuaXplZF9leGFtcGxlcyUyMCUzRCUyMHRva2VuaXplcihmaXJzdF9zZW50ZW5jZXMlMkMlMjBzZWNvbmRfc2VudGVuY2VzJTJDJTIwdHJ1bmNhdGlvbiUzRFRydWUpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwJTdCayUzQSUyMCU1QnYlNUJpJTIwJTNBJTIwaSUyMCUyQiUyMDQlNUQlMjBmb3IlMjBpJTIwaW4lMjByYW5nZSgwJTJDJTIwbGVuKHYpJTJDJTIwNCklNUQlMjBmb3IlMjBrJTJDJTIwdiUyMGluJTIwdG9rZW5pemVkX2V4YW1wbGVzLml0ZW1zKCklN0Q=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>ending_names = [<span class="hljs-string">&quot;ending0&quot;</span>, <span class="hljs-string">&quot;ending1&quot;</span>, <span class="hljs-string">&quot;ending2&quot;</span>, <span class="hljs-string">&quot;ending3&quot;</span>]


<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>    first_sentences = [[context] * <span class="hljs-number">4</span> <span class="hljs-keyword">for</span> context <span class="hljs-keyword">in</span> examples[<span class="hljs-string">&quot;sent1&quot;</span>]]
<span class="hljs-meta">... </span>    question_headers = examples[<span class="hljs-string">&quot;sent2&quot;</span>]
<span class="hljs-meta">... </span>    second_sentences = [
<span class="hljs-meta">... </span>        [<span class="hljs-string">f&quot;<span class="hljs-subst">{header}</span> <span class="hljs-subst">{examples[end][i]}</span>&quot;</span> <span class="hljs-keyword">for</span> end <span class="hljs-keyword">in</span> ending_names] <span class="hljs-keyword">for</span> i, header <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(question_headers)
<span class="hljs-meta">... </span>    ]

<span class="hljs-meta">... </span>    first_sentences = <span class="hljs-built_in">sum</span>(first_sentences, [])
<span class="hljs-meta">... </span>    second_sentences = <span class="hljs-built_in">sum</span>(second_sentences, [])

<span class="hljs-meta">... </span>    tokenized_examples = tokenizer(first_sentences, second_sentences, truncation=<span class="hljs-literal">True</span>)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> {k: [v[i : i + <span class="hljs-number">4</span>] <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">0</span>, <span class="hljs-built_in">len</span>(v), <span class="hljs-number">4</span>)] <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> tokenized_examples.items()}`,wrap:!1}}),Bs=new R({props:{code:"dG9rZW5pemVkX3N3YWclMjAlM0QlMjBzd2FnLm1hcChwcmVwcm9jZXNzX2Z1bmN0aW9uJTJDJTIwYmF0Y2hlZCUzRFRydWUp",highlighted:'tokenized_swag = swag.<span class="hljs-built_in">map</span>(preprocess_function, batched=<span class="hljs-literal">True</span>)',wrap:!1}}),ds=new Oe({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[xl],pytorch:[Al]},$$scope:{ctx:k}}}),Ys=new ae({}),Fs=new R({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}}),Qs=new R({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}}),Ss=new ae({}),js=new Oe({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Ql],pytorch:[Nl]},$$scope:{ctx:k}}}),fs=new qe({props:{$$slots:{default:[Hl]},$$scope:{ctx:k}}}),qs=new ae({}),Ds=new R({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyRnJhbmNlJTIwaGFzJTIwYSUyMGJyZWFkJTIwbGF3JTJDJTIwTGUlMjBEJUMzJUE5Y3JldCUyMFBhaW4lMkMlMjB3aXRoJTIwc3RyaWN0JTIwcnVsZXMlMjBvbiUyMHdoYXQlMjBpcyUyMGFsbG93ZWQlMjBpbiUyMGElMjB0cmFkaXRpb25hbCUyMGJhZ3VldHRlLiUyMiUwQWNhbmRpZGF0ZTElMjAlM0QlMjAlMjJUaGUlMjBsYXclMjBkb2VzJTIwbm90JTIwYXBwbHklMjB0byUyMGNyb2lzc2FudHMlMjBhbmQlMjBicmlvY2hlLiUyMiUwQWNhbmRpZGF0ZTIlMjAlM0QlMjAlMjJUaGUlMjBsYXclMjBhcHBsaWVzJTIwdG8lMjBiYWd1ZXR0ZXMuJTIy",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;France has a bread law, Le Décret Pain, with strict rules on what is allowed in a traditional baguette.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>candidate1 = <span class="hljs-string">&quot;The law does not apply to croissants and brioche.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>candidate2 = <span class="hljs-string">&quot;The law applies to baguettes.&quot;</span>`,wrap:!1}}),bs=new Oe({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Pl],pytorch:[ql]},$$scope:{ctx:k}}}),{c(){t=h("meta"),c=o(),l=h("p"),m=o(),u=h("h1"),$=h("a"),B=h("span"),j(_.$$.fragment),V=o(),v=h("span"),v.textContent=G,Y=o(),j(Z.$$.fragment),C=o(),I=h("p"),I.textContent=r,U=o(),x=h("p"),x.textContent=z,N=o(),d=h("ol"),d.innerHTML=X,Q=o(),j(ss.$$.fragment),ns=o(),H=h("p"),H.textContent=gs,D=o(),j(es.$$.fragment),ps=o(),S=h("p"),S.textContent=Js,K=o(),j(ls.$$.fragment),rs=o(),F=h("h2"),L=h("a"),P=h("span"),j(ts.$$.fragment),hs=o(),q=h("span"),q.textContent=Us,O=o(),as=h("p"),as.innerHTML=$s,n=o(),j(J.$$.fragment),_s=o(),Cs=h("p"),Cs.textContent=sl,de=o(),j(ks.$$.fragment),ue=o(),Zs=h("p"),Zs.textContent=el,ye=o(),Is=h("ul"),Is.innerHTML=ll,je=o(),os=h("h2"),Ms=h("a"),pe=h("span"),j(vs.$$.fragment),Le=o(),se=h("span"),se.textContent=tl,fe=o(),Gs=h("p"),Gs.textContent=al,we=o(),j(Rs.$$.fragment),be=o(),Vs=h("p"),Vs.textContent=nl,Te=o(),Xs=h("ol"),Xs.innerHTML=pl,ge=o(),j(Ws.$$.fragment),Je=o(),As=h("p"),As.innerHTML=rl,Ue=o(),j(Bs.$$.fragment),$e=o(),xs=h("p"),xs.innerHTML=ol,_e=o(),Es=h("p"),Es.innerHTML=il,Ce=o(),j(ds.$$.fragment),ke=o(),is=h("h2"),us=h("a"),re=h("span"),j(Ys.$$.fragment),Pe=o(),ee=h("span"),ee.textContent=cl,Ze=o(),Ns=h("p"),Ns.innerHTML=ml,Ie=o(),j(Fs.$$.fragment),ve=o(),zs=h("p"),zs.innerHTML=hl,Ge=o(),j(Qs.$$.fragment),Re=o(),Hs=h("p"),Hs.innerHTML=Ml,Ve=o(),cs=h("h2"),ys=h("a"),oe=h("span"),j(Ss.$$.fragment),De=o(),le=h("span"),le.textContent=dl,Xe=o(),j(js.$$.fragment),We=o(),j(fs.$$.fragment),Ae=o(),ms=h("h2"),ws=h("a"),ie=h("span"),j(qs.$$.fragment),Ke=o(),te=h("span"),te.textContent=ul,Be=o(),Ls=h("p"),Ls.textContent=yl,xe=o(),Ps=h("p"),Ps.textContent=jl,Ee=o(),j(Ds.$$.fragment),Ye=o(),j(bs.$$.fragment),Ne=o(),ce=h("p"),this.h()},l(s){const p=Rl("svelte-1phssyn",document.head);t=M(p,"META",{name:!0,content:!0}),p.forEach(e),c=i(s),l=M(s,"P",{}),E(l).forEach(e),m=i(s),u=M(s,"H1",{class:!0});var Ks=E(u);$=M(Ks,"A",{id:!0,class:!0,href:!0});var me=E($);B=M(me,"SPAN",{});var he=E(B);f(_.$$.fragment,he),he.forEach(e),me.forEach(e),V=i(Ks),v=M(Ks,"SPAN",{"data-svelte-h":!0}),y(v)!=="svelte-1wubvu4"&&(v.textContent=G),Ks.forEach(e),Y=i(s),f(Z.$$.fragment,s),C=i(s),I=M(s,"P",{"data-svelte-h":!0}),y(I)!=="svelte-gcifhg"&&(I.textContent=r),U=i(s),x=M(s,"P",{"data-svelte-h":!0}),y(x)!=="svelte-1aff4p7"&&(x.textContent=z),N=i(s),d=M(s,"OL",{"data-svelte-h":!0}),y(d)!=="svelte-sta7hj"&&(d.innerHTML=X),Q=i(s),f(ss.$$.fragment,s),ns=i(s),H=M(s,"P",{"data-svelte-h":!0}),y(H)!=="svelte-1c9nexd"&&(H.textContent=gs),D=i(s),f(es.$$.fragment,s),ps=i(s),S=M(s,"P",{"data-svelte-h":!0}),y(S)!=="svelte-k76o1m"&&(S.textContent=Js),K=i(s),f(ls.$$.fragment,s),rs=i(s),F=M(s,"H2",{class:!0});var Os=E(F);L=M(Os,"A",{id:!0,class:!0,href:!0});var Me=E(L);P=M(Me,"SPAN",{});var fl=E(P);f(ts.$$.fragment,fl),fl.forEach(e),Me.forEach(e),hs=i(Os),q=M(Os,"SPAN",{"data-svelte-h":!0}),y(q)!=="svelte-1kph5b5"&&(q.textContent=Us),Os.forEach(e),O=i(s),as=M(s,"P",{"data-svelte-h":!0}),y(as)!=="svelte-ndvump"&&(as.innerHTML=$s),n=i(s),f(J.$$.fragment,s),_s=i(s),Cs=M(s,"P",{"data-svelte-h":!0}),y(Cs)!=="svelte-1m91ua0"&&(Cs.textContent=sl),de=i(s),f(ks.$$.fragment,s),ue=i(s),Zs=M(s,"P",{"data-svelte-h":!0}),y(Zs)!=="svelte-1dgdrcg"&&(Zs.textContent=el),ye=i(s),Is=M(s,"UL",{"data-svelte-h":!0}),y(Is)!=="svelte-vj0noe"&&(Is.innerHTML=ll),je=i(s),os=M(s,"H2",{class:!0});var ze=E(os);Ms=M(ze,"A",{id:!0,class:!0,href:!0});var wl=E(Ms);pe=M(wl,"SPAN",{});var bl=E(pe);f(vs.$$.fragment,bl),bl.forEach(e),wl.forEach(e),Le=i(ze),se=M(ze,"SPAN",{"data-svelte-h":!0}),y(se)!=="svelte-1cg9qj"&&(se.textContent=tl),ze.forEach(e),fe=i(s),Gs=M(s,"P",{"data-svelte-h":!0}),y(Gs)!=="svelte-j3i2fe"&&(Gs.textContent=al),we=i(s),f(Rs.$$.fragment,s),be=i(s),Vs=M(s,"P",{"data-svelte-h":!0}),y(Vs)!=="svelte-pduvot"&&(Vs.textContent=nl),Te=i(s),Xs=M(s,"OL",{"data-svelte-h":!0}),y(Xs)!=="svelte-tso4vc"&&(Xs.innerHTML=pl),ge=i(s),f(Ws.$$.fragment,s),Je=i(s),As=M(s,"P",{"data-svelte-h":!0}),y(As)!=="svelte-ndcj3d"&&(As.innerHTML=rl),Ue=i(s),f(Bs.$$.fragment,s),$e=i(s),xs=M(s,"P",{"data-svelte-h":!0}),y(xs)!=="svelte-13wh8q8"&&(xs.innerHTML=ol),_e=i(s),Es=M(s,"P",{"data-svelte-h":!0}),y(Es)!=="svelte-1ytir7e"&&(Es.innerHTML=il),Ce=i(s),f(ds.$$.fragment,s),ke=i(s),is=M(s,"H2",{class:!0});var Qe=E(is);us=M(Qe,"A",{id:!0,class:!0,href:!0});var Tl=E(us);re=M(Tl,"SPAN",{});var gl=E(re);f(Ys.$$.fragment,gl),gl.forEach(e),Tl.forEach(e),Pe=i(Qe),ee=M(Qe,"SPAN",{"data-svelte-h":!0}),y(ee)!=="svelte-sh8s6s"&&(ee.textContent=cl),Qe.forEach(e),Ze=i(s),Ns=M(s,"P",{"data-svelte-h":!0}),y(Ns)!=="svelte-j1ipe9"&&(Ns.innerHTML=ml),Ie=i(s),f(Fs.$$.fragment,s),ve=i(s),zs=M(s,"P",{"data-svelte-h":!0}),y(zs)!=="svelte-14oy2j6"&&(zs.innerHTML=hl),Ge=i(s),f(Qs.$$.fragment,s),Re=i(s),Hs=M(s,"P",{"data-svelte-h":!0}),y(Hs)!=="svelte-183aynn"&&(Hs.innerHTML=Ml),Ve=i(s),cs=M(s,"H2",{class:!0});var He=E(cs);ys=M(He,"A",{id:!0,class:!0,href:!0});var Jl=E(ys);oe=M(Jl,"SPAN",{});var Ul=E(oe);f(Ss.$$.fragment,Ul),Ul.forEach(e),Jl.forEach(e),De=i(He),le=M(He,"SPAN",{"data-svelte-h":!0}),y(le)!=="svelte-5arm0l"&&(le.textContent=dl),He.forEach(e),Xe=i(s),f(js.$$.fragment,s),We=i(s),f(fs.$$.fragment,s),Ae=i(s),ms=M(s,"H2",{class:!0});var Se=E(ms);ws=M(Se,"A",{id:!0,class:!0,href:!0});var $l=E(ws);ie=M($l,"SPAN",{});var _l=E(ie);f(qs.$$.fragment,_l),_l.forEach(e),$l.forEach(e),Ke=i(Se),te=M(Se,"SPAN",{"data-svelte-h":!0}),y(te)!=="svelte-199uz7g"&&(te.textContent=ul),Se.forEach(e),Be=i(s),Ls=M(s,"P",{"data-svelte-h":!0}),y(Ls)!=="svelte-633ppb"&&(Ls.textContent=yl),xe=i(s),Ps=M(s,"P",{"data-svelte-h":!0}),y(Ps)!=="svelte-nni2mt"&&(Ps.textContent=jl),Ee=i(s),f(Ds.$$.fragment,s),Ye=i(s),f(bs.$$.fragment,s),Ne=i(s),ce=M(s,"P",{}),E(ce).forEach(e),this.h()},h(){W(t,"name","hf:doc:metadata"),W(t,"content",JSON.stringify(Kl)),W($,"id","multiple-choice"),W($,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),W($,"href","#multiple-choice"),W(u,"class","relative group"),W(L,"id","load-swag-dataset"),W(L,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),W(L,"href","#load-swag-dataset"),W(F,"class","relative group"),W(Ms,"id","preprocess"),W(Ms,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),W(Ms,"href","#preprocess"),W(os,"class","relative group"),W(us,"id","evaluate"),W(us,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),W(us,"href","#evaluate"),W(is,"class","relative group"),W(ys,"id","train"),W(ys,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),W(ys,"href","#train"),W(cs,"class","relative group"),W(ws,"id","inference"),W(ws,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),W(ws,"href","#inference"),W(ms,"class","relative group")},m(s,p){A(document.head,t),a(s,c,p),a(s,l,p),a(s,m,p),a(s,u,p),A(u,$),A($,B),w(_,B,null),A(u,V),A(u,v),a(s,Y,p),w(Z,s,p),a(s,C,p),a(s,I,p),a(s,U,p),a(s,x,p),a(s,N,p),a(s,d,p),a(s,Q,p),w(ss,s,p),a(s,ns,p),a(s,H,p),a(s,D,p),w(es,s,p),a(s,ps,p),a(s,S,p),a(s,K,p),w(ls,s,p),a(s,rs,p),a(s,F,p),A(F,L),A(L,P),w(ts,P,null),A(F,hs),A(F,q),a(s,O,p),a(s,as,p),a(s,n,p),w(J,s,p),a(s,_s,p),a(s,Cs,p),a(s,de,p),w(ks,s,p),a(s,ue,p),a(s,Zs,p),a(s,ye,p),a(s,Is,p),a(s,je,p),a(s,os,p),A(os,Ms),A(Ms,pe),w(vs,pe,null),A(os,Le),A(os,se),a(s,fe,p),a(s,Gs,p),a(s,we,p),w(Rs,s,p),a(s,be,p),a(s,Vs,p),a(s,Te,p),a(s,Xs,p),a(s,ge,p),w(Ws,s,p),a(s,Je,p),a(s,As,p),a(s,Ue,p),w(Bs,s,p),a(s,$e,p),a(s,xs,p),a(s,_e,p),a(s,Es,p),a(s,Ce,p),w(ds,s,p),a(s,ke,p),a(s,is,p),A(is,us),A(us,re),w(Ys,re,null),A(is,Pe),A(is,ee),a(s,Ze,p),a(s,Ns,p),a(s,Ie,p),w(Fs,s,p),a(s,ve,p),a(s,zs,p),a(s,Ge,p),w(Qs,s,p),a(s,Re,p),a(s,Hs,p),a(s,Ve,p),a(s,cs,p),A(cs,ys),A(ys,oe),w(Ss,oe,null),A(cs,De),A(cs,le),a(s,Xe,p),w(js,s,p),a(s,We,p),w(fs,s,p),a(s,Ae,p),a(s,ms,p),A(ms,ws),A(ws,ie),w(qs,ie,null),A(ms,Ke),A(ms,te),a(s,Be,p),a(s,Ls,p),a(s,xe,p),a(s,Ps,p),a(s,Ee,p),w(Ds,s,p),a(s,Ye,p),w(bs,s,p),a(s,Ne,p),a(s,ce,p),Fe=!0},p(s,[p]){const Ks={};p&2&&(Ks.$$scope={dirty:p,ctx:s}),ss.$set(Ks);const me={};p&2&&(me.$$scope={dirty:p,ctx:s}),ds.$set(me);const he={};p&2&&(he.$$scope={dirty:p,ctx:s}),js.$set(he);const Os={};p&2&&(Os.$$scope={dirty:p,ctx:s}),fs.$set(Os);const Me={};p&2&&(Me.$$scope={dirty:p,ctx:s}),bs.$set(Me)},i(s){Fe||(b(_.$$.fragment,s),b(Z.$$.fragment,s),b(ss.$$.fragment,s),b(es.$$.fragment,s),b(ls.$$.fragment,s),b(ts.$$.fragment,s),b(J.$$.fragment,s),b(ks.$$.fragment,s),b(vs.$$.fragment,s),b(Rs.$$.fragment,s),b(Ws.$$.fragment,s),b(Bs.$$.fragment,s),b(ds.$$.fragment,s),b(Ys.$$.fragment,s),b(Fs.$$.fragment,s),b(Qs.$$.fragment,s),b(Ss.$$.fragment,s),b(js.$$.fragment,s),b(fs.$$.fragment,s),b(qs.$$.fragment,s),b(Ds.$$.fragment,s),b(bs.$$.fragment,s),Fe=!0)},o(s){T(_.$$.fragment,s),T(Z.$$.fragment,s),T(ss.$$.fragment,s),T(es.$$.fragment,s),T(ls.$$.fragment,s),T(ts.$$.fragment,s),T(J.$$.fragment,s),T(ks.$$.fragment,s),T(vs.$$.fragment,s),T(Rs.$$.fragment,s),T(Ws.$$.fragment,s),T(Bs.$$.fragment,s),T(ds.$$.fragment,s),T(Ys.$$.fragment,s),T(Fs.$$.fragment,s),T(Qs.$$.fragment,s),T(Ss.$$.fragment,s),T(js.$$.fragment,s),T(fs.$$.fragment,s),T(qs.$$.fragment,s),T(Ds.$$.fragment,s),T(bs.$$.fragment,s),Fe=!1},d(s){s&&(e(c),e(l),e(m),e(u),e(Y),e(C),e(I),e(U),e(x),e(N),e(d),e(Q),e(ns),e(H),e(D),e(ps),e(S),e(K),e(rs),e(F),e(O),e(as),e(n),e(_s),e(Cs),e(de),e(ue),e(Zs),e(ye),e(Is),e(je),e(os),e(fe),e(Gs),e(we),e(be),e(Vs),e(Te),e(Xs),e(ge),e(Je),e(As),e(Ue),e($e),e(xs),e(_e),e(Es),e(Ce),e(ke),e(is),e(Ze),e(Ns),e(Ie),e(ve),e(zs),e(Ge),e(Re),e(Hs),e(Ve),e(cs),e(Xe),e(We),e(Ae),e(ms),e(Be),e(Ls),e(xe),e(Ps),e(Ee),e(Ye),e(Ne),e(ce)),e(t),g(_),g(Z,s),g(ss,s),g(es,s),g(ls,s),g(ts),g(J,s),g(ks,s),g(vs),g(Rs,s),g(Ws,s),g(Bs,s),g(ds,s),g(Ys),g(Fs,s),g(Qs,s),g(Ss),g(js,s),g(fs,s),g(qs),g(Ds,s),g(bs,s)}}}const Kl={local:"multiple-choice",sections:[{local:"load-swag-dataset",title:"Load SWAG dataset"},{local:"preprocess",title:"Preprocess"},{local:"evaluate",title:"Evaluate"},{local:"train",title:"Train"},{local:"inference",title:"Inference"}],title:"Multiple choice"};function Ol(k){return Il(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class rt extends vl{constructor(t){super(),Gl(this,t,Ol,Dl,Zl,{})}}export{rt as component};
