import{S as Vs,i as Ys,s as Hs,e as s,k as c,w as T,t as n,M as Qs,c as a,d as t,m,a as i,x as P,h as r,b as h,G as e,g as p,y as $,q as M,o as C,B as E,v as Ks,L as Rs}from"../../chunks/vendor-hf-doc-builder.js";import{T as pn}from"../../chunks/Tip-hf-doc-builder.js";import{D as No}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Nt}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as vt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Xs}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function ea(W){let d,y,f,_,w,u,g,x,be,Se,U,q,ve,ee,ye,we,ao,se,j,io,L,lo,co,ke,b,mo,ae,ie,ho,de,le,po,ce,X,We,R,fo,qe,V,oe,uo,te,go,_o,me,ne,Ae,Y,bo,Ze,D,Ue,he,Le,I,re,pe,A,vo,O,yo,wo,G,ko,To;return{c(){d=s("p"),y=n("The "),f=s("code"),_=n("Persimmon"),w=n(" models were trained using "),u=s("code"),g=n("bfloat16"),x=n(", but the original inference uses "),be=s("code"),Se=n("float16"),U=n(" The checkpoints uploaded on the hub use "),q=s("code"),ve=n("torch_dtype = 'float16'"),ee=n(` which will be
used by the `),ye=s("code"),we=n("AutoModel"),ao=n(" API to cast the checkpoints from "),se=s("code"),j=n("torch.float32"),io=n(" to "),L=s("code"),lo=n("torch.float16"),co=n("."),ke=c(),b=s("p"),mo=n("The "),ae=s("code"),ie=n("dtype"),ho=n(" of the online weights is mostly irrelevant, unless you are using "),de=s("code"),le=n('torch_dtype="auto"'),po=n(" when initializing a model using "),ce=s("code"),X=n('model = AutoModelForCausalLM.from_pretrained("path", torch_dtype = "auto")'),We=n(". The reason is that the model will first be downloaded ( using the "),R=s("code"),fo=n("dtype"),qe=n(" of the checkpoints online) then it will be cast to the default "),V=s("code"),oe=n("dtype"),uo=n(" of "),te=s("code"),go=n("torch"),_o=n(" (becomes "),me=s("code"),ne=n("torch.float32"),Ae=n("). Users should specify the "),Y=s("code"),bo=n("torch_dtype"),Ze=n(" they want, and if they don\u2019t it will be "),D=s("code"),Ue=n("torch.float32"),he=n("."),Le=c(),I=s("p"),re=n("Finetuning the model in "),pe=s("code"),A=n("float16"),vo=n(" is not recommended and known to produce "),O=s("code"),yo=n("nan"),wo=n(", as such the model should be fine-tuned in "),G=s("code"),ko=n("bfloat16"),To=n(".")},l(z){d=a(z,"P",{});var v=i(d);y=r(v,"The "),f=a(v,"CODE",{});var De=i(f);_=r(De,"Persimmon"),De.forEach(t),w=r(v," models were trained using "),u=a(v,"CODE",{});var J=i(u);g=r(J,"bfloat16"),J.forEach(t),x=r(v,", but the original inference uses "),be=a(v,"CODE",{});var Bo=i(be);Se=r(Bo,"float16"),Bo.forEach(t),U=r(v," The checkpoints uploaded on the hub use "),q=a(v,"CODE",{});var Oe=i(q);ve=r(Oe,"torch_dtype = 'float16'"),Oe.forEach(t),ee=r(v,` which will be
used by the `),ye=a(v,"CODE",{});var jo=i(ye);we=r(jo,"AutoModel"),jo.forEach(t),ao=r(v," API to cast the checkpoints from "),se=a(v,"CODE",{});var Xo=i(se);j=r(Xo,"torch.float32"),Xo.forEach(t),io=r(v," to "),L=a(v,"CODE",{});var Ge=i(L);lo=r(Ge,"torch.float16"),Ge.forEach(t),co=r(v,"."),v.forEach(t),ke=m(z),b=a(z,"P",{});var k=i(b);mo=r(k,"The "),ae=a(k,"CODE",{});var Ro=i(ae);ie=r(Ro,"dtype"),Ro.forEach(t),ho=r(k," of the online weights is mostly irrelevant, unless you are using "),de=a(k,"CODE",{});var Ne=i(de);le=r(Ne,'torch_dtype="auto"'),Ne.forEach(t),po=r(k," when initializing a model using "),ce=a(k,"CODE",{});var Vo=i(ce);X=r(Vo,'model = AutoModelForCausalLM.from_pretrained("path", torch_dtype = "auto")'),Vo.forEach(t),We=r(k,". The reason is that the model will first be downloaded ( using the "),R=a(k,"CODE",{});var Yo=i(R);fo=r(Yo,"dtype"),Yo.forEach(t),qe=r(k," of the checkpoints online) then it will be cast to the default "),V=a(k,"CODE",{});var Be=i(V);oe=r(Be,"dtype"),Be.forEach(t),uo=r(k," of "),te=a(k,"CODE",{});var Ho=i(te);go=r(Ho,"torch"),Ho.forEach(t),_o=r(k," (becomes "),me=a(k,"CODE",{});var Qo=i(me);ne=r(Qo,"torch.float32"),Qo.forEach(t),Ae=r(k,"). Users should specify the "),Y=a(k,"CODE",{});var je=i(Y);bo=r(je,"torch_dtype"),je.forEach(t),Ze=r(k," they want, and if they don\u2019t it will be "),D=a(k,"CODE",{});var Ko=i(D);Ue=r(Ko,"torch.float32"),Ko.forEach(t),he=r(k,"."),k.forEach(t),Le=m(z),I=a(z,"P",{});var H=i(I);re=r(H,"Finetuning the model in "),pe=a(H,"CODE",{});var et=i(pe);A=r(et,"float16"),et.forEach(t),vo=r(H," is not recommended and known to produce "),O=a(H,"CODE",{});var Xe=i(O);yo=r(Xe,"nan"),Xe.forEach(t),wo=r(H,", as such the model should be fine-tuned in "),G=a(H,"CODE",{});var Te=i(G);ko=r(Te,"bfloat16"),Te.forEach(t),To=r(H,"."),H.forEach(t)},m(z,v){p(z,d,v),e(d,y),e(d,f),e(f,_),e(d,w),e(d,u),e(u,g),e(d,x),e(d,be),e(be,Se),e(d,U),e(d,q),e(q,ve),e(d,ee),e(d,ye),e(ye,we),e(d,ao),e(d,se),e(se,j),e(d,io),e(d,L),e(L,lo),e(d,co),p(z,ke,v),p(z,b,v),e(b,mo),e(b,ae),e(ae,ie),e(b,ho),e(b,de),e(de,le),e(b,po),e(b,ce),e(ce,X),e(b,We),e(b,R),e(R,fo),e(b,qe),e(b,V),e(V,oe),e(b,uo),e(b,te),e(te,go),e(b,_o),e(b,me),e(me,ne),e(b,Ae),e(b,Y),e(Y,bo),e(b,Ze),e(b,D),e(D,Ue),e(b,he),p(z,Le,v),p(z,I,v),e(I,re),e(I,pe),e(pe,A),e(I,vo),e(I,O),e(O,yo),e(I,wo),e(I,G),e(G,ko),e(I,To)},d(z){z&&t(d),z&&t(ke),z&&t(b),z&&t(Le),z&&t(I)}}}function oa(W){let d,y;return d=new Nt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFBlcnNpbW1vbk1vZGVsJTJDJTIwUGVyc2ltbW9uQ29uZmlnJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFBlcnNpbW1vbiUyMHBlcnNpbW1vbi03YiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBQZXJzaW1tb25Db25maWcoKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> PersimmonModel, PersimmonConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Persimmon persimmon-7b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = PersimmonConfig()`}}),{c(){T(d.$$.fragment)},l(f){P(d.$$.fragment,f)},m(f,_){$(d,f,_),y=!0},p:Rs,i(f){y||(M(d.$$.fragment,f),y=!0)},o(f){C(d.$$.fragment,f),y=!1},d(f){E(d,f)}}}function ta(W){let d,y,f,_,w;return{c(){d=s("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s("code"),_=n("Module"),w=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(u){d=a(u,"P",{});var g=i(d);y=r(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a(g,"CODE",{});var x=i(f);_=r(x,"Module"),x.forEach(t),w=r(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(t)},m(u,g){p(u,d,g),e(d,y),e(d,f),e(f,_),e(d,w)},d(u){u&&t(d)}}}function na(W){let d,y,f,_,w;return{c(){d=s("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s("code"),_=n("Module"),w=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(u){d=a(u,"P",{});var g=i(d);y=r(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a(g,"CODE",{});var x=i(f);_=r(x,"Module"),x.forEach(t),w=r(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(t)},m(u,g){p(u,d,g),e(d,y),e(d,f),e(f,_),e(d,w)},d(u){u&&t(d)}}}function ra(W){let d,y,f,_,w;return _=new Nt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBQZXJzaW1tb25Gb3JDYXVzYWxMTSUwQSUwQW1vZGVsJTIwJTNEJTIwUGVyc2ltbW9uRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMkFydGh1clolMkZwZXJzaW1tb24tOGItYmFzZSUyMikuY3VkYSgpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyQXJ0aHVyWiUyRnBlcnNpbW1vbi04Yi1iYXNlJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMmh1bWFuJTNBJTIwSGV5JTJDJTIwd2hhdCUyMHNob3VsZCUyMEklMjBlYXQlMjBmb3IlMjBkaW5uZXIlM0YlMjIlMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIocHJvbXB0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikuY3VkYSgpJTBBJTBBJTIzJTIwR2VuZXJhdGUlMEFnZW5lcmF0ZV9pZHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZShpbnB1dHMuaW5wdXRfaWRzJTJDJTIwbWF4X2xlbmd0aCUzRDMwKSUwQXRva2VuaXplci5iYXRjaF9kZWNvZGUoZ2VuZXJhdGVfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUlMkMlMjBjbGVhbl91cF90b2tlbml6YXRpb25fc3BhY2VzJTNERmFsc2UpJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, PersimmonForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = PersimmonForCausalLM.from_pretrained(<span class="hljs-string">&quot;ArthurZ/persimmon-8b-base&quot;</span>).cuda()
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;ArthurZ/persimmon-8b-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;human: Hey, what should I eat for dinner?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(prompt, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).cuda()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Generate</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>generate_ids = model.generate(inputs.input_ids, max_length=<span class="hljs-number">30</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(generate_ids, skip_special_tokens=<span class="hljs-literal">True</span>, clean_up_tokenization_spaces=<span class="hljs-literal">False</span>)[<span class="hljs-number">0</span>]
<span class="hljs-string">&#x27;human: Hey, what should I eat for dinner?\\n\\ncat: \u{1F431}\\n\\nhuman: \u{1F610}\\n\\n&#x27;</span>`}}),{c(){d=s("p"),y=n("Example:"),f=c(),T(_.$$.fragment)},l(u){d=a(u,"P",{});var g=i(d);y=r(g,"Example:"),g.forEach(t),f=m(u),P(_.$$.fragment,u)},m(u,g){p(u,d,g),e(d,y),p(u,f,g),$(_,u,g),w=!0},p:Rs,i(u){w||(M(_.$$.fragment,u),w=!0)},o(u){C(_.$$.fragment,u),w=!1},d(u){u&&t(d),u&&t(f),E(_,u)}}}function sa(W){let d,y,f,_,w;return{c(){d=s("p"),y=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s("code"),_=n("Module"),w=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(u){d=a(u,"P",{});var g=i(d);y=r(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a(g,"CODE",{});var x=i(f);_=r(x,"Module"),x.forEach(t),w=r(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(t)},m(u,g){p(u,d,g),e(d,y),e(d,f),e(f,_),e(d,w)},d(u){u&&t(d)}}}function aa(W){let d,y,f,_,w,u,g,x,be,Se,U,q,ve,ee,ye,we,ao,se,j,io,L,lo,co,ke,b,mo,ae,ie,ho,de,le,po,ce,X,We,R,fo,qe,V,oe,uo,te,go,_o,me,ne,Ae,Y,bo,Ze,D,Ue,he,Le,I,re,pe,A,vo,O,yo,wo,G,ko,To,z,v,De,J,Bo,Oe,jo,Xo,Ge,k,Ro,Ne,Vo,Yo,Be,Ho,Qo,je,Ko,H,et,Xe,Te,fn,yt,un,Bt,Pe,Re,wt,Po,gn,kt,_n,jt,N,$o,bn,$e,vn,ot,yn,wn,Mo,kn,Tn,Pn,Me,$n,tt,Mn,Cn,nt,En,zn,Fn,Ve,Xt,Ce,Ye,Tt,Co,xn,Pt,Jn,Rt,S,Eo,In,zo,Sn,rt,Wn,qn,An,Fo,Zn,xo,Un,Ln,Dn,He,On,$t,Gn,Nn,Mt,Bn,jn,fe,Jo,Xn,Ee,Rn,st,Vn,Yn,Ct,Hn,Qn,Kn,Qe,Vt,ze,Ke,Et,Io,er,zt,or,Yt,Fe,So,tr,Q,Wo,nr,xe,rr,at,sr,ar,Ft,ir,dr,lr,eo,cr,oo,Ht,Je,to,xt,qo,mr,Jt,hr,Qt,F,Ao,pr,It,fr,ur,it,dt,gr,_r,br,B,vr,St,yr,wr,Wt,kr,Tr,qt,Pr,$r,At,Mr,Cr,Er,Zo,zr,lt,Fr,xr,Jr,Uo,Ir,Lo,Sr,Wr,qr,ue,Do,Ar,Ie,Zr,ct,Ur,Lr,Zt,Dr,Or,Gr,no,Kt;return u=new vt({}),ee=new vt({}),X=new pn({props:{warning:!0,$$slots:{default:[ea]},$$scope:{ctx:W}}}),ne=new Nt({props:{code:"Z2l0JTIwY2xvbmUlMjBodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkZwZXJzaW1tb24tYWktbGFicyUyRmFkZXB0LWluZmVyZW5jZSUwQXdnZXQlMjBodHRwcyUzQSUyRiUyRmF4dGtuNHhsNWNpcC5vYmplY3RzdG9yYWdlLnVzLXBob2VuaXgtMS5vY2kuY3VzdG9tZXItb2NpLmNvbSUyRm4lMkZheHRrbjR4bDVjaXAlMkZiJTJGYWRlcHQtcHVibGljLWRhdGElMkZvJTJGOGJfYmFzZV9tb2RlbF9yZWxlYXNlLnRhciUwQXRhciUyMC14dmYlMjA4Yl9iYXNlX21vZGVsX3JlbGVhc2UudGFyJTBBcHl0aG9uJTIwc3JjJTJGdHJhbnNmb3JtZXJzJTJGbW9kZWxzJTJGcGVyc2ltbW9uJTJGY29udmVydF9wZXJzaW1tb25fd2VpZ2h0c190b19oZi5weSUyMCUyMC0taW5wdXRfZGlyJTIwJTJGcGF0aCUyRnRvJTJGZG93bmxvYWRlZCUyRnBlcnNpbW1vbiUyRndlaWdodHMlMkYlMjAtLW91dHB1dF9kaXIlMjAlMkZvdXRwdXQlMkZwYXRoJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wdF9tb2RlbF9wYXRoJTIwJTJGcGF0aCUyRnRvJTJGOGJfY2hhdF9tb2RlbF9yZWxlYXNlJTJGaXRlcl8wMDAxMjUxJTJGbXBfcmFua18wMCUyRm1vZGVsX29wdGltX3JuZy5wdCUwQSUyMCUyMCUyMCUyMC0tYWRhX2xpYl9wYXRoJTIwJTJGcGF0aCUyRnRvJTJGYWRlcHQtaW5mZXJlbmNl",highlighted:`git <span class="hljs-built_in">clone</span> https://github.com/persimmon-ai-labs/adept-inference
wget https://axtkn4xl5cip.objectstorage.us-phoenix-1.oci.customer-oci.com/n/axtkn4xl5cip/b/adept-public-data/o/8b_base_model_release.tar
tar -xvf 8b_base_model_release.tar
python src/transformers/models/persimmon/convert_persimmon_weights_to_hf.py  --input_dir /path/to/downloaded/persimmon/weights/ --output_dir /output/path \\
    --pt_model_path /path/to/8b_chat_model_release/iter_0001251/mp_rank_00/model_optim_rng.pt
    --ada_lib_path /path/to/adept-inference`}}),D=new Nt({props:{code:"d2dldCUyMGh0dHBzJTNBJTJGJTJGYXh0a240eGw1Y2lwLm9iamVjdHN0b3JhZ2UudXMtcGhvZW5peC0xLm9jaS5jdXN0b21lci1vY2kuY29tJTJGbiUyRmF4dGtuNHhsNWNpcCUyRmIlMkZhZGVwdC1wdWJsaWMtZGF0YSUyRm8lMkY4Yl9jaGF0X21vZGVsX3JlbGVhc2UudGFyJTBBdGFyJTIwLXh2ZiUyMDhiX2Jhc2VfbW9kZWxfcmVsZWFzZS50YXI=",highlighted:`wget https://axtkn4xl5cip.objectstorage.us-phoenix-1.oci.customer-oci.com/n/axtkn4xl5cip/b/adept-public-data/o/8b_chat_model_release.tar
tar -xvf 8b_base_model_release.tar`}}),re=new Nt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFBlcnNpbW1vbkZvckNhdXNhbExNJTJDJTIwUGVyc2ltbW9uVG9rZW5pemVyJTBBJTBBbW9kZWwlMjAlM0QlMjBQZXJzaW1tb25Gb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIyJTJGb3V0cHV0JTJGcGF0aCUyMiklMEF0b2tlbml6ZXIlMjAlM0QlMjBQZXJzaW1tb25Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMiUyRm91dHB1dCUyRnBhdGglMjIp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> PersimmonForCausalLM, PersimmonTokenizer

model = PersimmonForCausalLM.from_pretrained(<span class="hljs-string">&quot;/output/path&quot;</span>)
tokenizer = PersimmonTokenizer.from_pretrained(<span class="hljs-string">&quot;/output/path&quot;</span>)`}}),Po=new vt({}),$o=new No({props:{name:"class transformers.PersimmonConfig",anchor:"transformers.PersimmonConfig",parameters:[{name:"vocab_size",val:" = 262144"},{name:"hidden_size",val:" = 4096"},{name:"intermediate_size",val:" = 16384"},{name:"num_hidden_layers",val:" = 36"},{name:"num_attention_heads",val:" = 64"},{name:"hidden_act",val:" = 'relu2'"},{name:"max_position_embeddings",val:" = 16384"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"use_cache",val:" = True"},{name:"tie_word_embeddings",val:" = False"},{name:"rope_theta",val:" = 25000.0"},{name:"rope_scaling",val:" = None"},{name:"qk_layernorm",val:" = True"},{name:"hidden_dropout",val:" = 0.0"},{name:"attention_dropout",val:" = 0.0"},{name:"partial_rotary_factor",val:" = 0.5"},{name:"pad_token_id",val:" = None"},{name:"bos_token_id",val:" = 1"},{name:"eos_token_id",val:" = 2"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.PersimmonConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 262144) &#x2014;
Vocabulary size of the Persimmon model. Defines the number of different tokens that can be represented by
the <code>inputs_ids</code> passed when calling <a href="/docs/transformers/main/en/model_doc/persimmon#transformers.PersimmonModel">PersimmonModel</a>`,name:"vocab_size"},{anchor:"transformers.PersimmonConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Dimension of the hidden representations.`,name:"hidden_size"},{anchor:"transformers.PersimmonConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 16384) &#x2014;
Dimension of the MLP representations.`,name:"intermediate_size"},{anchor:"transformers.PersimmonConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 36) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.PersimmonConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.PersimmonConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;relu2&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the decoder.`,name:"hidden_act"},{anchor:"transformers.PersimmonConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 16384) &#x2014;
The maximum sequence length that this model might ever be used with.`,name:"max_position_embeddings"},{anchor:"transformers.PersimmonConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.PersimmonConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The epsilon used by the rms normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.PersimmonConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models). Only
relevant if <code>config.is_decoder=True</code>.`,name:"use_cache"},{anchor:"transformers.PersimmonConfig.tie_word_embeddings(bool,",description:`<strong>tie_word_embeddings(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to tie weight embeddings`,name:"tie_word_embeddings(bool,"},{anchor:"transformers.PersimmonConfig.rope_theta",description:`<strong>rope_theta</strong> (<code>float</code>, <em>optional</em>, defaults to 25000.0) &#x2014;
The base period of the RoPE embeddings.`,name:"rope_theta"},{anchor:"transformers.PersimmonConfig.rope_scaling",description:`<strong>rope_scaling</strong> (<code>Dict</code>, <em>optional</em>) &#x2014;
Dictionary containing the scaling configuration for the RoPE embeddings. Currently supports two scaling
strategies: linear and dynamic. Their scaling factor must be an float greater than 1. The expected format
is <code>{&quot;type&quot;: strategy name, &quot;factor&quot;: scaling factor}</code>. When using this flag, don&#x2019;t update
<code>max_position_embeddings</code> to the expected new maximum. See the following thread for more information on how
these scaling strategies behave:
<a href="https://www.reddit.com/r/LocalPersimmon/comments/14mrgpr/dynamically_scaled_rope_further_increases/" rel="nofollow">https://www.reddit.com/r/LocalPersimmon/comments/14mrgpr/dynamically_scaled_rope_further_increases/</a>. This
is an experimental feature, subject to breaking API changes in future versions.`,name:"rope_scaling"},{anchor:"transformers.PersimmonConfig.qk_layernorm",description:`<strong>qk_layernorm</strong> (<code>bool</code>, <em>optional</em>, default to <code>True</code>) &#x2014;
Whether or not to normalize the Queries and Keys after projecting the hidden states`,name:"qk_layernorm"},{anchor:"transformers.PersimmonConfig.hidden_dropout",description:`<strong>hidden_dropout</strong> (<code>float</code>, <em>optional</em>, default to 0.0) &#x2014;
The dropout ratio after applying the MLP to the hidden states.`,name:"hidden_dropout"},{anchor:"transformers.PersimmonConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, default to 0.0) &#x2014;
The dropout ratio after computing the attention scores.`,name:"attention_dropout"},{anchor:"transformers.PersimmonConfig.partial_rotary_factor",description:`<strong>partial_rotary_factor</strong> (<code>float</code>, <em>optional</em>, default to 0.5) &#x2014;
Percentage of the query and keys which will have rotary embedding.</p>
<p>Example &#x2014;`,name:"partial_rotary_factor"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/persimmon/configuration_persimmon.py#L28"}}),Ve=new Xs({props:{anchor:"transformers.PersimmonConfig.example",$$slots:{default:[oa]},$$scope:{ctx:W}}}),Co=new vt({}),Eo=new No({props:{name:"class transformers.PersimmonModel",anchor:"transformers.PersimmonModel",parameters:[{name:"config",val:": PersimmonConfig"}],parametersDescription:[{anchor:"transformers.PersimmonModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/persimmon#transformers.PersimmonConfig">PersimmonConfig</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.
config &#x2014; PersimmonConfig`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/persimmon/modeling_persimmon.py#L548"}}),Jo=new No({props:{name:"forward",anchor:"transformers.PersimmonModel.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.List[torch.FloatTensor]] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.PersimmonModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.PersimmonModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"attention_mask"},{anchor:"transformers.PersimmonModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.PersimmonModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) &#x2014;
Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and 2 additional tensors of shape
<code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.PersimmonModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.PersimmonModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.PersimmonModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.PersimmonModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.PersimmonModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/persimmon/modeling_persimmon.py#L599"}}),Qe=new pn({props:{$$slots:{default:[ta]},$$scope:{ctx:W}}}),Io=new vt({}),So=new No({props:{name:"class transformers.PersimmonForCausalLM",anchor:"transformers.PersimmonForCausalLM",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/persimmon/modeling_persimmon.py#L727"}}),Wo=new No({props:{name:"forward",anchor:"transformers.PersimmonForCausalLM.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.List[torch.FloatTensor]] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.PersimmonForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.PersimmonForCausalLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"attention_mask"},{anchor:"transformers.PersimmonForCausalLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.PersimmonForCausalLM.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) &#x2014;
Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and 2 additional tensors of shape
<code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.PersimmonForCausalLM.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.PersimmonForCausalLM.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.PersimmonForCausalLM.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.PersimmonForCausalLM.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.PersimmonForCausalLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.</p>
<p>Args &#x2014;
labels (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>):
Labels for computing the masked language modeling loss. Indices should either be in <code>[0, ..., config.vocab_size]</code> or -100 (see <code>input_ids</code> docstring). Tokens with indices set to <code>-100</code> are ignored
(masked), the loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/persimmon/modeling_persimmon.py#L764",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/persimmon#transformers.PersimmonConfig"
>PersimmonConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Language modeling loss (for next-token prediction).</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>)</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),eo=new pn({props:{$$slots:{default:[na]},$$scope:{ctx:W}}}),oo=new Xs({props:{anchor:"transformers.PersimmonForCausalLM.forward.example",$$slots:{default:[ra]},$$scope:{ctx:W}}}),qo=new vt({}),Ao=new No({props:{name:"class transformers.PersimmonForSequenceClassification",anchor:"transformers.PersimmonForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.PersimmonForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/persimmon#transformers.PersimmonConfig">PersimmonConfig</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/persimmon/modeling_persimmon.py#L909"}}),Do=new No({props:{name:"forward",anchor:"transformers.PersimmonForSequenceClassification.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.List[torch.FloatTensor]] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.PersimmonForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.PersimmonForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"attention_mask"},{anchor:"transformers.PersimmonForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.PersimmonForSequenceClassification.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) &#x2014;
Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and 2 additional tensors of shape
<code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.PersimmonForSequenceClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.PersimmonForSequenceClassification.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.PersimmonForSequenceClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.PersimmonForSequenceClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.PersimmonForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.PersimmonForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/persimmon/modeling_persimmon.py#L925"}}),no=new pn({props:{$$slots:{default:[sa]},$$scope:{ctx:W}}}),{c(){d=s("meta"),y=c(),f=s("h1"),_=s("a"),w=s("span"),T(u.$$.fragment),g=c(),x=s("span"),be=n("Persimmon"),Se=c(),U=s("h2"),q=s("a"),ve=s("span"),T(ee.$$.fragment),ye=c(),we=s("span"),ao=n("Overview"),se=c(),j=s("p"),io=n("The Persimmon model was created by "),L=s("a"),lo=n("ADEPT"),co=n(", and authored by Erich Elsen, Augustus Odena, Maxwell Nye, Sa\u011Fnak Ta\u015F\u0131rlar, Tri Dao, Curtis Hawthorne, Deepak Moparthi, Arushi Somani."),ke=c(),b=s("p"),mo=n("The authors introduced Persimmon-8B, a decoder model based on the classic transformers architecture, with query and key normalization. Persimmon-8B is a fully permissively-licensed model with approximately 8 billion parameters, released under the Apache license.  Some of the key attributes of Persimmon-8B are long context size (16K), performance, and capabilities for multimodal extensions."),ae=c(),ie=s("p"),ho=n("The authors showcase their approach to model evaluation, focusing on practical text generation, mirroring how users interact with language models. The work also includes a comparative analysis, pitting Persimmon-8B against other prominent models (MPT 7B Instruct and Llama 2 Base 7B 1-Shot), across various evaluation tasks. The results demonstrate Persimmon-8B\u2019s competitive performance, even with limited training data."),de=c(),le=s("p"),po=n("In terms of model details, the work outlines the architecture and training methodology of Persimmon-8B, providing insights into its design choices, sequence length, and dataset composition. The authors present a fast inference code that outperforms traditional implementations through operator fusion and CUDA graph utilization while maintaining code coherence. They express their anticipation of how the community will leverage this contribution to drive innovation, hinting at further upcoming releases as part of an ongoing series of developments."),ce=c(),T(X.$$.fragment),We=c(),R=s("p"),fo=n("Tips:"),qe=c(),V=s("ul"),oe=s("li"),uo=n("To convert the model, you need to clone the original repository using "),te=s("code"),go=n("git clone https://github.com/persimmon-ai-labs/adept-inference"),_o=n(", then get the checkpoints:"),me=c(),T(ne.$$.fragment),Ae=c(),Y=s("p"),bo=n("For the chat model:"),Ze=c(),T(D.$$.fragment),Ue=c(),he=s("p"),Le=n("Thereafter, models can be loaded via:"),I=c(),T(re.$$.fragment),pe=c(),A=s("p"),vo=n("This model was contributed by "),O=s("a"),yo=n("ArthurZ"),wo=n(`.
The original code can be found `),G=s("a"),ko=n("here"),To=n("."),z=c(),v=s("ul"),De=s("li"),J=s("p"),Bo=n("Perismmon uses a "),Oe=s("code"),jo=n("sentencepiece"),Xo=n(" based tokenizer, with a "),Ge=s("code"),k=n("Unigram"),Ro=n(" model. It supports bytefallback, which is only available in "),Ne=s("code"),Vo=n("tokenizers==0.14.0"),Yo=n(` for the fast tokenizer.
The `),Be=s("code"),Ho=n("LlamaTokenizer"),Qo=n(" is used as it is a standard wrapper around sentencepiece. The "),je=s("code"),Ko=n("chat"),H=n(" template will be updated with the templating functions in a follow up PR!"),et=c(),Xe=s("li"),Te=s("p"),fn=n("The authors suggest to use the following prompt format for the chat mode: "),yt=s("code"),un=n('f"human: {prompt}\\n\\nadept:"'),Bt=c(),Pe=s("h2"),Re=s("a"),wt=s("span"),T(Po.$$.fragment),gn=c(),kt=s("span"),_n=n("PersimmonConfig"),jt=c(),N=s("div"),T($o.$$.fragment),bn=c(),$e=s("p"),vn=n("This is the configuration class to store the configuration of a "),ot=s("a"),yn=n("PersimmonModel"),wn=n(`. It is used to instantiate an
Persimmon model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configuration to that of the
`),Mo=s("a"),kn=n("ArthurZ/persimmon-8b-base"),Tn=n("."),Pn=c(),Me=s("p"),$n=n("Configuration objects inherit from "),tt=s("a"),Mn=n("PretrainedConfig"),Cn=n(` and can be used to control the model outputs. Read the
documentation from `),nt=s("a"),En=n("PretrainedConfig"),zn=n(" for more information."),Fn=c(),T(Ve.$$.fragment),Xt=c(),Ce=s("h2"),Ye=s("a"),Tt=s("span"),T(Co.$$.fragment),xn=c(),Pt=s("span"),Jn=n("PersimmonModel"),Rt=c(),S=s("div"),T(Eo.$$.fragment),In=c(),zo=s("p"),Sn=n(`The bare Persimmon Model outputting raw hidden-states without any specific head on top.
This model inherits from `),rt=s("a"),Wn=n("PreTrainedModel"),qn=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),An=c(),Fo=s("p"),Zn=n("This model is also a PyTorch "),xo=s("a"),Un=n("torch.nn.Module"),Ln=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Dn=c(),He=s("p"),On=n("Transformer decoder consisting of "),$t=s("em"),Gn=n("config.num_hidden_layers"),Nn=n(" layers. Each layer is a "),Mt=s("code"),Bn=n("PersimmonDecoderLayer"),jn=c(),fe=s("div"),T(Jo.$$.fragment),Xn=c(),Ee=s("p"),Rn=n("The "),st=s("a"),Vn=n("PersimmonModel"),Yn=n(" forward method, overrides the "),Ct=s("code"),Hn=n("__call__"),Qn=n(" special method."),Kn=c(),T(Qe.$$.fragment),Vt=c(),ze=s("h2"),Ke=s("a"),Et=s("span"),T(Io.$$.fragment),er=c(),zt=s("span"),or=n("PersimmonForCausalLM"),Yt=c(),Fe=s("div"),T(So.$$.fragment),tr=c(),Q=s("div"),T(Wo.$$.fragment),nr=c(),xe=s("p"),rr=n("The "),at=s("a"),sr=n("PersimmonForCausalLM"),ar=n(" forward method, overrides the "),Ft=s("code"),ir=n("__call__"),dr=n(" special method."),lr=c(),T(eo.$$.fragment),cr=c(),T(oo.$$.fragment),Ht=c(),Je=s("h2"),to=s("a"),xt=s("span"),T(qo.$$.fragment),mr=c(),Jt=s("span"),hr=n("PersimmonForSequenceClassification"),Qt=c(),F=s("div"),T(Ao.$$.fragment),pr=c(),It=s("p"),fr=n("The Persimmon transformer with a sequence classification head on top (linear layer)."),ur=c(),it=s("p"),dt=s("a"),gr=n("PersimmonForSequenceClassification"),_r=n(` uses the last token in order to do the classification, as other causal
models (e.g. GPT-2) do.`),br=c(),B=s("p"),vr=n(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),St=s("code"),yr=n("pad_token_id"),wr=n(` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Wt=s("code"),kr=n("pad_token_id"),Tr=n(` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),qt=s("code"),Pr=n("inputs_embeds"),$r=n(" are passed instead of "),At=s("code"),Mr=n("input_ids"),Cr=n(`, it does the same (take the last value in
each row of the batch).`),Er=c(),Zo=s("p"),zr=n("This model inherits from "),lt=s("a"),Fr=n("PreTrainedModel"),xr=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Jr=c(),Uo=s("p"),Ir=n("This model is also a PyTorch "),Lo=s("a"),Sr=n("torch.nn.Module"),Wr=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),qr=c(),ue=s("div"),T(Do.$$.fragment),Ar=c(),Ie=s("p"),Zr=n("The "),ct=s("a"),Ur=n("PersimmonForSequenceClassification"),Lr=n(" forward method, overrides the "),Zt=s("code"),Dr=n("__call__"),Or=n(" special method."),Gr=c(),T(no.$$.fragment),this.h()},l(o){const l=Qs('[data-svelte="svelte-1phssyn"]',document.head);d=a(l,"META",{name:!0,content:!0}),l.forEach(t),y=m(o),f=a(o,"H1",{class:!0});var Oo=i(f);_=a(Oo,"A",{id:!0,class:!0,href:!0});var Ut=i(_);w=a(Ut,"SPAN",{});var Lt=i(w);P(u.$$.fragment,Lt),Lt.forEach(t),Ut.forEach(t),g=m(Oo),x=a(Oo,"SPAN",{});var Dt=i(x);be=r(Dt,"Persimmon"),Dt.forEach(t),Oo.forEach(t),Se=m(o),U=a(o,"H2",{class:!0});var Go=i(U);q=a(Go,"A",{id:!0,class:!0,href:!0});var Ot=i(q);ve=a(Ot,"SPAN",{});var jr=i(ve);P(ee.$$.fragment,jr),jr.forEach(t),Ot.forEach(t),ye=m(Go),we=a(Go,"SPAN",{});var Xr=i(we);ao=r(Xr,"Overview"),Xr.forEach(t),Go.forEach(t),se=m(o),j=a(o,"P",{});var en=i(j);io=r(en,"The Persimmon model was created by "),L=a(en,"A",{href:!0,rel:!0});var Rr=i(L);lo=r(Rr,"ADEPT"),Rr.forEach(t),co=r(en,", and authored by Erich Elsen, Augustus Odena, Maxwell Nye, Sa\u011Fnak Ta\u015F\u0131rlar, Tri Dao, Curtis Hawthorne, Deepak Moparthi, Arushi Somani."),en.forEach(t),ke=m(o),b=a(o,"P",{});var Vr=i(b);mo=r(Vr,"The authors introduced Persimmon-8B, a decoder model based on the classic transformers architecture, with query and key normalization. Persimmon-8B is a fully permissively-licensed model with approximately 8 billion parameters, released under the Apache license.  Some of the key attributes of Persimmon-8B are long context size (16K), performance, and capabilities for multimodal extensions."),Vr.forEach(t),ae=m(o),ie=a(o,"P",{});var Yr=i(ie);ho=r(Yr,"The authors showcase their approach to model evaluation, focusing on practical text generation, mirroring how users interact with language models. The work also includes a comparative analysis, pitting Persimmon-8B against other prominent models (MPT 7B Instruct and Llama 2 Base 7B 1-Shot), across various evaluation tasks. The results demonstrate Persimmon-8B\u2019s competitive performance, even with limited training data."),Yr.forEach(t),de=m(o),le=a(o,"P",{});var Hr=i(le);po=r(Hr,"In terms of model details, the work outlines the architecture and training methodology of Persimmon-8B, providing insights into its design choices, sequence length, and dataset composition. The authors present a fast inference code that outperforms traditional implementations through operator fusion and CUDA graph utilization while maintaining code coherence. They express their anticipation of how the community will leverage this contribution to drive innovation, hinting at further upcoming releases as part of an ongoing series of developments."),Hr.forEach(t),ce=m(o),P(X.$$.fragment,o),We=m(o),R=a(o,"P",{});var Qr=i(R);fo=r(Qr,"Tips:"),Qr.forEach(t),qe=m(o),V=a(o,"UL",{});var Kr=i(V);oe=a(Kr,"LI",{});var on=i(oe);uo=r(on,"To convert the model, you need to clone the original repository using "),te=a(on,"CODE",{});var es=i(te);go=r(es,"git clone https://github.com/persimmon-ai-labs/adept-inference"),es.forEach(t),_o=r(on,", then get the checkpoints:"),on.forEach(t),Kr.forEach(t),me=m(o),P(ne.$$.fragment,o),Ae=m(o),Y=a(o,"P",{});var os=i(Y);bo=r(os,"For the chat model:"),os.forEach(t),Ze=m(o),P(D.$$.fragment,o),Ue=m(o),he=a(o,"P",{});var ts=i(he);Le=r(ts,"Thereafter, models can be loaded via:"),ts.forEach(t),I=m(o),P(re.$$.fragment,o),pe=m(o),A=a(o,"P",{});var mt=i(A);vo=r(mt,"This model was contributed by "),O=a(mt,"A",{href:!0,rel:!0});var ns=i(O);yo=r(ns,"ArthurZ"),ns.forEach(t),wo=r(mt,`.
The original code can be found `),G=a(mt,"A",{href:!0,rel:!0});var rs=i(G);ko=r(rs,"here"),rs.forEach(t),To=r(mt,"."),mt.forEach(t),z=m(o),v=a(o,"UL",{});var tn=i(v);De=a(tn,"LI",{});var ss=i(De);J=a(ss,"P",{});var K=i(J);Bo=r(K,"Perismmon uses a "),Oe=a(K,"CODE",{});var as=i(Oe);jo=r(as,"sentencepiece"),as.forEach(t),Xo=r(K," based tokenizer, with a "),Ge=a(K,"CODE",{});var is=i(Ge);k=r(is,"Unigram"),is.forEach(t),Ro=r(K," model. It supports bytefallback, which is only available in "),Ne=a(K,"CODE",{});var ds=i(Ne);Vo=r(ds,"tokenizers==0.14.0"),ds.forEach(t),Yo=r(K,` for the fast tokenizer.
The `),Be=a(K,"CODE",{});var ls=i(Be);Ho=r(ls,"LlamaTokenizer"),ls.forEach(t),Qo=r(K," is used as it is a standard wrapper around sentencepiece. The "),je=a(K,"CODE",{});var cs=i(je);Ko=r(cs,"chat"),cs.forEach(t),H=r(K," template will be updated with the templating functions in a follow up PR!"),K.forEach(t),ss.forEach(t),et=m(tn),Xe=a(tn,"LI",{});var ms=i(Xe);Te=a(ms,"P",{});var Nr=i(Te);fn=r(Nr,"The authors suggest to use the following prompt format for the chat mode: "),yt=a(Nr,"CODE",{});var hs=i(yt);un=r(hs,'f"human: {prompt}\\n\\nadept:"'),hs.forEach(t),Nr.forEach(t),ms.forEach(t),tn.forEach(t),Bt=m(o),Pe=a(o,"H2",{class:!0});var nn=i(Pe);Re=a(nn,"A",{id:!0,class:!0,href:!0});var ps=i(Re);wt=a(ps,"SPAN",{});var fs=i(wt);P(Po.$$.fragment,fs),fs.forEach(t),ps.forEach(t),gn=m(nn),kt=a(nn,"SPAN",{});var us=i(kt);_n=r(us,"PersimmonConfig"),us.forEach(t),nn.forEach(t),jt=m(o),N=a(o,"DIV",{class:!0});var ro=i(N);P($o.$$.fragment,ro),bn=m(ro),$e=a(ro,"P",{});var ht=i($e);vn=r(ht,"This is the configuration class to store the configuration of a "),ot=a(ht,"A",{href:!0});var gs=i(ot);yn=r(gs,"PersimmonModel"),gs.forEach(t),wn=r(ht,`. It is used to instantiate an
Persimmon model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configuration to that of the
`),Mo=a(ht,"A",{href:!0,rel:!0});var _s=i(Mo);kn=r(_s,"ArthurZ/persimmon-8b-base"),_s.forEach(t),Tn=r(ht,"."),ht.forEach(t),Pn=m(ro),Me=a(ro,"P",{});var pt=i(Me);$n=r(pt,"Configuration objects inherit from "),tt=a(pt,"A",{href:!0});var bs=i(tt);Mn=r(bs,"PretrainedConfig"),bs.forEach(t),Cn=r(pt,` and can be used to control the model outputs. Read the
documentation from `),nt=a(pt,"A",{href:!0});var vs=i(nt);En=r(vs,"PretrainedConfig"),vs.forEach(t),zn=r(pt," for more information."),pt.forEach(t),Fn=m(ro),P(Ve.$$.fragment,ro),ro.forEach(t),Xt=m(o),Ce=a(o,"H2",{class:!0});var rn=i(Ce);Ye=a(rn,"A",{id:!0,class:!0,href:!0});var ys=i(Ye);Tt=a(ys,"SPAN",{});var ws=i(Tt);P(Co.$$.fragment,ws),ws.forEach(t),ys.forEach(t),xn=m(rn),Pt=a(rn,"SPAN",{});var ks=i(Pt);Jn=r(ks,"PersimmonModel"),ks.forEach(t),rn.forEach(t),Rt=m(o),S=a(o,"DIV",{class:!0});var ge=i(S);P(Eo.$$.fragment,ge),In=m(ge),zo=a(ge,"P",{});var sn=i(zo);Sn=r(sn,`The bare Persimmon Model outputting raw hidden-states without any specific head on top.
This model inherits from `),rt=a(sn,"A",{href:!0});var Ts=i(rt);Wn=r(Ts,"PreTrainedModel"),Ts.forEach(t),qn=r(sn,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),sn.forEach(t),An=m(ge),Fo=a(ge,"P",{});var an=i(Fo);Zn=r(an,"This model is also a PyTorch "),xo=a(an,"A",{href:!0,rel:!0});var Ps=i(xo);Un=r(Ps,"torch.nn.Module"),Ps.forEach(t),Ln=r(an,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),an.forEach(t),Dn=m(ge),He=a(ge,"P",{});var Gt=i(He);On=r(Gt,"Transformer decoder consisting of "),$t=a(Gt,"EM",{});var $s=i($t);Gn=r($s,"config.num_hidden_layers"),$s.forEach(t),Nn=r(Gt," layers. Each layer is a "),Mt=a(Gt,"CODE",{});var Ms=i(Mt);Bn=r(Ms,"PersimmonDecoderLayer"),Ms.forEach(t),Gt.forEach(t),jn=m(ge),fe=a(ge,"DIV",{class:!0});var ft=i(fe);P(Jo.$$.fragment,ft),Xn=m(ft),Ee=a(ft,"P",{});var ut=i(Ee);Rn=r(ut,"The "),st=a(ut,"A",{href:!0});var Cs=i(st);Vn=r(Cs,"PersimmonModel"),Cs.forEach(t),Yn=r(ut," forward method, overrides the "),Ct=a(ut,"CODE",{});var Es=i(Ct);Hn=r(Es,"__call__"),Es.forEach(t),Qn=r(ut," special method."),ut.forEach(t),Kn=m(ft),P(Qe.$$.fragment,ft),ft.forEach(t),ge.forEach(t),Vt=m(o),ze=a(o,"H2",{class:!0});var dn=i(ze);Ke=a(dn,"A",{id:!0,class:!0,href:!0});var zs=i(Ke);Et=a(zs,"SPAN",{});var Fs=i(Et);P(Io.$$.fragment,Fs),Fs.forEach(t),zs.forEach(t),er=m(dn),zt=a(dn,"SPAN",{});var xs=i(zt);or=r(xs,"PersimmonForCausalLM"),xs.forEach(t),dn.forEach(t),Yt=m(o),Fe=a(o,"DIV",{class:!0});var ln=i(Fe);P(So.$$.fragment,ln),tr=m(ln),Q=a(ln,"DIV",{class:!0});var so=i(Q);P(Wo.$$.fragment,so),nr=m(so),xe=a(so,"P",{});var gt=i(xe);rr=r(gt,"The "),at=a(gt,"A",{href:!0});var Js=i(at);sr=r(Js,"PersimmonForCausalLM"),Js.forEach(t),ar=r(gt," forward method, overrides the "),Ft=a(gt,"CODE",{});var Is=i(Ft);ir=r(Is,"__call__"),Is.forEach(t),dr=r(gt," special method."),gt.forEach(t),lr=m(so),P(eo.$$.fragment,so),cr=m(so),P(oo.$$.fragment,so),so.forEach(t),ln.forEach(t),Ht=m(o),Je=a(o,"H2",{class:!0});var cn=i(Je);to=a(cn,"A",{id:!0,class:!0,href:!0});var Ss=i(to);xt=a(Ss,"SPAN",{});var Ws=i(xt);P(qo.$$.fragment,Ws),Ws.forEach(t),Ss.forEach(t),mr=m(cn),Jt=a(cn,"SPAN",{});var qs=i(Jt);hr=r(qs,"PersimmonForSequenceClassification"),qs.forEach(t),cn.forEach(t),Qt=m(o),F=a(o,"DIV",{class:!0});var Z=i(F);P(Ao.$$.fragment,Z),pr=m(Z),It=a(Z,"P",{});var As=i(It);fr=r(As,"The Persimmon transformer with a sequence classification head on top (linear layer)."),As.forEach(t),ur=m(Z),it=a(Z,"P",{});var Br=i(it);dt=a(Br,"A",{href:!0});var Zs=i(dt);gr=r(Zs,"PersimmonForSequenceClassification"),Zs.forEach(t),_r=r(Br,` uses the last token in order to do the classification, as other causal
models (e.g. GPT-2) do.`),Br.forEach(t),br=m(Z),B=a(Z,"P",{});var _e=i(B);vr=r(_e,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),St=a(_e,"CODE",{});var Us=i(St);yr=r(Us,"pad_token_id"),Us.forEach(t),wr=r(_e,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Wt=a(_e,"CODE",{});var Ls=i(Wt);kr=r(Ls,"pad_token_id"),Ls.forEach(t),Tr=r(_e,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),qt=a(_e,"CODE",{});var Ds=i(qt);Pr=r(Ds,"inputs_embeds"),Ds.forEach(t),$r=r(_e," are passed instead of "),At=a(_e,"CODE",{});var Os=i(At);Mr=r(Os,"input_ids"),Os.forEach(t),Cr=r(_e,`, it does the same (take the last value in
each row of the batch).`),_e.forEach(t),Er=m(Z),Zo=a(Z,"P",{});var mn=i(Zo);zr=r(mn,"This model inherits from "),lt=a(mn,"A",{href:!0});var Gs=i(lt);Fr=r(Gs,"PreTrainedModel"),Gs.forEach(t),xr=r(mn,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),mn.forEach(t),Jr=m(Z),Uo=a(Z,"P",{});var hn=i(Uo);Ir=r(hn,"This model is also a PyTorch "),Lo=a(hn,"A",{href:!0,rel:!0});var Ns=i(Lo);Sr=r(Ns,"torch.nn.Module"),Ns.forEach(t),Wr=r(hn,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),hn.forEach(t),qr=m(Z),ue=a(Z,"DIV",{class:!0});var _t=i(ue);P(Do.$$.fragment,_t),Ar=m(_t),Ie=a(_t,"P",{});var bt=i(Ie);Zr=r(bt,"The "),ct=a(bt,"A",{href:!0});var Bs=i(ct);Ur=r(Bs,"PersimmonForSequenceClassification"),Bs.forEach(t),Lr=r(bt," forward method, overrides the "),Zt=a(bt,"CODE",{});var js=i(Zt);Dr=r(js,"__call__"),js.forEach(t),Or=r(bt," special method."),bt.forEach(t),Gr=m(_t),P(no.$$.fragment,_t),_t.forEach(t),Z.forEach(t),this.h()},h(){h(d,"name","hf:doc:metadata"),h(d,"content",JSON.stringify(ia)),h(_,"id","persimmon"),h(_,"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"),h(_,"href","#persimmon"),h(f,"class","relative group"),h(q,"id","overview"),h(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"),h(q,"href","#overview"),h(U,"class","relative group"),h(L,"href","https://www.adept.ai/blog/persimmon-8b"),h(L,"rel","nofollow"),h(O,"href","https://huggingface.co/ArthurZ"),h(O,"rel","nofollow"),h(G,"href","https://github.com/persimmon-ai-labs/adept-inference"),h(G,"rel","nofollow"),h(Re,"id","transformers.PersimmonConfig"),h(Re,"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"),h(Re,"href","#transformers.PersimmonConfig"),h(Pe,"class","relative group"),h(ot,"href","/docs/transformers/main/en/model_doc/persimmon#transformers.PersimmonModel"),h(Mo,"href","https://huggingface.co/ArthurZ/persimmon-8b-base"),h(Mo,"rel","nofollow"),h(tt,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),h(nt,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),h(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ye,"id","transformers.PersimmonModel"),h(Ye,"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"),h(Ye,"href","#transformers.PersimmonModel"),h(Ce,"class","relative group"),h(rt,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),h(xo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(xo,"rel","nofollow"),h(st,"href","/docs/transformers/main/en/model_doc/persimmon#transformers.PersimmonModel"),h(fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ke,"id","transformers.PersimmonForCausalLM"),h(Ke,"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"),h(Ke,"href","#transformers.PersimmonForCausalLM"),h(ze,"class","relative group"),h(at,"href","/docs/transformers/main/en/model_doc/persimmon#transformers.PersimmonForCausalLM"),h(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(to,"id","transformers.PersimmonForSequenceClassification"),h(to,"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"),h(to,"href","#transformers.PersimmonForSequenceClassification"),h(Je,"class","relative group"),h(dt,"href","/docs/transformers/main/en/model_doc/persimmon#transformers.PersimmonForSequenceClassification"),h(lt,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),h(Lo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Lo,"rel","nofollow"),h(ct,"href","/docs/transformers/main/en/model_doc/persimmon#transformers.PersimmonForSequenceClassification"),h(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,l){e(document.head,d),p(o,y,l),p(o,f,l),e(f,_),e(_,w),$(u,w,null),e(f,g),e(f,x),e(x,be),p(o,Se,l),p(o,U,l),e(U,q),e(q,ve),$(ee,ve,null),e(U,ye),e(U,we),e(we,ao),p(o,se,l),p(o,j,l),e(j,io),e(j,L),e(L,lo),e(j,co),p(o,ke,l),p(o,b,l),e(b,mo),p(o,ae,l),p(o,ie,l),e(ie,ho),p(o,de,l),p(o,le,l),e(le,po),p(o,ce,l),$(X,o,l),p(o,We,l),p(o,R,l),e(R,fo),p(o,qe,l),p(o,V,l),e(V,oe),e(oe,uo),e(oe,te),e(te,go),e(oe,_o),p(o,me,l),$(ne,o,l),p(o,Ae,l),p(o,Y,l),e(Y,bo),p(o,Ze,l),$(D,o,l),p(o,Ue,l),p(o,he,l),e(he,Le),p(o,I,l),$(re,o,l),p(o,pe,l),p(o,A,l),e(A,vo),e(A,O),e(O,yo),e(A,wo),e(A,G),e(G,ko),e(A,To),p(o,z,l),p(o,v,l),e(v,De),e(De,J),e(J,Bo),e(J,Oe),e(Oe,jo),e(J,Xo),e(J,Ge),e(Ge,k),e(J,Ro),e(J,Ne),e(Ne,Vo),e(J,Yo),e(J,Be),e(Be,Ho),e(J,Qo),e(J,je),e(je,Ko),e(J,H),e(v,et),e(v,Xe),e(Xe,Te),e(Te,fn),e(Te,yt),e(yt,un),p(o,Bt,l),p(o,Pe,l),e(Pe,Re),e(Re,wt),$(Po,wt,null),e(Pe,gn),e(Pe,kt),e(kt,_n),p(o,jt,l),p(o,N,l),$($o,N,null),e(N,bn),e(N,$e),e($e,vn),e($e,ot),e(ot,yn),e($e,wn),e($e,Mo),e(Mo,kn),e($e,Tn),e(N,Pn),e(N,Me),e(Me,$n),e(Me,tt),e(tt,Mn),e(Me,Cn),e(Me,nt),e(nt,En),e(Me,zn),e(N,Fn),$(Ve,N,null),p(o,Xt,l),p(o,Ce,l),e(Ce,Ye),e(Ye,Tt),$(Co,Tt,null),e(Ce,xn),e(Ce,Pt),e(Pt,Jn),p(o,Rt,l),p(o,S,l),$(Eo,S,null),e(S,In),e(S,zo),e(zo,Sn),e(zo,rt),e(rt,Wn),e(zo,qn),e(S,An),e(S,Fo),e(Fo,Zn),e(Fo,xo),e(xo,Un),e(Fo,Ln),e(S,Dn),e(S,He),e(He,On),e(He,$t),e($t,Gn),e(He,Nn),e(He,Mt),e(Mt,Bn),e(S,jn),e(S,fe),$(Jo,fe,null),e(fe,Xn),e(fe,Ee),e(Ee,Rn),e(Ee,st),e(st,Vn),e(Ee,Yn),e(Ee,Ct),e(Ct,Hn),e(Ee,Qn),e(fe,Kn),$(Qe,fe,null),p(o,Vt,l),p(o,ze,l),e(ze,Ke),e(Ke,Et),$(Io,Et,null),e(ze,er),e(ze,zt),e(zt,or),p(o,Yt,l),p(o,Fe,l),$(So,Fe,null),e(Fe,tr),e(Fe,Q),$(Wo,Q,null),e(Q,nr),e(Q,xe),e(xe,rr),e(xe,at),e(at,sr),e(xe,ar),e(xe,Ft),e(Ft,ir),e(xe,dr),e(Q,lr),$(eo,Q,null),e(Q,cr),$(oo,Q,null),p(o,Ht,l),p(o,Je,l),e(Je,to),e(to,xt),$(qo,xt,null),e(Je,mr),e(Je,Jt),e(Jt,hr),p(o,Qt,l),p(o,F,l),$(Ao,F,null),e(F,pr),e(F,It),e(It,fr),e(F,ur),e(F,it),e(it,dt),e(dt,gr),e(it,_r),e(F,br),e(F,B),e(B,vr),e(B,St),e(St,yr),e(B,wr),e(B,Wt),e(Wt,kr),e(B,Tr),e(B,qt),e(qt,Pr),e(B,$r),e(B,At),e(At,Mr),e(B,Cr),e(F,Er),e(F,Zo),e(Zo,zr),e(Zo,lt),e(lt,Fr),e(Zo,xr),e(F,Jr),e(F,Uo),e(Uo,Ir),e(Uo,Lo),e(Lo,Sr),e(Uo,Wr),e(F,qr),e(F,ue),$(Do,ue,null),e(ue,Ar),e(ue,Ie),e(Ie,Zr),e(Ie,ct),e(ct,Ur),e(Ie,Lr),e(Ie,Zt),e(Zt,Dr),e(Ie,Or),e(ue,Gr),$(no,ue,null),Kt=!0},p(o,[l]){const Oo={};l&2&&(Oo.$$scope={dirty:l,ctx:o}),X.$set(Oo);const Ut={};l&2&&(Ut.$$scope={dirty:l,ctx:o}),Ve.$set(Ut);const Lt={};l&2&&(Lt.$$scope={dirty:l,ctx:o}),Qe.$set(Lt);const Dt={};l&2&&(Dt.$$scope={dirty:l,ctx:o}),eo.$set(Dt);const Go={};l&2&&(Go.$$scope={dirty:l,ctx:o}),oo.$set(Go);const Ot={};l&2&&(Ot.$$scope={dirty:l,ctx:o}),no.$set(Ot)},i(o){Kt||(M(u.$$.fragment,o),M(ee.$$.fragment,o),M(X.$$.fragment,o),M(ne.$$.fragment,o),M(D.$$.fragment,o),M(re.$$.fragment,o),M(Po.$$.fragment,o),M($o.$$.fragment,o),M(Ve.$$.fragment,o),M(Co.$$.fragment,o),M(Eo.$$.fragment,o),M(Jo.$$.fragment,o),M(Qe.$$.fragment,o),M(Io.$$.fragment,o),M(So.$$.fragment,o),M(Wo.$$.fragment,o),M(eo.$$.fragment,o),M(oo.$$.fragment,o),M(qo.$$.fragment,o),M(Ao.$$.fragment,o),M(Do.$$.fragment,o),M(no.$$.fragment,o),Kt=!0)},o(o){C(u.$$.fragment,o),C(ee.$$.fragment,o),C(X.$$.fragment,o),C(ne.$$.fragment,o),C(D.$$.fragment,o),C(re.$$.fragment,o),C(Po.$$.fragment,o),C($o.$$.fragment,o),C(Ve.$$.fragment,o),C(Co.$$.fragment,o),C(Eo.$$.fragment,o),C(Jo.$$.fragment,o),C(Qe.$$.fragment,o),C(Io.$$.fragment,o),C(So.$$.fragment,o),C(Wo.$$.fragment,o),C(eo.$$.fragment,o),C(oo.$$.fragment,o),C(qo.$$.fragment,o),C(Ao.$$.fragment,o),C(Do.$$.fragment,o),C(no.$$.fragment,o),Kt=!1},d(o){t(d),o&&t(y),o&&t(f),E(u),o&&t(Se),o&&t(U),E(ee),o&&t(se),o&&t(j),o&&t(ke),o&&t(b),o&&t(ae),o&&t(ie),o&&t(de),o&&t(le),o&&t(ce),E(X,o),o&&t(We),o&&t(R),o&&t(qe),o&&t(V),o&&t(me),E(ne,o),o&&t(Ae),o&&t(Y),o&&t(Ze),E(D,o),o&&t(Ue),o&&t(he),o&&t(I),E(re,o),o&&t(pe),o&&t(A),o&&t(z),o&&t(v),o&&t(Bt),o&&t(Pe),E(Po),o&&t(jt),o&&t(N),E($o),E(Ve),o&&t(Xt),o&&t(Ce),E(Co),o&&t(Rt),o&&t(S),E(Eo),E(Jo),E(Qe),o&&t(Vt),o&&t(ze),E(Io),o&&t(Yt),o&&t(Fe),E(So),E(Wo),E(eo),E(oo),o&&t(Ht),o&&t(Je),E(qo),o&&t(Qt),o&&t(F),E(Ao),E(Do),E(no)}}}const ia={local:"persimmon",sections:[{local:"overview",title:"Overview"},{local:"transformers.PersimmonConfig",title:"PersimmonConfig"},{local:"transformers.PersimmonModel",title:"PersimmonModel"},{local:"transformers.PersimmonForCausalLM",title:"PersimmonForCausalLM"},{local:"transformers.PersimmonForSequenceClassification",title:"PersimmonForSequenceClassification"}],title:"Persimmon"};function da(W){return Ks(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ua extends Vs{constructor(d){super();Ys(this,d,da,aa,Hs,{})}}export{ua as default,ia as metadata};
