import{s as qe,n as Se,o as Be}from"../chunks/scheduler.9bc65507.js";import{S as Ge,i as ze,g as a,s as o,u as z,A as Pe,h as s,f as t,c as r,j as c,v as P,y as p,k as i,o as h,a as l,w as X,d as R,t as W,x as V}from"../chunks/index.78c82d43.js";import{I as me}from"../chunks/IconCopyLink.bedaa44d.js";import{C as Xe}from"../chunks/CodeBlock.73e038be.js";function Re(ye){let u,Y,F,Q,d,g,H,M,fe,Z,Te="FLAN-UL2",O,m,w,q,b,ve,U,Me="Overview",K,_,be=`Flan-UL2 is an encoder decoder model based on the T5 architecture. It uses the same configuration as the <a href="ul2">UL2</a> model released earlier last year.
It was fine tuned using the “Flan” prompt tuning and dataset collection. Similiar to <code>Flan-T5</code>,  one can directly use FLAN-UL2 weights without finetuning the model:`,D,k,_e="According ot the original blog here are the notable improvements:",ee,$,ke=`<li>The original UL2 model was only trained with receptive field of 512, which made it non-ideal for N-shot prompting where N is large.</li> <li>The Flan-UL2 checkpoint uses a receptive field of 2048 which makes it more usable for few-shot in-context learning.</li> <li>The original UL2 model also had mode switch tokens that was rather mandatory to get good performance. However, they were a little cumbersome as this requires often some changes during inference or finetuning. In this update/change, we continue training UL2 20B for an additional 100k steps (with small batch) to forget “mode tokens” before applying Flan instruction tuning. This Flan-UL2 checkpoint does not require mode tokens anymore.
Google has released the following variants:</li>`,te,x,$e='One can refer to <a href="t5">T5’s documentation page</a> for all tips, code examples and notebooks. As well as the FLAN-T5 model card for more details regarding training and evaluation of the model.',ne,j,xe='The original checkpoints can be found <a href="https://github.com/google-research/t5x/blob/main/docs/models.md#flan-ul2-checkpoints" rel="nofollow">here</a>.',le,f,y,S,C,ge,A,je="Running on low resource devices",ae,E,Ce="The model is pretty heavy (~40GB in half precision) so if you just want to run the model, make sure you load your model in 8bit, and use <code>device_map=&quot;auto&quot;</code> to make sure  you don’t have any OOM issue!",se,L,oe,v,T,B,J,we,N,Ee="Inference",re,I,Le='The inference protocol is exaclty the same as any <code>T5</code> model, please have a look at the <a href="t5">T5’s documentation page</a> for more details.',ie,G,he;return M=new me({}),b=new me({}),C=new me({}),L=new Xe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclNlcTJTZXFMTSUyQyUyMEF1dG9Ub2tlbml6ZXIlMEElMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvclNlcTJTZXFMTS5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGZmxhbi11bDIlMjIlMkMlMjBsb2FkX2luXzhiaXQlM0RUcnVlJTJDJTIwZGV2aWNlX21hcCUzRCUyMmF1dG8lMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGZmxhbi11bDIlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkElMjBzdGVwJTIwYnklMjBzdGVwJTIwcmVjaXBlJTIwdG8lMjBtYWtlJTIwYm9sb2duZXNlJTIwcGFzdGElM0ElMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSgqKmlucHV0cyklMEFwcmludCh0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKG91dHB1dHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSkp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForSeq2SeqLM, AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForSeq2SeqLM.from_pretrained(<span class="hljs-string">&quot;google/flan-ul2&quot;</span>, load_in_8bit=<span class="hljs-literal">True</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/flan-ul2&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;A step by step recipe to make bolognese pasta:&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.batch_decode(outputs, skip_special_tokens=<span class="hljs-literal">True</span>))
[<span class="hljs-string">&#x27;In a large skillet, brown the ground beef and onion over medium heat. Add the garlic&#x27;</span>]`,wrap:!1}}),J=new me({}),{c(){u=a("meta"),Y=o(),F=a("p"),Q=o(),d=a("h1"),g=a("a"),H=a("span"),z(M.$$.fragment),fe=o(),Z=a("span"),Z.textContent=Te,O=o(),m=a("h2"),w=a("a"),q=a("span"),z(b.$$.fragment),ve=o(),U=a("span"),U.textContent=Me,K=o(),_=a("p"),_.innerHTML=be,D=o(),k=a("p"),k.textContent=_e,ee=o(),$=a("ul"),$.innerHTML=ke,te=o(),x=a("p"),x.innerHTML=$e,ne=o(),j=a("p"),j.innerHTML=xe,le=o(),f=a("h2"),y=a("a"),S=a("span"),z(C.$$.fragment),ge=o(),A=a("span"),A.textContent=je,ae=o(),E=a("p"),E.innerHTML=Ce,se=o(),z(L.$$.fragment),oe=o(),v=a("h2"),T=a("a"),B=a("span"),z(J.$$.fragment),we=o(),N=a("span"),N.textContent=Ee,re=o(),I=a("p"),I.innerHTML=Le,ie=o(),G=a("p"),this.h()},l(e){const n=Pe("svelte-1phssyn",document.head);u=s(n,"META",{name:!0,content:!0}),n.forEach(t),Y=r(e),F=s(e,"P",{}),c(F).forEach(t),Q=r(e),d=s(e,"H1",{class:!0});var ce=c(d);g=s(ce,"A",{id:!0,class:!0,href:!0});var Je=c(g);H=s(Je,"SPAN",{});var Ie=c(H);P(M.$$.fragment,Ie),Ie.forEach(t),Je.forEach(t),fe=r(ce),Z=s(ce,"SPAN",{"data-svelte-h":!0}),p(Z)!=="svelte-7yc1oy"&&(Z.textContent=Te),ce.forEach(t),O=r(e),m=s(e,"H2",{class:!0});var pe=c(m);w=s(pe,"A",{id:!0,class:!0,href:!0});var Ze=c(w);q=s(Ze,"SPAN",{});var Ue=c(q);P(b.$$.fragment,Ue),Ue.forEach(t),Ze.forEach(t),ve=r(pe),U=s(pe,"SPAN",{"data-svelte-h":!0}),p(U)!=="svelte-1jsw1pg"&&(U.textContent=Me),pe.forEach(t),K=r(e),_=s(e,"P",{"data-svelte-h":!0}),p(_)!=="svelte-1avabrz"&&(_.innerHTML=be),D=r(e),k=s(e,"P",{"data-svelte-h":!0}),p(k)!=="svelte-5nsd8"&&(k.textContent=_e),ee=r(e),$=s(e,"UL",{"data-svelte-h":!0}),p($)!=="svelte-145gzzg"&&($.innerHTML=ke),te=r(e),x=s(e,"P",{"data-svelte-h":!0}),p(x)!=="svelte-lmluq6"&&(x.innerHTML=$e),ne=r(e),j=s(e,"P",{"data-svelte-h":!0}),p(j)!=="svelte-tjdjai"&&(j.innerHTML=xe),le=r(e),f=s(e,"H2",{class:!0});var ue=c(f);y=s(ue,"A",{id:!0,class:!0,href:!0});var Ae=c(y);S=s(Ae,"SPAN",{});var Ne=c(S);P(C.$$.fragment,Ne),Ne.forEach(t),Ae.forEach(t),ge=r(ue),A=s(ue,"SPAN",{"data-svelte-h":!0}),p(A)!=="svelte-1jsev52"&&(A.textContent=je),ue.forEach(t),ae=r(e),E=s(e,"P",{"data-svelte-h":!0}),p(E)!=="svelte-1qrqz37"&&(E.innerHTML=Ce),se=r(e),P(L.$$.fragment,e),oe=r(e),v=s(e,"H2",{class:!0});var de=c(v);T=s(de,"A",{id:!0,class:!0,href:!0});var Fe=c(T);B=s(Fe,"SPAN",{});var He=c(B);P(J.$$.fragment,He),He.forEach(t),Fe.forEach(t),we=r(de),N=s(de,"SPAN",{"data-svelte-h":!0}),p(N)!=="svelte-199uz7g"&&(N.textContent=Ee),de.forEach(t),re=r(e),I=s(e,"P",{"data-svelte-h":!0}),p(I)!=="svelte-vt95nc"&&(I.innerHTML=Le),ie=r(e),G=s(e,"P",{}),c(G).forEach(t),this.h()},h(){i(u,"name","hf:doc:metadata"),i(u,"content",JSON.stringify(We)),i(g,"id","flanul2"),i(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"),i(g,"href","#flanul2"),i(d,"class","relative group"),i(w,"id","overview"),i(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"),i(w,"href","#overview"),i(m,"class","relative group"),i(y,"id","running-on-low-resource-devices"),i(y,"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"),i(y,"href","#running-on-low-resource-devices"),i(f,"class","relative group"),i(T,"id","inference"),i(T,"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"),i(T,"href","#inference"),i(v,"class","relative group")},m(e,n){h(document.head,u),l(e,Y,n),l(e,F,n),l(e,Q,n),l(e,d,n),h(d,g),h(g,H),X(M,H,null),h(d,fe),h(d,Z),l(e,O,n),l(e,m,n),h(m,w),h(w,q),X(b,q,null),h(m,ve),h(m,U),l(e,K,n),l(e,_,n),l(e,D,n),l(e,k,n),l(e,ee,n),l(e,$,n),l(e,te,n),l(e,x,n),l(e,ne,n),l(e,j,n),l(e,le,n),l(e,f,n),h(f,y),h(y,S),X(C,S,null),h(f,ge),h(f,A),l(e,ae,n),l(e,E,n),l(e,se,n),X(L,e,n),l(e,oe,n),l(e,v,n),h(v,T),h(T,B),X(J,B,null),h(v,we),h(v,N),l(e,re,n),l(e,I,n),l(e,ie,n),l(e,G,n),he=!0},p:Se,i(e){he||(R(M.$$.fragment,e),R(b.$$.fragment,e),R(C.$$.fragment,e),R(L.$$.fragment,e),R(J.$$.fragment,e),he=!0)},o(e){W(M.$$.fragment,e),W(b.$$.fragment,e),W(C.$$.fragment,e),W(L.$$.fragment,e),W(J.$$.fragment,e),he=!1},d(e){e&&(t(Y),t(F),t(Q),t(d),t(O),t(m),t(K),t(_),t(D),t(k),t(ee),t($),t(te),t(x),t(ne),t(j),t(le),t(f),t(ae),t(E),t(se),t(oe),t(v),t(re),t(I),t(ie),t(G)),t(u),V(M),V(b),V(C),V(L,e),V(J)}}}const We={local:"flanul2",sections:[{local:"overview",title:"Overview"},{local:"running-on-low-resource-devices",title:"Running on low resource devices"},{local:"inference",title:"Inference"}],title:"FLAN-UL2"};function Ve(ye){return Be(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class De extends Ge{constructor(u){super(),ze(this,u,Ve,Re,qe,{})}}export{De as component};
