import{s as Il,o as Gl,n as Xs}from"../chunks/scheduler.9bc65507.js";import{S as Vl,i as Xl,g as J,s as M,r as j,A as Rl,h as U,f as t,c,j as _l,u as y,x as T,k as kl,y as Wl,a as e,v as h,d as u,t as d,w,m as Al,n as Bl}from"../chunks/index.707bf1b6.js";import{T as ol}from"../chunks/Tip.c2ecdbf4.js";import{C as V}from"../chunks/CodeBlock.54a9f38d.js";import{D as vl}from"../chunks/DocNotebookDropdown.41f65cb5.js";import{F as il,M as Ws}from"../chunks/Markdown.8ab98a13.js";import{H as Rs,E as Yl}from"../chunks/EditOnGithub.922df6ba.js";function xl(G){let a,m;return a=new V({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(a.$$.fragment)},l(l){y(a.$$.fragment,l)},m(l,i){h(a,l,i),m=!0},p:Xs,i(l){m||(u(a.$$.fragment,l),m=!0)},o(l){d(a.$$.fragment,l),m=!1},d(l){w(a,l)}}}function Fl(G){let a,m;return a=new Ws({props:{$$slots:{default:[xl]},$$scope:{ctx:G}}}),{c(){j(a.$$.fragment)},l(l){y(a.$$.fragment,l)},m(l,i){h(a,l,i),m=!0},p(l,i){const f={};i&2&&(f.$$scope={dirty:i,ctx:l}),a.$set(f)},i(l){m||(u(a.$$.fragment,l),m=!0)},o(l){d(a.$$.fragment,l),m=!1},d(l){w(a,l)}}}function El(G){let a,m;return a=new V({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(a.$$.fragment)},l(l){y(a.$$.fragment,l)},m(l,i){h(a,l,i),m=!0},p:Xs,i(l){m||(u(a.$$.fragment,l),m=!0)},o(l){d(a.$$.fragment,l),m=!1},d(l){w(a,l)}}}function Nl(G){let a,m;return a=new Ws({props:{$$slots:{default:[El]},$$scope:{ctx:G}}}),{c(){j(a.$$.fragment)},l(l){y(a.$$.fragment,l)},m(l,i){h(a,l,i),m=!0},p(l,i){const f={};i&2&&(f.$$scope={dirty:i,ctx:l}),a.$set(f)},i(l){m||(u(a.$$.fragment,l),m=!0)},o(l){d(a.$$.fragment,l),m=!1},d(l){w(a,l)}}}function zl(G){let a,m='<a href="/docs/transformers/pr_31098/ja/main_classes/trainer#transformers.Trainer">Trainer</a> を使用したモデルの微調整に慣れていない場合は、<a href="../training#train-with-pytorch-trainer">ここ</a> の基本的なチュートリアルをご覧ください。';return{c(){a=J("p"),a.innerHTML=m},l(l){a=U(l,"P",{"data-svelte-h":!0}),T(a)!=="svelte-1opd0x1"&&(a.innerHTML=m)},m(l,i){e(l,a,i)},p:Xs,d(l){l&&t(a)}}}function Ql(G){let a,m,l,i='これでモデルのトレーニングを開始する準備が整いました。 <a href="/docs/transformers/pr_31098/ja/model_doc/auto#transformers.AutoModelForMultipleChoice">AutoModelForMultipleChoice</a> を使用して BERT をロードします。',f,C,A,k,Z="この時点で残っている手順は次の 3 つだけです。",R,_,B='<li><a href="/docs/transformers/pr_31098/ja/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a> でトレーニング ハイパーパラメータを定義します。唯一の必須パラメータは、モデルの保存場所を指定する <code>output_dir</code> です。 <code>push_to_hub=True</code>を設定して、このモデルをハブにプッシュします (モデルをアップロードするには、Hugging Face にサインインする必要があります)。各エポックの終了時に、<a href="/docs/transformers/pr_31098/ja/main_classes/trainer#transformers.Trainer">Trainer</a> は精度を評価し、トレーニング チェックポイントを保存します。</li> <li>トレーニング引数を、モデル、データセット、トークナイザー、データ照合器、および <code>compute_metrics</code> 関数とともに <a href="/docs/transformers/pr_31098/ja/main_classes/trainer#transformers.Trainer">Trainer</a> に渡します。</li> <li><a href="/docs/transformers/pr_31098/ja/main_classes/trainer#transformers.Trainer.train">train()</a> を呼び出してモデルを微調整します。</li>',W,$,I,r,g='トレーニングが完了したら、 <a href="/docs/transformers/pr_31098/ja/main_classes/trainer#transformers.Trainer.push_to_hub">push_to_hub()</a> メソッドを使用してモデルをハブに共有し、誰もがモデルを使用できますように。',v,F,x;return a=new ol({props:{$$slots:{default:[zl]},$$scope:{ctx:G}}}),C=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvck11bHRpcGxlQ2hvaWNlJTJDJTIwVHJhaW5pbmdBcmd1bWVudHMlMkMlMjBUcmFpbmVyJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JNdWx0aXBsZUNob2ljZS5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlLWJlcnQlMkZiZXJ0LWJhc2UtdW5jYXNlZCUyMik=",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;google-bert/bert-base-uncased&quot;</span>)`,wrap:!1}}),$=new V({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJteV9hd2Vzb21lX3N3YWdfbW9kZWwlMjIlMkMlMEElMjAlMjAlMjAlMjBldmFsX3N0cmF0ZWd5JTNEJTIyZXBvY2glMjIlMkMlMEElMjAlMjAlMjAlMjBzYXZlX3N0cmF0ZWd5JTNEJTIyZXBvY2glMjIlMkMlMEElMjAlMjAlMjAlMjBsb2FkX2Jlc3RfbW9kZWxfYXRfZW5kJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMGxlYXJuaW5nX3JhdGUlM0Q1ZS01JTJDJTBBJTIwJTIwJTIwJTIwcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBwZXJfZGV2aWNlX2V2YWxfYmF0Y2hfc2l6ZSUzRDE2JTJDJTBBJTIwJTIwJTIwJTIwbnVtX3RyYWluX2Vwb2NocyUzRDMlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfZGVjYXklM0QwLjAxJTJDJTBBJTIwJTIwJTIwJTIwcHVzaF90b19odWIlM0RUcnVlJTJDJTBBKSUwQSUwQXRyYWluZXIlMjAlM0QlMjBUcmFpbmVyKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEbW9kZWwlMkMlMEElMjAlMjAlMjAlMjBhcmdzJTNEdHJhaW5pbmdfYXJncyUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0R0b2tlbml6ZWRfc3dhZyU1QiUyMnRyYWluJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9kYXRhc2V0JTNEdG9rZW5pemVkX3N3YWclNUIlMjJ2YWxpZGF0aW9uJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwdG9rZW5pemVyJTNEdG9rZW5pemVyJTJDJTBBJTIwJTIwJTIwJTIwZGF0YV9jb2xsYXRvciUzRERhdGFDb2xsYXRvckZvck11bHRpcGxlQ2hvaWNlKHRva2VuaXplciUzRHRva2VuaXplciklMkMlMEElMjAlMjAlMjAlMjBjb21wdXRlX21ldHJpY3MlM0Rjb21wdXRlX21ldHJpY3MlMkMlMEEpJTBBJTBBdHJhaW5lci50cmFpbigp",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>    eval_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}}),F=new V({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){j(a.$$.fragment),m=M(),l=J("p"),l.innerHTML=i,f=M(),j(C.$$.fragment),A=M(),k=J("p"),k.textContent=Z,R=M(),_=J("ol"),_.innerHTML=B,W=M(),j($.$$.fragment),I=M(),r=J("p"),r.innerHTML=g,v=M(),j(F.$$.fragment)},l(o){y(a.$$.fragment,o),m=c(o),l=U(o,"P",{"data-svelte-h":!0}),T(l)!=="svelte-zs4dl3"&&(l.innerHTML=i),f=c(o),y(C.$$.fragment,o),A=c(o),k=U(o,"P",{"data-svelte-h":!0}),T(k)!=="svelte-1j8bgyv"&&(k.textContent=Z),R=c(o),_=U(o,"OL",{"data-svelte-h":!0}),T(_)!=="svelte-1i4kata"&&(_.innerHTML=B),W=c(o),y($.$$.fragment,o),I=c(o),r=U(o,"P",{"data-svelte-h":!0}),T(r)!=="svelte-16hdftw"&&(r.innerHTML=g),v=c(o),y(F.$$.fragment,o)},m(o,X){h(a,o,X),e(o,m,X),e(o,l,X),e(o,f,X),h(C,o,X),e(o,A,X),e(o,k,X),e(o,R,X),e(o,_,X),e(o,W,X),h($,o,X),e(o,I,X),e(o,r,X),e(o,v,X),h(F,o,X),x=!0},p(o,X){const Y={};X&2&&(Y.$$scope={dirty:X,ctx:o}),a.$set(Y)},i(o){x||(u(a.$$.fragment,o),u(C.$$.fragment,o),u($.$$.fragment,o),u(F.$$.fragment,o),x=!0)},o(o){d(a.$$.fragment,o),d(C.$$.fragment,o),d($.$$.fragment,o),d(F.$$.fragment,o),x=!1},d(o){o&&(t(m),t(l),t(f),t(A),t(k),t(R),t(_),t(W),t(I),t(r),t(v)),w(a,o),w(C,o),w($,o),w(F,o)}}}function Hl(G){let a,m;return a=new Ws({props:{$$slots:{default:[Ql]},$$scope:{ctx:G}}}),{c(){j(a.$$.fragment)},l(l){y(a.$$.fragment,l)},m(l,i){h(a,l,i),m=!0},p(l,i){const f={};i&2&&(f.$$scope={dirty:i,ctx:l}),a.$set(f)},i(l){m||(u(a.$$.fragment,l),m=!0)},o(l){d(a.$$.fragment,l),m=!1},d(l){w(a,l)}}}function Sl(G){let a,m='Keras を使用したモデルの微調整に慣れていない場合は、<a href="../training#train-a-tensorflow-model-with-keras">こちら</a> の基本的なチュートリアルをご覧ください。';return{c(){a=J("p"),a.innerHTML=m},l(l){a=U(l,"P",{"data-svelte-h":!0}),T(a)!=="svelte-1jwo7q8"&&(a.innerHTML=m)},m(l,i){e(l,a,i)},p:Xs,d(l){l&&t(a)}}}function ql(G){let a,m,l,i,f,C='次に、<a href="/docs/transformers/pr_31098/ja/model_doc/auto#transformers.TFAutoModelForMultipleChoice">TFAutoModelForMultipleChoice</a> を使用して BERT をロードできます。',A,k,Z,R,_='<a href="/docs/transformers/pr_31098/ja/main_classes/model#transformers.TFPreTrainedModel.prepare_tf_dataset">prepare_tf_dataset()</a> を使用して、データセットを <code>tf.data.Dataset</code> 形式に変換します。',B,W,$,I,r='<a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a> を使用してトレーニング用のモデルを設定します。 Transformers モデルにはすべてデフォルトのタスク関連の損失関数があるため、次の場合を除き、損失関数を指定する必要はないことに注意してください。',g,v,F,x,o='トレーニングを開始する前にセットアップする最後の 2 つのことは、予測から精度を計算することと、モデルをハブにプッシュする方法を提供することです。どちらも <a href="../main_classes/keras_callbacks">Keras コールバック</a> を使用して行われます。',X,Y,As='<code>compute_metrics</code> 関数を <a href="/docs/transformers/pr_31098/ja/main_classes/keras_callbacks#transformers.KerasMetricCallback">KerasMetricCallback</a> に渡します。',ss,E,ls,N,ms='<a href="/docs/transformers/pr_31098/ja/main_classes/keras_callbacks#transformers.PushToHubCallback">PushToHubCallback</a> でモデルとトークナイザーをプッシュする場所を指定します。',S,D,as,z,is="次に、コールバックをまとめてバンドルします。",q,P,ts,Q,os='ついに、モデルのトレーニングを開始する準備が整いました。トレーニングおよび検証データセット、エポック数、コールバックを指定して <a href="https://keras.io/api/models/model_training_apis/#fit-method" rel="nofollow"><code>fit</code></a> を呼び出し、モデルを微調整します。',L,K,es,H,Bs="トレーニングが完了すると、モデルは自動的にハブにアップロードされ、誰でも使用できるようになります。",ns;return a=new ol({props:{$$slots:{default:[Sl]},$$scope:{ctx:G}}}),l=new V({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}}),k=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yTXVsdGlwbGVDaG9pY2UlMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yTXVsdGlwbGVDaG9pY2UuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZS1iZXJ0JTJGYmVydC1iYXNlLXVuY2FzZWQlMjIp",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;google-bert/bert-base-uncased&quot;</span>)`,wrap:!1}}),W=new V({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}}),v=new V({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}}),E=new V({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}}),D=new V({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 V({props:{code:"Y2FsbGJhY2tzJTIwJTNEJTIwJTVCbWV0cmljX2NhbGxiYWNrJTJDJTIwcHVzaF90b19odWJfY2FsbGJhY2slNUQ=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>callbacks = [metric_callback, push_to_hub_callback]',wrap:!1}}),K=new V({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(a.$$.fragment),m=Al(`
TensorFlow でモデルを微調整するには、オプティマイザー関数、学習率スケジュール、およびいくつかのトレーニング ハイパーパラメーターをセットアップすることから始めます。

	`),j(l.$$.fragment),i=M(),f=J("p"),f.innerHTML=C,A=M(),j(k.$$.fragment),Z=M(),R=J("p"),R.innerHTML=_,B=M(),j(W.$$.fragment),$=M(),I=J("p"),I.innerHTML=r,g=M(),j(v.$$.fragment),F=M(),x=J("p"),x.innerHTML=o,X=M(),Y=J("p"),Y.innerHTML=As,ss=M(),j(E.$$.fragment),ls=M(),N=J("p"),N.innerHTML=ms,S=M(),j(D.$$.fragment),as=M(),z=J("p"),z.textContent=is,q=M(),j(P.$$.fragment),ts=M(),Q=J("p"),Q.innerHTML=os,L=M(),j(K.$$.fragment),es=M(),H=J("p"),H.textContent=Bs},l(n){y(a.$$.fragment,n),m=Bl(n,`
TensorFlow でモデルを微調整するには、オプティマイザー関数、学習率スケジュール、およびいくつかのトレーニング ハイパーパラメーターをセットアップすることから始めます。

	`),y(l.$$.fragment,n),i=c(n),f=U(n,"P",{"data-svelte-h":!0}),T(f)!=="svelte-b8a8kq"&&(f.innerHTML=C),A=c(n),y(k.$$.fragment,n),Z=c(n),R=U(n,"P",{"data-svelte-h":!0}),T(R)!=="svelte-18nn0rl"&&(R.innerHTML=_),B=c(n),y(W.$$.fragment,n),$=c(n),I=U(n,"P",{"data-svelte-h":!0}),T(I)!=="svelte-1pd5few"&&(I.innerHTML=r),g=c(n),y(v.$$.fragment,n),F=c(n),x=U(n,"P",{"data-svelte-h":!0}),T(x)!=="svelte-16n7r85"&&(x.innerHTML=o),X=c(n),Y=U(n,"P",{"data-svelte-h":!0}),T(Y)!=="svelte-oxynob"&&(Y.innerHTML=As),ss=c(n),y(E.$$.fragment,n),ls=c(n),N=U(n,"P",{"data-svelte-h":!0}),T(N)!=="svelte-3fia5g"&&(N.innerHTML=ms),S=c(n),y(D.$$.fragment,n),as=c(n),z=U(n,"P",{"data-svelte-h":!0}),T(z)!=="svelte-r16oc5"&&(z.textContent=is),q=c(n),y(P.$$.fragment,n),ts=c(n),Q=U(n,"P",{"data-svelte-h":!0}),T(Q)!=="svelte-ffgub5"&&(Q.innerHTML=os),L=c(n),y(K.$$.fragment,n),es=c(n),H=U(n,"P",{"data-svelte-h":!0}),T(H)!=="svelte-vh7z0v"&&(H.textContent=Bs)},m(n,b){h(a,n,b),e(n,m,b),h(l,n,b),e(n,i,b),e(n,f,b),e(n,A,b),h(k,n,b),e(n,Z,b),e(n,R,b),e(n,B,b),h(W,n,b),e(n,$,b),e(n,I,b),e(n,g,b),h(v,n,b),e(n,F,b),e(n,x,b),e(n,X,b),e(n,Y,b),e(n,ss,b),h(E,n,b),e(n,ls,b),e(n,N,b),e(n,S,b),h(D,n,b),e(n,as,b),e(n,z,b),e(n,q,b),h(P,n,b),e(n,ts,b),e(n,Q,b),e(n,L,b),h(K,n,b),e(n,es,b),e(n,H,b),ns=!0},p(n,b){const O={};b&2&&(O.$$scope={dirty:b,ctx:n}),a.$set(O)},i(n){ns||(u(a.$$.fragment,n),u(l.$$.fragment,n),u(k.$$.fragment,n),u(W.$$.fragment,n),u(v.$$.fragment,n),u(E.$$.fragment,n),u(D.$$.fragment,n),u(P.$$.fragment,n),u(K.$$.fragment,n),ns=!0)},o(n){d(a.$$.fragment,n),d(l.$$.fragment,n),d(k.$$.fragment,n),d(W.$$.fragment,n),d(v.$$.fragment,n),d(E.$$.fragment,n),d(D.$$.fragment,n),d(P.$$.fragment,n),d(K.$$.fragment,n),ns=!1},d(n){n&&(t(m),t(i),t(f),t(A),t(Z),t(R),t(B),t($),t(I),t(g),t(F),t(x),t(X),t(Y),t(ss),t(ls),t(N),t(S),t(as),t(z),t(q),t(ts),t(Q),t(L),t(es),t(H)),w(a,n),w(l,n),w(k,n),w(W,n),w(v,n),w(E,n),w(D,n),w(P,n),w(K,n)}}}function Ll(G){let a,m;return a=new Ws({props:{$$slots:{default:[ql]},$$scope:{ctx:G}}}),{c(){j(a.$$.fragment)},l(l){y(a.$$.fragment,l)},m(l,i){h(a,l,i),m=!0},p(l,i){const f={};i&2&&(f.$$scope={dirty:i,ctx:l}),a.$set(f)},i(l){m||(u(a.$$.fragment,l),m=!0)},o(l){d(a.$$.fragment,l),m=!1},d(l){w(a,l)}}}function Dl(G){let a,m=`複数選択用にモデルを微調整する方法の詳細な例については、対応するセクションを参照してください。
<a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multiple_choice.ipynb" rel="nofollow">PyTorch ノートブック</a>
または <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multiple_choice-tf.ipynb" rel="nofollow">TensorFlow ノートブック</a>。`;return{c(){a=J("p"),a.innerHTML=m},l(l){a=U(l,"P",{"data-svelte-h":!0}),T(a)!=="svelte-qfa40k"&&(a.innerHTML=m)},m(l,i){e(l,a,i)},p:Xs,d(l){l&&t(a)}}}function Pl(G){let a,m="各プロンプトと回答候補のペアをトークン化し、PyTorch テンソルを返します。いくつかの<code>lables</code>も作成する必要があります。",l,i,f,C,A="入力とラベルをモデルに渡し、<code>logits</code>を返します。",k,Z,R,_,B="最も高い確率でクラスを取得します。",W,$,I;return i=new V({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}}),Z=new V({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}}),$=new V({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(){a=J("p"),a.innerHTML=m,l=M(),j(i.$$.fragment),f=M(),C=J("p"),C.innerHTML=A,k=M(),j(Z.$$.fragment),R=M(),_=J("p"),_.textContent=B,W=M(),j($.$$.fragment)},l(r){a=U(r,"P",{"data-svelte-h":!0}),T(a)!=="svelte-zbyraq"&&(a.innerHTML=m),l=c(r),y(i.$$.fragment,r),f=c(r),C=U(r,"P",{"data-svelte-h":!0}),T(C)!=="svelte-3ueqnu"&&(C.innerHTML=A),k=c(r),y(Z.$$.fragment,r),R=c(r),_=U(r,"P",{"data-svelte-h":!0}),T(_)!=="svelte-yua5rw"&&(_.textContent=B),W=c(r),y($.$$.fragment,r)},m(r,g){e(r,a,g),e(r,l,g),h(i,r,g),e(r,f,g),e(r,C,g),e(r,k,g),h(Z,r,g),e(r,R,g),e(r,_,g),e(r,W,g),h($,r,g),I=!0},p:Xs,i(r){I||(u(i.$$.fragment,r),u(Z.$$.fragment,r),u($.$$.fragment,r),I=!0)},o(r){d(i.$$.fragment,r),d(Z.$$.fragment,r),d($.$$.fragment,r),I=!1},d(r){r&&(t(a),t(l),t(f),t(C),t(k),t(R),t(_),t(W)),w(i,r),w(Z,r),w($,r)}}}function Kl(G){let a,m;return a=new Ws({props:{$$slots:{default:[Pl]},$$scope:{ctx:G}}}),{c(){j(a.$$.fragment)},l(l){y(a.$$.fragment,l)},m(l,i){h(a,l,i),m=!0},p(l,i){const f={};i&2&&(f.$$scope={dirty:i,ctx:l}),a.$set(f)},i(l){m||(u(a.$$.fragment,l),m=!0)},o(l){d(a.$$.fragment,l),m=!1},d(l){w(a,l)}}}function Ol(G){let a,m="各プロンプトと回答候補のペアをトークン化し、TensorFlow テンソルを返します。",l,i,f,C,A="入力をモデルに渡し、<code>logits</code>を返します。",k,Z,R,_,B="最も高い確率でクラスを取得します。",W,$,I;return i=new V({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}}),Z=new V({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}}),$=new V({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(){a=J("p"),a.textContent=m,l=M(),j(i.$$.fragment),f=M(),C=J("p"),C.innerHTML=A,k=M(),j(Z.$$.fragment),R=M(),_=J("p"),_.textContent=B,W=M(),j($.$$.fragment)},l(r){a=U(r,"P",{"data-svelte-h":!0}),T(a)!=="svelte-fvrqfh"&&(a.textContent=m),l=c(r),y(i.$$.fragment,r),f=c(r),C=U(r,"P",{"data-svelte-h":!0}),T(C)!=="svelte-1rvunpz"&&(C.innerHTML=A),k=c(r),y(Z.$$.fragment,r),R=c(r),_=U(r,"P",{"data-svelte-h":!0}),T(_)!=="svelte-yua5rw"&&(_.textContent=B),W=c(r),y($.$$.fragment,r)},m(r,g){e(r,a,g),e(r,l,g),h(i,r,g),e(r,f,g),e(r,C,g),e(r,k,g),h(Z,r,g),e(r,R,g),e(r,_,g),e(r,W,g),h($,r,g),I=!0},p:Xs,i(r){I||(u(i.$$.fragment,r),u(Z.$$.fragment,r),u($.$$.fragment,r),I=!0)},o(r){d(i.$$.fragment,r),d(Z.$$.fragment,r),d($.$$.fragment,r),I=!1},d(r){r&&(t(a),t(l),t(f),t(C),t(k),t(R),t(_),t(W)),w(i,r),w(Z,r),w($,r)}}}function sa(G){let a,m;return a=new Ws({props:{$$slots:{default:[Ol]},$$scope:{ctx:G}}}),{c(){j(a.$$.fragment)},l(l){y(a.$$.fragment,l)},m(l,i){h(a,l,i),m=!0},p(l,i){const f={};i&2&&(f.$$scope={dirty:i,ctx:l}),a.$set(f)},i(l){m||(u(a.$$.fragment,l),m=!0)},o(l){d(a.$$.fragment,l),m=!1},d(l){w(a,l)}}}function la(G){let a,m,l,i,f,C,A,k,Z,R="多肢選択タスクは質問応答に似ていますが、いくつかの候補の回答がコンテキストとともに提供され、正しい回答を選択するようにモデルがトレーニングされる点が異なります。",_,B,W="このガイドでは、次の方法を説明します。",$,I,r='<li><a href="https://huggingface.co/datasets/swag" rel="nofollow">SWAG</a> データセットの「通常」構成で <a href="https://huggingface.co/google-bert/bert-base-uncased" rel="nofollow">BERT</a> を微調整して、最適なデータセットを選択します複数の選択肢と何らかのコンテキストを考慮して回答します。</li> <li>微調整したモデルを推論に使用します。</li>',g,v,F="始める前に、必要なライブラリがすべてインストールされていることを確認してください。",x,o,X,Y,As="モデルをアップロードしてコミュニティと共有できるように、Hugging Face アカウントにログインすることをお勧めします。プロンプトが表示されたら、トークンを入力してログインします。",ss,E,ls,N,ms,S,D="まず、🤗 データセット ライブラリから SWAG データセットの「通常」構成をロードします。",as,z,is,q,P="次に、例を見てみましょう。",ts,Q,os,L,K="ここにはたくさんのフィールドがあるように見えますが、実際は非常に簡単です。",es,H,Bs="<li><code>sent1</code> と <code>sent2</code>: これらのフィールドは文の始まりを示し、この 2 つを組み合わせると <code>startphrase</code> フィールドが得られます。</li> <li><code>ending</code>: 文の終わり方として考えられる終わり方を示唆しますが、正しいのは 1 つだけです。</li> <li><code>label</code>: 正しい文の終わりを識別します。</li>",ns,n,b,O,jl="次のステップでは、BERT トークナイザーをロードして、文の始まりと 4 つの可能な終わりを処理します。",Ys,js,xs,ys,yl="作成する前処理関数は次のことを行う必要があります。",Fs,hs,hl="<li><code>sent1</code> フィールドのコピーを 4 つ作成し、それぞれを <code>sent2</code> と組み合わせて文の始まりを再現します。</li> <li><code>sent2</code> を 4 つの可能な文末尾のそれぞれと組み合わせます。</li> <li>これら 2 つのリストをトークン化できるようにフラット化し、その後、各例に対応する <code>input_ids</code>、<code>attention_mask</code>、および <code>labels</code> フィールドが含まれるように非フラット化します。</li>",Es,us,Ns,ds,ul="データセット全体に前処理関数を適用するには、🤗 Datasets <code>map</code> メソッドを使用します。 <code>batched=True</code> を設定してデータセットの複数の要素を一度に処理することで、<code>map</code> 関数を高速化できます。",zs,ws,Qs,fs,dl="🤗 Transformers には多肢選択用のデータ照合器がないため、<code>DataCollat​​orWithPadding</code> を調整してサンプルのバッチを作成する必要があります。データセット全体を最大長までパディングするのではなく、照合中にバッチ内の最長の長さまで文を <em>動的にパディング</em> する方が効率的です。",Hs,Js,wl="<code>DataCollat​​orForMultipleChoice</code> は、すべてのモデル入力を平坦化し、パディングを適用して、結果を非平坦化します。",Ss,ps,qs,Us,Ls,bs,fl='トレーニング中にメトリクスを含めると、多くの場合、モデルのパフォーマンスを評価するのに役立ちます。 🤗 <a href="https://huggingface.co/docs/evaluate/index" rel="nofollow">Evaluate</a> ライブラリを使用して、評価メソッドをすばやくロードできます。このタスクでは、<a href="https://huggingface.co/spaces/evaluate-metric/accuracy" rel="nofollow">accuracy</a> メトリクスを読み込みます (🤗 Evaluate <a href="https://huggingface.co/docs/evaluate/a_quick_tour" rel="nofollow">クイック ツアー</a> を参照してください) ) メトリクスの読み込みと計算方法の詳細については、次を参照してください)。',Ds,Ts,Ps,gs,Jl="次に、予測とラベルを <code>compute</code> に渡して精度を計算する関数を作成します。",Ks,$s,Os,Cs,Ul="これで<code>compute_metrics</code>関数の準備が整いました。トレーニングをセットアップするときにこの関数に戻ります。",sl,Zs,ll,rs,al,Ms,tl,_s,el,ks,bl="モデルを微調整したので、それを推論に使用できるようになりました。",nl,Is,Tl="いくつかのテキストと 2 つの回答候補を考えてください。",pl,Gs,rl,cs,Ml,Vs,cl,vs,ml;return f=new Rs({props:{title:"Multiple choice",local:"multiple-choice",headingTag:"h1"}}),A=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/ja/multiple_choice.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ja/pytorch/multiple_choice.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ja/tensorflow/multiple_choice.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ja/multiple_choice.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ja/pytorch/multiple_choice.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ja/tensorflow/multiple_choice.ipynb"}]}}),o=new V({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGU=",highlighted:"pip install transformers datasets evaluate",wrap:!1}}),E=new V({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMG5vdGVib29rX2xvZ2luJTBBJTBBbm90ZWJvb2tfbG9naW4oKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> notebook_login

<span class="hljs-meta">&gt;&gt;&gt; </span>notebook_login()`,wrap:!1}}),N=new Rs({props:{title:"Load SWAG dataset",local:"load-swag-dataset",headingTag:"h2"}}),z=new V({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}}),Q=new V({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}}),n=new Rs({props:{title:"Preprocess",local:"preprocess",headingTag:"h2"}}),js=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUtYmVydCUyRmJlcnQtYmFzZS11bmNhc2VkJTIyKQ==",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;google-bert/bert-base-uncased&quot;</span>)`,wrap:!1}}),us=new V({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}}),ws=new V({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}}),ps=new il({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Nl],pytorch:[Fl]},$$scope:{ctx:G}}}),Us=new Rs({props:{title:"Evaluate",local:"evaluate",headingTag:"h2"}}),Ts=new V({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}}),$s=new V({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}}),Zs=new Rs({props:{title:"Train",local:"train",headingTag:"h2"}}),rs=new il({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Ll],pytorch:[Hl]},$$scope:{ctx:G}}}),Ms=new ol({props:{$$slots:{default:[Dl]},$$scope:{ctx:G}}}),_s=new Rs({props:{title:"Inference",local:"inference",headingTag:"h1"}}),Gs=new V({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}}),cs=new il({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[sa],pytorch:[Kl]},$$scope:{ctx:G}}}),Vs=new Yl({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/ja/tasks/multiple_choice.md"}}),{c(){a=J("meta"),m=M(),l=J("p"),i=M(),j(f.$$.fragment),C=M(),j(A.$$.fragment),k=M(),Z=J("p"),Z.textContent=R,_=M(),B=J("p"),B.textContent=W,$=M(),I=J("ol"),I.innerHTML=r,g=M(),v=J("p"),v.textContent=F,x=M(),j(o.$$.fragment),X=M(),Y=J("p"),Y.textContent=As,ss=M(),j(E.$$.fragment),ls=M(),j(N.$$.fragment),ms=M(),S=J("p"),S.textContent=D,as=M(),j(z.$$.fragment),is=M(),q=J("p"),q.textContent=P,ts=M(),j(Q.$$.fragment),os=M(),L=J("p"),L.textContent=K,es=M(),H=J("ul"),H.innerHTML=Bs,ns=M(),j(n.$$.fragment),b=M(),O=J("p"),O.textContent=jl,Ys=M(),j(js.$$.fragment),xs=M(),ys=J("p"),ys.textContent=yl,Fs=M(),hs=J("ol"),hs.innerHTML=hl,Es=M(),j(us.$$.fragment),Ns=M(),ds=J("p"),ds.innerHTML=ul,zs=M(),j(ws.$$.fragment),Qs=M(),fs=J("p"),fs.innerHTML=dl,Hs=M(),Js=J("p"),Js.innerHTML=wl,Ss=M(),j(ps.$$.fragment),qs=M(),j(Us.$$.fragment),Ls=M(),bs=J("p"),bs.innerHTML=fl,Ds=M(),j(Ts.$$.fragment),Ps=M(),gs=J("p"),gs.innerHTML=Jl,Ks=M(),j($s.$$.fragment),Os=M(),Cs=J("p"),Cs.innerHTML=Ul,sl=M(),j(Zs.$$.fragment),ll=M(),j(rs.$$.fragment),al=M(),j(Ms.$$.fragment),tl=M(),j(_s.$$.fragment),el=M(),ks=J("p"),ks.textContent=bl,nl=M(),Is=J("p"),Is.textContent=Tl,pl=M(),j(Gs.$$.fragment),rl=M(),j(cs.$$.fragment),Ml=M(),j(Vs.$$.fragment),cl=M(),vs=J("p"),this.h()},l(s){const p=Rl("svelte-u9bgzb",document.head);a=U(p,"META",{name:!0,content:!0}),p.forEach(t),m=c(s),l=U(s,"P",{}),_l(l).forEach(t),i=c(s),y(f.$$.fragment,s),C=c(s),y(A.$$.fragment,s),k=c(s),Z=U(s,"P",{"data-svelte-h":!0}),T(Z)!=="svelte-eakc5k"&&(Z.textContent=R),_=c(s),B=U(s,"P",{"data-svelte-h":!0}),T(B)!=="svelte-w5jzhi"&&(B.textContent=W),$=c(s),I=U(s,"OL",{"data-svelte-h":!0}),T(I)!=="svelte-2ipb08"&&(I.innerHTML=r),g=c(s),v=U(s,"P",{"data-svelte-h":!0}),T(v)!=="svelte-1lya3k8"&&(v.textContent=F),x=c(s),y(o.$$.fragment,s),X=c(s),Y=U(s,"P",{"data-svelte-h":!0}),T(Y)!=="svelte-193zy02"&&(Y.textContent=As),ss=c(s),y(E.$$.fragment,s),ls=c(s),y(N.$$.fragment,s),ms=c(s),S=U(s,"P",{"data-svelte-h":!0}),T(S)!=="svelte-gtxhgw"&&(S.textContent=D),as=c(s),y(z.$$.fragment,s),is=c(s),q=U(s,"P",{"data-svelte-h":!0}),T(q)!=="svelte-1r6oj5w"&&(q.textContent=P),ts=c(s),y(Q.$$.fragment,s),os=c(s),L=U(s,"P",{"data-svelte-h":!0}),T(L)!=="svelte-1441z1m"&&(L.textContent=K),es=c(s),H=U(s,"UL",{"data-svelte-h":!0}),T(H)!=="svelte-aqbkoq"&&(H.innerHTML=Bs),ns=c(s),y(n.$$.fragment,s),b=c(s),O=U(s,"P",{"data-svelte-h":!0}),T(O)!=="svelte-1onnjgu"&&(O.textContent=jl),Ys=c(s),y(js.$$.fragment,s),xs=c(s),ys=U(s,"P",{"data-svelte-h":!0}),T(ys)!=="svelte-pmbrx1"&&(ys.textContent=yl),Fs=c(s),hs=U(s,"OL",{"data-svelte-h":!0}),T(hs)!=="svelte-b8ymrh"&&(hs.innerHTML=hl),Es=c(s),y(us.$$.fragment,s),Ns=c(s),ds=U(s,"P",{"data-svelte-h":!0}),T(ds)!=="svelte-1rdkxip"&&(ds.innerHTML=ul),zs=c(s),y(ws.$$.fragment,s),Qs=c(s),fs=U(s,"P",{"data-svelte-h":!0}),T(fs)!=="svelte-15vpmmb"&&(fs.innerHTML=dl),Hs=c(s),Js=U(s,"P",{"data-svelte-h":!0}),T(Js)!=="svelte-3rlquo"&&(Js.innerHTML=wl),Ss=c(s),y(ps.$$.fragment,s),qs=c(s),y(Us.$$.fragment,s),Ls=c(s),bs=U(s,"P",{"data-svelte-h":!0}),T(bs)!=="svelte-629o19"&&(bs.innerHTML=fl),Ds=c(s),y(Ts.$$.fragment,s),Ps=c(s),gs=U(s,"P",{"data-svelte-h":!0}),T(gs)!=="svelte-o90xg4"&&(gs.innerHTML=Jl),Ks=c(s),y($s.$$.fragment,s),Os=c(s),Cs=U(s,"P",{"data-svelte-h":!0}),T(Cs)!=="svelte-18cw5xr"&&(Cs.innerHTML=Ul),sl=c(s),y(Zs.$$.fragment,s),ll=c(s),y(rs.$$.fragment,s),al=c(s),y(Ms.$$.fragment,s),tl=c(s),y(_s.$$.fragment,s),el=c(s),ks=U(s,"P",{"data-svelte-h":!0}),T(ks)!=="svelte-cyrfc8"&&(ks.textContent=bl),nl=c(s),Is=U(s,"P",{"data-svelte-h":!0}),T(Is)!=="svelte-l4pjg8"&&(Is.textContent=Tl),pl=c(s),y(Gs.$$.fragment,s),rl=c(s),y(cs.$$.fragment,s),Ml=c(s),y(Vs.$$.fragment,s),cl=c(s),vs=U(s,"P",{}),_l(vs).forEach(t),this.h()},h(){kl(a,"name","hf:doc:metadata"),kl(a,"content",aa)},m(s,p){Wl(document.head,a),e(s,m,p),e(s,l,p),e(s,i,p),h(f,s,p),e(s,C,p),h(A,s,p),e(s,k,p),e(s,Z,p),e(s,_,p),e(s,B,p),e(s,$,p),e(s,I,p),e(s,g,p),e(s,v,p),e(s,x,p),h(o,s,p),e(s,X,p),e(s,Y,p),e(s,ss,p),h(E,s,p),e(s,ls,p),h(N,s,p),e(s,ms,p),e(s,S,p),e(s,as,p),h(z,s,p),e(s,is,p),e(s,q,p),e(s,ts,p),h(Q,s,p),e(s,os,p),e(s,L,p),e(s,es,p),e(s,H,p),e(s,ns,p),h(n,s,p),e(s,b,p),e(s,O,p),e(s,Ys,p),h(js,s,p),e(s,xs,p),e(s,ys,p),e(s,Fs,p),e(s,hs,p),e(s,Es,p),h(us,s,p),e(s,Ns,p),e(s,ds,p),e(s,zs,p),h(ws,s,p),e(s,Qs,p),e(s,fs,p),e(s,Hs,p),e(s,Js,p),e(s,Ss,p),h(ps,s,p),e(s,qs,p),h(Us,s,p),e(s,Ls,p),e(s,bs,p),e(s,Ds,p),h(Ts,s,p),e(s,Ps,p),e(s,gs,p),e(s,Ks,p),h($s,s,p),e(s,Os,p),e(s,Cs,p),e(s,sl,p),h(Zs,s,p),e(s,ll,p),h(rs,s,p),e(s,al,p),h(Ms,s,p),e(s,tl,p),h(_s,s,p),e(s,el,p),e(s,ks,p),e(s,nl,p),e(s,Is,p),e(s,pl,p),h(Gs,s,p),e(s,rl,p),h(cs,s,p),e(s,Ml,p),h(Vs,s,p),e(s,cl,p),e(s,vs,p),ml=!0},p(s,[p]){const gl={};p&2&&(gl.$$scope={dirty:p,ctx:s}),ps.$set(gl);const $l={};p&2&&($l.$$scope={dirty:p,ctx:s}),rs.$set($l);const Cl={};p&2&&(Cl.$$scope={dirty:p,ctx:s}),Ms.$set(Cl);const Zl={};p&2&&(Zl.$$scope={dirty:p,ctx:s}),cs.$set(Zl)},i(s){ml||(u(f.$$.fragment,s),u(A.$$.fragment,s),u(o.$$.fragment,s),u(E.$$.fragment,s),u(N.$$.fragment,s),u(z.$$.fragment,s),u(Q.$$.fragment,s),u(n.$$.fragment,s),u(js.$$.fragment,s),u(us.$$.fragment,s),u(ws.$$.fragment,s),u(ps.$$.fragment,s),u(Us.$$.fragment,s),u(Ts.$$.fragment,s),u($s.$$.fragment,s),u(Zs.$$.fragment,s),u(rs.$$.fragment,s),u(Ms.$$.fragment,s),u(_s.$$.fragment,s),u(Gs.$$.fragment,s),u(cs.$$.fragment,s),u(Vs.$$.fragment,s),ml=!0)},o(s){d(f.$$.fragment,s),d(A.$$.fragment,s),d(o.$$.fragment,s),d(E.$$.fragment,s),d(N.$$.fragment,s),d(z.$$.fragment,s),d(Q.$$.fragment,s),d(n.$$.fragment,s),d(js.$$.fragment,s),d(us.$$.fragment,s),d(ws.$$.fragment,s),d(ps.$$.fragment,s),d(Us.$$.fragment,s),d(Ts.$$.fragment,s),d($s.$$.fragment,s),d(Zs.$$.fragment,s),d(rs.$$.fragment,s),d(Ms.$$.fragment,s),d(_s.$$.fragment,s),d(Gs.$$.fragment,s),d(cs.$$.fragment,s),d(Vs.$$.fragment,s),ml=!1},d(s){s&&(t(m),t(l),t(i),t(C),t(k),t(Z),t(_),t(B),t($),t(I),t(g),t(v),t(x),t(X),t(Y),t(ss),t(ls),t(ms),t(S),t(as),t(is),t(q),t(ts),t(os),t(L),t(es),t(H),t(ns),t(b),t(O),t(Ys),t(xs),t(ys),t(Fs),t(hs),t(Es),t(Ns),t(ds),t(zs),t(Qs),t(fs),t(Hs),t(Js),t(Ss),t(qs),t(Ls),t(bs),t(Ds),t(Ps),t(gs),t(Ks),t(Os),t(Cs),t(sl),t(ll),t(al),t(tl),t(el),t(ks),t(nl),t(Is),t(pl),t(rl),t(Ml),t(cl),t(vs)),t(a),w(f,s),w(A,s),w(o,s),w(E,s),w(N,s),w(z,s),w(Q,s),w(n,s),w(js,s),w(us,s),w(ws,s),w(ps,s),w(Us,s),w(Ts,s),w($s,s),w(Zs,s),w(rs,s),w(Ms,s),w(_s,s),w(Gs,s),w(cs,s),w(Vs,s)}}}const aa='{"title":"Multiple choice","local":"multiple-choice","sections":[{"title":"Load SWAG dataset","local":"load-swag-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}],"depth":1}';function ta(G){return Gl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ia extends Vl{constructor(a){super(),Xl(this,a,ta,la,Il,{})}}export{ia as component};
