import{S as kl,i as wl,s as yl,e as n,k as c,w as h,t,M as bl,c as o,d as s,m as d,a as r,x as g,h as l,b as f,N as ql,G as a,g as p,y as v,q as $,o as _,B as E,v as Pl}from"../chunks/vendor-hf-doc-builder.js";import{T as zl}from"../chunks/Tip-hf-doc-builder.js";import{I as ia}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as A}from"../chunks/CodeBlock-hf-doc-builder.js";function Cl(ra){let u,H,j,w,M;return{c(){u=n("p"),H=t("Echa un vistazo a la documentaci\xF3n de "),j=n("code"),w=t("pipeline()"),M=t(" para obtener una lista completa de tareas admitidas.")},l(k){u=o(k,"P",{});var z=r(u);H=l(z,"Echa un vistazo a la documentaci\xF3n de "),j=o(z,"CODE",{});var U=r(j);w=l(U,"pipeline()"),U.forEach(s),M=l(z," para obtener una lista completa de tareas admitidas."),z.forEach(s)},m(k,z){p(k,u,z),a(u,H),a(u,j),a(j,w),a(u,M)},d(k){k&&s(u)}}}function Dl(ra){let u,H,j,w,M,k,z,U,es,pa,y,as,ze,ss,ts,Z,ls,ns,Ce,os,is,ca,C,ee,rs,De,ps,cs,ds,Ae,fs,us,ae,ms,Me,hs,gs,da,N,fa,S,F,Se,se,vs,Oe,$s,ua,b,_s,Le,Es,js,Te,xs,ks,He,ws,ys,ma,ke,te,bs,Ue,qs,Ps,ha,le,ga,ne,oe,zs,Ne,Cs,Ds,va,ie,$a,we,As,_a,re,Ea,x,Ms,Fe,Ss,Os,Ie,Ls,Ts,Re,Hs,Us,Je,Ns,Fs,ja,pe,xa,O,I,Ke,ce,Is,We,Rs,ka,m,Js,Be,Ks,Ws,de,Bs,Gs,Ge,Qs,Vs,Qe,Xs,Ys,Ve,Zs,et,wa,fe,ya,R,at,Xe,st,tt,ba,ue,qa,J,lt,Ye,nt,ot,Pa,me,za,L,K,Ze,he,it,ea,rt,Ca,W,pt,aa,ct,dt,Da,q,ft,ge,ut,mt,ve,ht,gt,sa,vt,$t,Aa,$e,Ma,B,_t,ta,Et,jt,Sa,_e,Oa,T,G,la,Ee,xt,na,kt,La,Q,wt,oa,yt,bt,Ta,ye,qt,Ha,be,qe,Pt,Ua,je,Na;return k=new ia({}),N=new zl({props:{$$slots:{default:[Cl]},$$scope:{ctx:ra}}}),se=new ia({}),le=new A({props:{code:`from transformers import pipeline

generator = pipeline(task="text-generation")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>generator = pipeline(task=<span class="hljs-string">&quot;text-generation&quot;</span>)`}}),ie=new A({props:{code:'generator("Three Rings for the Elven-kings under the sky, Seven for the Dwarf-lords in their halls of stone")',highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>generator(<span class="hljs-string">&quot;Three Rings for the Elven-kings under the sky, Seven for the Dwarf-lords in their halls of stone&quot;</span>)
[{<span class="hljs-string">&#x27;generated_text&#x27;</span>: <span class="hljs-string">&#x27;Three Rings for the Elven-kings under the sky, Seven for the Dwarf-lords in their halls of stone, Seven for the Iron-priests at the door to the east, and thirteen for the Lord Kings at the end of the mountain&#x27;</span>}]`}}),re=new A({props:{code:`generator(
    [
        "Three Rings for the Elven-kings under the sky, Seven for the Dwarf-lords in their halls of stone",
        "Nine for Mortal Men, doomed to die, One for the Dark Lord on his dark throne",
    ]
)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>generator(
<span class="hljs-meta">... </span>    [
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;Three Rings for the Elven-kings under the sky, Seven for the Dwarf-lords in their halls of stone&quot;</span>,
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;Nine for Mortal Men, doomed to die, One for the Dark Lord on his dark throne&quot;</span>,
<span class="hljs-meta">... </span>    ]
<span class="hljs-meta">... </span>)`}}),pe=new A({props:{code:`generator(
    "Three Rings for the Elven-kings under the sky, Seven for the Dwarf-lords in their halls of stone",
    num_return_sequences=2,
)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>generator(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Three Rings for the Elven-kings under the sky, Seven for the Dwarf-lords in their halls of stone&quot;</span>,
<span class="hljs-meta">... </span>    num_return_sequences=<span class="hljs-number">2</span>,
<span class="hljs-meta">... </span>)`}}),ce=new ia({}),fe=new A({props:{code:`from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("distilgpt2")
model = AutoModelForCausalLM.from_pretrained("distilgpt2")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModelForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;distilgpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;distilgpt2&quot;</span>)`}}),ue=new A({props:{code:`from transformers import pipeline

generator = pipeline(task="text-generation", model=model, tokenizer=tokenizer)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>generator = pipeline(task=<span class="hljs-string">&quot;text-generation&quot;</span>, model=model, tokenizer=tokenizer)`}}),me=new A({props:{code:'generator("Three Rings for the Elven-kings under the sky, Seven for the Dwarf-lords in their halls of stone")',highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>generator(<span class="hljs-string">&quot;Three Rings for the Elven-kings under the sky, Seven for the Dwarf-lords in their halls of stone&quot;</span>)
[{<span class="hljs-string">&#x27;generated_text&#x27;</span>: <span class="hljs-string">&#x27;Three Rings for the Elven-kings under the sky, Seven for the Dwarf-lords in their halls of stone, Seven for the Dragon-lords (for them to rule in a world ruled by their rulers, and all who live within the realm&#x27;</span>}]`}}),he=new ia({}),$e=new A({props:{code:`from transformers import pipeline

audio_classifier = pipeline(
    task="audio-classification", model="ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition"
)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>audio_classifier = pipeline(
<span class="hljs-meta">... </span>    task=<span class="hljs-string">&quot;audio-classification&quot;</span>, model=<span class="hljs-string">&quot;ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition&quot;</span>
<span class="hljs-meta">... </span>)`}}),_e=new A({props:{code:'audio_classifier("jfk_moon_speech.wav")',highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>audio_classifier(<span class="hljs-string">&quot;jfk_moon_speech.wav&quot;</span>)
[{<span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;calm&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.13856211304664612</span>},
 {<span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;disgust&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.13148026168346405</span>},
 {<span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;happy&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.12635163962841034</span>},
 {<span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;angry&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.12439591437578201</span>},
 {<span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;fearful&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.12404385954141617</span>}]`}}),Ee=new ia({}),je=new A({props:{code:`from transformers import pipeline

vision_classifier = pipeline(task="image-classification")
vision_classifier(
    images="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>vision_classifier = pipeline(task=<span class="hljs-string">&quot;image-classification&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>vision_classifier(
<span class="hljs-meta">... </span>    images=<span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg&quot;</span>
<span class="hljs-meta">... </span>)
[{<span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;lynx, catamount&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.4403027892112732</span>},
 {<span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;cougar, puma, catamount, mountain lion, painter, panther, Felis concolor&#x27;</span>,
  <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.03433405980467796</span>},
 {<span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;snow leopard, ounce, Panthera uncia&#x27;</span>,
  <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.032148055732250214</span>},
 {<span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;Egyptian cat&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.02353910356760025</span>},
 {<span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;tiger cat&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.023034192621707916</span>}]`}}),{c(){u=n("meta"),H=c(),j=n("h1"),w=n("a"),M=n("span"),h(k.$$.fragment),z=c(),U=n("span"),es=t("Pipelines para inferencia"),pa=c(),y=n("p"),as=t("Un "),ze=n("code"),ss=t("pipeline()"),ts=t(" simplifica el uso de cualquier modelo del "),Z=n("a"),ls=t("Model Hub"),ns=t(" para la inferencia en una variedad de tareas como la generaci\xF3n de texto, la segmentaci\xF3n de im\xE1genes y la clasificaci\xF3n de audio. Incluso si no tienes experiencia con una modalidad espec\xEDfica o no comprendes el c\xF3digo que alimenta los modelos, \xA1a\xFAn puedes usarlos con el "),Ce=n("code"),os=t("pipeline()"),is=t("! Este tutorial te ense\xF1ar\xE1 a:"),ca=c(),C=n("ul"),ee=n("li"),rs=t("Utilizar un "),De=n("code"),ps=t("pipeline()"),cs=t(" para inferencia."),ds=c(),Ae=n("li"),fs=t("Utilizar un tokenizador o modelo espec\xEDfico."),us=c(),ae=n("li"),ms=t("Utilizar un "),Me=n("code"),hs=t("pipeline()"),gs=t(" para tareas de audio y visi\xF3n."),da=c(),h(N.$$.fragment),fa=c(),S=n("h2"),F=n("a"),Se=n("span"),h(se.$$.fragment),vs=c(),Oe=n("span"),$s=t("Uso del pipeline"),ua=c(),b=n("p"),_s=t("Si bien cada tarea tiene un "),Le=n("code"),Es=t("pipeline()"),js=t(" asociado, es m\xE1s sencillo usar la abstracci\xF3n general "),Te=n("code"),xs=t("pipeline()"),ks=t(" que contiene todos los pipelines de tareas espec\xEDficas. El "),He=n("code"),ws=t("pipeline()"),ys=t(" carga autom\xE1ticamente un modelo predeterminado y un tokenizador con capacidad de inferencia para tu tarea."),ma=c(),ke=n("ol"),te=n("li"),bs=t("Comienza creando un "),Ue=n("code"),qs=t("pipeline()"),Ps=t(" y espec\xEDfica una tarea de inferencia:"),ha=c(),h(le.$$.fragment),ga=c(),ne=n("ol"),oe=n("li"),zs=t("Pasa tu texto de entrada al "),Ne=n("code"),Cs=t("pipeline()"),Ds=t(":"),va=c(),h(ie.$$.fragment),$a=c(),we=n("p"),As=t("Si tienes m\xE1s de una entrada, p\xE1sala como una lista:"),_a=c(),h(re.$$.fragment),Ea=c(),x=n("p"),Ms=t("Cualquier par\xE1metro adicional para tu tarea tambi\xE9n se puede incluir en el "),Fe=n("code"),Ss=t("pipeline()"),Os=t(". La tarea "),Ie=n("code"),Ls=t("text-generation"),Ts=t(" tiene un m\xE9todo "),Re=n("code"),Hs=t("generate()"),Us=t(" con varios par\xE1metros para controlar la salida. Por ejemplo, si deseas generar m\xE1s de una salida, def\xEDnelo en el par\xE1metro "),Je=n("code"),Ns=t("num_return_sequences"),Fs=t(":"),ja=c(),h(pe.$$.fragment),xa=c(),O=n("h3"),I=n("a"),Ke=n("span"),h(ce.$$.fragment),Is=c(),We=n("span"),Rs=t("Selecciona un modelo y un tokenizador"),ka=c(),m=n("p"),Js=t("El "),Be=n("code"),Ks=t("pipeline()"),Ws=t(" acepta cualquier modelo del "),de=n("a"),Bs=t("Model Hub"),Gs=t(". Hay etiquetas en el Model Hub que te permiten filtrar por el modelo que te gustar\xEDa utilizar para tu tarea. Una vez que hayas elegido un modelo apropiado, c\xE1rgalo con la clase "),Ge=n("code"),Qs=t("AutoModelFor"),Vs=t(" y "),Qe=n("code"),Xs=t("AutoTokenizer"),Ys=t(" correspondientes. Por ejemplo, carga la clase "),Ve=n("code"),Zs=t("AutoModelForCausalLM"),et=t(" para una tarea de modelado de lenguaje causal:"),wa=c(),h(fe.$$.fragment),ya=c(),R=n("p"),at=t("Crea un "),Xe=n("code"),st=t("pipeline()"),tt=t(" para tu tarea y espec\xEDfica el modelo y el tokenizador que cargaste:"),ba=c(),h(ue.$$.fragment),qa=c(),J=n("p"),lt=t("Pasa tu texto de entrada a "),Ye=n("code"),nt=t("pipeline()"),ot=t(" para generar algo de texto:"),Pa=c(),h(me.$$.fragment),za=c(),L=n("h2"),K=n("a"),Ze=n("span"),h(he.$$.fragment),it=c(),ea=n("span"),rt=t("Pipeline de audio"),Ca=c(),W=n("p"),pt=t("La flexibilidad de "),aa=n("code"),ct=t("pipeline()"),dt=t(" significa que tambi\xE9n se puede extender a tareas de audio."),Da=c(),q=n("p"),ft=t("Por ejemplo, clasifiquemos la emoci\xF3n de un breve fragmento del famoso discurso de John F. Kennedy "),ge=n("a"),ut=t("\u201CWe choose to go to the Moon\u201D"),mt=t(". Encuentra un modelo de "),ve=n("a"),ht=t("audio classification"),gt=t(" para reconocimiento de emociones en el Model Hub y c\xE1rgalo en el "),sa=n("code"),vt=t("pipeline()"),$t=t(":"),Aa=c(),h($e.$$.fragment),Ma=c(),B=n("p"),_t=t("Pasa el archivo de audio al "),ta=n("code"),Et=t("pipeline()"),jt=t(":"),Sa=c(),h(_e.$$.fragment),Oa=c(),T=n("h2"),G=n("a"),la=n("span"),h(Ee.$$.fragment),xt=c(),na=n("span"),kt=t("Pipeline de visi\xF3n"),La=c(),Q=n("p"),wt=t("Finalmente, utilizar un "),oa=n("code"),yt=t("pipeline()"),bt=t(" para tareas de visi\xF3n es pr\xE1cticamente igual."),Ta=c(),ye=n("p"),qt=t("Espec\xEDfica tu tarea de visi\xF3n y pasa tu imagen al clasificador. La imagen puede ser un enlace o una ruta local a la imagen. Por ejemplo, \xBFqu\xE9 especie de gato se muestra a continuaci\xF3n?"),Ha=c(),be=n("p"),qe=n("img"),Ua=c(),h(je.$$.fragment),this.h()},l(e){const i=bl('[data-svelte="svelte-1phssyn"]',document.head);u=o(i,"META",{name:!0,content:!0}),i.forEach(s),H=d(e),j=o(e,"H1",{class:!0});var xe=r(j);w=o(xe,"A",{id:!0,class:!0,href:!0});var zt=r(w);M=o(zt,"SPAN",{});var Ct=r(M);g(k.$$.fragment,Ct),Ct.forEach(s),zt.forEach(s),z=d(xe),U=o(xe,"SPAN",{});var Dt=r(U);es=l(Dt,"Pipelines para inferencia"),Dt.forEach(s),xe.forEach(s),pa=d(e),y=o(e,"P",{});var V=r(y);as=l(V,"Un "),ze=o(V,"CODE",{});var At=r(ze);ss=l(At,"pipeline()"),At.forEach(s),ts=l(V," simplifica el uso de cualquier modelo del "),Z=o(V,"A",{href:!0,rel:!0});var Mt=r(Z);ls=l(Mt,"Model Hub"),Mt.forEach(s),ns=l(V," para la inferencia en una variedad de tareas como la generaci\xF3n de texto, la segmentaci\xF3n de im\xE1genes y la clasificaci\xF3n de audio. Incluso si no tienes experiencia con una modalidad espec\xEDfica o no comprendes el c\xF3digo que alimenta los modelos, \xA1a\xFAn puedes usarlos con el "),Ce=o(V,"CODE",{});var St=r(Ce);os=l(St,"pipeline()"),St.forEach(s),is=l(V,"! Este tutorial te ense\xF1ar\xE1 a:"),V.forEach(s),ca=d(e),C=o(e,"UL",{});var Pe=r(C);ee=o(Pe,"LI",{});var Fa=r(ee);rs=l(Fa,"Utilizar un "),De=o(Fa,"CODE",{});var Ot=r(De);ps=l(Ot,"pipeline()"),Ot.forEach(s),cs=l(Fa," para inferencia."),Fa.forEach(s),ds=d(Pe),Ae=o(Pe,"LI",{});var Lt=r(Ae);fs=l(Lt,"Utilizar un tokenizador o modelo espec\xEDfico."),Lt.forEach(s),us=d(Pe),ae=o(Pe,"LI",{});var Ia=r(ae);ms=l(Ia,"Utilizar un "),Me=o(Ia,"CODE",{});var Tt=r(Me);hs=l(Tt,"pipeline()"),Tt.forEach(s),gs=l(Ia," para tareas de audio y visi\xF3n."),Ia.forEach(s),Pe.forEach(s),da=d(e),g(N.$$.fragment,e),fa=d(e),S=o(e,"H2",{class:!0});var Ra=r(S);F=o(Ra,"A",{id:!0,class:!0,href:!0});var Ht=r(F);Se=o(Ht,"SPAN",{});var Ut=r(Se);g(se.$$.fragment,Ut),Ut.forEach(s),Ht.forEach(s),vs=d(Ra),Oe=o(Ra,"SPAN",{});var Nt=r(Oe);$s=l(Nt,"Uso del pipeline"),Nt.forEach(s),Ra.forEach(s),ua=d(e),b=o(e,"P",{});var X=r(b);_s=l(X,"Si bien cada tarea tiene un "),Le=o(X,"CODE",{});var Ft=r(Le);Es=l(Ft,"pipeline()"),Ft.forEach(s),js=l(X," asociado, es m\xE1s sencillo usar la abstracci\xF3n general "),Te=o(X,"CODE",{});var It=r(Te);xs=l(It,"pipeline()"),It.forEach(s),ks=l(X," que contiene todos los pipelines de tareas espec\xEDficas. El "),He=o(X,"CODE",{});var Rt=r(He);ws=l(Rt,"pipeline()"),Rt.forEach(s),ys=l(X," carga autom\xE1ticamente un modelo predeterminado y un tokenizador con capacidad de inferencia para tu tarea."),X.forEach(s),ma=d(e),ke=o(e,"OL",{});var Jt=r(ke);te=o(Jt,"LI",{});var Ja=r(te);bs=l(Ja,"Comienza creando un "),Ue=o(Ja,"CODE",{});var Kt=r(Ue);qs=l(Kt,"pipeline()"),Kt.forEach(s),Ps=l(Ja," y espec\xEDfica una tarea de inferencia:"),Ja.forEach(s),Jt.forEach(s),ha=d(e),g(le.$$.fragment,e),ga=d(e),ne=o(e,"OL",{start:!0});var Wt=r(ne);oe=o(Wt,"LI",{});var Ka=r(oe);zs=l(Ka,"Pasa tu texto de entrada al "),Ne=o(Ka,"CODE",{});var Bt=r(Ne);Cs=l(Bt,"pipeline()"),Bt.forEach(s),Ds=l(Ka,":"),Ka.forEach(s),Wt.forEach(s),va=d(e),g(ie.$$.fragment,e),$a=d(e),we=o(e,"P",{});var Gt=r(we);As=l(Gt,"Si tienes m\xE1s de una entrada, p\xE1sala como una lista:"),Gt.forEach(s),_a=d(e),g(re.$$.fragment,e),Ea=d(e),x=o(e,"P",{});var D=r(x);Ms=l(D,"Cualquier par\xE1metro adicional para tu tarea tambi\xE9n se puede incluir en el "),Fe=o(D,"CODE",{});var Qt=r(Fe);Ss=l(Qt,"pipeline()"),Qt.forEach(s),Os=l(D,". La tarea "),Ie=o(D,"CODE",{});var Vt=r(Ie);Ls=l(Vt,"text-generation"),Vt.forEach(s),Ts=l(D," tiene un m\xE9todo "),Re=o(D,"CODE",{});var Xt=r(Re);Hs=l(Xt,"generate()"),Xt.forEach(s),Us=l(D," con varios par\xE1metros para controlar la salida. Por ejemplo, si deseas generar m\xE1s de una salida, def\xEDnelo en el par\xE1metro "),Je=o(D,"CODE",{});var Yt=r(Je);Ns=l(Yt,"num_return_sequences"),Yt.forEach(s),Fs=l(D,":"),D.forEach(s),ja=d(e),g(pe.$$.fragment,e),xa=d(e),O=o(e,"H3",{class:!0});var Wa=r(O);I=o(Wa,"A",{id:!0,class:!0,href:!0});var Zt=r(I);Ke=o(Zt,"SPAN",{});var el=r(Ke);g(ce.$$.fragment,el),el.forEach(s),Zt.forEach(s),Is=d(Wa),We=o(Wa,"SPAN",{});var al=r(We);Rs=l(al,"Selecciona un modelo y un tokenizador"),al.forEach(s),Wa.forEach(s),ka=d(e),m=o(e,"P",{});var P=r(m);Js=l(P,"El "),Be=o(P,"CODE",{});var sl=r(Be);Ks=l(sl,"pipeline()"),sl.forEach(s),Ws=l(P," acepta cualquier modelo del "),de=o(P,"A",{href:!0,rel:!0});var tl=r(de);Bs=l(tl,"Model Hub"),tl.forEach(s),Gs=l(P,". Hay etiquetas en el Model Hub que te permiten filtrar por el modelo que te gustar\xEDa utilizar para tu tarea. Una vez que hayas elegido un modelo apropiado, c\xE1rgalo con la clase "),Ge=o(P,"CODE",{});var ll=r(Ge);Qs=l(ll,"AutoModelFor"),ll.forEach(s),Vs=l(P," y "),Qe=o(P,"CODE",{});var nl=r(Qe);Xs=l(nl,"AutoTokenizer"),nl.forEach(s),Ys=l(P," correspondientes. Por ejemplo, carga la clase "),Ve=o(P,"CODE",{});var ol=r(Ve);Zs=l(ol,"AutoModelForCausalLM"),ol.forEach(s),et=l(P," para una tarea de modelado de lenguaje causal:"),P.forEach(s),wa=d(e),g(fe.$$.fragment,e),ya=d(e),R=o(e,"P",{});var Ba=r(R);at=l(Ba,"Crea un "),Xe=o(Ba,"CODE",{});var il=r(Xe);st=l(il,"pipeline()"),il.forEach(s),tt=l(Ba," para tu tarea y espec\xEDfica el modelo y el tokenizador que cargaste:"),Ba.forEach(s),ba=d(e),g(ue.$$.fragment,e),qa=d(e),J=o(e,"P",{});var Ga=r(J);lt=l(Ga,"Pasa tu texto de entrada a "),Ye=o(Ga,"CODE",{});var rl=r(Ye);nt=l(rl,"pipeline()"),rl.forEach(s),ot=l(Ga," para generar algo de texto:"),Ga.forEach(s),Pa=d(e),g(me.$$.fragment,e),za=d(e),L=o(e,"H2",{class:!0});var Qa=r(L);K=o(Qa,"A",{id:!0,class:!0,href:!0});var pl=r(K);Ze=o(pl,"SPAN",{});var cl=r(Ze);g(he.$$.fragment,cl),cl.forEach(s),pl.forEach(s),it=d(Qa),ea=o(Qa,"SPAN",{});var dl=r(ea);rt=l(dl,"Pipeline de audio"),dl.forEach(s),Qa.forEach(s),Ca=d(e),W=o(e,"P",{});var Va=r(W);pt=l(Va,"La flexibilidad de "),aa=o(Va,"CODE",{});var fl=r(aa);ct=l(fl,"pipeline()"),fl.forEach(s),dt=l(Va," significa que tambi\xE9n se puede extender a tareas de audio."),Va.forEach(s),Da=d(e),q=o(e,"P",{});var Y=r(q);ft=l(Y,"Por ejemplo, clasifiquemos la emoci\xF3n de un breve fragmento del famoso discurso de John F. Kennedy "),ge=o(Y,"A",{href:!0,rel:!0});var ul=r(ge);ut=l(ul,"\u201CWe choose to go to the Moon\u201D"),ul.forEach(s),mt=l(Y,". Encuentra un modelo de "),ve=o(Y,"A",{href:!0,rel:!0});var ml=r(ve);ht=l(ml,"audio classification"),ml.forEach(s),gt=l(Y," para reconocimiento de emociones en el Model Hub y c\xE1rgalo en el "),sa=o(Y,"CODE",{});var hl=r(sa);vt=l(hl,"pipeline()"),hl.forEach(s),$t=l(Y,":"),Y.forEach(s),Aa=d(e),g($e.$$.fragment,e),Ma=d(e),B=o(e,"P",{});var Xa=r(B);_t=l(Xa,"Pasa el archivo de audio al "),ta=o(Xa,"CODE",{});var gl=r(ta);Et=l(gl,"pipeline()"),gl.forEach(s),jt=l(Xa,":"),Xa.forEach(s),Sa=d(e),g(_e.$$.fragment,e),Oa=d(e),T=o(e,"H2",{class:!0});var Ya=r(T);G=o(Ya,"A",{id:!0,class:!0,href:!0});var vl=r(G);la=o(vl,"SPAN",{});var $l=r(la);g(Ee.$$.fragment,$l),$l.forEach(s),vl.forEach(s),xt=d(Ya),na=o(Ya,"SPAN",{});var _l=r(na);kt=l(_l,"Pipeline de visi\xF3n"),_l.forEach(s),Ya.forEach(s),La=d(e),Q=o(e,"P",{});var Za=r(Q);wt=l(Za,"Finalmente, utilizar un "),oa=o(Za,"CODE",{});var El=r(oa);yt=l(El,"pipeline()"),El.forEach(s),bt=l(Za," para tareas de visi\xF3n es pr\xE1cticamente igual."),Za.forEach(s),Ta=d(e),ye=o(e,"P",{});var jl=r(ye);qt=l(jl,"Espec\xEDfica tu tarea de visi\xF3n y pasa tu imagen al clasificador. La imagen puede ser un enlace o una ruta local a la imagen. Por ejemplo, \xBFqu\xE9 especie de gato se muestra a continuaci\xF3n?"),jl.forEach(s),Ha=d(e),be=o(e,"P",{});var xl=r(be);qe=o(xl,"IMG",{src:!0,alt:!0}),xl.forEach(s),Ua=d(e),g(je.$$.fragment,e),this.h()},h(){f(u,"name","hf:doc:metadata"),f(u,"content",JSON.stringify(Al)),f(w,"id","pipelines-para-inferencia"),f(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"),f(w,"href","#pipelines-para-inferencia"),f(j,"class","relative group"),f(Z,"href","https://huggingface.co/models"),f(Z,"rel","nofollow"),f(F,"id","uso-del-pipeline"),f(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"),f(F,"href","#uso-del-pipeline"),f(S,"class","relative group"),f(ne,"start","2"),f(I,"id","selecciona-un-modelo-y-un-tokenizador"),f(I,"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"),f(I,"href","#selecciona-un-modelo-y-un-tokenizador"),f(O,"class","relative group"),f(de,"href","https://huggingface.co/models"),f(de,"rel","nofollow"),f(K,"id","pipeline-de-audio"),f(K,"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"),f(K,"href","#pipeline-de-audio"),f(L,"class","relative group"),f(ge,"href","https://en.wikipedia.org/wiki/We_choose_to_go_to_the_Moon"),f(ge,"rel","nofollow"),f(ve,"href","https://huggingface.co/models?pipeline_tag=audio-classification"),f(ve,"rel","nofollow"),f(G,"id","pipeline-de-visin"),f(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"),f(G,"href","#pipeline-de-visin"),f(T,"class","relative group"),ql(qe.src,Pt="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg")||f(qe,"src",Pt),f(qe,"alt","pipeline-cat-chonk")},m(e,i){a(document.head,u),p(e,H,i),p(e,j,i),a(j,w),a(w,M),v(k,M,null),a(j,z),a(j,U),a(U,es),p(e,pa,i),p(e,y,i),a(y,as),a(y,ze),a(ze,ss),a(y,ts),a(y,Z),a(Z,ls),a(y,ns),a(y,Ce),a(Ce,os),a(y,is),p(e,ca,i),p(e,C,i),a(C,ee),a(ee,rs),a(ee,De),a(De,ps),a(ee,cs),a(C,ds),a(C,Ae),a(Ae,fs),a(C,us),a(C,ae),a(ae,ms),a(ae,Me),a(Me,hs),a(ae,gs),p(e,da,i),v(N,e,i),p(e,fa,i),p(e,S,i),a(S,F),a(F,Se),v(se,Se,null),a(S,vs),a(S,Oe),a(Oe,$s),p(e,ua,i),p(e,b,i),a(b,_s),a(b,Le),a(Le,Es),a(b,js),a(b,Te),a(Te,xs),a(b,ks),a(b,He),a(He,ws),a(b,ys),p(e,ma,i),p(e,ke,i),a(ke,te),a(te,bs),a(te,Ue),a(Ue,qs),a(te,Ps),p(e,ha,i),v(le,e,i),p(e,ga,i),p(e,ne,i),a(ne,oe),a(oe,zs),a(oe,Ne),a(Ne,Cs),a(oe,Ds),p(e,va,i),v(ie,e,i),p(e,$a,i),p(e,we,i),a(we,As),p(e,_a,i),v(re,e,i),p(e,Ea,i),p(e,x,i),a(x,Ms),a(x,Fe),a(Fe,Ss),a(x,Os),a(x,Ie),a(Ie,Ls),a(x,Ts),a(x,Re),a(Re,Hs),a(x,Us),a(x,Je),a(Je,Ns),a(x,Fs),p(e,ja,i),v(pe,e,i),p(e,xa,i),p(e,O,i),a(O,I),a(I,Ke),v(ce,Ke,null),a(O,Is),a(O,We),a(We,Rs),p(e,ka,i),p(e,m,i),a(m,Js),a(m,Be),a(Be,Ks),a(m,Ws),a(m,de),a(de,Bs),a(m,Gs),a(m,Ge),a(Ge,Qs),a(m,Vs),a(m,Qe),a(Qe,Xs),a(m,Ys),a(m,Ve),a(Ve,Zs),a(m,et),p(e,wa,i),v(fe,e,i),p(e,ya,i),p(e,R,i),a(R,at),a(R,Xe),a(Xe,st),a(R,tt),p(e,ba,i),v(ue,e,i),p(e,qa,i),p(e,J,i),a(J,lt),a(J,Ye),a(Ye,nt),a(J,ot),p(e,Pa,i),v(me,e,i),p(e,za,i),p(e,L,i),a(L,K),a(K,Ze),v(he,Ze,null),a(L,it),a(L,ea),a(ea,rt),p(e,Ca,i),p(e,W,i),a(W,pt),a(W,aa),a(aa,ct),a(W,dt),p(e,Da,i),p(e,q,i),a(q,ft),a(q,ge),a(ge,ut),a(q,mt),a(q,ve),a(ve,ht),a(q,gt),a(q,sa),a(sa,vt),a(q,$t),p(e,Aa,i),v($e,e,i),p(e,Ma,i),p(e,B,i),a(B,_t),a(B,ta),a(ta,Et),a(B,jt),p(e,Sa,i),v(_e,e,i),p(e,Oa,i),p(e,T,i),a(T,G),a(G,la),v(Ee,la,null),a(T,xt),a(T,na),a(na,kt),p(e,La,i),p(e,Q,i),a(Q,wt),a(Q,oa),a(oa,yt),a(Q,bt),p(e,Ta,i),p(e,ye,i),a(ye,qt),p(e,Ha,i),p(e,be,i),a(be,qe),p(e,Ua,i),v(je,e,i),Na=!0},p(e,[i]){const xe={};i&2&&(xe.$$scope={dirty:i,ctx:e}),N.$set(xe)},i(e){Na||($(k.$$.fragment,e),$(N.$$.fragment,e),$(se.$$.fragment,e),$(le.$$.fragment,e),$(ie.$$.fragment,e),$(re.$$.fragment,e),$(pe.$$.fragment,e),$(ce.$$.fragment,e),$(fe.$$.fragment,e),$(ue.$$.fragment,e),$(me.$$.fragment,e),$(he.$$.fragment,e),$($e.$$.fragment,e),$(_e.$$.fragment,e),$(Ee.$$.fragment,e),$(je.$$.fragment,e),Na=!0)},o(e){_(k.$$.fragment,e),_(N.$$.fragment,e),_(se.$$.fragment,e),_(le.$$.fragment,e),_(ie.$$.fragment,e),_(re.$$.fragment,e),_(pe.$$.fragment,e),_(ce.$$.fragment,e),_(fe.$$.fragment,e),_(ue.$$.fragment,e),_(me.$$.fragment,e),_(he.$$.fragment,e),_($e.$$.fragment,e),_(_e.$$.fragment,e),_(Ee.$$.fragment,e),_(je.$$.fragment,e),Na=!1},d(e){s(u),e&&s(H),e&&s(j),E(k),e&&s(pa),e&&s(y),e&&s(ca),e&&s(C),e&&s(da),E(N,e),e&&s(fa),e&&s(S),E(se),e&&s(ua),e&&s(b),e&&s(ma),e&&s(ke),e&&s(ha),E(le,e),e&&s(ga),e&&s(ne),e&&s(va),E(ie,e),e&&s($a),e&&s(we),e&&s(_a),E(re,e),e&&s(Ea),e&&s(x),e&&s(ja),E(pe,e),e&&s(xa),e&&s(O),E(ce),e&&s(ka),e&&s(m),e&&s(wa),E(fe,e),e&&s(ya),e&&s(R),e&&s(ba),E(ue,e),e&&s(qa),e&&s(J),e&&s(Pa),E(me,e),e&&s(za),e&&s(L),E(he),e&&s(Ca),e&&s(W),e&&s(Da),e&&s(q),e&&s(Aa),E($e,e),e&&s(Ma),e&&s(B),e&&s(Sa),E(_e,e),e&&s(Oa),e&&s(T),E(Ee),e&&s(La),e&&s(Q),e&&s(Ta),e&&s(ye),e&&s(Ha),e&&s(be),e&&s(Ua),E(je,e)}}}const Al={local:"pipelines-para-inferencia",sections:[{local:"uso-del-pipeline",sections:[{local:"selecciona-un-modelo-y-un-tokenizador",title:"Selecciona un modelo y un tokenizador"}],title:"Uso del pipeline"},{local:"pipeline-de-audio",title:"Pipeline de audio"},{local:"pipeline-de-visin",title:"Pipeline de visi\xF3n"}],title:"Pipelines para inferencia"};function Ml(ra){return Pl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Hl extends kl{constructor(u){super();wl(this,u,Ml,Dl,yl,{})}}export{Hl as default,Al as metadata};
