import{s as Qs,o as qs,n as ue}from"../chunks/scheduler.36a0863c.js";import{S as Ls,i as Ns,g as u,s as i,u as $,A as Ss,h as d,f as t,c,j as Y,v as j,y,k as Z,o as I,a as l,w as b,d as w,t as T,x as U}from"../chunks/index.d0f7a4c4.js";import{T as st}from"../chunks/Tip.4c7d7eb1.js";import{Y as ls}from"../chunks/Youtube.d15bb502.js";import{I as Se}from"../chunks/IconCopyLink.bc5fad79.js";import{C as z}from"../chunks/CodeBlock.69433f87.js";import{F as ms,M as at}from"../chunks/Markdown.1d1f160a.js";function Ps(v){let s,h='Puedes realizar fine-tuning a otras arquitecturas para modelos de lenguaje como <a href="https://huggingface.co/EleutherAI/gpt-neo-125M" rel="nofollow">GPT-Neo</a>, <a href="https://huggingface.co/EleutherAI/gpt-j-6B" rel="nofollow">GPT-J</a> y <a href="https://huggingface.co/bert-base-uncased" rel="nofollow">BERT</a> siguiendo los mismos pasos presentados en esta guía!',a,p,g='Mira la <a href="https://huggingface.co/tasks/text-generation" rel="nofollow">página de tarea</a> para generación de texto y la <a href="https://huggingface.co/tasks/fill-mask" rel="nofollow">página de tarea</a> para modelos de lenguajes por enmascaramiento para obtener más información sobre los modelos, datasets, y métricas asociadas.';return{c(){s=u("p"),s.innerHTML=h,a=i(),p=u("p"),p.innerHTML=g},l(f){s=d(f,"P",{"data-svelte-h":!0}),y(s)!=="svelte-1ka52f1"&&(s.innerHTML=h),a=c(f),p=d(f,"P",{"data-svelte-h":!0}),y(p)!=="svelte-kfpohj"&&(p.innerHTML=g)},m(f,C){l(f,s,C),l(f,a,C),l(f,p,C)},p:ue,d(f){f&&(t(s),t(a),t(p))}}}function Ds(v){let s,h="Puedes usar el token de final de secuencia como el token de relleno y asignar <code>mlm=False</code>. Esto usará los inputs como etiquetas movidas un elemento hacia la derecha:",a,p,g,f,C="Para modelados de lenguaje por enmascaramiento usa el mismo <code>DataCollatorForLanguageModeling</code> excepto que deberás especificar <code>mlm_probability</code> para enmascarar tokens aleatoriamente cada vez que iteras sobre los datos.",J,R,x;return p=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvckxhbmd1YWdlTW9kZWxpbmclMEElMEF0b2tlbml6ZXIucGFkX3Rva2VuJTIwJTNEJTIwdG9rZW5pemVyLmVvc190b2tlbiUwQWRhdGFfY29sbGF0b3IlMjAlM0QlMjBEYXRhQ29sbGF0b3JGb3JMYW5ndWFnZU1vZGVsaW5nKHRva2VuaXplciUzRHRva2VuaXplciUyQyUyMG1sbSUzREZhbHNlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorForLanguageModeling

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.pad_token = tokenizer.eos_token
<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm=<span class="hljs-literal">False</span>)`}}),R=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvckxhbmd1YWdlTW9kZWxpbmclMEElMEF0b2tlbml6ZXIucGFkX3Rva2VuJTIwJTNEJTIwdG9rZW5pemVyLmVvc190b2tlbiUwQWRhdGFfY29sbGF0b3IlMjAlM0QlMjBEYXRhQ29sbGF0b3JGb3JMYW5ndWFnZU1vZGVsaW5nKHRva2VuaXplciUzRHRva2VuaXplciUyQyUyMG1sbV9wcm9iYWJpbGl0eSUzRDAuMTUp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorForLanguageModeling

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.pad_token = tokenizer.eos_token
<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm_probability=<span class="hljs-number">0.15</span>)`}}),{c(){s=u("p"),s.innerHTML=h,a=i(),$(p.$$.fragment),g=i(),f=u("p"),f.innerHTML=C,J=i(),$(R.$$.fragment)},l(m){s=d(m,"P",{"data-svelte-h":!0}),y(s)!=="svelte-uvilkn"&&(s.innerHTML=h),a=c(m),j(p.$$.fragment,m),g=c(m),f=d(m,"P",{"data-svelte-h":!0}),y(f)!=="svelte-1sc95x7"&&(f.innerHTML=C),J=c(m),j(R.$$.fragment,m)},m(m,k){l(m,s,k),l(m,a,k),b(p,m,k),l(m,g,k),l(m,f,k),l(m,J,k),b(R,m,k),x=!0},p:ue,i(m){x||(w(p.$$.fragment,m),w(R.$$.fragment,m),x=!0)},o(m){T(p.$$.fragment,m),T(R.$$.fragment,m),x=!1},d(m){m&&(t(s),t(a),t(g),t(f),t(J)),U(p,m),U(R,m)}}}function Ks(v){let s,h;return s=new at({props:{$$slots:{default:[Ds]},$$scope:{ctx:v}}}),{c(){$(s.$$.fragment)},l(a){j(s.$$.fragment,a)},m(a,p){b(s,a,p),h=!0},p(a,p){const g={};p&2&&(g.$$scope={dirty:p,ctx:a}),s.$set(g)},i(a){h||(w(s.$$.fragment,a),h=!0)},o(a){T(s.$$.fragment,a),h=!1},d(a){U(s,a)}}}function Os(v){let s,h="Puedes usar el token de final de secuencia como el token de relleno y asignar <code>mlm=False</code>. Esto usará los inputs como etiquetas movidas un elemento hacia la derecha:",a,p,g,f,C="Para modelados de lenguajes por enmascaramiento usa el mismo <code>DataCollatorForLanguageModeling</code> excepto que deberás especificar <code>mlm_probability</code> para enmascarar tokens aleatoriamente cada vez que iteras sobre los datos.",J,R,x;return p=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvckxhbmd1YWdlTW9kZWxpbmclMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGF0YUNvbGxhdG9yRm9yTGFuZ3VhZ2VNb2RlbGluZyh0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMjBtbG0lM0RGYWxzZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorForLanguageModeling

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm=<span class="hljs-literal">False</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`}}),R=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvckxhbmd1YWdlTW9kZWxpbmclMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGF0YUNvbGxhdG9yRm9yTGFuZ3VhZ2VNb2RlbGluZyh0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMjBtbG0lM0RGYWxzZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorForLanguageModeling

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm=<span class="hljs-literal">False</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`}}),{c(){s=u("p"),s.innerHTML=h,a=i(),$(p.$$.fragment),g=i(),f=u("p"),f.innerHTML=C,J=i(),$(R.$$.fragment)},l(m){s=d(m,"P",{"data-svelte-h":!0}),y(s)!=="svelte-uvilkn"&&(s.innerHTML=h),a=c(m),j(p.$$.fragment,m),g=c(m),f=d(m,"P",{"data-svelte-h":!0}),y(f)!=="svelte-1jtycjg"&&(f.innerHTML=C),J=c(m),j(R.$$.fragment,m)},m(m,k){l(m,s,k),l(m,a,k),b(p,m,k),l(m,g,k),l(m,f,k),l(m,J,k),b(R,m,k),x=!0},p:ue,i(m){x||(w(p.$$.fragment,m),w(R.$$.fragment,m),x=!0)},o(m){T(p.$$.fragment,m),T(R.$$.fragment,m),x=!1},d(m){m&&(t(s),t(a),t(g),t(f),t(J)),U(p,m),U(R,m)}}}function ea(v){let s,h;return s=new at({props:{$$slots:{default:[Os]},$$scope:{ctx:v}}}),{c(){$(s.$$.fragment)},l(a){j(s.$$.fragment,a)},m(a,p){b(s,a,p),h=!0},p(a,p){const g={};p&2&&(g.$$scope={dirty:p,ctx:a}),s.$set(g)},i(a){h||(w(s.$$.fragment,a),h=!0)},o(a){T(s.$$.fragment,a),h=!1},d(a){U(s,a)}}}function ta(v){let s,h='Si no estás familiarizado con el proceso de realizar fine-tuning sobre un modelo con <code>Trainer</code>, considera el tutorial básico <a href="../training#finetune-with-trainer">aquí</a>!';return{c(){s=u("p"),s.innerHTML=h},l(a){s=d(a,"P",{"data-svelte-h":!0}),y(s)!=="svelte-1rt7ku5"&&(s.innerHTML=h)},m(a,p){l(a,s,p)},p:ue,d(a){a&&t(s)}}}function sa(v){let s,h="Carga DistilGPT2 con <code>AutoModelForCausalLM</code>:",a,p,g,f,C,J,R="A este punto, solo faltan tres pasos:",x,m,k="<li>Definir tus hiperparámetros de entrenamiento en <code>TrainingArguments</code>.</li> <li>Pasarle los argumentos de entrenamiento a <code>Trainer</code> junto con el modelo, dataset, y el data collator.</li> <li>Realiza la llamada <code>train()</code> para realizar el fine-tuning sobre tu modelo.</li>",G,W,V;return p=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwVHJhaW5pbmdBcmd1bWVudHMlMkMlMjBUcmFpbmVyJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsZ3B0MiUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, TrainingArguments, Trainer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;distilgpt2&quot;</span>)`}}),f=new st({props:{$$slots:{default:[ta]},$$scope:{ctx:v}}}),W=new z({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjIuJTJGcmVzdWx0cyUyMiUyQyUwQSUyMCUyMCUyMCUyMGV2YWx1YXRpb25fc3RyYXRlZ3klM0QlMjJlcG9jaCUyMiUyQyUwQSUyMCUyMCUyMCUyMGxlYXJuaW5nX3JhdGUlM0QyZS01JTJDJTBBJTIwJTIwJTIwJTIwd2VpZ2h0X2RlY2F5JTNEMC4wMSUyQyUwQSklMEElMEF0cmFpbmVyJTIwJTNEJTIwVHJhaW5lciglMEElMjAlMjAlMjAlMjBtb2RlbCUzRG1vZGVsJTJDJTBBJTIwJTIwJTIwJTIwYXJncyUzRHRyYWluaW5nX2FyZ3MlMkMlMEElMjAlMjAlMjAlMjB0cmFpbl9kYXRhc2V0JTNEbG1fZGF0YXNldCU1QiUyMnRyYWluJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9kYXRhc2V0JTNEbG1fZGF0YXNldCU1QiUyMnRlc3QlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBkYXRhX2NvbGxhdG9yJTNEZGF0YV9jb2xsYXRvciUyQyUwQSklMEElMEF0cmFpbmVyLnRyYWluKCk=",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>    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=lm_dataset[<span class="hljs-string">&quot;train&quot;</span>],
<span class="hljs-meta">... </span>    eval_dataset=lm_dataset[<span class="hljs-string">&quot;test&quot;</span>],
<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(){s=u("p"),s.innerHTML=h,a=i(),$(p.$$.fragment),g=i(),$(f.$$.fragment),C=i(),J=u("p"),J.textContent=R,x=i(),m=u("ol"),m.innerHTML=k,G=i(),$(W.$$.fragment)},l(r){s=d(r,"P",{"data-svelte-h":!0}),y(s)!=="svelte-1yy4yh2"&&(s.innerHTML=h),a=c(r),j(p.$$.fragment,r),g=c(r),j(f.$$.fragment,r),C=c(r),J=d(r,"P",{"data-svelte-h":!0}),y(J)!=="svelte-1fkdw25"&&(J.textContent=R),x=c(r),m=d(r,"OL",{"data-svelte-h":!0}),y(m)!=="svelte-16tq1zt"&&(m.innerHTML=k),G=c(r),j(W.$$.fragment,r)},m(r,_){l(r,s,_),l(r,a,_),b(p,r,_),l(r,g,_),b(f,r,_),l(r,C,_),l(r,J,_),l(r,x,_),l(r,m,_),l(r,G,_),b(W,r,_),V=!0},p(r,_){const E={};_&2&&(E.$$scope={dirty:_,ctx:r}),f.$set(E)},i(r){V||(w(p.$$.fragment,r),w(f.$$.fragment,r),w(W.$$.fragment,r),V=!0)},o(r){T(p.$$.fragment,r),T(f.$$.fragment,r),T(W.$$.fragment,r),V=!1},d(r){r&&(t(s),t(a),t(g),t(C),t(J),t(x),t(m),t(G)),U(p,r),U(f,r),U(W,r)}}}function aa(v){let s,h;return s=new at({props:{$$slots:{default:[sa]},$$scope:{ctx:v}}}),{c(){$(s.$$.fragment)},l(a){j(s.$$.fragment,a)},m(a,p){b(s,a,p),h=!0},p(a,p){const g={};p&2&&(g.$$scope={dirty:p,ctx:a}),s.$set(g)},i(a){h||(w(s.$$.fragment,a),h=!0)},o(a){T(s.$$.fragment,a),h=!1},d(a){U(s,a)}}}function la(v){let s,h='Si no estás familiarizado con realizar fine-tuning de tus modelos con Keras, considera el tutorial básico <a href="training#finetune-with-keras">aquí</a>!';return{c(){s=u("p"),s.innerHTML=h},l(a){s=d(a,"P",{"data-svelte-h":!0}),y(s)!=="svelte-txxfse"&&(s.innerHTML=h)},m(a,p){l(a,s,p)},p:ue,d(a){a&&t(s)}}}function na(v){let s,h='Para realizar el fine-tuning de un modelo en TensorFlow, comienza por convertir tus datasets al formato <code>tf.data.Dataset</code> con <a href="https://huggingface.co/docs/datasets/package_reference/main_classes.html#datasets.Dataset.to_tf_dataset" rel="nofollow"><code>to_tf_dataset</code></a>. Especifica los inputs y etiquetas en <code>columns</code>, ya sea para mezclar el dataset, tamaño de lote, y el data collator:',a,p,g,f,C,J,R="Crea la función optimizadora, la tasa de aprendizaje, y algunos hiperparámetros de entrenamiento:",x,m,k,G,W="Carga DistilGPT2 con <code>TFAutoModelForCausalLM</code>:",V,r,_,E,ee='Configura el modelo para entrenamiento con <a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a>:',A,F,B,X,te='Llama a <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:',Q,H,q;return p=new z({props:{code:"dGZfdHJhaW5fc2V0JTIwJTNEJTIwbG1fZGF0YXNldCU1QiUyMnRyYWluJTIyJTVELnRvX3RmX2RhdGFzZXQoJTBBJTIwJTIwJTIwJTIwY29sdW1ucyUzRCU1QiUyMmF0dGVudGlvbl9tYXNrJTIyJTJDJTIwJTIyaW5wdXRfaWRzJTIyJTJDJTIwJTIybGFiZWxzJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwZHVtbXlfbGFiZWxzJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMHNodWZmbGUlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwYmF0Y2hfc2l6ZSUzRDE2JTJDJTBBJTIwJTIwJTIwJTIwY29sbGF0ZV9mbiUzRGRhdGFfY29sbGF0b3IlMkMlMEEpJTBBJTBBdGZfdGVzdF9zZXQlMjAlM0QlMjBsbV9kYXRhc2V0JTVCJTIydGVzdCUyMiU1RC50b190Zl9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMGNvbHVtbnMlM0QlNUIlMjJhdHRlbnRpb25fbWFzayUyMiUyQyUyMCUyMmlucHV0X2lkcyUyMiUyQyUyMCUyMmxhYmVscyUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMGR1bW15X2xhYmVscyUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBzaHVmZmxlJTNERmFsc2UlMkMlMEElMjAlMjAlMjAlMjBiYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBjb2xsYXRlX2ZuJTNEZGF0YV9jb2xsYXRvciUyQyUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tf_train_set = lm_dataset[<span class="hljs-string">&quot;train&quot;</span>].to_tf_dataset(
<span class="hljs-meta">... </span>    columns=[<span class="hljs-string">&quot;attention_mask&quot;</span>, <span class="hljs-string">&quot;input_ids&quot;</span>, <span class="hljs-string">&quot;labels&quot;</span>],
<span class="hljs-meta">... </span>    dummy_labels=<span class="hljs-literal">True</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_test_set = lm_dataset[<span class="hljs-string">&quot;test&quot;</span>].to_tf_dataset(
<span class="hljs-meta">... </span>    columns=[<span class="hljs-string">&quot;attention_mask&quot;</span>, <span class="hljs-string">&quot;input_ids&quot;</span>, <span class="hljs-string">&quot;labels&quot;</span>],
<span class="hljs-meta">... </span>    dummy_labels=<span class="hljs-literal">True</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>)`}}),f=new st({props:{$$slots:{default:[la]},$$scope:{ctx:v}}}),m=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMGNyZWF0ZV9vcHRpbWl6ZXIlMkMlMjBBZGFtV2VpZ2h0RGVjYXklMEElMEFvcHRpbWl6ZXIlMjAlM0QlMjBBZGFtV2VpZ2h0RGVjYXkobGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMjB3ZWlnaHRfZGVjYXlfcmF0ZSUzRDAuMDEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> create_optimizer, AdamWeightDecay

<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer = AdamWeightDecay(learning_rate=<span class="hljs-number">2e-5</span>, weight_decay_rate=<span class="hljs-number">0.01</span>)`}}),r=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yQ2F1c2FsTE0lMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGdwdDIlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;distilgpt2&quot;</span>)`}}),F=new z({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)`}}),H=new z({props:{code:"bW9kZWwuZml0KHglM0R0Zl90cmFpbl9zZXQlMkMlMjB2YWxpZGF0aW9uX2RhdGElM0R0Zl90ZXN0X3NldCUyQyUyMGVwb2NocyUzRDMp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model.fit(x=tf_train_set, validation_data=tf_test_set, epochs=<span class="hljs-number">3</span>)'}}),{c(){s=u("p"),s.innerHTML=h,a=i(),$(p.$$.fragment),g=i(),$(f.$$.fragment),C=i(),J=u("p"),J.textContent=R,x=i(),$(m.$$.fragment),k=i(),G=u("p"),G.innerHTML=W,V=i(),$(r.$$.fragment),_=i(),E=u("p"),E.innerHTML=ee,A=i(),$(F.$$.fragment),B=i(),X=u("p"),X.innerHTML=te,Q=i(),$(H.$$.fragment)},l(n){s=d(n,"P",{"data-svelte-h":!0}),y(s)!=="svelte-14lg0rt"&&(s.innerHTML=h),a=c(n),j(p.$$.fragment,n),g=c(n),j(f.$$.fragment,n),C=c(n),J=d(n,"P",{"data-svelte-h":!0}),y(J)!=="svelte-qa98st"&&(J.textContent=R),x=c(n),j(m.$$.fragment,n),k=c(n),G=d(n,"P",{"data-svelte-h":!0}),y(G)!=="svelte-r3087k"&&(G.innerHTML=W),V=c(n),j(r.$$.fragment,n),_=c(n),E=d(n,"P",{"data-svelte-h":!0}),y(E)!=="svelte-vifi3w"&&(E.innerHTML=ee),A=c(n),j(F.$$.fragment,n),B=c(n),X=d(n,"P",{"data-svelte-h":!0}),y(X)!=="svelte-meb7zc"&&(X.innerHTML=te),Q=c(n),j(H.$$.fragment,n)},m(n,M){l(n,s,M),l(n,a,M),b(p,n,M),l(n,g,M),b(f,n,M),l(n,C,M),l(n,J,M),l(n,x,M),b(m,n,M),l(n,k,M),l(n,G,M),l(n,V,M),b(r,n,M),l(n,_,M),l(n,E,M),l(n,A,M),b(F,n,M),l(n,B,M),l(n,X,M),l(n,Q,M),b(H,n,M),q=!0},p(n,M){const L={};M&2&&(L.$$scope={dirty:M,ctx:n}),f.$set(L)},i(n){q||(w(p.$$.fragment,n),w(f.$$.fragment,n),w(m.$$.fragment,n),w(r.$$.fragment,n),w(F.$$.fragment,n),w(H.$$.fragment,n),q=!0)},o(n){T(p.$$.fragment,n),T(f.$$.fragment,n),T(m.$$.fragment,n),T(r.$$.fragment,n),T(F.$$.fragment,n),T(H.$$.fragment,n),q=!1},d(n){n&&(t(s),t(a),t(g),t(C),t(J),t(x),t(k),t(G),t(V),t(_),t(E),t(A),t(B),t(X),t(Q)),U(p,n),U(f,n),U(m,n),U(r,n),U(F,n),U(H,n)}}}function oa(v){let s,h;return s=new at({props:{$$slots:{default:[na]},$$scope:{ctx:v}}}),{c(){$(s.$$.fragment)},l(a){j(s.$$.fragment,a)},m(a,p){b(s,a,p),h=!0},p(a,p){const g={};p&2&&(g.$$scope={dirty:p,ctx:a}),s.$set(g)},i(a){h||(w(s.$$.fragment,a),h=!0)},o(a){T(s.$$.fragment,a),h=!1},d(a){U(s,a)}}}function ra(v){let s,h='Si no estás familiarizado con el proceso de realizar fine-tuning sobre un modelo con <code>Trainer</code>, considera el tutorial básico <a href="../training#finetune-with-trainer">aquí</a>!';return{c(){s=u("p"),s.innerHTML=h},l(a){s=d(a,"P",{"data-svelte-h":!0}),y(s)!=="svelte-1rt7ku5"&&(s.innerHTML=h)},m(a,p){l(a,s,p)},p:ue,d(a){a&&t(s)}}}function pa(v){let s,h="Carga DistilRoBERTa con <code>AutoModelForMaskedlM</code>:",a,p,g,f,C,J,R="A este punto, solo faltan tres pasos:",x,m,k="<li>Definir tus hiperparámetros de entrenamiento en <code>TrainingArguments</code>.</li> <li>Pasarle los argumentos de entrenamiento a <code>Trainer</code> junto con el modelo, dataset, y el data collator.</li> <li>Realiza la llamada <code>train()</code> para realizar el fine-tuning de tu modelo.</li>",G,W,V;return p=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvck1hc2tlZExNJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JNYXNrZWRMTS5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlscm9iZXJ0YS1iYXNlJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForMaskedLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForMaskedLM.from_pretrained(<span class="hljs-string">&quot;distilroberta-base&quot;</span>)`}}),f=new st({props:{$$slots:{default:[ra]},$$scope:{ctx:v}}}),W=new z({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjIuJTJGcmVzdWx0cyUyMiUyQyUwQSUyMCUyMCUyMCUyMGV2YWx1YXRpb25fc3RyYXRlZ3klM0QlMjJlcG9jaCUyMiUyQyUwQSUyMCUyMCUyMCUyMGxlYXJuaW5nX3JhdGUlM0QyZS01JTJDJTBBJTIwJTIwJTIwJTIwbnVtX3RyYWluX2Vwb2NocyUzRDMlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfZGVjYXklM0QwLjAxJTJDJTBBKSUwQSUwQXRyYWluZXIlMjAlM0QlMjBUcmFpbmVyKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEbW9kZWwlMkMlMEElMjAlMjAlMjAlMjBhcmdzJTNEdHJhaW5pbmdfYXJncyUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0RsbV9kYXRhc2V0JTVCJTIydHJhaW4lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBldmFsX2RhdGFzZXQlM0RsbV9kYXRhc2V0JTVCJTIydGVzdCUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMGRhdGFfY29sbGF0b3IlM0RkYXRhX2NvbGxhdG9yJTJDJTBBKSUwQSUwQXRyYWluZXIudHJhaW4oKQ==",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>    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=lm_dataset[<span class="hljs-string">&quot;train&quot;</span>],
<span class="hljs-meta">... </span>    eval_dataset=lm_dataset[<span class="hljs-string">&quot;test&quot;</span>],
<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(){s=u("p"),s.innerHTML=h,a=i(),$(p.$$.fragment),g=i(),$(f.$$.fragment),C=i(),J=u("p"),J.textContent=R,x=i(),m=u("ol"),m.innerHTML=k,G=i(),$(W.$$.fragment)},l(r){s=d(r,"P",{"data-svelte-h":!0}),y(s)!=="svelte-7nepae"&&(s.innerHTML=h),a=c(r),j(p.$$.fragment,r),g=c(r),j(f.$$.fragment,r),C=c(r),J=d(r,"P",{"data-svelte-h":!0}),y(J)!=="svelte-1fkdw25"&&(J.textContent=R),x=c(r),m=d(r,"OL",{"data-svelte-h":!0}),y(m)!=="svelte-11bmfc5"&&(m.innerHTML=k),G=c(r),j(W.$$.fragment,r)},m(r,_){l(r,s,_),l(r,a,_),b(p,r,_),l(r,g,_),b(f,r,_),l(r,C,_),l(r,J,_),l(r,x,_),l(r,m,_),l(r,G,_),b(W,r,_),V=!0},p(r,_){const E={};_&2&&(E.$$scope={dirty:_,ctx:r}),f.$set(E)},i(r){V||(w(p.$$.fragment,r),w(f.$$.fragment,r),w(W.$$.fragment,r),V=!0)},o(r){T(p.$$.fragment,r),T(f.$$.fragment,r),T(W.$$.fragment,r),V=!1},d(r){r&&(t(s),t(a),t(g),t(C),t(J),t(x),t(m),t(G)),U(p,r),U(f,r),U(W,r)}}}function ia(v){let s,h;return s=new at({props:{$$slots:{default:[pa]},$$scope:{ctx:v}}}),{c(){$(s.$$.fragment)},l(a){j(s.$$.fragment,a)},m(a,p){b(s,a,p),h=!0},p(a,p){const g={};p&2&&(g.$$scope={dirty:p,ctx:a}),s.$set(g)},i(a){h||(w(s.$$.fragment,a),h=!0)},o(a){T(s.$$.fragment,a),h=!1},d(a){U(s,a)}}}function ca(v){let s,h='Si no estás familiarizado con realizar fine-tuning de tus modelos con Keras, considera el tutorial básico <a href="training#finetune-with-keras">aquí</a>!';return{c(){s=u("p"),s.innerHTML=h},l(a){s=d(a,"P",{"data-svelte-h":!0}),y(s)!=="svelte-txxfse"&&(s.innerHTML=h)},m(a,p){l(a,s,p)},p:ue,d(a){a&&t(s)}}}function ma(v){let s,h='Para realizar el fine-tuning de un modelo en TensorFlow, comienza por convertir tus datasets al formato <code>tf.data.Dataset</code> con <a href="https://huggingface.co/docs/datasets/package_reference/main_classes.html#datasets.Dataset.to_tf_dataset" rel="nofollow"><code>to_tf_dataset</code></a>. Especifica los inputs y etiquetas en <code>columns</code>, ya sea para mezclar el dataset, tamaño de lote, y el data collator:',a,p,g,f,C,J,R="Crea la función optimizadora, la tasa de aprendizaje, y algunos hiperparámetros de entrenamiento:",x,m,k,G,W="Carga DistilRoBERTa con <code>TFAutoModelForMaskedLM</code>:",V,r,_,E,ee='Configura el modelo para entrenamiento con <a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a>:',A,F,B,X,te='Llama a <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:',Q,H,q;return p=new z({props:{code:"dGZfdHJhaW5fc2V0JTIwJTNEJTIwbG1fZGF0YXNldCU1QiUyMnRyYWluJTIyJTVELnRvX3RmX2RhdGFzZXQoJTBBJTIwJTIwJTIwJTIwY29sdW1ucyUzRCU1QiUyMmF0dGVudGlvbl9tYXNrJTIyJTJDJTIwJTIyaW5wdXRfaWRzJTIyJTJDJTIwJTIybGFiZWxzJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwZHVtbXlfbGFiZWxzJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMHNodWZmbGUlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwYmF0Y2hfc2l6ZSUzRDE2JTJDJTBBJTIwJTIwJTIwJTIwY29sbGF0ZV9mbiUzRGRhdGFfY29sbGF0b3IlMkMlMEEpJTBBJTBBdGZfdGVzdF9zZXQlMjAlM0QlMjBsbV9kYXRhc2V0JTVCJTIydGVzdCUyMiU1RC50b190Zl9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMGNvbHVtbnMlM0QlNUIlMjJhdHRlbnRpb25fbWFzayUyMiUyQyUyMCUyMmlucHV0X2lkcyUyMiUyQyUyMCUyMmxhYmVscyUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMGR1bW15X2xhYmVscyUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBzaHVmZmxlJTNERmFsc2UlMkMlMEElMjAlMjAlMjAlMjBiYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBjb2xsYXRlX2ZuJTNEZGF0YV9jb2xsYXRvciUyQyUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tf_train_set = lm_dataset[<span class="hljs-string">&quot;train&quot;</span>].to_tf_dataset(
<span class="hljs-meta">... </span>    columns=[<span class="hljs-string">&quot;attention_mask&quot;</span>, <span class="hljs-string">&quot;input_ids&quot;</span>, <span class="hljs-string">&quot;labels&quot;</span>],
<span class="hljs-meta">... </span>    dummy_labels=<span class="hljs-literal">True</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_test_set = lm_dataset[<span class="hljs-string">&quot;test&quot;</span>].to_tf_dataset(
<span class="hljs-meta">... </span>    columns=[<span class="hljs-string">&quot;attention_mask&quot;</span>, <span class="hljs-string">&quot;input_ids&quot;</span>, <span class="hljs-string">&quot;labels&quot;</span>],
<span class="hljs-meta">... </span>    dummy_labels=<span class="hljs-literal">True</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>)`}}),f=new st({props:{$$slots:{default:[ca]},$$scope:{ctx:v}}}),m=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMGNyZWF0ZV9vcHRpbWl6ZXIlMkMlMjBBZGFtV2VpZ2h0RGVjYXklMEElMEFvcHRpbWl6ZXIlMjAlM0QlMjBBZGFtV2VpZ2h0RGVjYXkobGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMjB3ZWlnaHRfZGVjYXlfcmF0ZSUzRDAuMDEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> create_optimizer, AdamWeightDecay

<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer = AdamWeightDecay(learning_rate=<span class="hljs-number">2e-5</span>, weight_decay_rate=<span class="hljs-number">0.01</span>)`}}),r=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yTWFza2VkTE0lMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbHJvYmVydGEtYmFzZSUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForMaskedLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;distilroberta-base&quot;</span>)`}}),F=new z({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)`}}),H=new z({props:{code:"bW9kZWwuZml0KHglM0R0Zl90cmFpbl9zZXQlMkMlMjB2YWxpZGF0aW9uX2RhdGElM0R0Zl90ZXN0X3NldCUyQyUyMGVwb2NocyUzRDMp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model.fit(x=tf_train_set, validation_data=tf_test_set, epochs=<span class="hljs-number">3</span>)'}}),{c(){s=u("p"),s.innerHTML=h,a=i(),$(p.$$.fragment),g=i(),$(f.$$.fragment),C=i(),J=u("p"),J.textContent=R,x=i(),$(m.$$.fragment),k=i(),G=u("p"),G.innerHTML=W,V=i(),$(r.$$.fragment),_=i(),E=u("p"),E.innerHTML=ee,A=i(),$(F.$$.fragment),B=i(),X=u("p"),X.innerHTML=te,Q=i(),$(H.$$.fragment)},l(n){s=d(n,"P",{"data-svelte-h":!0}),y(s)!=="svelte-14lg0rt"&&(s.innerHTML=h),a=c(n),j(p.$$.fragment,n),g=c(n),j(f.$$.fragment,n),C=c(n),J=d(n,"P",{"data-svelte-h":!0}),y(J)!=="svelte-qa98st"&&(J.textContent=R),x=c(n),j(m.$$.fragment,n),k=c(n),G=d(n,"P",{"data-svelte-h":!0}),y(G)!=="svelte-1h9i1wk"&&(G.innerHTML=W),V=c(n),j(r.$$.fragment,n),_=c(n),E=d(n,"P",{"data-svelte-h":!0}),y(E)!=="svelte-vifi3w"&&(E.innerHTML=ee),A=c(n),j(F.$$.fragment,n),B=c(n),X=d(n,"P",{"data-svelte-h":!0}),y(X)!=="svelte-meb7zc"&&(X.innerHTML=te),Q=c(n),j(H.$$.fragment,n)},m(n,M){l(n,s,M),l(n,a,M),b(p,n,M),l(n,g,M),b(f,n,M),l(n,C,M),l(n,J,M),l(n,x,M),b(m,n,M),l(n,k,M),l(n,G,M),l(n,V,M),b(r,n,M),l(n,_,M),l(n,E,M),l(n,A,M),b(F,n,M),l(n,B,M),l(n,X,M),l(n,Q,M),b(H,n,M),q=!0},p(n,M){const L={};M&2&&(L.$$scope={dirty:M,ctx:n}),f.$set(L)},i(n){q||(w(p.$$.fragment,n),w(f.$$.fragment,n),w(m.$$.fragment,n),w(r.$$.fragment,n),w(F.$$.fragment,n),w(H.$$.fragment,n),q=!0)},o(n){T(p.$$.fragment,n),T(f.$$.fragment,n),T(m.$$.fragment,n),T(r.$$.fragment,n),T(F.$$.fragment,n),T(H.$$.fragment,n),q=!1},d(n){n&&(t(s),t(a),t(g),t(C),t(J),t(x),t(k),t(G),t(V),t(_),t(E),t(A),t(B),t(X),t(Q)),U(p,n),U(f,n),U(m,n),U(r,n),U(F,n),U(H,n)}}}function ua(v){let s,h;return s=new at({props:{$$slots:{default:[ma]},$$scope:{ctx:v}}}),{c(){$(s.$$.fragment)},l(a){j(s.$$.fragment,a)},m(a,p){b(s,a,p),h=!0},p(a,p){const g={};p&2&&(g.$$scope={dirty:p,ctx:a}),s.$set(g)},i(a){h||(w(s.$$.fragment,a),h=!0)},o(a){T(s.$$.fragment,a),h=!1},d(a){U(s,a)}}}function da(v){let s,h=`Para un ejemplo más profundo sobre cómo realizar el fine-tuning sobre un modelo de lenguaje causal, considera
<a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb" rel="nofollow">PyTorch notebook</a>
o <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb" rel="nofollow">TensorFlow notebook</a>.`;return{c(){s=u("p"),s.innerHTML=h},l(a){s=d(a,"P",{"data-svelte-h":!0}),y(s)!=="svelte-1frn7nq"&&(s.innerHTML=h)},m(a,p){l(a,s,p)},p:ue,d(a){a&&t(s)}}}function ha(v){let s,h,a,p,g,f,C,J,R,x,m="Modelado de lenguaje",k,G,W="El modelado de lenguaje predice palabras en un enunciado. Hay dos formas de modelado de lenguaje.",V,r,_,E,ee="El modelado de lenguaje causal predice el siguiente token en una secuencia de tokens, y el modelo solo puede considerar los tokens a la izquierda.",A,F,B,X,te="El modelado de lenguaje por enmascaramiento predice un token enmascarado en una secuencia, y el modelo puede considerar los tokens bidireccionalmente.",Q,H,q='Esta guía te mostrará cómo realizar fine-tuning <a href="https://huggingface.co/distilgpt2" rel="nofollow">DistilGPT2</a> para modelos de lenguaje causales y <a href="https://huggingface.co/distilroberta-base" rel="nofollow">DistilRoBERTa</a> para modelos de lenguaje por enmascaramiento en el <a href="https://www.reddit.com/r/askscience/" rel="nofollow">r/askscience</a> subdataset <a href="https://huggingface.co/datasets/eli5" rel="nofollow">ELI5</a>.',n,M,L,N,se,lt,de,ns,Pe,us="Carga el dataset ELI5",ht,he,ds="Carga solo los primeros 5000 registros desde la biblioteca 🤗 Datasets, dado que es bastante grande:",ft,fe,gt,ge,hs="Divide este dataset en subdatasets para el entrenamiento y el test:",Mt,Me,yt,ye,fs="Luego observa un ejemplo:",$t,$e,jt,je,gs="Observa que <code>text</code> es un subcampo anidado dentro del diccionario <code>answers</code>. Cuando preproceses el dataset, deberás extraer el subcampo <code>text</code> en una columna aparte.",bt,S,ae,nt,be,os,De,Ms="Preprocesamiento",wt,we,Tt,Te,ys="Para modelados de lenguaje causales carga el tokenizador DistilGPT2 para procesar el subcampo <code>text</code>:",Ut,Ue,Jt,Je,_t,_e,$s="Para modelados de lenguaje por enmascaramiento carga el tokenizador DistilRoBERTa, en lugar de DistilGPT2:",xt,xe,kt,ke,js='Extrae el subcampo <code>text</code> desde su estructura anidado con el método <a href="https://huggingface.co/docs/datasets/process.html#flatten" rel="nofollow"><code>flatten</code></a>:',vt,ve,Ct,Ce,bs="Cada subcampo es ahora una columna separada, como lo indica el prefijo <code>answers</code>. Observa que <code>answers.text</code> es una lista. En lugar de tokenizar cada enunciado por separado, convierte la lista en un string para tokenizarlos conjuntamente.",Gt,Ge,ws="Así es como puedes crear una función de preprocesamiento para convertir la lista en una cadena y truncar las secuencias para que no superen la longitud máxima de input de DistilGPT2:",Rt,Re,Zt,Ze,Ts='Usa de 🤗 Datasets la función <a href="https://huggingface.co/docs/datasets/package_reference/main_classes.html#datasets.Dataset.map" rel="nofollow"><code>map</code></a> para aplicar la función de preprocesamiento sobre el dataset en su totalidad. Puedes acelerar la función <code>map</code> configurando el argumento <code>batched=True</code> para procesar múltiples elementos del dataset a la vez y aumentar la cantidad de procesos con <code>num_proc</code>. Elimina las columnas que no necesitas:',Et,Ee,It,Ie,Us="Ahora necesitas una segunda función de preprocesamiento para capturar el texto truncado de cualquier ejemplo demasiado largo para evitar cualquier pérdida de información. Esta función de preprocesamiento debería:",zt,ze,Js="<li>Concatenar todo el texto.</li> <li>Dividir el texto concatenado en trozos más pequeños definidos por un <code>block_size</code>.</li>",Wt,We,Vt,Ve,_s="Aplica la función <code>group_texts</code> sobre todo el dataset:",Ft,Fe,Xt,Xe,xs="Para modelados de lenguaje causales, usa <code>DataCollatorForLanguageModeling</code> para crear un lote de ejemplos. Esto también <em>rellenará dinámicamente</em> tu texto a la dimensión del elemento más largo del lote para que de esta manera tengan largo uniforme. Si bien es posible rellenar tu texto en la función <code>tokenizer</code> mediante el argumento <code>padding=True</code>, el rellenado dinámico es más eficiente.",Ht,le,Yt,P,ne,ot,He,rs,Ke,ks="Modelado de lenguaje causal",At,Ye,vs='El modelado de lenguaje causal es frecuentemente utilizado para generación de texto. Esta sección te muestra cómo realizar fine-tuning a <a href="https://huggingface.co/distilgpt2" rel="nofollow">DistilGPT2</a> para generar nuevo texto.',Bt,D,oe,rt,Ae,ps,Oe,Cs="Entrenamiento",Qt,re,qt,K,pe,pt,Be,is,et,Gs="Modelado de lenguaje por enmascaramiento",Lt,Qe,Rs='El modelado de lenguaje por enmascaramiento es también conocido como una tarea de rellenar la máscara, pues predice un token enmascarado dada una secuencia. Los modelos de lenguaje por enmascaramiento requieren una buena comprensión del contexto de una secuencia entera, en lugar de solo el contexto a la izquierda. Esta sección te enseña como realizar el fine-tuning de <a href="https://huggingface.co/distilroberta-base" rel="nofollow">DistilRoBERTa</a> para predecir una palabra enmascarada.',Nt,O,ie,it,qe,cs,tt,Zs="Entrenamiento",St,ce,Pt,me,Dt,ct,Kt;return J=new Se({}),r=new ls({props:{id:"Vpjb1lu0MDk"}}),F=new ls({props:{id:"mqElG5QJWUg"}}),M=new st({props:{$$slots:{default:[Ps]},$$scope:{ctx:v}}}),de=new Se({}),fe=new z({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZWxpNSUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJlbGk1JTIyJTJDJTIwc3BsaXQlM0QlMjJ0cmFpbl9hc2tzJTVCJTNBNTAwMCU1RCUyMik=",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>eli5 = load_dataset(<span class="hljs-string">&quot;eli5&quot;</span>, split=<span class="hljs-string">&quot;train_asks[:5000]&quot;</span>)`}}),Me=new z({props:{code:"ZWxpNSUyMCUzRCUyMGVsaTUudHJhaW5fdGVzdF9zcGxpdCh0ZXN0X3NpemUlM0QwLjIp",highlighted:'eli5 = eli5.train_test_split(test_size=<span class="hljs-number">0.2</span>)'}}),$e=new z({props:{code:"ZWxpNSU1QiUyMnRyYWluJTIyJTVEJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>eli5[<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;a_id&#x27;</span>: [<span class="hljs-string">&#x27;c3d1aib&#x27;</span>, <span class="hljs-string">&#x27;c3d4lya&#x27;</span>],
  <span class="hljs-string">&#x27;score&#x27;</span>: [<span class="hljs-number">6</span>, <span class="hljs-number">3</span>],
  <span class="hljs-string">&#x27;text&#x27;</span>: [<span class="hljs-string">&quot;The velocity needed to remain in orbit is equal to the square root of Newton&#x27;s constant times the mass of earth divided by the distance from the center of the earth. I don&#x27;t know the altitude of that specific mission, but they&#x27;re usually around 300 km. That means he&#x27;s going 7-8 km/s.\\n\\nIn space there are no other forces acting on either the shuttle or the guy, so they stay in the same position relative to each other. If he were to become unable to return to the ship, he would presumably run out of oxygen, or slowly fall into the atmosphere and burn up.&quot;</span>,
   <span class="hljs-string">&quot;Hope you don&#x27;t mind me asking another question, but why aren&#x27;t there any stars visible in this photo?&quot;</span>]},
 <span class="hljs-string">&#x27;answers_urls&#x27;</span>: {<span class="hljs-string">&#x27;url&#x27;</span>: []},
 <span class="hljs-string">&#x27;document&#x27;</span>: <span class="hljs-string">&#x27;&#x27;</span>,
 <span class="hljs-string">&#x27;q_id&#x27;</span>: <span class="hljs-string">&#x27;nyxfp&#x27;</span>,
 <span class="hljs-string">&#x27;selftext&#x27;</span>: <span class="hljs-string">&#x27;_URL_0_\\n\\nThis was on the front page earlier and I have a few questions about it. Is it possible to calculate how fast the astronaut would be orbiting the earth? Also how does he stay close to the shuttle so that he can return safely, i.e is he orbiting at the same speed and can therefore stay next to it? And finally if his propulsion system failed, would he eventually re-enter the atmosphere and presumably die?&#x27;</span>,
 <span class="hljs-string">&#x27;selftext_urls&#x27;</span>: {<span class="hljs-string">&#x27;url&#x27;</span>: [<span class="hljs-string">&#x27;http://apod.nasa.gov/apod/image/1201/freeflyer_nasa_3000.jpg&#x27;</span>]},
 <span class="hljs-string">&#x27;subreddit&#x27;</span>: <span class="hljs-string">&#x27;askscience&#x27;</span>,
 <span class="hljs-string">&#x27;title&#x27;</span>: <span class="hljs-string">&#x27;Few questions about this space walk photograph.&#x27;</span>,
 <span class="hljs-string">&#x27;title_urls&#x27;</span>: {<span class="hljs-string">&#x27;url&#x27;</span>: []}}`}}),be=new Se({}),we=new ls({props:{id:"ma1TrR7gE7I"}}),Ue=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxncHQyJTIyKQ==",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;distilgpt2&quot;</span>)`}}),Je=new ls({props:{id:"8PmhEIXhBvI"}}),xe=new z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxyb2JlcnRhLWJhc2UlMjIp",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;distilroberta-base&quot;</span>)`}}),ve=new z({props:{code:"ZWxpNSUyMCUzRCUyMGVsaTUuZmxhdHRlbigpJTBBZWxpNSU1QiUyMnRyYWluJTIyJTVEJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>eli5 = eli5.flatten()
<span class="hljs-meta">&gt;&gt;&gt; </span>eli5[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;answers.a_id&#x27;</span>: [<span class="hljs-string">&#x27;c3d1aib&#x27;</span>, <span class="hljs-string">&#x27;c3d4lya&#x27;</span>],
 <span class="hljs-string">&#x27;answers.score&#x27;</span>: [<span class="hljs-number">6</span>, <span class="hljs-number">3</span>],
 <span class="hljs-string">&#x27;answers.text&#x27;</span>: [<span class="hljs-string">&quot;The velocity needed to remain in orbit is equal to the square root of Newton&#x27;s constant times the mass of earth divided by the distance from the center of the earth. I don&#x27;t know the altitude of that specific mission, but they&#x27;re usually around 300 km. That means he&#x27;s going 7-8 km/s.\\n\\nIn space there are no other forces acting on either the shuttle or the guy, so they stay in the same position relative to each other. If he were to become unable to return to the ship, he would presumably run out of oxygen, or slowly fall into the atmosphere and burn up.&quot;</span>,
  <span class="hljs-string">&quot;Hope you don&#x27;t mind me asking another question, but why aren&#x27;t there any stars visible in this photo?&quot;</span>],
 <span class="hljs-string">&#x27;answers_urls.url&#x27;</span>: [],
 <span class="hljs-string">&#x27;document&#x27;</span>: <span class="hljs-string">&#x27;&#x27;</span>,
 <span class="hljs-string">&#x27;q_id&#x27;</span>: <span class="hljs-string">&#x27;nyxfp&#x27;</span>,
 <span class="hljs-string">&#x27;selftext&#x27;</span>: <span class="hljs-string">&#x27;_URL_0_\\n\\nThis was on the front page earlier and I have a few questions about it. Is it possible to calculate how fast the astronaut would be orbiting the earth? Also how does he stay close to the shuttle so that he can return safely, i.e is he orbiting at the same speed and can therefore stay next to it? And finally if his propulsion system failed, would he eventually re-enter the atmosphere and presumably die?&#x27;</span>,
 <span class="hljs-string">&#x27;selftext_urls.url&#x27;</span>: [<span class="hljs-string">&#x27;http://apod.nasa.gov/apod/image/1201/freeflyer_nasa_3000.jpg&#x27;</span>],
 <span class="hljs-string">&#x27;subreddit&#x27;</span>: <span class="hljs-string">&#x27;askscience&#x27;</span>,
 <span class="hljs-string">&#x27;title&#x27;</span>: <span class="hljs-string">&#x27;Few questions about this space walk photograph.&#x27;</span>,
 <span class="hljs-string">&#x27;title_urls.url&#x27;</span>: []}`}}),Re=new z({props:{code:"ZGVmJTIwcHJlcHJvY2Vzc19mdW5jdGlvbihleGFtcGxlcyklM0ElMEElMjAlMjAlMjAlMjByZXR1cm4lMjB0b2tlbml6ZXIoJTVCJTIyJTIwJTIyLmpvaW4oeCklMjBmb3IlMjB4JTIwaW4lMjBleGFtcGxlcyU1QiUyMmFuc3dlcnMudGV4dCUyMiU1RCU1RCUyQyUyMHRydW5jYXRpb24lM0RUcnVlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_function</span>(<span class="hljs-params">examples</span>):
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> tokenizer([<span class="hljs-string">&quot; &quot;</span>.join(x) <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> examples[<span class="hljs-string">&quot;answers.text&quot;</span>]], truncation=<span class="hljs-literal">True</span>)`}}),Ee=new z({props:{code:"dG9rZW5pemVkX2VsaTUlMjAlM0QlMjBlbGk1Lm1hcCglMEElMjAlMjAlMjAlMjBwcmVwcm9jZXNzX2Z1bmN0aW9uJTJDJTBBJTIwJTIwJTIwJTIwYmF0Y2hlZCUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBudW1fcHJvYyUzRDQlMkMlMEElMjAlMjAlMjAlMjByZW1vdmVfY29sdW1ucyUzRGVsaTUlNUIlMjJ0cmFpbiUyMiU1RC5jb2x1bW5fbmFtZXMlMkMlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tokenized_eli5 = eli5.<span class="hljs-built_in">map</span>(
<span class="hljs-meta">... </span>    preprocess_function,
<span class="hljs-meta">... </span>    batched=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    num_proc=<span class="hljs-number">4</span>,
<span class="hljs-meta">... </span>    remove_columns=eli5[<span class="hljs-string">&quot;train&quot;</span>].column_names,
<span class="hljs-meta">... </span>)`}}),We=new z({props:{code:"YmxvY2tfc2l6ZSUyMCUzRCUyMDEyOCUwQSUwQSUwQWRlZiUyMGdyb3VwX3RleHRzKGV4YW1wbGVzKSUzQSUwQSUyMCUyMCUyMCUyMGNvbmNhdGVuYXRlZF9leGFtcGxlcyUyMCUzRCUyMCU3QmslM0ElMjBzdW0oZXhhbXBsZXMlNUJrJTVEJTJDJTIwJTVCJTVEKSUyMGZvciUyMGslMjBpbiUyMGV4YW1wbGVzLmtleXMoKSU3RCUwQSUyMCUyMCUyMCUyMHRvdGFsX2xlbmd0aCUyMCUzRCUyMGxlbihjb25jYXRlbmF0ZWRfZXhhbXBsZXMlNUJsaXN0KGV4YW1wbGVzLmtleXMoKSklNUIwJTVEJTVEKSUwQSUyMCUyMCUyMCUyMHRvdGFsX2xlbmd0aCUyMCUzRCUyMCh0b3RhbF9sZW5ndGglMjAlMkYlMkYlMjBibG9ja19zaXplKSUyMColMjBibG9ja19zaXplJTBBJTIwJTIwJTIwJTIwcmVzdWx0JTIwJTNEJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwayUzQSUyMCU1QnQlNUJpJTIwJTNBJTIwaSUyMCUyQiUyMGJsb2NrX3NpemUlNUQlMjBmb3IlMjBpJTIwaW4lMjByYW5nZSgwJTJDJTIwdG90YWxfbGVuZ3RoJTJDJTIwYmxvY2tfc2l6ZSklNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBmb3IlMjBrJTJDJTIwdCUyMGluJTIwY29uY2F0ZW5hdGVkX2V4YW1wbGVzLml0ZW1zKCklMEElMjAlMjAlMjAlMjAlN0QlMEElMjAlMjAlMjAlMjByZXN1bHQlNUIlMjJsYWJlbHMlMjIlNUQlMjAlM0QlMjByZXN1bHQlNUIlMjJpbnB1dF9pZHMlMjIlNUQuY29weSgpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwcmVzdWx0",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>block_size = <span class="hljs-number">128</span>


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">group_texts</span>(<span class="hljs-params">examples</span>):
<span class="hljs-meta">... </span>    concatenated_examples = {k: <span class="hljs-built_in">sum</span>(examples[k], []) <span class="hljs-keyword">for</span> k <span class="hljs-keyword">in</span> examples.keys()}
<span class="hljs-meta">... </span>    total_length = <span class="hljs-built_in">len</span>(concatenated_examples[<span class="hljs-built_in">list</span>(examples.keys())[<span class="hljs-number">0</span>]])
<span class="hljs-meta">... </span>    total_length = (total_length // block_size) * block_size
<span class="hljs-meta">... </span>    result = {
<span class="hljs-meta">... </span>        k: [t[i : i + block_size] <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>, total_length, block_size)]
<span class="hljs-meta">... </span>        <span class="hljs-keyword">for</span> k, t <span class="hljs-keyword">in</span> concatenated_examples.items()
<span class="hljs-meta">... </span>    }
<span class="hljs-meta">... </span>    result[<span class="hljs-string">&quot;labels&quot;</span>] = result[<span class="hljs-string">&quot;input_ids&quot;</span>].copy()
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> result`}}),Fe=new z({props:{code:"bG1fZGF0YXNldCUyMCUzRCUyMHRva2VuaXplZF9lbGk1Lm1hcChncm91cF90ZXh0cyUyQyUyMGJhdGNoZWQlM0RUcnVlJTJDJTIwbnVtX3Byb2MlM0Q0KQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>lm_dataset = tokenized_eli5.<span class="hljs-built_in">map</span>(group_texts, batched=<span class="hljs-literal">True</span>, num_proc=<span class="hljs-number">4</span>)'}}),le=new ms({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[ea],pytorch:[Ks]},$$scope:{ctx:v}}}),He=new Se({}),Ae=new Se({}),re=new ms({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[oa],pytorch:[aa]},$$scope:{ctx:v}}}),Be=new Se({}),qe=new Se({}),ce=new ms({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[ua],pytorch:[ia]},$$scope:{ctx:v}}}),me=new st({props:{$$slots:{default:[da]},$$scope:{ctx:v}}}),{c(){s=u("meta"),h=i(),a=u("p"),p=i(),g=u("h1"),f=u("a"),C=u("span"),$(J.$$.fragment),R=i(),x=u("span"),x.textContent=m,k=i(),G=u("p"),G.textContent=W,V=i(),$(r.$$.fragment),_=i(),E=u("p"),E.textContent=ee,A=i(),$(F.$$.fragment),B=i(),X=u("p"),X.textContent=te,Q=i(),H=u("p"),H.innerHTML=q,n=i(),$(M.$$.fragment),L=i(),N=u("h2"),se=u("a"),lt=u("span"),$(de.$$.fragment),ns=i(),Pe=u("span"),Pe.textContent=us,ht=i(),he=u("p"),he.textContent=ds,ft=i(),$(fe.$$.fragment),gt=i(),ge=u("p"),ge.textContent=hs,Mt=i(),$(Me.$$.fragment),yt=i(),ye=u("p"),ye.textContent=fs,$t=i(),$($e.$$.fragment),jt=i(),je=u("p"),je.innerHTML=gs,bt=i(),S=u("h2"),ae=u("a"),nt=u("span"),$(be.$$.fragment),os=i(),De=u("span"),De.textContent=Ms,wt=i(),$(we.$$.fragment),Tt=i(),Te=u("p"),Te.innerHTML=ys,Ut=i(),$(Ue.$$.fragment),Jt=i(),$(Je.$$.fragment),_t=i(),_e=u("p"),_e.textContent=$s,xt=i(),$(xe.$$.fragment),kt=i(),ke=u("p"),ke.innerHTML=js,vt=i(),$(ve.$$.fragment),Ct=i(),Ce=u("p"),Ce.innerHTML=bs,Gt=i(),Ge=u("p"),Ge.textContent=ws,Rt=i(),$(Re.$$.fragment),Zt=i(),Ze=u("p"),Ze.innerHTML=Ts,Et=i(),$(Ee.$$.fragment),It=i(),Ie=u("p"),Ie.textContent=Us,zt=i(),ze=u("ul"),ze.innerHTML=Js,Wt=i(),$(We.$$.fragment),Vt=i(),Ve=u("p"),Ve.innerHTML=_s,Ft=i(),$(Fe.$$.fragment),Xt=i(),Xe=u("p"),Xe.innerHTML=xs,Ht=i(),$(le.$$.fragment),Yt=i(),P=u("h2"),ne=u("a"),ot=u("span"),$(He.$$.fragment),rs=i(),Ke=u("span"),Ke.textContent=ks,At=i(),Ye=u("p"),Ye.innerHTML=vs,Bt=i(),D=u("h3"),oe=u("a"),rt=u("span"),$(Ae.$$.fragment),ps=i(),Oe=u("span"),Oe.textContent=Cs,Qt=i(),$(re.$$.fragment),qt=i(),K=u("h2"),pe=u("a"),pt=u("span"),$(Be.$$.fragment),is=i(),et=u("span"),et.textContent=Gs,Lt=i(),Qe=u("p"),Qe.innerHTML=Rs,Nt=i(),O=u("h3"),ie=u("a"),it=u("span"),$(qe.$$.fragment),cs=i(),tt=u("span"),tt.textContent=Zs,St=i(),$(ce.$$.fragment),Pt=i(),$(me.$$.fragment),Dt=i(),ct=u("p"),this.h()},l(e){const o=Ss("svelte-1phssyn",document.head);s=d(o,"META",{name:!0,content:!0}),o.forEach(t),h=c(e),a=d(e,"P",{}),Y(a).forEach(t),p=c(e),g=d(e,"H1",{class:!0});var Le=Y(g);f=d(Le,"A",{id:!0,class:!0,href:!0});var mt=Y(f);C=d(mt,"SPAN",{});var ut=Y(C);j(J.$$.fragment,ut),ut.forEach(t),mt.forEach(t),R=c(Le),x=d(Le,"SPAN",{"data-svelte-h":!0}),y(x)!=="svelte-1nuqda4"&&(x.textContent=m),Le.forEach(t),k=c(e),G=d(e,"P",{"data-svelte-h":!0}),y(G)!=="svelte-1sv8lp6"&&(G.textContent=W),V=c(e),j(r.$$.fragment,e),_=c(e),E=d(e,"P",{"data-svelte-h":!0}),y(E)!=="svelte-o9osiq"&&(E.textContent=ee),A=c(e),j(F.$$.fragment,e),B=c(e),X=d(e,"P",{"data-svelte-h":!0}),y(X)!=="svelte-rdtqpf"&&(X.textContent=te),Q=c(e),H=d(e,"P",{"data-svelte-h":!0}),y(H)!=="svelte-mri092"&&(H.innerHTML=q),n=c(e),j(M.$$.fragment,e),L=c(e),N=d(e,"H2",{class:!0});var Ne=Y(N);se=d(Ne,"A",{id:!0,class:!0,href:!0});var dt=Y(se);lt=d(dt,"SPAN",{});var Es=Y(lt);j(de.$$.fragment,Es),Es.forEach(t),dt.forEach(t),ns=c(Ne),Pe=d(Ne,"SPAN",{"data-svelte-h":!0}),y(Pe)!=="svelte-jrkd3h"&&(Pe.textContent=us),Ne.forEach(t),ht=c(e),he=d(e,"P",{"data-svelte-h":!0}),y(he)!=="svelte-3nech7"&&(he.textContent=ds),ft=c(e),j(fe.$$.fragment,e),gt=c(e),ge=d(e,"P",{"data-svelte-h":!0}),y(ge)!=="svelte-1fx745g"&&(ge.textContent=hs),Mt=c(e),j(Me.$$.fragment,e),yt=c(e),ye=d(e,"P",{"data-svelte-h":!0}),y(ye)!=="svelte-62xfwd"&&(ye.textContent=fs),$t=c(e),j($e.$$.fragment,e),jt=c(e),je=d(e,"P",{"data-svelte-h":!0}),y(je)!=="svelte-1pbomcc"&&(je.innerHTML=gs),bt=c(e),S=d(e,"H2",{class:!0});var Ot=Y(S);ae=d(Ot,"A",{id:!0,class:!0,href:!0});var Is=Y(ae);nt=d(Is,"SPAN",{});var zs=Y(nt);j(be.$$.fragment,zs),zs.forEach(t),Is.forEach(t),os=c(Ot),De=d(Ot,"SPAN",{"data-svelte-h":!0}),y(De)!=="svelte-klvb09"&&(De.textContent=Ms),Ot.forEach(t),wt=c(e),j(we.$$.fragment,e),Tt=c(e),Te=d(e,"P",{"data-svelte-h":!0}),y(Te)!=="svelte-1300qak"&&(Te.innerHTML=ys),Ut=c(e),j(Ue.$$.fragment,e),Jt=c(e),j(Je.$$.fragment,e),_t=c(e),_e=d(e,"P",{"data-svelte-h":!0}),y(_e)!=="svelte-1ihod96"&&(_e.textContent=$s),xt=c(e),j(xe.$$.fragment,e),kt=c(e),ke=d(e,"P",{"data-svelte-h":!0}),y(ke)!=="svelte-fe48nn"&&(ke.innerHTML=js),vt=c(e),j(ve.$$.fragment,e),Ct=c(e),Ce=d(e,"P",{"data-svelte-h":!0}),y(Ce)!=="svelte-1qnu3op"&&(Ce.innerHTML=bs),Gt=c(e),Ge=d(e,"P",{"data-svelte-h":!0}),y(Ge)!=="svelte-lbchb7"&&(Ge.textContent=ws),Rt=c(e),j(Re.$$.fragment,e),Zt=c(e),Ze=d(e,"P",{"data-svelte-h":!0}),y(Ze)!=="svelte-1fou81l"&&(Ze.innerHTML=Ts),Et=c(e),j(Ee.$$.fragment,e),It=c(e),Ie=d(e,"P",{"data-svelte-h":!0}),y(Ie)!=="svelte-10yu7cu"&&(Ie.textContent=Us),zt=c(e),ze=d(e,"UL",{"data-svelte-h":!0}),y(ze)!=="svelte-jdg0mp"&&(ze.innerHTML=Js),Wt=c(e),j(We.$$.fragment,e),Vt=c(e),Ve=d(e,"P",{"data-svelte-h":!0}),y(Ve)!=="svelte-bteuj6"&&(Ve.innerHTML=_s),Ft=c(e),j(Fe.$$.fragment,e),Xt=c(e),Xe=d(e,"P",{"data-svelte-h":!0}),y(Xe)!=="svelte-1llnvt1"&&(Xe.innerHTML=xs),Ht=c(e),j(le.$$.fragment,e),Yt=c(e),P=d(e,"H2",{class:!0});var es=Y(P);ne=d(es,"A",{id:!0,class:!0,href:!0});var Ws=Y(ne);ot=d(Ws,"SPAN",{});var Vs=Y(ot);j(He.$$.fragment,Vs),Vs.forEach(t),Ws.forEach(t),rs=c(es),Ke=d(es,"SPAN",{"data-svelte-h":!0}),y(Ke)!=="svelte-x09b83"&&(Ke.textContent=ks),es.forEach(t),At=c(e),Ye=d(e,"P",{"data-svelte-h":!0}),y(Ye)!=="svelte-o0gs1y"&&(Ye.innerHTML=vs),Bt=c(e),D=d(e,"H3",{class:!0});var ts=Y(D);oe=d(ts,"A",{id:!0,class:!0,href:!0});var Fs=Y(oe);rt=d(Fs,"SPAN",{});var Xs=Y(rt);j(Ae.$$.fragment,Xs),Xs.forEach(t),Fs.forEach(t),ps=c(ts),Oe=d(ts,"SPAN",{"data-svelte-h":!0}),y(Oe)!=="svelte-1b8djky"&&(Oe.textContent=Cs),ts.forEach(t),Qt=c(e),j(re.$$.fragment,e),qt=c(e),K=d(e,"H2",{class:!0});var ss=Y(K);pe=d(ss,"A",{id:!0,class:!0,href:!0});var Hs=Y(pe);pt=d(Hs,"SPAN",{});var Ys=Y(pt);j(Be.$$.fragment,Ys),Ys.forEach(t),Hs.forEach(t),is=c(ss),et=d(ss,"SPAN",{"data-svelte-h":!0}),y(et)!=="svelte-mce37a"&&(et.textContent=Gs),ss.forEach(t),Lt=c(e),Qe=d(e,"P",{"data-svelte-h":!0}),y(Qe)!=="svelte-kmhyul"&&(Qe.innerHTML=Rs),Nt=c(e),O=d(e,"H3",{class:!0});var as=Y(O);ie=d(as,"A",{id:!0,class:!0,href:!0});var As=Y(ie);it=d(As,"SPAN",{});var Bs=Y(it);j(qe.$$.fragment,Bs),Bs.forEach(t),As.forEach(t),cs=c(as),tt=d(as,"SPAN",{"data-svelte-h":!0}),y(tt)!=="svelte-1b8djky"&&(tt.textContent=Zs),as.forEach(t),St=c(e),j(ce.$$.fragment,e),Pt=c(e),j(me.$$.fragment,e),Dt=c(e),ct=d(e,"P",{}),Y(ct).forEach(t),this.h()},h(){Z(s,"name","hf:doc:metadata"),Z(s,"content",JSON.stringify(fa)),Z(f,"id","modelado-de-lenguaje"),Z(f,"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"),Z(f,"href","#modelado-de-lenguaje"),Z(g,"class","relative group"),Z(se,"id","carga-el-dataset-eli5"),Z(se,"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"),Z(se,"href","#carga-el-dataset-eli5"),Z(N,"class","relative group"),Z(ae,"id","preprocesamiento"),Z(ae,"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"),Z(ae,"href","#preprocesamiento"),Z(S,"class","relative group"),Z(ne,"id","modelado-de-lenguaje-causal"),Z(ne,"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"),Z(ne,"href","#modelado-de-lenguaje-causal"),Z(P,"class","relative group"),Z(oe,"id","entrenamiento"),Z(oe,"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"),Z(oe,"href","#entrenamiento"),Z(D,"class","relative group"),Z(pe,"id","modelado-de-lenguaje-por-enmascaramiento"),Z(pe,"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"),Z(pe,"href","#modelado-de-lenguaje-por-enmascaramiento"),Z(K,"class","relative group"),Z(ie,"id","entrenamiento"),Z(ie,"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"),Z(ie,"href","#entrenamiento"),Z(O,"class","relative group")},m(e,o){I(document.head,s),l(e,h,o),l(e,a,o),l(e,p,o),l(e,g,o),I(g,f),I(f,C),b(J,C,null),I(g,R),I(g,x),l(e,k,o),l(e,G,o),l(e,V,o),b(r,e,o),l(e,_,o),l(e,E,o),l(e,A,o),b(F,e,o),l(e,B,o),l(e,X,o),l(e,Q,o),l(e,H,o),l(e,n,o),b(M,e,o),l(e,L,o),l(e,N,o),I(N,se),I(se,lt),b(de,lt,null),I(N,ns),I(N,Pe),l(e,ht,o),l(e,he,o),l(e,ft,o),b(fe,e,o),l(e,gt,o),l(e,ge,o),l(e,Mt,o),b(Me,e,o),l(e,yt,o),l(e,ye,o),l(e,$t,o),b($e,e,o),l(e,jt,o),l(e,je,o),l(e,bt,o),l(e,S,o),I(S,ae),I(ae,nt),b(be,nt,null),I(S,os),I(S,De),l(e,wt,o),b(we,e,o),l(e,Tt,o),l(e,Te,o),l(e,Ut,o),b(Ue,e,o),l(e,Jt,o),b(Je,e,o),l(e,_t,o),l(e,_e,o),l(e,xt,o),b(xe,e,o),l(e,kt,o),l(e,ke,o),l(e,vt,o),b(ve,e,o),l(e,Ct,o),l(e,Ce,o),l(e,Gt,o),l(e,Ge,o),l(e,Rt,o),b(Re,e,o),l(e,Zt,o),l(e,Ze,o),l(e,Et,o),b(Ee,e,o),l(e,It,o),l(e,Ie,o),l(e,zt,o),l(e,ze,o),l(e,Wt,o),b(We,e,o),l(e,Vt,o),l(e,Ve,o),l(e,Ft,o),b(Fe,e,o),l(e,Xt,o),l(e,Xe,o),l(e,Ht,o),b(le,e,o),l(e,Yt,o),l(e,P,o),I(P,ne),I(ne,ot),b(He,ot,null),I(P,rs),I(P,Ke),l(e,At,o),l(e,Ye,o),l(e,Bt,o),l(e,D,o),I(D,oe),I(oe,rt),b(Ae,rt,null),I(D,ps),I(D,Oe),l(e,Qt,o),b(re,e,o),l(e,qt,o),l(e,K,o),I(K,pe),I(pe,pt),b(Be,pt,null),I(K,is),I(K,et),l(e,Lt,o),l(e,Qe,o),l(e,Nt,o),l(e,O,o),I(O,ie),I(ie,it),b(qe,it,null),I(O,cs),I(O,tt),l(e,St,o),b(ce,e,o),l(e,Pt,o),b(me,e,o),l(e,Dt,o),l(e,ct,o),Kt=!0},p(e,[o]){const Le={};o&2&&(Le.$$scope={dirty:o,ctx:e}),M.$set(Le);const mt={};o&2&&(mt.$$scope={dirty:o,ctx:e}),le.$set(mt);const ut={};o&2&&(ut.$$scope={dirty:o,ctx:e}),re.$set(ut);const Ne={};o&2&&(Ne.$$scope={dirty:o,ctx:e}),ce.$set(Ne);const dt={};o&2&&(dt.$$scope={dirty:o,ctx:e}),me.$set(dt)},i(e){Kt||(w(J.$$.fragment,e),w(r.$$.fragment,e),w(F.$$.fragment,e),w(M.$$.fragment,e),w(de.$$.fragment,e),w(fe.$$.fragment,e),w(Me.$$.fragment,e),w($e.$$.fragment,e),w(be.$$.fragment,e),w(we.$$.fragment,e),w(Ue.$$.fragment,e),w(Je.$$.fragment,e),w(xe.$$.fragment,e),w(ve.$$.fragment,e),w(Re.$$.fragment,e),w(Ee.$$.fragment,e),w(We.$$.fragment,e),w(Fe.$$.fragment,e),w(le.$$.fragment,e),w(He.$$.fragment,e),w(Ae.$$.fragment,e),w(re.$$.fragment,e),w(Be.$$.fragment,e),w(qe.$$.fragment,e),w(ce.$$.fragment,e),w(me.$$.fragment,e),Kt=!0)},o(e){T(J.$$.fragment,e),T(r.$$.fragment,e),T(F.$$.fragment,e),T(M.$$.fragment,e),T(de.$$.fragment,e),T(fe.$$.fragment,e),T(Me.$$.fragment,e),T($e.$$.fragment,e),T(be.$$.fragment,e),T(we.$$.fragment,e),T(Ue.$$.fragment,e),T(Je.$$.fragment,e),T(xe.$$.fragment,e),T(ve.$$.fragment,e),T(Re.$$.fragment,e),T(Ee.$$.fragment,e),T(We.$$.fragment,e),T(Fe.$$.fragment,e),T(le.$$.fragment,e),T(He.$$.fragment,e),T(Ae.$$.fragment,e),T(re.$$.fragment,e),T(Be.$$.fragment,e),T(qe.$$.fragment,e),T(ce.$$.fragment,e),T(me.$$.fragment,e),Kt=!1},d(e){e&&(t(h),t(a),t(p),t(g),t(k),t(G),t(V),t(_),t(E),t(A),t(B),t(X),t(Q),t(H),t(n),t(L),t(N),t(ht),t(he),t(ft),t(gt),t(ge),t(Mt),t(yt),t(ye),t($t),t(jt),t(je),t(bt),t(S),t(wt),t(Tt),t(Te),t(Ut),t(Jt),t(_t),t(_e),t(xt),t(kt),t(ke),t(vt),t(Ct),t(Ce),t(Gt),t(Ge),t(Rt),t(Zt),t(Ze),t(Et),t(It),t(Ie),t(zt),t(ze),t(Wt),t(Vt),t(Ve),t(Ft),t(Xt),t(Xe),t(Ht),t(Yt),t(P),t(At),t(Ye),t(Bt),t(D),t(Qt),t(qt),t(K),t(Lt),t(Qe),t(Nt),t(O),t(St),t(Pt),t(Dt),t(ct)),t(s),U(J),U(r,e),U(F,e),U(M,e),U(de),U(fe,e),U(Me,e),U($e,e),U(be),U(we,e),U(Ue,e),U(Je,e),U(xe,e),U(ve,e),U(Re,e),U(Ee,e),U(We,e),U(Fe,e),U(le,e),U(He),U(Ae),U(re,e),U(Be),U(qe),U(ce,e),U(me,e)}}}const fa={local:"modelado-de-lenguaje",sections:[{local:"carga-el-dataset-eli5",title:"Carga el dataset ELI5"},{local:"preprocesamiento",title:"Preprocesamiento"},{local:"modelado-de-lenguaje-causal",sections:[{local:"entrenamiento",title:"Entrenamiento"}],title:"Modelado de lenguaje causal"},{local:"modelado-de-lenguaje-por-enmascaramiento",sections:[{local:"entrenamiento",title:"Entrenamiento"}],title:"Modelado de lenguaje por enmascaramiento"}],title:"Modelado de lenguaje"};function ga(v){return qs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ua extends Ls{constructor(s){super(),Ns(this,s,ga,ha,Qs,{})}}export{Ua as component};
