import{s as be,o as Ie,n as $s}from"../chunks/scheduler.36a0863c.js";import{S as _e,i as Ae,g as m,s as c,u as h,A as ve,h as u,f as t,c as M,j as X,v as y,y as T,k as v,o as k,a as l,w as f,d as w,t as U,x as J}from"../chunks/index.d0f7a4c4.js";import{T as ae}from"../chunks/Tip.4c7d7eb1.js";import{Y as $e}from"../chunks/Youtube.d15bb502.js";import{I as ee}from"../chunks/IconCopyLink.bc5fad79.js";import{C as V}from"../chunks/CodeBlock.69433f87.js";import{F as Ce,M as te}from"../chunks/Markdown.1d1f160a.js";function xe($){let e,r='Revisa la <a href="https://huggingface.co/tasks/question-answering" rel="nofollow">página de la tarea</a> de responder preguntas para tener más información sobre otras formas de responder preguntas y los modelos, datasets y métricas asociadas.';return{c(){e=m("p"),e.innerHTML=r},l(a){e=u(a,"P",{"data-svelte-h":!0}),T(e)!=="svelte-1yfogxf"&&(e.innerHTML=r)},m(a,o){l(a,e,o)},p:$s,d(a){a&&t(e)}}}function Ze($){let e,r;return e=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERlZmF1bHREYXRhQ29sbGF0b3IlMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGVmYXVsdERhdGFDb2xsYXRvcigp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DefaultDataCollator

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DefaultDataCollator()`}}),{c(){h(e.$$.fragment)},l(a){y(e.$$.fragment,a)},m(a,o){f(e,a,o),r=!0},p:$s,i(a){r||(w(e.$$.fragment,a),r=!0)},o(a){U(e.$$.fragment,a),r=!1},d(a){J(e,a)}}}function ke($){let e,r;return e=new te({props:{$$slots:{default:[Ze]},$$scope:{ctx:$}}}),{c(){h(e.$$.fragment)},l(a){y(e.$$.fragment,a)},m(a,o){f(e,a,o),r=!0},p(a,o){const j={};o&2&&(j.$$scope={dirty:o,ctx:a}),e.$set(j)},i(a){r||(w(e.$$.fragment,a),r=!0)},o(a){U(e.$$.fragment,a),r=!1},d(a){J(e,a)}}}function Ee($){let e,r;return e=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERlZmF1bHREYXRhQ29sbGF0b3IlMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGVmYXVsdERhdGFDb2xsYXRvcihyZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DefaultDataCollator

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DefaultDataCollator(return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`}}),{c(){h(e.$$.fragment)},l(a){y(e.$$.fragment,a)},m(a,o){f(e,a,o),r=!0},p:$s,i(a){r||(w(e.$$.fragment,a),r=!0)},o(a){U(e.$$.fragment,a),r=!1},d(a){J(e,a)}}}function Re($){let e,r;return e=new te({props:{$$slots:{default:[Ee]},$$scope:{ctx:$}}}),{c(){h(e.$$.fragment)},l(a){y(e.$$.fragment,a)},m(a,o){f(e,a,o),r=!0},p(a,o){const j={};o&2&&(j.$$scope={dirty:o,ctx:a}),e.$set(j)},i(a){r||(w(e.$$.fragment,a),r=!0)},o(a){U(e.$$.fragment,a),r=!1},d(a){J(e,a)}}}function Ge($){let e,r='Para familiarizarte con el fine-tuning con <code>Trainer</code>, ¡mira el tutorial básico <a href="../training#finetune-with-trainer">aquí</a>!';return{c(){e=m("p"),e.innerHTML=r},l(a){e=u(a,"P",{"data-svelte-h":!0}),T(e)!=="svelte-1sco78m"&&(e.innerHTML=r)},m(a,o){l(a,e,o)},p:$s,d(a){a&&t(e)}}}function Be($){let e,r="Carga el modelo DistilBERT con <code>AutoModelForQuestionAnswering</code>:",a,o,j,g,R,b,F="En este punto, solo quedan tres pasos:",E,_,z="<li>Definir tus hiperparámetros de entrenamiento en <code>TrainingArguments</code>.</li> <li>Pasarle los argumentos del entrenamiento al <code>Trainer</code> junto con el modelo, el dataset, el tokenizer y el collator de datos.</li> <li>Invocar el método <code>train()</code> para realizar el fine-tuning del modelo.</li>",I,G,x;return o=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclF1ZXN0aW9uQW5zd2VyaW5nJTJDJTIwVHJhaW5pbmdBcmd1bWVudHMlMkMlMjBUcmFpbmVyJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JRdWVzdGlvbkFuc3dlcmluZy5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForQuestionAnswering, TrainingArguments, Trainer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)`}}),g=new ae({props:{$$slots:{default:[Ge]},$$scope:{ctx:$}}}),G=new V({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjIuJTJGcmVzdWx0cyUyMiUyQyUwQSUyMCUyMCUyMCUyMGV2YWx1YXRpb25fc3RyYXRlZ3klM0QlMjJlcG9jaCUyMiUyQyUwQSUyMCUyMCUyMCUyMGxlYXJuaW5nX3JhdGUlM0QyZS01JTJDJTBBJTIwJTIwJTIwJTIwcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBwZXJfZGV2aWNlX2V2YWxfYmF0Y2hfc2l6ZSUzRDE2JTJDJTBBJTIwJTIwJTIwJTIwbnVtX3RyYWluX2Vwb2NocyUzRDMlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfZGVjYXklM0QwLjAxJTJDJTBBKSUwQSUwQXRyYWluZXIlMjAlM0QlMjBUcmFpbmVyKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEbW9kZWwlMkMlMEElMjAlMjAlMjAlMjBhcmdzJTNEdHJhaW5pbmdfYXJncyUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0R0b2tlbml6ZWRfc3F1YWQlNUIlMjJ0cmFpbiUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMGV2YWxfZGF0YXNldCUzRHRva2VuaXplZF9zcXVhZCU1QiUyMnZhbGlkYXRpb24lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMEElMjAlMjAlMjAlMjBkYXRhX2NvbGxhdG9yJTNEZGF0YV9jb2xsYXRvciUyQyUwQSklMEElMEF0cmFpbmVyLnRyYWluKCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>training_args = TrainingArguments(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;./results&quot;</span>,
<span class="hljs-meta">... </span>    evaluation_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
<span class="hljs-meta">... </span>    learning_rate=<span class="hljs-number">2e-5</span>,
<span class="hljs-meta">... </span>    per_device_train_batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    per_device_eval_batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    num_train_epochs=<span class="hljs-number">3</span>,
<span class="hljs-meta">... </span>    weight_decay=<span class="hljs-number">0.01</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_squad[<span class="hljs-string">&quot;train&quot;</span>],
<span class="hljs-meta">... </span>    eval_dataset=tokenized_squad[<span class="hljs-string">&quot;validation&quot;</span>],
<span class="hljs-meta">... </span>    tokenizer=tokenizer,
<span class="hljs-meta">... </span>    data_collator=data_collator,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.train()`}}),{c(){e=m("p"),e.innerHTML=r,a=c(),h(o.$$.fragment),j=c(),h(g.$$.fragment),R=c(),b=m("p"),b.textContent=F,E=c(),_=m("ol"),_.innerHTML=z,I=c(),h(G.$$.fragment)},l(i){e=u(i,"P",{"data-svelte-h":!0}),T(e)!=="svelte-1jpacxl"&&(e.innerHTML=r),a=M(i),y(o.$$.fragment,i),j=M(i),y(g.$$.fragment,i),R=M(i),b=u(i,"P",{"data-svelte-h":!0}),T(b)!=="svelte-bd5x35"&&(b.textContent=F),E=M(i),_=u(i,"OL",{"data-svelte-h":!0}),T(_)!=="svelte-omqmsj"&&(_.innerHTML=z),I=M(i),y(G.$$.fragment,i)},m(i,C){l(i,e,C),l(i,a,C),f(o,i,C),l(i,j,C),f(g,i,C),l(i,R,C),l(i,b,C),l(i,E,C),l(i,_,C),l(i,I,C),f(G,i,C),x=!0},p(i,C){const A={};C&2&&(A.$$scope={dirty:C,ctx:i}),g.$set(A)},i(i){x||(w(o.$$.fragment,i),w(g.$$.fragment,i),w(G.$$.fragment,i),x=!0)},o(i){U(o.$$.fragment,i),U(g.$$.fragment,i),U(G.$$.fragment,i),x=!1},d(i){i&&(t(e),t(a),t(j),t(R),t(b),t(E),t(_),t(I)),J(o,i),J(g,i),J(G,i)}}}function Xe($){let e,r;return e=new te({props:{$$slots:{default:[Be]},$$scope:{ctx:$}}}),{c(){h(e.$$.fragment)},l(a){y(e.$$.fragment,a)},m(a,o){f(e,a,o),r=!0},p(a,o){const j={};o&2&&(j.$$scope={dirty:o,ctx:a}),e.$set(j)},i(a){r||(w(e.$$.fragment,a),r=!0)},o(a){U(e.$$.fragment,a),r=!1},d(a){J(e,a)}}}function Ve($){let e,r='Para familiarizarte con el fine-tuning con Keras, ¡mira el tutorial básico <a href="training#finetune-with-keras">aquí</a>!';return{c(){e=m("p"),e.innerHTML=r},l(a){e=u(a,"P",{"data-svelte-h":!0}),T(e)!=="svelte-66s4ry"&&(e.innerHTML=r)},m(a,o){l(a,e,o)},p:$s,d(a){a&&t(e)}}}function We($){let e,r="Para realizar el fine-tuning de un modelo en TensorFlow, primero convierte tus datasets al formato <code>tf.data.Dataset</code> con el método <code>prepare_tf_dataset()</code>.",a,o,j,g,R,b,F="Prepara una función de optimización, un programa para la tasa de aprendizaje y algunos hiperparámetros de entrenamiento:",E,_,z,I,G="Carga el modelo DistilBERT con <code>TFAutoModelForQuestionAnswering</code>:",x,i,C,A,Cs='Configura el modelo para entrenarlo con <a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a>:',Y,B,ss,Q,N='Invoca el método <a href="https://keras.io/api/models/model_training_apis/#fit-method" rel="nofollow"><code>fit</code></a> para realizar el fine-tuning del modelo:',H,Z,W;return o=new V({props:{code:"dGZfdHJhaW5fc2V0JTIwJTNEJTIwbW9kZWwucHJlcGFyZV90Zl9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMHRva2VuaXplZF9zcXVhZCU1QiUyMnRyYWluJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwc2h1ZmZsZSUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBiYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBjb2xsYXRlX2ZuJTNEZGF0YV9jb2xsYXRvciUyQyUwQSklMEElMEF0Zl92YWxpZGF0aW9uX3NldCUyMCUzRCUyMG1vZGVsLnByZXBhcmVfdGZfZGF0YXNldCglMEElMjAlMjAlMjAlMjB0b2tlbml6ZWRfc3F1YWQlNUIlMjJ2YWxpZGF0aW9uJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwc2h1ZmZsZSUzREZhbHNlJTJDJTBBJTIwJTIwJTIwJTIwYmF0Y2hfc2l6ZSUzRDE2JTJDJTBBJTIwJTIwJTIwJTIwY29sbGF0ZV9mbiUzRGRhdGFfY29sbGF0b3IlMkMlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tf_train_set = model.prepare_tf_dataset(
<span class="hljs-meta">... </span>    tokenized_squad[<span class="hljs-string">&quot;train&quot;</span>],
<span class="hljs-meta">... </span>    shuffle=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    collate_fn=data_collator,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>tf_validation_set = model.prepare_tf_dataset(
<span class="hljs-meta">... </span>    tokenized_squad[<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=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    collate_fn=data_collator,
<span class="hljs-meta">... </span>)`}}),g=new ae({props:{$$slots:{default:[Ve]},$$scope:{ctx:$}}}),_=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMGNyZWF0ZV9vcHRpbWl6ZXIlMEElMEFiYXRjaF9zaXplJTIwJTNEJTIwMTYlMEFudW1fZXBvY2hzJTIwJTNEJTIwMiUwQXRvdGFsX3RyYWluX3N0ZXBzJTIwJTNEJTIwKGxlbih0b2tlbml6ZWRfc3F1YWQlNUIlMjJ0cmFpbiUyMiU1RCklMjAlMkYlMkYlMjBiYXRjaF9zaXplKSUyMColMjBudW1fZXBvY2hzJTBBb3B0aW1pemVyJTJDJTIwc2NoZWR1bGUlMjAlM0QlMjBjcmVhdGVfb3B0aW1pemVyKCUwQSUyMCUyMCUyMCUyMGluaXRfbHIlM0QyZS01JTJDJTBBJTIwJTIwJTIwJTIwbnVtX3dhcm11cF9zdGVwcyUzRDAlMkMlMEElMjAlMjAlMjAlMjBudW1fdHJhaW5fc3RlcHMlM0R0b3RhbF90cmFpbl9zdGVwcyUyQyUwQSk=",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_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_squad[<span class="hljs-string">&quot;train&quot;</span>]) // batch_size) * num_epochs
<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer, schedule = create_optimizer(
<span class="hljs-meta">... </span>    init_lr=<span class="hljs-number">2e-5</span>,
<span class="hljs-meta">... </span>    num_warmup_steps=<span class="hljs-number">0</span>,
<span class="hljs-meta">... </span>    num_train_steps=total_train_steps,
<span class="hljs-meta">... </span>)`}}),i=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yUXVlc3Rpb25BbnN3ZXJpbmclMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yUXVlc3Rpb25BbnN3ZXJpbmcoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForQuestionAnswering

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForQuestionAnswering(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)`}}),B=new V({props:{code:"aW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEFtb2RlbC5jb21waWxlKG9wdGltaXplciUzRG9wdGltaXplcik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

<span class="hljs-meta">&gt;&gt;&gt; </span>model.<span class="hljs-built_in">compile</span>(optimizer=optimizer)`}}),Z=new V({props:{code:"bW9kZWwuZml0KHglM0R0Zl90cmFpbl9zZXQlMkMlMjB2YWxpZGF0aW9uX2RhdGElM0R0Zl92YWxpZGF0aW9uX3NldCUyQyUyMGVwb2NocyUzRDMp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model.fit(x=tf_train_set, validation_data=tf_validation_set, epochs=<span class="hljs-number">3</span>)'}}),{c(){e=m("p"),e.innerHTML=r,a=c(),h(o.$$.fragment),j=c(),h(g.$$.fragment),R=c(),b=m("p"),b.textContent=F,E=c(),h(_.$$.fragment),z=c(),I=m("p"),I.innerHTML=G,x=c(),h(i.$$.fragment),C=c(),A=m("p"),A.innerHTML=Cs,Y=c(),h(B.$$.fragment),ss=c(),Q=m("p"),Q.innerHTML=N,H=c(),h(Z.$$.fragment)},l(n){e=u(n,"P",{"data-svelte-h":!0}),T(e)!=="svelte-1dn6k4v"&&(e.innerHTML=r),a=M(n),y(o.$$.fragment,n),j=M(n),y(g.$$.fragment,n),R=M(n),b=u(n,"P",{"data-svelte-h":!0}),T(b)!=="svelte-81yq28"&&(b.textContent=F),E=M(n),y(_.$$.fragment,n),z=M(n),I=u(n,"P",{"data-svelte-h":!0}),T(I)!=="svelte-owfaiz"&&(I.innerHTML=G),x=M(n),y(i.$$.fragment,n),C=M(n),A=u(n,"P",{"data-svelte-h":!0}),T(A)!=="svelte-jy7mgr"&&(A.innerHTML=Cs),Y=M(n),y(B.$$.fragment,n),ss=M(n),Q=u(n,"P",{"data-svelte-h":!0}),T(Q)!=="svelte-1dz4xz1"&&(Q.innerHTML=N),H=M(n),y(Z.$$.fragment,n)},m(n,d){l(n,e,d),l(n,a,d),f(o,n,d),l(n,j,d),f(g,n,d),l(n,R,d),l(n,b,d),l(n,E,d),f(_,n,d),l(n,z,d),l(n,I,d),l(n,x,d),f(i,n,d),l(n,C,d),l(n,A,d),l(n,Y,d),f(B,n,d),l(n,ss,d),l(n,Q,d),l(n,H,d),f(Z,n,d),W=!0},p(n,d){const Us={};d&2&&(Us.$$scope={dirty:d,ctx:n}),g.$set(Us)},i(n){W||(w(o.$$.fragment,n),w(g.$$.fragment,n),w(_.$$.fragment,n),w(i.$$.fragment,n),w(B.$$.fragment,n),w(Z.$$.fragment,n),W=!0)},o(n){U(o.$$.fragment,n),U(g.$$.fragment,n),U(_.$$.fragment,n),U(i.$$.fragment,n),U(B.$$.fragment,n),U(Z.$$.fragment,n),W=!1},d(n){n&&(t(e),t(a),t(j),t(R),t(b),t(E),t(z),t(I),t(x),t(C),t(A),t(Y),t(ss),t(Q),t(H)),J(o,n),J(g,n),J(_,n),J(i,n),J(B,n),J(Z,n)}}}function ze($){let e,r;return e=new te({props:{$$slots:{default:[We]},$$scope:{ctx:$}}}),{c(){h(e.$$.fragment)},l(a){y(e.$$.fragment,a)},m(a,o){f(e,a,o),r=!0},p(a,o){const j={};o&2&&(j.$$scope={dirty:o,ctx:a}),e.$set(j)},i(a){r||(w(e.$$.fragment,a),r=!0)},o(a){U(e.$$.fragment,a),r=!1},d(a){J(e,a)}}}function Qe($){let e,r=`Para un ejemplo con mayor profundidad de cómo hacer fine-tuning a un modelo para responder preguntas, échale un vistazo al
<a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering.ipynb" rel="nofollow">cuaderno de PyTorch</a> o al
<a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering-tf.ipynb" rel="nofollow">cuaderno de TensorFlow</a> correspondiente.`;return{c(){e=m("p"),e.innerHTML=r},l(a){e=u(a,"P",{"data-svelte-h":!0}),T(e)!=="svelte-1vvpf09"&&(e.innerHTML=r)},m(a,o){l(a,e,o)},p:$s,d(a){a&&t(e)}}}function Ne($){let e,r,a,o,j,g,R,b,F,E,_="Respuesta a preguntas",z,I,G,x,i="La respuesta a preguntas devuelve una respuesta a partir de una pregunta dada. Existen dos formas comunes de responder preguntas:",C,A,Cs="<li>Extractiva: extraer la respuesta a partir del contexto dado.</li> <li>Abstractiva: generar una respuesta que responda correctamente la pregunta a partir del contexto dado.</li>",Y,B,ss='Esta guía te mostrará como hacer fine-tuning de <a href="https://huggingface.co/distilbert-base-uncased" rel="nofollow">DistilBERT</a> en el dataset <a href="https://huggingface.co/datasets/squad" rel="nofollow">SQuAD</a> para responder preguntas de forma extractiva.',Q,N,H,Z,W,n,d,Us,Js,pe="Carga el dataset SQuAD",xs,es,re="Carga el dataset SQuAD con la biblioteca 🤗 Datasets:",Zs,as,ks,ts,oe="Ahora, échale un vistazo a una muestra:",Es,ls,Rs,ns,ie="El campo <code>answers</code> es un diccionario que contiene la posición inicial de la respuesta y el <code>texto</code> de la respuesta.",Gs,q,L,bs,ps,le,Ts,ce="Preprocesamiento",Bs,rs,Xs,os,Me="Carga el tokenizer de DistilBERT para procesar los campos <code>question</code> (pregunta) y <code>context</code> (contexto):",Vs,is,Ws,cs,me="Hay algunos pasos de preprocesamiento específicos para la tarea de respuesta a preguntas que debes tener en cuenta:",zs,Ms,ue=`<li>Algunos ejemplos en un dataset pueden tener un contexto que supera la longitud máxima de entrada de un modelo. Trunca solamente el contexto asignándole el valor <code>&quot;only_second&quot;</code> al parámetro <code>truncation</code>.</li> <li>A continuación, mapea las posiciones de inicio y fin de la respuesta al contexto original asignándole el valor <code>True</code> al parámetro <code>return_offsets_mapping</code>.</li> <li>Una vez tengas el mapeo, puedes encontrar los tokens de inicio y fin de la respuesta. Usa el método <a href="https://huggingface.co/docs/tokenizers/python/latest/api/reference.html#tokenizers.Encoding.sequence_ids" rel="nofollow"><code>sequence_ids</code></a>
para encontrar qué parte de la lista de tokens desplazados corresponde a la pregunta y cuál corresponde al contexto.</li>`,Qs,ms,de="A continuación puedes ver como se crea una función para truncar y mapear los tokens de inicio y fin de la respuesta al <code>context</code>:",Ns,us,Fs,ds,je=`Usa la función <code>map</code> de 🤗 Datasets para aplicarle la función de preprocesamiento al dataset entero. Puedes acelerar la función <code>map</code> haciendo <code>batched=True</code> para procesar varios elementos del dataset a la vez.
Quita las columnas que no necesites:`,Ys,js,Hs,hs,he="Usa el <code>DefaultDataCollator</code> para crear un lote de ejemplos. A diferencia de los otros collators de datos en 🤗 Transformers, el <code>DefaultDataCollator</code> no aplica ningún procesamiento adicional (como el rellenado).",qs,D,Ss,S,P,Is,ys,ne,gs,ye="Entrenamiento",Ls,K,Ds,O,Ps,_s,Ks;return b=new ee({}),I=new $e({props:{id:"ajPx5LwJD-I"}}),N=new ae({props:{$$slots:{default:[xe]},$$scope:{ctx:$}}}),d=new ee({}),as=new V({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBc3F1YWQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyc3F1YWQlMjIp",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>squad = load_dataset(<span class="hljs-string">&quot;squad&quot;</span>)`}}),ls=new V({props:{code:"c3F1YWQlNUIlMjJ0cmFpbiUyMiU1RCU1QjAlNUQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>squad[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;answers&#x27;</span>: {<span class="hljs-string">&#x27;answer_start&#x27;</span>: [<span class="hljs-number">515</span>], <span class="hljs-string">&#x27;text&#x27;</span>: [<span class="hljs-string">&#x27;Saint Bernadette Soubirous&#x27;</span>]},
 <span class="hljs-string">&#x27;context&#x27;</span>: <span class="hljs-string">&#x27;Architecturally, the school has a Catholic character. Atop the Main Building\\&#x27;s gold dome is a golden statue of the Virgin Mary. Immediately in front of the Main Building and facing it, is a copper statue of Christ with arms upraised with the legend &quot;Venite Ad Me Omnes&quot;. Next to the Main Building is the Basilica of the Sacred Heart. Immediately behind the basilica is the Grotto, a Marian place of prayer and reflection. It is a replica of the grotto at Lourdes, France where the Virgin Mary reputedly appeared to Saint Bernadette Soubirous in 1858. At the end of the main drive (and in a direct line that connects through 3 statues and the Gold Dome), is a simple, modern stone statue of Mary.&#x27;</span>,
 <span class="hljs-string">&#x27;id&#x27;</span>: <span class="hljs-string">&#x27;5733be284776f41900661182&#x27;</span>,
 <span class="hljs-string">&#x27;question&#x27;</span>: <span class="hljs-string">&#x27;To whom did the Virgin Mary allegedly appear in 1858 in Lourdes France?&#x27;</span>,
 <span class="hljs-string">&#x27;title&#x27;</span>: <span class="hljs-string">&#x27;University_of_Notre_Dame&#x27;</span>
}`}}),ps=new ee({}),rs=new $e({props:{id:"qgaM0weJHpA"}}),is=new V({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)`}}),us=new V({props:{code:"ZGVmJTIwcHJlcHJvY2Vzc19mdW5jdGlvbihleGFtcGxlcyklM0ElMEElMjAlMjAlMjAlMjBxdWVzdGlvbnMlMjAlM0QlMjAlNUJxLnN0cmlwKCklMjBmb3IlMjBxJTIwaW4lMjBleGFtcGxlcyU1QiUyMnF1ZXN0aW9uJTIyJTVEJTVEJTBBJTIwJTIwJTIwJTIwaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHF1ZXN0aW9ucyUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGV4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IwJTIwJTIwaWR4JTIwJTNEJTIwY29udGV4dF9lbmQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB3aGlsZSUyMGlkeCUyMCUzRSUzRCUyMGNvbnRleHRfc3RhcnQlMjBhbmQlMjBvZmZzZXQlNUJpZHglNUQlNUIxJTVEJTIwJTNFJTNEJTIwZW5kX2NoYXIlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpZHglMjAtJTNEJTIwMSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGVuZF9wb3NpdGlvbnMuYXBwZW5kKGlkeCUyMCUyQiUyMDEpJTBBJTBBJTIwJTIwJTIwJTIwaW5wdXRzJTVCJTIyc3RhcnRfcG9zaXRpb25zJTIyJTVEJTIwJTNEJTIwc3RhcnRfcG9zaXRpb25zJTBBJTIwJTIwJTIwJTIwaW5wdXRzJTVCJTIyZW5kX3Bvc2l0aW9ucyUyMiU1RCUyMCUzRCUyMGVuZF9wb3NpdGlvbnMlMEElMjAlMjAlMjAlMjByZXR1cm4lMjBpbnB1dHM=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_function</span>(<span class="hljs-params">examples</span>):
<span class="hljs-meta">... </span>    questions = [q.strip() <span class="hljs-keyword">for</span> q <span class="hljs-keyword">in</span> examples[<span class="hljs-string">&quot;question&quot;</span>]]
<span class="hljs-meta">... </span>    inputs = tokenizer(
<span class="hljs-meta">... </span>        questions,
<span class="hljs-meta">... </span>        examples[<span class="hljs-string">&quot;context&quot;</span>],
<span class="hljs-meta">... </span>        max_length=<span class="hljs-number">384</span>,
<span class="hljs-meta">... </span>        truncation=<span class="hljs-string">&quot;only_second&quot;</span>,
<span class="hljs-meta">... </span>        return_offsets_mapping=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>        padding=<span class="hljs-string">&quot;max_length&quot;</span>,
<span class="hljs-meta">... </span>    )

<span class="hljs-meta">... </span>    offset_mapping = inputs.pop(<span class="hljs-string">&quot;offset_mapping&quot;</span>)
<span class="hljs-meta">... </span>    answers = examples[<span class="hljs-string">&quot;answers&quot;</span>]
<span class="hljs-meta">... </span>    start_positions = []
<span class="hljs-meta">... </span>    end_positions = []

<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> i, offset <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(offset_mapping):
<span class="hljs-meta">... </span>        answer = answers[i]
<span class="hljs-meta">... </span>        start_char = answer[<span class="hljs-string">&quot;answer_start&quot;</span>][<span class="hljs-number">0</span>]
<span class="hljs-meta">... </span>        end_char = answer[<span class="hljs-string">&quot;answer_start&quot;</span>][<span class="hljs-number">0</span>] + <span class="hljs-built_in">len</span>(answer[<span class="hljs-string">&quot;text&quot;</span>][<span class="hljs-number">0</span>])
<span class="hljs-meta">... </span>        sequence_ids = inputs.sequence_ids(i)

<span class="hljs-meta">... </span>        <span class="hljs-comment"># Encuentra el inicio y el fin del contexto</span>
<span class="hljs-meta">... </span>        idx = <span class="hljs-number">0</span>
<span class="hljs-meta">... </span>        <span class="hljs-keyword">while</span> sequence_ids[idx] != <span class="hljs-number">1</span>:
<span class="hljs-meta">... </span>            idx += <span class="hljs-number">1</span>
<span class="hljs-meta">... </span>        context_start = idx
<span class="hljs-meta">... </span>        <span class="hljs-keyword">while</span> sequence_ids[idx] == <span class="hljs-number">1</span>:
<span class="hljs-meta">... </span>            idx += <span class="hljs-number">1</span>
<span class="hljs-meta">... </span>        context_end = idx - <span class="hljs-number">1</span>

<span class="hljs-meta">... </span>        <span class="hljs-comment"># Si la respuesta entera no está dentro del contexto, etiquétala como (0, 0)</span>
<span class="hljs-meta">... </span>        <span class="hljs-keyword">if</span> offset[context_start][<span class="hljs-number">0</span>] &gt; end_char <span class="hljs-keyword">or</span> offset[context_end][<span class="hljs-number">1</span>] &lt; start_char:
<span class="hljs-meta">... </span>            start_positions.append(<span class="hljs-number">0</span>)
<span class="hljs-meta">... </span>            end_positions.append(<span class="hljs-number">0</span>)
<span class="hljs-meta">... </span>        <span class="hljs-keyword">else</span>:
<span class="hljs-meta">... </span>            <span class="hljs-comment"># De lo contrario, esta es la posición de los tokens de inicio y fin</span>
<span class="hljs-meta">... </span>            idx = context_start
<span class="hljs-meta">... </span>            <span class="hljs-keyword">while</span> idx &lt;= context_end <span class="hljs-keyword">and</span> offset[idx][<span class="hljs-number">0</span>] &lt;= start_char:
<span class="hljs-meta">... </span>                idx += <span class="hljs-number">1</span>
<span class="hljs-meta">... </span>            start_positions.append(idx - <span class="hljs-number">1</span>)

<span class="hljs-meta">... </span>            idx = context_end
<span class="hljs-meta">... </span>            <span class="hljs-keyword">while</span> idx &gt;= context_start <span class="hljs-keyword">and</span> offset[idx][<span class="hljs-number">1</span>] &gt;= end_char:
<span class="hljs-meta">... </span>                idx -= <span class="hljs-number">1</span>
<span class="hljs-meta">... </span>            end_positions.append(idx + <span class="hljs-number">1</span>)

<span class="hljs-meta">... </span>    inputs[<span class="hljs-string">&quot;start_positions&quot;</span>] = start_positions
<span class="hljs-meta">... </span>    inputs[<span class="hljs-string">&quot;end_positions&quot;</span>] = end_positions
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> inputs`}}),js=new V({props:{code:"dG9rZW5pemVkX3NxdWFkJTIwJTNEJTIwc3F1YWQubWFwKHByZXByb2Nlc3NfZnVuY3Rpb24lMkMlMjBiYXRjaGVkJTNEVHJ1ZSUyQyUyMHJlbW92ZV9jb2x1bW5zJTNEc3F1YWQlNUIlMjJ0cmFpbiUyMiU1RC5jb2x1bW5fbmFtZXMp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tokenized_squad = squad.<span class="hljs-built_in">map</span>(preprocess_function, batched=<span class="hljs-literal">True</span>, remove_columns=squad[<span class="hljs-string">&quot;train&quot;</span>].column_names)'}}),D=new Ce({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Re],pytorch:[ke]},$$scope:{ctx:$}}}),ys=new ee({}),K=new Ce({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[ze],pytorch:[Xe]},$$scope:{ctx:$}}}),O=new ae({props:{$$slots:{default:[Qe]},$$scope:{ctx:$}}}),{c(){e=m("meta"),r=c(),a=m("p"),o=c(),j=m("h1"),g=m("a"),R=m("span"),h(b.$$.fragment),F=c(),E=m("span"),E.textContent=_,z=c(),h(I.$$.fragment),G=c(),x=m("p"),x.textContent=i,C=c(),A=m("ul"),A.innerHTML=Cs,Y=c(),B=m("p"),B.innerHTML=ss,Q=c(),h(N.$$.fragment),H=c(),Z=m("h2"),W=m("a"),n=m("span"),h(d.$$.fragment),Us=c(),Js=m("span"),Js.textContent=pe,xs=c(),es=m("p"),es.textContent=re,Zs=c(),h(as.$$.fragment),ks=c(),ts=m("p"),ts.textContent=oe,Es=c(),h(ls.$$.fragment),Rs=c(),ns=m("p"),ns.innerHTML=ie,Gs=c(),q=m("h2"),L=m("a"),bs=m("span"),h(ps.$$.fragment),le=c(),Ts=m("span"),Ts.textContent=ce,Bs=c(),h(rs.$$.fragment),Xs=c(),os=m("p"),os.innerHTML=Me,Vs=c(),h(is.$$.fragment),Ws=c(),cs=m("p"),cs.textContent=me,zs=c(),Ms=m("ol"),Ms.innerHTML=ue,Qs=c(),ms=m("p"),ms.innerHTML=de,Ns=c(),h(us.$$.fragment),Fs=c(),ds=m("p"),ds.innerHTML=je,Ys=c(),h(js.$$.fragment),Hs=c(),hs=m("p"),hs.innerHTML=he,qs=c(),h(D.$$.fragment),Ss=c(),S=m("h2"),P=m("a"),Is=m("span"),h(ys.$$.fragment),ne=c(),gs=m("span"),gs.textContent=ye,Ls=c(),h(K.$$.fragment),Ds=c(),h(O.$$.fragment),Ps=c(),_s=m("p"),this.h()},l(s){const p=ve("svelte-1phssyn",document.head);e=u(p,"META",{name:!0,content:!0}),p.forEach(t),r=M(s),a=u(s,"P",{}),X(a).forEach(t),o=M(s),j=u(s,"H1",{class:!0});var fs=X(j);g=u(fs,"A",{id:!0,class:!0,href:!0});var As=X(g);R=u(As,"SPAN",{});var vs=X(R);y(b.$$.fragment,vs),vs.forEach(t),As.forEach(t),F=M(fs),E=u(fs,"SPAN",{"data-svelte-h":!0}),T(E)!=="svelte-1jpuaxl"&&(E.textContent=_),fs.forEach(t),z=M(s),y(I.$$.fragment,s),G=M(s),x=u(s,"P",{"data-svelte-h":!0}),T(x)!=="svelte-dwstrz"&&(x.textContent=i),C=M(s),A=u(s,"UL",{"data-svelte-h":!0}),T(A)!=="svelte-3bop09"&&(A.innerHTML=Cs),Y=M(s),B=u(s,"P",{"data-svelte-h":!0}),T(B)!=="svelte-1crydxd"&&(B.innerHTML=ss),Q=M(s),y(N.$$.fragment,s),H=M(s),Z=u(s,"H2",{class:!0});var ws=X(Z);W=u(ws,"A",{id:!0,class:!0,href:!0});var fe=X(W);n=u(fe,"SPAN",{});var we=X(n);y(d.$$.fragment,we),we.forEach(t),fe.forEach(t),Us=M(ws),Js=u(ws,"SPAN",{"data-svelte-h":!0}),T(Js)!=="svelte-rn76rm"&&(Js.textContent=pe),ws.forEach(t),xs=M(s),es=u(s,"P",{"data-svelte-h":!0}),T(es)!=="svelte-pf8yi"&&(es.textContent=re),Zs=M(s),y(as.$$.fragment,s),ks=M(s),ts=u(s,"P",{"data-svelte-h":!0}),T(ts)!=="svelte-161h43k"&&(ts.textContent=oe),Es=M(s),y(ls.$$.fragment,s),Rs=M(s),ns=u(s,"P",{"data-svelte-h":!0}),T(ns)!=="svelte-14mr2wr"&&(ns.innerHTML=ie),Gs=M(s),q=u(s,"H2",{class:!0});var Os=X(q);L=u(Os,"A",{id:!0,class:!0,href:!0});var Ue=X(L);bs=u(Ue,"SPAN",{});var Je=X(bs);y(ps.$$.fragment,Je),Je.forEach(t),Ue.forEach(t),le=M(Os),Ts=u(Os,"SPAN",{"data-svelte-h":!0}),T(Ts)!=="svelte-klvb09"&&(Ts.textContent=ce),Os.forEach(t),Bs=M(s),y(rs.$$.fragment,s),Xs=M(s),os=u(s,"P",{"data-svelte-h":!0}),T(os)!=="svelte-10ihzcv"&&(os.innerHTML=Me),Vs=M(s),y(is.$$.fragment,s),Ws=M(s),cs=u(s,"P",{"data-svelte-h":!0}),T(cs)!=="svelte-1p9uuun"&&(cs.textContent=me),zs=M(s),Ms=u(s,"OL",{"data-svelte-h":!0}),T(Ms)!=="svelte-1av8agk"&&(Ms.innerHTML=ue),Qs=M(s),ms=u(s,"P",{"data-svelte-h":!0}),T(ms)!=="svelte-x2vphs"&&(ms.innerHTML=de),Ns=M(s),y(us.$$.fragment,s),Fs=M(s),ds=u(s,"P",{"data-svelte-h":!0}),T(ds)!=="svelte-1eq69ea"&&(ds.innerHTML=je),Ys=M(s),y(js.$$.fragment,s),Hs=M(s),hs=u(s,"P",{"data-svelte-h":!0}),T(hs)!=="svelte-1w3gd6z"&&(hs.innerHTML=he),qs=M(s),y(D.$$.fragment,s),Ss=M(s),S=u(s,"H2",{class:!0});var se=X(S);P=u(se,"A",{id:!0,class:!0,href:!0});var Te=X(P);Is=u(Te,"SPAN",{});var ge=X(Is);y(ys.$$.fragment,ge),ge.forEach(t),Te.forEach(t),ne=M(se),gs=u(se,"SPAN",{"data-svelte-h":!0}),T(gs)!=="svelte-1b8djky"&&(gs.textContent=ye),se.forEach(t),Ls=M(s),y(K.$$.fragment,s),Ds=M(s),y(O.$$.fragment,s),Ps=M(s),_s=u(s,"P",{}),X(_s).forEach(t),this.h()},h(){v(e,"name","hf:doc:metadata"),v(e,"content",JSON.stringify(Fe)),v(g,"id","respuesta-a-preguntas"),v(g,"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"),v(g,"href","#respuesta-a-preguntas"),v(j,"class","relative group"),v(W,"id","carga-el-dataset-squad"),v(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"),v(W,"href","#carga-el-dataset-squad"),v(Z,"class","relative group"),v(L,"id","preprocesamiento"),v(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"),v(L,"href","#preprocesamiento"),v(q,"class","relative group"),v(P,"id","entrenamiento"),v(P,"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"),v(P,"href","#entrenamiento"),v(S,"class","relative group")},m(s,p){k(document.head,e),l(s,r,p),l(s,a,p),l(s,o,p),l(s,j,p),k(j,g),k(g,R),f(b,R,null),k(j,F),k(j,E),l(s,z,p),f(I,s,p),l(s,G,p),l(s,x,p),l(s,C,p),l(s,A,p),l(s,Y,p),l(s,B,p),l(s,Q,p),f(N,s,p),l(s,H,p),l(s,Z,p),k(Z,W),k(W,n),f(d,n,null),k(Z,Us),k(Z,Js),l(s,xs,p),l(s,es,p),l(s,Zs,p),f(as,s,p),l(s,ks,p),l(s,ts,p),l(s,Es,p),f(ls,s,p),l(s,Rs,p),l(s,ns,p),l(s,Gs,p),l(s,q,p),k(q,L),k(L,bs),f(ps,bs,null),k(q,le),k(q,Ts),l(s,Bs,p),f(rs,s,p),l(s,Xs,p),l(s,os,p),l(s,Vs,p),f(is,s,p),l(s,Ws,p),l(s,cs,p),l(s,zs,p),l(s,Ms,p),l(s,Qs,p),l(s,ms,p),l(s,Ns,p),f(us,s,p),l(s,Fs,p),l(s,ds,p),l(s,Ys,p),f(js,s,p),l(s,Hs,p),l(s,hs,p),l(s,qs,p),f(D,s,p),l(s,Ss,p),l(s,S,p),k(S,P),k(P,Is),f(ys,Is,null),k(S,ne),k(S,gs),l(s,Ls,p),f(K,s,p),l(s,Ds,p),f(O,s,p),l(s,Ps,p),l(s,_s,p),Ks=!0},p(s,[p]){const fs={};p&2&&(fs.$$scope={dirty:p,ctx:s}),N.$set(fs);const As={};p&2&&(As.$$scope={dirty:p,ctx:s}),D.$set(As);const vs={};p&2&&(vs.$$scope={dirty:p,ctx:s}),K.$set(vs);const ws={};p&2&&(ws.$$scope={dirty:p,ctx:s}),O.$set(ws)},i(s){Ks||(w(b.$$.fragment,s),w(I.$$.fragment,s),w(N.$$.fragment,s),w(d.$$.fragment,s),w(as.$$.fragment,s),w(ls.$$.fragment,s),w(ps.$$.fragment,s),w(rs.$$.fragment,s),w(is.$$.fragment,s),w(us.$$.fragment,s),w(js.$$.fragment,s),w(D.$$.fragment,s),w(ys.$$.fragment,s),w(K.$$.fragment,s),w(O.$$.fragment,s),Ks=!0)},o(s){U(b.$$.fragment,s),U(I.$$.fragment,s),U(N.$$.fragment,s),U(d.$$.fragment,s),U(as.$$.fragment,s),U(ls.$$.fragment,s),U(ps.$$.fragment,s),U(rs.$$.fragment,s),U(is.$$.fragment,s),U(us.$$.fragment,s),U(js.$$.fragment,s),U(D.$$.fragment,s),U(ys.$$.fragment,s),U(K.$$.fragment,s),U(O.$$.fragment,s),Ks=!1},d(s){s&&(t(r),t(a),t(o),t(j),t(z),t(G),t(x),t(C),t(A),t(Y),t(B),t(Q),t(H),t(Z),t(xs),t(es),t(Zs),t(ks),t(ts),t(Es),t(Rs),t(ns),t(Gs),t(q),t(Bs),t(Xs),t(os),t(Vs),t(Ws),t(cs),t(zs),t(Ms),t(Qs),t(ms),t(Ns),t(Fs),t(ds),t(Ys),t(Hs),t(hs),t(qs),t(Ss),t(S),t(Ls),t(Ds),t(Ps),t(_s)),t(e),J(b),J(I,s),J(N,s),J(d),J(as,s),J(ls,s),J(ps),J(rs,s),J(is,s),J(us,s),J(js,s),J(D,s),J(ys),J(K,s),J(O,s)}}}const Fe={local:"respuesta-a-preguntas",sections:[{local:"carga-el-dataset-squad",title:"Carga el dataset SQuAD"},{local:"preprocesamiento",title:"Preprocesamiento"},{local:"entrenamiento",title:"Entrenamiento"}],title:"Respuesta a preguntas"};function Ye($){return Ie(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Oe extends _e{constructor(e){super(),Ae(this,e,Ye,Ne,be,{})}}export{Oe as component};
