import{S as Ja,i as Qa,s as Va,e as r,k as _,w as u,t as n,M as Wa,c as a,d as t,m as f,a as l,x as d,h as s,b as c,G as o,g as i,y as m,q as v,o as T,B as E,v as Za}from"../chunks/vendor-hf-doc-builder.js";import{T as el}from"../chunks/Tip-hf-doc-builder.js";import{I as U}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as ue}from"../chunks/CodeBlock-hf-doc-builder.js";function tl(yt){let h,K,A,O,R,N,k,j,S,M,P;return{c(){h=r("p"),K=n("Desde 2.3.0, el script para convertir es parte de la CLI de transformers ("),A=r("strong"),O=n("transformers-cli"),R=n(") disponible en cualquier instalaci\xF3n de transformers >= 2.3.0."),N=_(),k=r("p"),j=n("La siguiente documentaci\xF3n refleja el formato para el comando "),S=r("strong"),M=n("transformers-cli convert"),P=n(".")},l(y){h=a(y,"P",{});var b=l(h);K=s(b,"Desde 2.3.0, el script para convertir es parte de la CLI de transformers ("),A=a(b,"STRONG",{});var Ge=l(A);O=s(Ge,"transformers-cli"),Ge.forEach(t),R=s(b,") disponible en cualquier instalaci\xF3n de transformers >= 2.3.0."),b.forEach(t),N=f(y),k=a(y,"P",{});var z=l(k);j=s(z,"La siguiente documentaci\xF3n refleja el formato para el comando "),S=a(z,"STRONG",{});var Y=l(S);M=s(Y,"transformers-cli convert"),Y.forEach(t),P=s(z,"."),z.forEach(t)},m(y,b){i(y,h,b),o(h,K),o(h,A),o(A,O),o(h,R),i(y,N,b),i(y,k,b),o(k,j),o(k,S),o(S,M),o(k,P)},d(y){y&&t(h),y&&t(N),y&&t(k)}}}function ol(yt){let h,K,A,O,R,N,k,j,S,M,P,y,b,Ge,z,Y,Ao,yo,Ye,bo,go,bt,J,gt,H,Q,Je,de,Oo,Qe,No,Ot,I,ko,me,wo,Io,ve,Co,Lo,Nt,$,Ro,Ve,jo,So,We,Ho,Fo,Ze,xo,Do,qe,Bo,Go,Te,qo,Xo,kt,g,Uo,et,Ko,Mo,tt,zo,Yo,ot,Jo,Qo,rt,Vo,Wo,wt,V,Zo,at,er,tr,It,W,or,lt,rr,ar,Ct,Ee,Lt,Z,lr,Pe,nr,sr,Rt,F,ee,nt,$e,pr,st,ir,jt,te,cr,Ae,_r,fr,St,C,hr,pt,ur,dr,it,mr,vr,Ht,oe,Tr,ct,Er,Pr,Ft,ye,xt,re,$r,be,Ar,yr,Dt,x,ae,_t,ge,br,ft,gr,Bt,le,Or,Oe,Nr,kr,Gt,Ne,qt,D,ne,ht,ke,wr,ut,Ir,Xt,se,Cr,we,Lr,Rr,Ut,Ie,Kt,B,pe,dt,Ce,jr,mt,Sr,Mt,ie,Hr,Le,Fr,xr,zt,Re,Yt,G,ce,vt,je,Dr,Tt,Br,Jt,Xe,Gr,Qt,Se,Vt,q,_e,Et,He,qr,Pt,Xr,Wt,Ue,Ur,Zt,Fe,eo,X,fe,$t,xe,Kr,At,Mr,to,Ke,zr,oo,De,ro;return N=new U({}),J=new el({props:{$$slots:{default:[tl]},$$scope:{ctx:yt}}}),de=new U({}),Ee=new ue({props:{code:`export BERT_BASE_DIR=/path/to/bert/uncased_L-12_H-768_A-12

transformers-cli convert --model_type bert \\
  --tf_checkpoint $BERT_BASE_DIR/bert_model.ckpt \\
  --config $BERT_BASE_DIR/bert_config.json \\
  --pytorch_dump_output $BERT_BASE_DIR/pytorch_model.bin`,highlighted:`<span class="hljs-built_in">export</span> BERT_BASE_DIR=/path/to/bert/uncased_L-12_H-768_A-12

transformers-cli convert --model_type bert \\
  --tf_checkpoint <span class="hljs-variable">$BERT_BASE_DIR</span>/bert_model.ckpt \\
  --config <span class="hljs-variable">$BERT_BASE_DIR</span>/bert_config.json \\
  --pytorch_dump_output <span class="hljs-variable">$BERT_BASE_DIR</span>/pytorch_model.bin`}}),$e=new U({}),ye=new ue({props:{code:`export ALBERT_BASE_DIR=/path/to/albert/albert_base

transformers-cli convert --model_type albert \\
  --tf_checkpoint $ALBERT_BASE_DIR/model.ckpt-best \\
  --config $ALBERT_BASE_DIR/albert_config.json \\
  --pytorch_dump_output $ALBERT_BASE_DIR/pytorch_model.bin`,highlighted:`<span class="hljs-built_in">export</span> ALBERT_BASE_DIR=/path/to/albert/albert_base

transformers-cli convert --model_type albert \\
  --tf_checkpoint <span class="hljs-variable">$ALBERT_BASE_DIR</span>/model.ckpt-best \\
  --config <span class="hljs-variable">$ALBERT_BASE_DIR</span>/albert_config.json \\
  --pytorch_dump_output <span class="hljs-variable">$ALBERT_BASE_DIR</span>/pytorch_model.bin`}}),ge=new U({}),Ne=new ue({props:{code:`export OPENAI_GPT_CHECKPOINT_FOLDER_PATH=/path/to/openai/pretrained/numpy/weights

transformers-cli convert --model_type gpt \\
  --tf_checkpoint $OPENAI_GPT_CHECKPOINT_FOLDER_PATH \\
  --pytorch_dump_output $PYTORCH_DUMP_OUTPUT \\
  [--config OPENAI_GPT_CONFIG] \\
  [--finetuning_task_name OPENAI_GPT_FINETUNED_TASK] \\`,highlighted:`<span class="hljs-built_in">export</span> OPENAI_GPT_CHECKPOINT_FOLDER_PATH=/path/to/openai/pretrained/numpy/weights

transformers-cli convert --model_type gpt \\
  --tf_checkpoint <span class="hljs-variable">$OPENAI_GPT_CHECKPOINT_FOLDER_PATH</span> \\
  --pytorch_dump_output <span class="hljs-variable">$PYTORCH_DUMP_OUTPUT</span> \\
  [--config OPENAI_GPT_CONFIG] \\
  [--finetuning_task_name OPENAI_GPT_FINETUNED_TASK] \\`}}),ke=new U({}),Ie=new ue({props:{code:`export OPENAI_GPT2_CHECKPOINT_PATH=/path/to/gpt2/pretrained/weights

transformers-cli convert --model_type gpt2 \\
  --tf_checkpoint $OPENAI_GPT2_CHECKPOINT_PATH \\
  --pytorch_dump_output $PYTORCH_DUMP_OUTPUT \\
  [--config OPENAI_GPT2_CONFIG] \\
  [--finetuning_task_name OPENAI_GPT2_FINETUNED_TASK]`,highlighted:`<span class="hljs-built_in">export</span> OPENAI_GPT2_CHECKPOINT_PATH=/path/to/gpt2/pretrained/weights

transformers-cli convert --model_type gpt2 \\
  --tf_checkpoint <span class="hljs-variable">$OPENAI_GPT2_CHECKPOINT_PATH</span> \\
  --pytorch_dump_output <span class="hljs-variable">$PYTORCH_DUMP_OUTPUT</span> \\
  [--config OPENAI_GPT2_CONFIG] \\
  [--finetuning_task_name OPENAI_GPT2_FINETUNED_TASK]`}}),Ce=new U({}),Re=new ue({props:{code:`export TRANSFO_XL_CHECKPOINT_FOLDER_PATH=/path/to/transfo/xl/checkpoint

transformers-cli convert --model_type transfo_xl \\
  --tf_checkpoint $TRANSFO_XL_CHECKPOINT_FOLDER_PATH \\
  --pytorch_dump_output $PYTORCH_DUMP_OUTPUT \\
  [--config TRANSFO_XL_CONFIG] \\
  [--finetuning_task_name TRANSFO_XL_FINETUNED_TASK]`,highlighted:`<span class="hljs-built_in">export</span> TRANSFO_XL_CHECKPOINT_FOLDER_PATH=/path/to/transfo/xl/checkpoint

transformers-cli convert --model_type transfo_xl \\
  --tf_checkpoint <span class="hljs-variable">$TRANSFO_XL_CHECKPOINT_FOLDER_PATH</span> \\
  --pytorch_dump_output <span class="hljs-variable">$PYTORCH_DUMP_OUTPUT</span> \\
  [--config TRANSFO_XL_CONFIG] \\
  [--finetuning_task_name TRANSFO_XL_FINETUNED_TASK]`}}),je=new U({}),Se=new ue({props:{code:`export TRANSFO_XL_CHECKPOINT_PATH=/path/to/xlnet/checkpoint
export TRANSFO_XL_CONFIG_PATH=/path/to/xlnet/config

transformers-cli convert --model_type xlnet \\
  --tf_checkpoint $TRANSFO_XL_CHECKPOINT_PATH \\
  --config $TRANSFO_XL_CONFIG_PATH \\
  --pytorch_dump_output $PYTORCH_DUMP_OUTPUT \\
  [--finetuning_task_name XLNET_FINETUNED_TASK] \\`,highlighted:`<span class="hljs-built_in">export</span> TRANSFO_XL_CHECKPOINT_PATH=/path/to/xlnet/checkpoint
<span class="hljs-built_in">export</span> TRANSFO_XL_CONFIG_PATH=/path/to/xlnet/config

transformers-cli convert --model_type xlnet \\
  --tf_checkpoint <span class="hljs-variable">$TRANSFO_XL_CHECKPOINT_PATH</span> \\
  --config <span class="hljs-variable">$TRANSFO_XL_CONFIG_PATH</span> \\
  --pytorch_dump_output <span class="hljs-variable">$PYTORCH_DUMP_OUTPUT</span> \\
  [--finetuning_task_name XLNET_FINETUNED_TASK] \\`}}),He=new U({}),Fe=new ue({props:{code:`export XLM_CHECKPOINT_PATH=/path/to/xlm/checkpoint

transformers-cli convert --model_type xlm \\
  --tf_checkpoint $XLM_CHECKPOINT_PATH \\
  --pytorch_dump_output $PYTORCH_DUMP_OUTPUT
 [--config XML_CONFIG] \\
 [--finetuning_task_name XML_FINETUNED_TASK]`,highlighted:`<span class="hljs-built_in">export</span> XLM_CHECKPOINT_PATH=/path/to/xlm/checkpoint

transformers-cli convert --model_type xlm \\
  --tf_checkpoint <span class="hljs-variable">$XLM_CHECKPOINT_PATH</span> \\
  --pytorch_dump_output <span class="hljs-variable">$PYTORCH_DUMP_OUTPUT</span>
 [--config XML_CONFIG] \\
 [--finetuning_task_name XML_FINETUNED_TASK]`}}),xe=new U({}),De=new ue({props:{code:`export T5=/path/to/t5/uncased_L-12_H-768_A-12

transformers-cli convert --model_type t5 \\
  --tf_checkpoint $T5/t5_model.ckpt \\
  --config $T5/t5_config.json \\
  --pytorch_dump_output $T5/pytorch_model.bin`,highlighted:`<span class="hljs-built_in">export</span> T5=/path/to/t5/uncased_L-12_H-768_A-12

transformers-cli convert --model_type t5 \\
  --tf_checkpoint <span class="hljs-variable">$T5</span>/t5_model.ckpt \\
  --config <span class="hljs-variable">$T5</span>/t5_config.json \\
  --pytorch_dump_output <span class="hljs-variable">$T5</span>/pytorch_model.bin`}}),{c(){h=r("meta"),K=_(),A=r("h1"),O=r("a"),R=r("span"),u(N.$$.fragment),k=_(),j=r("span"),S=n("Convertir checkpoints de Tensorflow"),M=_(),P=r("p"),y=n("Te proporcionamos una interfaz de l\xEDnea de comando ("),b=r("code"),Ge=n("CLI"),z=n(", por sus siglas en ingl\xE9s) para convertir puntos de control ("),Y=r("em"),Ao=n("checkpoints"),yo=n(") originales de Bert/GPT/GPT-2/Transformer-XL/XLNet/XLM en modelos que se puedan cargar utilizando los m\xE9todos "),Ye=r("code"),bo=n("from_pretrained"),go=n(" de la biblioteca."),bt=_(),u(J.$$.fragment),gt=_(),H=r("h2"),Q=r("a"),Je=r("span"),u(de.$$.fragment),Oo=_(),Qe=r("span"),No=n("BERT"),Ot=_(),I=r("p"),ko=n("Puedes convertir cualquier checkpoint de TensorFlow para BERT (en particular, "),me=r("a"),wo=n("los modelos pre-entrenados y publicados por Google"),Io=n(") en un archivo de PyTorch mediante el script "),ve=r("a"),Co=n("convert_bert_original_tf_checkpoint_to_pytorch.py"),Lo=n("."),Nt=_(),$=r("p"),Ro=n("Esta CLI toma como entrada un checkpoint de TensorFlow (tres archivos que comienzan con "),Ve=r("code"),jo=n("bert_model.ckpt"),So=n(") y el archivo de configuraci\xF3n asociado ("),We=r("code"),Ho=n("bert_config.json"),Fo=n("), y crea un modelo PyTorch para esta configuraci\xF3n, carga los pesos del checkpoint de TensorFlow en el modelo de PyTorch y guarda el modelo resultante en un archivo est\xE1ndar de PyTorch que se puede importar usando "),Ze=r("code"),xo=n("from_pretrained()"),Do=n(" (ve el ejemplo en "),qe=r("a"),Bo=n("Tour r\xE1pido"),Go=n(", "),Te=r("a"),qo=n("run_glue.py"),Xo=n(")."),kt=_(),g=r("p"),Uo=n("Solo necesitas ejecutar este script "),et=r("strong"),Ko=n("una vez"),Mo=n(" para convertir un modelo a PyTorch. Despu\xE9s, puedes ignorar el checkpoint de TensorFlow (los tres archivos que comienzan con "),tt=r("code"),zo=n("bert_model.ckpt"),Yo=n("), pero aseg\xFArate de conservar el archivo de configuraci\xF3n ("),ot=r("code"),Jo=n("bert_config.json"),Qo=n(") y el archivo de vocabulario ("),rt=r("code"),Vo=n("vocab.txt"),Wo=n(") ya que estos tambi\xE9n son necesarios para el modelo en PyTorch."),wt=_(),V=r("p"),Zo=n("Para ejecutar este script deber\xE1s tener instalado TensorFlow y PyTorch ("),at=r("code"),er=n("pip install tensorflow"),tr=n("). El resto del repositorio solo requiere PyTorch."),It=_(),W=r("p"),or=n("Aqu\xED hay un ejemplo del proceso para convertir un modelo "),lt=r("code"),rr=n("BERT-Base Uncased"),ar=n(" pre-entrenado:"),Ct=_(),u(Ee.$$.fragment),Lt=_(),Z=r("p"),lr=n("Puedes descargar los modelos pre-entrenados de Google para la conversi\xF3n "),Pe=r("a"),nr=n("aqu\xED"),sr=n("."),Rt=_(),F=r("h2"),ee=r("a"),nt=r("span"),u($e.$$.fragment),pr=_(),st=r("span"),ir=n("ALBERT"),jt=_(),te=r("p"),cr=n("Convierte los checkpoints del modelo ALBERT de TensorFlow a PyTorch usando el script "),Ae=r("a"),_r=n("convert_albert_original_tf_checkpoint_to_pytorch.py"),fr=n("."),St=_(),C=r("p"),hr=n("La CLI toma como entrada un checkpoint de TensorFlow (tres archivos que comienzan con "),pt=r("code"),ur=n("model.ckpt-best"),dr=n(") y el archivo de configuraci\xF3n adjunto ("),it=r("code"),mr=n("albert_config.json"),vr=n("), luego crea y guarda un modelo de PyTorch. Para ejecutar esta conversi\xF3n deber\xE1s tener instalados TensorFlow y PyTorch."),Ht=_(),oe=r("p"),Tr=n("Aqu\xED hay un ejemplo del proceso para convertir un modelo "),ct=r("code"),Er=n("ALBERT Base"),Pr=n(" pre-entrenado:"),Ft=_(),u(ye.$$.fragment),xt=_(),re=r("p"),$r=n("Puedes descargar los modelos pre-entrenados de Google para la conversi\xF3n "),be=r("a"),Ar=n("aqu\xED"),yr=n("."),Dt=_(),x=r("h2"),ae=r("a"),_t=r("span"),u(ge.$$.fragment),br=_(),ft=r("span"),gr=n("OpenAI GPT"),Bt=_(),le=r("p"),Or=n("Este es un ejemplo del proceso para convertir un modelo OpenAI GPT pre-entrenado, asumiendo que tu checkpoint de NumPy se guarda con el mismo formato que el modelo pre-entrenado de OpenAI (m\xE1s informaci\xF3n "),Oe=r("a"),Nr=n("aqu\xED"),kr=n("):"),Gt=_(),u(Ne.$$.fragment),qt=_(),D=r("h2"),ne=r("a"),ht=r("span"),u(ke.$$.fragment),wr=_(),ut=r("span"),Ir=n("OpenAI GPT-2"),Xt=_(),se=r("p"),Cr=n("Aqu\xED hay un ejemplo del proceso para convertir un modelo OpenAI GPT-2 pre-entrenado (m\xE1s informaci\xF3n "),we=r("a"),Lr=n("aqu\xED"),Rr=n("):"),Ut=_(),u(Ie.$$.fragment),Kt=_(),B=r("h2"),pe=r("a"),dt=r("span"),u(Ce.$$.fragment),jr=_(),mt=r("span"),Sr=n("Transformer-XL"),Mt=_(),ie=r("p"),Hr=n("Aqu\xED hay un ejemplo del proceso para convertir un modelo Transformer-XL pre-entrenado (m\xE1s informaci\xF3n "),Le=r("a"),Fr=n("aqu\xED"),xr=n("):"),zt=_(),u(Re.$$.fragment),Yt=_(),G=r("h2"),ce=r("a"),vt=r("span"),u(je.$$.fragment),Dr=_(),Tt=r("span"),Br=n("XLNet"),Jt=_(),Xe=r("p"),Gr=n("Aqu\xED hay un ejemplo del proceso para convertir un modelo XLNet pre-entrenado:"),Qt=_(),u(Se.$$.fragment),Vt=_(),q=r("h2"),_e=r("a"),Et=r("span"),u(He.$$.fragment),qr=_(),Pt=r("span"),Xr=n("XLM"),Wt=_(),Ue=r("p"),Ur=n("Aqu\xED hay un ejemplo del proceso para convertir un modelo XLM pre-entrenado:"),Zt=_(),u(Fe.$$.fragment),eo=_(),X=r("h2"),fe=r("a"),$t=r("span"),u(xe.$$.fragment),Kr=_(),At=r("span"),Mr=n("T5"),to=_(),Ke=r("p"),zr=n("Aqu\xED hay un ejemplo del proceso para convertir un modelo T5 pre-entrenado:"),oo=_(),u(De.$$.fragment),this.h()},l(e){const p=Wa('[data-svelte="svelte-1phssyn"]',document.head);h=a(p,"META",{name:!0,content:!0}),p.forEach(t),K=f(e),A=a(e,"H1",{class:!0});var Be=l(A);O=a(Be,"A",{id:!0,class:!0,href:!0});var Yr=l(O);R=a(Yr,"SPAN",{});var Jr=l(R);d(N.$$.fragment,Jr),Jr.forEach(t),Yr.forEach(t),k=f(Be),j=a(Be,"SPAN",{});var Qr=l(j);S=s(Qr,"Convertir checkpoints de Tensorflow"),Qr.forEach(t),Be.forEach(t),M=f(e),P=a(e,"P",{});var he=l(P);y=s(he,"Te proporcionamos una interfaz de l\xEDnea de comando ("),b=a(he,"CODE",{});var Vr=l(b);Ge=s(Vr,"CLI"),Vr.forEach(t),z=s(he,", por sus siglas en ingl\xE9s) para convertir puntos de control ("),Y=a(he,"EM",{});var Wr=l(Y);Ao=s(Wr,"checkpoints"),Wr.forEach(t),yo=s(he,") originales de Bert/GPT/GPT-2/Transformer-XL/XLNet/XLM en modelos que se puedan cargar utilizando los m\xE9todos "),Ye=a(he,"CODE",{});var Zr=l(Ye);bo=s(Zr,"from_pretrained"),Zr.forEach(t),go=s(he," de la biblioteca."),he.forEach(t),bt=f(e),d(J.$$.fragment,e),gt=f(e),H=a(e,"H2",{class:!0});var ao=l(H);Q=a(ao,"A",{id:!0,class:!0,href:!0});var ea=l(Q);Je=a(ea,"SPAN",{});var ta=l(Je);d(de.$$.fragment,ta),ta.forEach(t),ea.forEach(t),Oo=f(ao),Qe=a(ao,"SPAN",{});var oa=l(Qe);No=s(oa,"BERT"),oa.forEach(t),ao.forEach(t),Ot=f(e),I=a(e,"P",{});var Me=l(I);ko=s(Me,"Puedes convertir cualquier checkpoint de TensorFlow para BERT (en particular, "),me=a(Me,"A",{href:!0,rel:!0});var ra=l(me);wo=s(ra,"los modelos pre-entrenados y publicados por Google"),ra.forEach(t),Io=s(Me,") en un archivo de PyTorch mediante el script "),ve=a(Me,"A",{href:!0,rel:!0});var aa=l(ve);Co=s(aa,"convert_bert_original_tf_checkpoint_to_pytorch.py"),aa.forEach(t),Lo=s(Me,"."),Me.forEach(t),Nt=f(e),$=a(e,"P",{});var w=l($);Ro=s(w,"Esta CLI toma como entrada un checkpoint de TensorFlow (tres archivos que comienzan con "),Ve=a(w,"CODE",{});var la=l(Ve);jo=s(la,"bert_model.ckpt"),la.forEach(t),So=s(w,") y el archivo de configuraci\xF3n asociado ("),We=a(w,"CODE",{});var na=l(We);Ho=s(na,"bert_config.json"),na.forEach(t),Fo=s(w,"), y crea un modelo PyTorch para esta configuraci\xF3n, carga los pesos del checkpoint de TensorFlow en el modelo de PyTorch y guarda el modelo resultante en un archivo est\xE1ndar de PyTorch que se puede importar usando "),Ze=a(w,"CODE",{});var sa=l(Ze);xo=s(sa,"from_pretrained()"),sa.forEach(t),Do=s(w," (ve el ejemplo en "),qe=a(w,"A",{href:!0});var pa=l(qe);Bo=s(pa,"Tour r\xE1pido"),pa.forEach(t),Go=s(w,", "),Te=a(w,"A",{href:!0,rel:!0});var ia=l(Te);qo=s(ia,"run_glue.py"),ia.forEach(t),Xo=s(w,")."),w.forEach(t),kt=f(e),g=a(e,"P",{});var L=l(g);Uo=s(L,"Solo necesitas ejecutar este script "),et=a(L,"STRONG",{});var ca=l(et);Ko=s(ca,"una vez"),ca.forEach(t),Mo=s(L," para convertir un modelo a PyTorch. Despu\xE9s, puedes ignorar el checkpoint de TensorFlow (los tres archivos que comienzan con "),tt=a(L,"CODE",{});var _a=l(tt);zo=s(_a,"bert_model.ckpt"),_a.forEach(t),Yo=s(L,"), pero aseg\xFArate de conservar el archivo de configuraci\xF3n ("),ot=a(L,"CODE",{});var fa=l(ot);Jo=s(fa,"bert_config.json"),fa.forEach(t),Qo=s(L,") y el archivo de vocabulario ("),rt=a(L,"CODE",{});var ha=l(rt);Vo=s(ha,"vocab.txt"),ha.forEach(t),Wo=s(L,") ya que estos tambi\xE9n son necesarios para el modelo en PyTorch."),L.forEach(t),wt=f(e),V=a(e,"P",{});var lo=l(V);Zo=s(lo,"Para ejecutar este script deber\xE1s tener instalado TensorFlow y PyTorch ("),at=a(lo,"CODE",{});var ua=l(at);er=s(ua,"pip install tensorflow"),ua.forEach(t),tr=s(lo,"). El resto del repositorio solo requiere PyTorch."),lo.forEach(t),It=f(e),W=a(e,"P",{});var no=l(W);or=s(no,"Aqu\xED hay un ejemplo del proceso para convertir un modelo "),lt=a(no,"CODE",{});var da=l(lt);rr=s(da,"BERT-Base Uncased"),da.forEach(t),ar=s(no," pre-entrenado:"),no.forEach(t),Ct=f(e),d(Ee.$$.fragment,e),Lt=f(e),Z=a(e,"P",{});var so=l(Z);lr=s(so,"Puedes descargar los modelos pre-entrenados de Google para la conversi\xF3n "),Pe=a(so,"A",{href:!0,rel:!0});var ma=l(Pe);nr=s(ma,"aqu\xED"),ma.forEach(t),sr=s(so,"."),so.forEach(t),Rt=f(e),F=a(e,"H2",{class:!0});var po=l(F);ee=a(po,"A",{id:!0,class:!0,href:!0});var va=l(ee);nt=a(va,"SPAN",{});var Ta=l(nt);d($e.$$.fragment,Ta),Ta.forEach(t),va.forEach(t),pr=f(po),st=a(po,"SPAN",{});var Ea=l(st);ir=s(Ea,"ALBERT"),Ea.forEach(t),po.forEach(t),jt=f(e),te=a(e,"P",{});var io=l(te);cr=s(io,"Convierte los checkpoints del modelo ALBERT de TensorFlow a PyTorch usando el script "),Ae=a(io,"A",{href:!0,rel:!0});var Pa=l(Ae);_r=s(Pa,"convert_albert_original_tf_checkpoint_to_pytorch.py"),Pa.forEach(t),fr=s(io,"."),io.forEach(t),St=f(e),C=a(e,"P",{});var ze=l(C);hr=s(ze,"La CLI toma como entrada un checkpoint de TensorFlow (tres archivos que comienzan con "),pt=a(ze,"CODE",{});var $a=l(pt);ur=s($a,"model.ckpt-best"),$a.forEach(t),dr=s(ze,") y el archivo de configuraci\xF3n adjunto ("),it=a(ze,"CODE",{});var Aa=l(it);mr=s(Aa,"albert_config.json"),Aa.forEach(t),vr=s(ze,"), luego crea y guarda un modelo de PyTorch. Para ejecutar esta conversi\xF3n deber\xE1s tener instalados TensorFlow y PyTorch."),ze.forEach(t),Ht=f(e),oe=a(e,"P",{});var co=l(oe);Tr=s(co,"Aqu\xED hay un ejemplo del proceso para convertir un modelo "),ct=a(co,"CODE",{});var ya=l(ct);Er=s(ya,"ALBERT Base"),ya.forEach(t),Pr=s(co," pre-entrenado:"),co.forEach(t),Ft=f(e),d(ye.$$.fragment,e),xt=f(e),re=a(e,"P",{});var _o=l(re);$r=s(_o,"Puedes descargar los modelos pre-entrenados de Google para la conversi\xF3n "),be=a(_o,"A",{href:!0,rel:!0});var ba=l(be);Ar=s(ba,"aqu\xED"),ba.forEach(t),yr=s(_o,"."),_o.forEach(t),Dt=f(e),x=a(e,"H2",{class:!0});var fo=l(x);ae=a(fo,"A",{id:!0,class:!0,href:!0});var ga=l(ae);_t=a(ga,"SPAN",{});var Oa=l(_t);d(ge.$$.fragment,Oa),Oa.forEach(t),ga.forEach(t),br=f(fo),ft=a(fo,"SPAN",{});var Na=l(ft);gr=s(Na,"OpenAI GPT"),Na.forEach(t),fo.forEach(t),Bt=f(e),le=a(e,"P",{});var ho=l(le);Or=s(ho,"Este es un ejemplo del proceso para convertir un modelo OpenAI GPT pre-entrenado, asumiendo que tu checkpoint de NumPy se guarda con el mismo formato que el modelo pre-entrenado de OpenAI (m\xE1s informaci\xF3n "),Oe=a(ho,"A",{href:!0,rel:!0});var ka=l(Oe);Nr=s(ka,"aqu\xED"),ka.forEach(t),kr=s(ho,"):"),ho.forEach(t),Gt=f(e),d(Ne.$$.fragment,e),qt=f(e),D=a(e,"H2",{class:!0});var uo=l(D);ne=a(uo,"A",{id:!0,class:!0,href:!0});var wa=l(ne);ht=a(wa,"SPAN",{});var Ia=l(ht);d(ke.$$.fragment,Ia),Ia.forEach(t),wa.forEach(t),wr=f(uo),ut=a(uo,"SPAN",{});var Ca=l(ut);Ir=s(Ca,"OpenAI GPT-2"),Ca.forEach(t),uo.forEach(t),Xt=f(e),se=a(e,"P",{});var mo=l(se);Cr=s(mo,"Aqu\xED hay un ejemplo del proceso para convertir un modelo OpenAI GPT-2 pre-entrenado (m\xE1s informaci\xF3n "),we=a(mo,"A",{href:!0,rel:!0});var La=l(we);Lr=s(La,"aqu\xED"),La.forEach(t),Rr=s(mo,"):"),mo.forEach(t),Ut=f(e),d(Ie.$$.fragment,e),Kt=f(e),B=a(e,"H2",{class:!0});var vo=l(B);pe=a(vo,"A",{id:!0,class:!0,href:!0});var Ra=l(pe);dt=a(Ra,"SPAN",{});var ja=l(dt);d(Ce.$$.fragment,ja),ja.forEach(t),Ra.forEach(t),jr=f(vo),mt=a(vo,"SPAN",{});var Sa=l(mt);Sr=s(Sa,"Transformer-XL"),Sa.forEach(t),vo.forEach(t),Mt=f(e),ie=a(e,"P",{});var To=l(ie);Hr=s(To,"Aqu\xED hay un ejemplo del proceso para convertir un modelo Transformer-XL pre-entrenado (m\xE1s informaci\xF3n "),Le=a(To,"A",{href:!0,rel:!0});var Ha=l(Le);Fr=s(Ha,"aqu\xED"),Ha.forEach(t),xr=s(To,"):"),To.forEach(t),zt=f(e),d(Re.$$.fragment,e),Yt=f(e),G=a(e,"H2",{class:!0});var Eo=l(G);ce=a(Eo,"A",{id:!0,class:!0,href:!0});var Fa=l(ce);vt=a(Fa,"SPAN",{});var xa=l(vt);d(je.$$.fragment,xa),xa.forEach(t),Fa.forEach(t),Dr=f(Eo),Tt=a(Eo,"SPAN",{});var Da=l(Tt);Br=s(Da,"XLNet"),Da.forEach(t),Eo.forEach(t),Jt=f(e),Xe=a(e,"P",{});var Ba=l(Xe);Gr=s(Ba,"Aqu\xED hay un ejemplo del proceso para convertir un modelo XLNet pre-entrenado:"),Ba.forEach(t),Qt=f(e),d(Se.$$.fragment,e),Vt=f(e),q=a(e,"H2",{class:!0});var Po=l(q);_e=a(Po,"A",{id:!0,class:!0,href:!0});var Ga=l(_e);Et=a(Ga,"SPAN",{});var qa=l(Et);d(He.$$.fragment,qa),qa.forEach(t),Ga.forEach(t),qr=f(Po),Pt=a(Po,"SPAN",{});var Xa=l(Pt);Xr=s(Xa,"XLM"),Xa.forEach(t),Po.forEach(t),Wt=f(e),Ue=a(e,"P",{});var Ua=l(Ue);Ur=s(Ua,"Aqu\xED hay un ejemplo del proceso para convertir un modelo XLM pre-entrenado:"),Ua.forEach(t),Zt=f(e),d(Fe.$$.fragment,e),eo=f(e),X=a(e,"H2",{class:!0});var $o=l(X);fe=a($o,"A",{id:!0,class:!0,href:!0});var Ka=l(fe);$t=a(Ka,"SPAN",{});var Ma=l($t);d(xe.$$.fragment,Ma),Ma.forEach(t),Ka.forEach(t),Kr=f($o),At=a($o,"SPAN",{});var za=l(At);Mr=s(za,"T5"),za.forEach(t),$o.forEach(t),to=f(e),Ke=a(e,"P",{});var Ya=l(Ke);zr=s(Ya,"Aqu\xED hay un ejemplo del proceso para convertir un modelo T5 pre-entrenado:"),Ya.forEach(t),oo=f(e),d(De.$$.fragment,e),this.h()},h(){c(h,"name","hf:doc:metadata"),c(h,"content",JSON.stringify(rl)),c(O,"id","convertir-checkpoints-de-tensorflow"),c(O,"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"),c(O,"href","#convertir-checkpoints-de-tensorflow"),c(A,"class","relative group"),c(Q,"id","bert"),c(Q,"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"),c(Q,"href","#bert"),c(H,"class","relative group"),c(me,"href","https://github.com/google-research/bert#pre-trained-models"),c(me,"rel","nofollow"),c(ve,"href","https://github.com/huggingface/transformers/tree/main/src/transformers/models/bert/convert_bert_original_tf_checkpoint_to_pytorch.py"),c(ve,"rel","nofollow"),c(qe,"href","quicktour"),c(Te,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification/run_glue.py"),c(Te,"rel","nofollow"),c(Pe,"href","https://github.com/google-research/bert#pre-trained-models"),c(Pe,"rel","nofollow"),c(ee,"id","albert"),c(ee,"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"),c(ee,"href","#albert"),c(F,"class","relative group"),c(Ae,"href","https://github.com/huggingface/transformers/tree/main/src/transformers/models/albert/convert_albert_original_tf_checkpoint_to_pytorch.py"),c(Ae,"rel","nofollow"),c(be,"href","https://github.com/google-research/albert#pre-trained-models"),c(be,"rel","nofollow"),c(ae,"id","openai-gpt"),c(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"),c(ae,"href","#openai-gpt"),c(x,"class","relative group"),c(Oe,"href","https://github.com/openai/finetune-transformer-lm"),c(Oe,"rel","nofollow"),c(ne,"id","openai-gpt2"),c(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"),c(ne,"href","#openai-gpt2"),c(D,"class","relative group"),c(we,"href","https://github.com/openai/gpt-2"),c(we,"rel","nofollow"),c(pe,"id","transformerxl"),c(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"),c(pe,"href","#transformerxl"),c(B,"class","relative group"),c(Le,"href","https://github.com/kimiyoung/transformer-xl/tree/master/tf#obtain-and-evaluate-pretrained-sota-models"),c(Le,"rel","nofollow"),c(ce,"id","xlnet"),c(ce,"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"),c(ce,"href","#xlnet"),c(G,"class","relative group"),c(_e,"id","xlm"),c(_e,"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"),c(_e,"href","#xlm"),c(q,"class","relative group"),c(fe,"id","t5"),c(fe,"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"),c(fe,"href","#t5"),c(X,"class","relative group")},m(e,p){o(document.head,h),i(e,K,p),i(e,A,p),o(A,O),o(O,R),m(N,R,null),o(A,k),o(A,j),o(j,S),i(e,M,p),i(e,P,p),o(P,y),o(P,b),o(b,Ge),o(P,z),o(P,Y),o(Y,Ao),o(P,yo),o(P,Ye),o(Ye,bo),o(P,go),i(e,bt,p),m(J,e,p),i(e,gt,p),i(e,H,p),o(H,Q),o(Q,Je),m(de,Je,null),o(H,Oo),o(H,Qe),o(Qe,No),i(e,Ot,p),i(e,I,p),o(I,ko),o(I,me),o(me,wo),o(I,Io),o(I,ve),o(ve,Co),o(I,Lo),i(e,Nt,p),i(e,$,p),o($,Ro),o($,Ve),o(Ve,jo),o($,So),o($,We),o(We,Ho),o($,Fo),o($,Ze),o(Ze,xo),o($,Do),o($,qe),o(qe,Bo),o($,Go),o($,Te),o(Te,qo),o($,Xo),i(e,kt,p),i(e,g,p),o(g,Uo),o(g,et),o(et,Ko),o(g,Mo),o(g,tt),o(tt,zo),o(g,Yo),o(g,ot),o(ot,Jo),o(g,Qo),o(g,rt),o(rt,Vo),o(g,Wo),i(e,wt,p),i(e,V,p),o(V,Zo),o(V,at),o(at,er),o(V,tr),i(e,It,p),i(e,W,p),o(W,or),o(W,lt),o(lt,rr),o(W,ar),i(e,Ct,p),m(Ee,e,p),i(e,Lt,p),i(e,Z,p),o(Z,lr),o(Z,Pe),o(Pe,nr),o(Z,sr),i(e,Rt,p),i(e,F,p),o(F,ee),o(ee,nt),m($e,nt,null),o(F,pr),o(F,st),o(st,ir),i(e,jt,p),i(e,te,p),o(te,cr),o(te,Ae),o(Ae,_r),o(te,fr),i(e,St,p),i(e,C,p),o(C,hr),o(C,pt),o(pt,ur),o(C,dr),o(C,it),o(it,mr),o(C,vr),i(e,Ht,p),i(e,oe,p),o(oe,Tr),o(oe,ct),o(ct,Er),o(oe,Pr),i(e,Ft,p),m(ye,e,p),i(e,xt,p),i(e,re,p),o(re,$r),o(re,be),o(be,Ar),o(re,yr),i(e,Dt,p),i(e,x,p),o(x,ae),o(ae,_t),m(ge,_t,null),o(x,br),o(x,ft),o(ft,gr),i(e,Bt,p),i(e,le,p),o(le,Or),o(le,Oe),o(Oe,Nr),o(le,kr),i(e,Gt,p),m(Ne,e,p),i(e,qt,p),i(e,D,p),o(D,ne),o(ne,ht),m(ke,ht,null),o(D,wr),o(D,ut),o(ut,Ir),i(e,Xt,p),i(e,se,p),o(se,Cr),o(se,we),o(we,Lr),o(se,Rr),i(e,Ut,p),m(Ie,e,p),i(e,Kt,p),i(e,B,p),o(B,pe),o(pe,dt),m(Ce,dt,null),o(B,jr),o(B,mt),o(mt,Sr),i(e,Mt,p),i(e,ie,p),o(ie,Hr),o(ie,Le),o(Le,Fr),o(ie,xr),i(e,zt,p),m(Re,e,p),i(e,Yt,p),i(e,G,p),o(G,ce),o(ce,vt),m(je,vt,null),o(G,Dr),o(G,Tt),o(Tt,Br),i(e,Jt,p),i(e,Xe,p),o(Xe,Gr),i(e,Qt,p),m(Se,e,p),i(e,Vt,p),i(e,q,p),o(q,_e),o(_e,Et),m(He,Et,null),o(q,qr),o(q,Pt),o(Pt,Xr),i(e,Wt,p),i(e,Ue,p),o(Ue,Ur),i(e,Zt,p),m(Fe,e,p),i(e,eo,p),i(e,X,p),o(X,fe),o(fe,$t),m(xe,$t,null),o(X,Kr),o(X,At),o(At,Mr),i(e,to,p),i(e,Ke,p),o(Ke,zr),i(e,oo,p),m(De,e,p),ro=!0},p(e,[p]){const Be={};p&2&&(Be.$$scope={dirty:p,ctx:e}),J.$set(Be)},i(e){ro||(v(N.$$.fragment,e),v(J.$$.fragment,e),v(de.$$.fragment,e),v(Ee.$$.fragment,e),v($e.$$.fragment,e),v(ye.$$.fragment,e),v(ge.$$.fragment,e),v(Ne.$$.fragment,e),v(ke.$$.fragment,e),v(Ie.$$.fragment,e),v(Ce.$$.fragment,e),v(Re.$$.fragment,e),v(je.$$.fragment,e),v(Se.$$.fragment,e),v(He.$$.fragment,e),v(Fe.$$.fragment,e),v(xe.$$.fragment,e),v(De.$$.fragment,e),ro=!0)},o(e){T(N.$$.fragment,e),T(J.$$.fragment,e),T(de.$$.fragment,e),T(Ee.$$.fragment,e),T($e.$$.fragment,e),T(ye.$$.fragment,e),T(ge.$$.fragment,e),T(Ne.$$.fragment,e),T(ke.$$.fragment,e),T(Ie.$$.fragment,e),T(Ce.$$.fragment,e),T(Re.$$.fragment,e),T(je.$$.fragment,e),T(Se.$$.fragment,e),T(He.$$.fragment,e),T(Fe.$$.fragment,e),T(xe.$$.fragment,e),T(De.$$.fragment,e),ro=!1},d(e){t(h),e&&t(K),e&&t(A),E(N),e&&t(M),e&&t(P),e&&t(bt),E(J,e),e&&t(gt),e&&t(H),E(de),e&&t(Ot),e&&t(I),e&&t(Nt),e&&t($),e&&t(kt),e&&t(g),e&&t(wt),e&&t(V),e&&t(It),e&&t(W),e&&t(Ct),E(Ee,e),e&&t(Lt),e&&t(Z),e&&t(Rt),e&&t(F),E($e),e&&t(jt),e&&t(te),e&&t(St),e&&t(C),e&&t(Ht),e&&t(oe),e&&t(Ft),E(ye,e),e&&t(xt),e&&t(re),e&&t(Dt),e&&t(x),E(ge),e&&t(Bt),e&&t(le),e&&t(Gt),E(Ne,e),e&&t(qt),e&&t(D),E(ke),e&&t(Xt),e&&t(se),e&&t(Ut),E(Ie,e),e&&t(Kt),e&&t(B),E(Ce),e&&t(Mt),e&&t(ie),e&&t(zt),E(Re,e),e&&t(Yt),e&&t(G),E(je),e&&t(Jt),e&&t(Xe),e&&t(Qt),E(Se,e),e&&t(Vt),e&&t(q),E(He),e&&t(Wt),e&&t(Ue),e&&t(Zt),E(Fe,e),e&&t(eo),e&&t(X),E(xe),e&&t(to),e&&t(Ke),e&&t(oo),E(De,e)}}}const rl={local:"convertir-checkpoints-de-tensorflow",sections:[{local:"bert",title:"BERT"},{local:"albert",title:"ALBERT"},{local:"openai-gpt",title:"OpenAI GPT"},{local:"openai-gpt2",title:"OpenAI GPT-2"},{local:"transformerxl",title:"Transformer-XL"},{local:"xlnet",title:"XLNet"},{local:"xlm",title:"XLM"},{local:"t5",title:"T5"}],title:"Convertir checkpoints de Tensorflow"};function al(yt){return Za(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class il extends Ja{constructor(h){super();Qa(this,h,al,ol,Va,{})}}export{il as default,rl as metadata};
