import{S as Kc,i as em,s as tm,e as a,k as d,w as _,t as r,M as om,c as n,d as o,m as c,a as s,x as g,h as i,b as l,G as e,g as h,y as b,q as k,o as v,B as y,v as am,L as is}from"../../chunks/vendor-hf-doc-builder.js";import{T as sd}from"../../chunks/Tip-hf-doc-builder.js";import{D as A}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Bo}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as me}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as rs}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as Qc}from"../../chunks/PipelineTag-hf-doc-builder.js";function nm(F){let p,T;return p=new Bo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMExsYW1hTW9kZWwlMkMlMjBMbGFtYUNvbmZpZyUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBMTGFNQSUyMGxsYW1hLTdiJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMExsYW1hQ29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjBmcm9tJTIwdGhlJTIwbGxhbWEtN2IlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMExsYW1hTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LlamaModel, LlamaConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a LLaMA llama-7b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = LlamaConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the llama-7b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = LlamaModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){_(p.$$.fragment)},l(f){g(p.$$.fragment,f)},m(f,w){b(p,f,w),T=!0},p:is,i(f){T||(k(p.$$.fragment,f),T=!0)},o(f){v(p.$$.fragment,f),T=!1},d(f){y(p,f)}}}function sm(F){let p,T,f,w,$;return w=new Bo({props:{code:"MCUyMDAlMjAwJTIwMCUyMDAlMjAwJTIwMCUyMDAlMjAwJTIwMCUyMDAlMjAxJTIwMSUyMDElMjAxJTIwMSUyMDElMjAxJTIwMSUyMDElMEElN0MlMjBmaXJzdCUyMHNlcXVlbmNlJTIwJTIwJTIwJTIwJTdDJTIwc2Vjb25kJTIwc2VxdWVuY2UlMjAlN0M=",highlighted:`0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1 1
| first sequence    | second sequence |`}}),{c(){p=a("p"),T=r("sequence pair mask has the following format:"),f=d(),_(w.$$.fragment)},l(u){p=n(u,"P",{});var L=s(p);T=i(L,"sequence pair mask has the following format:"),L.forEach(o),f=c(u),g(w.$$.fragment,u)},m(u,L){h(u,p,L),e(p,T),h(u,f,L),b(w,u,L),$=!0},p:is,i(u){$||(k(w.$$.fragment,u),$=!0)},o(u){v(w.$$.fragment,u),$=!1},d(u){u&&o(p),u&&o(f),y(w,u)}}}function rm(F){let p,T;return p=new Bo({props:{code:"JTBBJTVCMSUyQyUyMDE1MDQzJTJDJTIwNDQ1JTJDJTIwMzM4JTJDJTIwMjYzJTJDJTIwMTI0MyU1RA==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LlamaTokenizerFast

tokenizer = LlamaTokenizerFast.from_pretrained(&quot;hf-internal-testing/llama-tokenizer&quot;)
tokenizer.encode(&quot;Hello this is a test&quot;)
&gt;&gt;&gt; [<span class="hljs-number">1</span>, <span class="hljs-number">15043</span>, <span class="hljs-number">445</span>, <span class="hljs-number">338</span>, <span class="hljs-number">263</span>, <span class="hljs-number">1243</span>]`}}),{c(){_(p.$$.fragment)},l(f){g(p.$$.fragment,f)},m(f,w){b(p,f,w),T=!0},p:is,i(f){T||(k(p.$$.fragment,f),T=!0)},o(f){v(p.$$.fragment,f),T=!1},d(f){y(p,f)}}}function im(F){let p,T,f,w,$;return{c(){p=a("p"),T=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),w=r("Module"),$=r(`
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){p=n(u,"P",{});var L=s(p);T=i(L,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n(L,"CODE",{});var P=s(f);w=i(P,"Module"),P.forEach(o),$=i(L,`
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.forEach(o)},m(u,L){h(u,p,L),e(p,T),e(p,f),e(f,w),e(p,$)},d(u){u&&o(p)}}}function lm(F){let p,T,f,w,$;return{c(){p=a("p"),T=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),w=r("Module"),$=r(`
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){p=n(u,"P",{});var L=s(p);T=i(L,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n(L,"CODE",{});var P=s(f);w=i(P,"Module"),P.forEach(o),$=i(L,`
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.forEach(o)},m(u,L){h(u,p,L),e(p,T),e(p,f),e(f,w),e(p,$)},d(u){u&&o(p)}}}function dm(F){let p,T,f,w,$;return w=new Bo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBMbGFtYUZvckNhdXNhbExNJTBBJTBBbW9kZWwlMjAlM0QlMjBMbGFtYUZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZChQQVRIX1RPX0NPTlZFUlRFRF9XRUlHSFRTKSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKFBBVEhfVE9fQ09OVkVSVEVEX1RPS0VOSVpFUiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJIZXklMkMlMjBhcmUlMjB5b3UlMjBjb25zY2lvdXMlM0YlMjBDYW4lMjB5b3UlMjB0YWxrJTIwdG8lMjBtZSUzRiUyMiUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihwcm9tcHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQSUyMyUyMEdlbmVyYXRlJTBBZ2VuZXJhdGVfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRzLmlucHV0X2lkcyUyQyUyMG1heF9sZW5ndGglM0QzMCklMEF0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKGdlbmVyYXRlX2lkcyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlJTJDJTIwY2xlYW5fdXBfdG9rZW5pemF0aW9uX3NwYWNlcyUzREZhbHNlKSU1QjAlNUQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, LlamaForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = LlamaForCausalLM.from_pretrained(PATH_TO_CONVERTED_WEIGHTS)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(PATH_TO_CONVERTED_TOKENIZER)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;Hey, are you conscious? Can you talk to me?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(prompt, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<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">&quot;Hey, are you conscious? Can you talk to me?\\nI&#x27;m not conscious, but I can talk to you.&quot;</span>`}}),{c(){p=a("p"),T=r("Example:"),f=d(),_(w.$$.fragment)},l(u){p=n(u,"P",{});var L=s(p);T=i(L,"Example:"),L.forEach(o),f=c(u),g(w.$$.fragment,u)},m(u,L){h(u,p,L),e(p,T),h(u,f,L),b(w,u,L),$=!0},p:is,i(u){$||(k(w.$$.fragment,u),$=!0)},o(u){v(w.$$.fragment,u),$=!1},d(u){u&&o(p),u&&o(f),y(w,u)}}}function cm(F){let p,T,f,w,$;return{c(){p=a("p"),T=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),w=r("Module"),$=r(`
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){p=n(u,"P",{});var L=s(p);T=i(L,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n(L,"CODE",{});var P=s(f);w=i(P,"Module"),P.forEach(o),$=i(L,`
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.forEach(o)},m(u,L){h(u,p,L),e(p,T),e(p,f),e(f,w),e(p,$)},d(u){u&&o(p)}}}function mm(F){let p,T,f,w,$,u,L,P,ls,Oa,X,he,Oo,We,ds,Jo,cs,Ja,pe,ms,Be,hs,ps,Ra,Kt,fs,Ga,eo,Ro,us,Va,to,_s,Za,fe,oo,gs,Oe,bs,ks,Je,vs,Re,ys,ws,Ha,Ge,Xa,ao,Go,Ls,Ya,Ve,Qa,no,Ts,Ka,so,Ze,$s,He,Ms,zs,en,q,Es,Xe,As,xs,Ye,Fs,Cs,Qe,Ps,qs,Ke,Is,Ss,tn,ro,Us,on,io,ue,Vo,js,Ns,lo,Ds,Ws,an,Y,_e,Zo,et,Bs,Ho,Os,nn,co,Js,sn,tt,rn,mo,ot,Rs,at,Gs,Vs,ln,nt,dn,ho,ge,st,Zs,Hs,rt,Xs,Ys,cn,po,Qs,mn,fo,it,Ks,lt,er,tr,hn,uo,or,pn,be,dt,ar,ct,nr,sr,rr,mt,ir,ht,lr,dr,fn,_o,cr,un,ke,pt,mr,ft,hr,pr,fr,ut,ur,_t,_r,gr,_n,Q,ve,Xo,gt,br,Yo,kr,gn,S,bt,vr,kt,yr,go,wr,Lr,Tr,K,$r,bo,Mr,zr,ko,Er,Ar,xr,ye,bn,ee,we,Qo,vt,Fr,Ko,Cr,kn,x,yt,Pr,ea,qr,Ir,vo,wt,Sr,Le,Lt,Ur,Tt,jr,ta,Nr,Dr,Wr,N,$t,Br,oa,Or,Jr,Te,Rr,aa,Gr,Vr,$e,Mt,Zr,na,Hr,vn,te,Me,sa,zt,Xr,ra,Yr,yn,M,Et,Qr,ia,Kr,ei,la,ti,oi,ze,ai,U,ni,da,si,ri,ca,ii,li,ma,di,ci,At,mi,hi,pi,xt,fi,yo,ui,_i,gi,B,Ft,bi,ha,ki,vi,pa,yi,wi,Ee,Ct,Li,oe,Ti,fa,$i,Mi,ua,zi,Ei,Ai,O,Pt,xi,wo,Fi,Lo,Ci,Pi,_a,qi,Ii,Ae,qt,Si,ae,Ui,ga,ji,Ni,ba,Di,Wi,Bi,To,It,wn,ne,xe,ka,St,Oi,va,Ji,Ln,C,Ut,Ri,jt,Gi,$o,Vi,Zi,Hi,Nt,Xi,Dt,Yi,Qi,Ki,Fe,el,ya,tl,ol,wa,al,nl,J,Wt,sl,se,rl,Mo,il,ll,La,dl,cl,ml,Ce,Tn,re,Pe,Ta,Bt,hl,$a,pl,$n,ie,Ot,fl,D,Jt,ul,le,_l,zo,gl,bl,Ma,kl,vl,yl,qe,wl,Ie,Mn,de,Se,za,Rt,Ll,Ea,Tl,zn,E,Gt,$l,Aa,Ml,zl,Eo,Ao,El,Al,xl,j,Fl,xa,Cl,Pl,Fa,ql,Il,Ca,Sl,Ul,Pa,jl,Nl,Dl,Vt,Wl,xo,Bl,Ol,Jl,Zt,Rl,Ht,Gl,Vl,Zl,R,Xt,Hl,ce,Xl,Fo,Yl,Ql,qa,Kl,ed,td,Ue,En;return u=new me({}),We=new me({}),Ge=new Bo({props:{code:"cHl0aG9uJTIwc3JjJTJGdHJhbnNmb3JtZXJzJTJGbW9kZWxzJTJGbGxhbWElMkZjb252ZXJ0X2xsYW1hX3dlaWdodHNfdG9faGYucHklMjAlNUMlMEElMjAlMjAlMjAlMjAtLWlucHV0X2RpciUyMCUyRnBhdGglMkZ0byUyRmRvd25sb2FkZWQlMkZsbGFtYSUyRndlaWdodHMlMjAtLW1vZGVsX3NpemUlMjA3QiUyMC0tb3V0cHV0X2RpciUyMCUyRm91dHB1dCUyRnBhdGg=",highlighted:`python src/transformers/models/llama/convert_llama_weights_to_hf.py \\
    --input_dir /path/to/downloaded/llama/weights --model_size 7B --output_dir /output/path`}}),Ve=new Bo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMExsYW1hRm9yQ2F1c2FsTE0lMkMlMjBMbGFtYVRva2VuaXplciUwQSUwQXRva2VuaXplciUyMCUzRCUyMExsYW1hVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjIlMkZvdXRwdXQlMkZwYXRoJTIyKSUwQW1vZGVsJTIwJTNEJTIwTGxhbWFGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIyJTJGb3V0cHV0JTJGcGF0aCUyMik=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> LlamaForCausalLM, LlamaTokenizer

tokenizer = LlamaTokenizer.from_pretrained(<span class="hljs-string">&quot;/output/path&quot;</span>)
model = LlamaForCausalLM.from_pretrained(<span class="hljs-string">&quot;/output/path&quot;</span>)`}}),et=new me({}),tt=new Qc({props:{pipeline:"text-classification"}}),nt=new Qc({props:{pipeline:"question-answering"}}),gt=new me({}),bt=new A({props:{name:"class transformers.LlamaConfig",anchor:"transformers.LlamaConfig",parameters:[{name:"vocab_size",val:" = 32000"},{name:"hidden_size",val:" = 4096"},{name:"intermediate_size",val:" = 11008"},{name:"num_hidden_layers",val:" = 32"},{name:"num_attention_heads",val:" = 32"},{name:"num_key_value_heads",val:" = None"},{name:"hidden_act",val:" = 'silu'"},{name:"max_position_embeddings",val:" = 2048"},{name:"initializer_range",val:" = 0.02"},{name:"rms_norm_eps",val:" = 1e-06"},{name:"use_cache",val:" = True"},{name:"pad_token_id",val:" = None"},{name:"bos_token_id",val:" = 1"},{name:"eos_token_id",val:" = 2"},{name:"pretraining_tp",val:" = 1"},{name:"tie_word_embeddings",val:" = False"},{name:"rope_theta",val:" = 10000.0"},{name:"rope_scaling",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LlamaConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 32000) &#x2014;
Vocabulary size of the LLaMA 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/llama2#transformers.LlamaModel">LlamaModel</a>`,name:"vocab_size"},{anchor:"transformers.LlamaConfig.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.LlamaConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 11008) &#x2014;
Dimension of the MLP representations.`,name:"intermediate_size"},{anchor:"transformers.LlamaConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.LlamaConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.LlamaConfig.num_key_value_heads",description:`<strong>num_key_value_heads</strong> (<code>int</code>, <em>optional</em>) &#x2014;
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
<code>num_key_value_heads=num_attention_heads</code>, the model will use Multi Head Attention (MHA), if
<code>num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed by meanpooling all the original heads within that group. For more details checkout [this paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to </code>num_attention_heads\`.`,name:"num_key_value_heads"},{anchor:"transformers.LlamaConfig.pretraining_tp",description:`<strong>pretraining_tp</strong> (<code>int</code>, <em>optional</em>, defaults to <code>1</code>) &#x2014;
Experimental feature. Tensor parallelism rank used during pretraining. Please refer to <a href="https://huggingface.co/docs/transformers/parallelism" rel="nofollow">this
document</a> to understand more about it. This value is
necessary to ensure exact reproducibility of the pretraining results. Please refer to <a href="https://github.com/pytorch/pytorch/issues/76232" rel="nofollow">this
issue</a>.`,name:"pretraining_tp"},{anchor:"transformers.LlamaConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;silu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the decoder.`,name:"hidden_act"},{anchor:"transformers.LlamaConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
The maximum sequence length that this model might ever be used with. Llama 1 supports up to 2048 tokens,
Llama 2 up to 4096, CodeLlama up to 16384.`,name:"max_position_embeddings"},{anchor:"transformers.LlamaConfig.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.LlamaConfig.rms_norm_eps",description:`<strong>rms_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the rms normalization layers.`,name:"rms_norm_eps"},{anchor:"transformers.LlamaConfig.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.LlamaConfig.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.LlamaConfig.rope_theta",description:`<strong>rope_theta</strong> (<code>float</code>, <em>optional</em>, defaults to 10000.0) &#x2014;
The base period of the RoPE embeddings.`,name:"rope_theta"},{anchor:"transformers.LlamaConfig.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/LocalLLaMA/comments/14mrgpr/dynamically_scaled_rope_further_increases/" rel="nofollow">https://www.reddit.com/r/LocalLLaMA/comments/14mrgpr/dynamically_scaled_rope_further_increases/</a>. This is an
experimental feature, subject to breaking API changes in future versions.</p>
<p>Example &#x2014;`,name:"rope_scaling"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/configuration_llama.py#L31"}}),ye=new rs({props:{anchor:"transformers.LlamaConfig.example",$$slots:{default:[nm]},$$scope:{ctx:F}}}),vt=new me({}),yt=new A({props:{name:"class transformers.LlamaTokenizer",anchor:"transformers.LlamaTokenizer",parameters:[{name:"vocab_file",val:""},{name:"unk_token",val:" = '<unk>'"},{name:"bos_token",val:" = '<s>'"},{name:"eos_token",val:" = '</s>'"},{name:"pad_token",val:" = None"},{name:"sp_model_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"add_bos_token",val:" = True"},{name:"add_eos_token",val:" = False"},{name:"clean_up_tokenization_spaces",val:" = False"},{name:"use_default_system_prompt",val:" = True"},{name:"spaces_between_special_tokens",val:" = False"},{name:"legacy",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LlamaTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.LlamaTokenizer.legacy",description:`<strong>legacy</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not the <code>legacy</code> behavior of the tokenizer should be used. Legacy is before the merge of #24622
and #25224 which includes fixes to properly handle tokens that appear after special tokens. A simple
example:</p>
<ul>
<li><code>legacy=True</code>:</li>
</ul>`,name:"legacy"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/tokenization_llama.py#L66"}}),wt=new A({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.LlamaTokenizer.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:""},{name:"token_ids_1",val:" = None"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/tokenization_llama.py#L295"}}),Lt=new A({props:{name:"get_special_tokens_mask",anchor:"transformers.LlamaTokenizer.get_special_tokens_mask",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"},{name:"already_has_special_tokens",val:": bool = False"}],parametersDescription:[{anchor:"transformers.LlamaTokenizer.get_special_tokens_mask.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.LlamaTokenizer.get_special_tokens_mask.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"},{anchor:"transformers.LlamaTokenizer.get_special_tokens_mask.already_has_special_tokens",description:`<strong>already_has_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the token list is already formatted with special tokens for the model.`,name:"already_has_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/tokenization_llama.py#L306",returnDescription:`
<p>A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),$t=new A({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.LlamaTokenizer.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.LlamaTokenizer.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of ids.`,name:"token_ids_0"},{anchor:"transformers.LlamaTokenizer.create_token_type_ids_from_sequences.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/tokenization_llama.py#L343",returnDescription:`
<p>List of <a href="../glossary#token-type-ids">token type IDs</a> according to the given sequence(s).</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Te=new rs({props:{anchor:"transformers.LlamaTokenizer.create_token_type_ids_from_sequences.example",$$slots:{default:[sm]},$$scope:{ctx:F}}}),Mt=new A({props:{name:"save_vocabulary",anchor:"transformers.LlamaTokenizer.save_vocabulary",parameters:[{name:"save_directory",val:""},{name:"filename_prefix",val:": typing.Optional[str] = None"}],parametersDescription:[{anchor:"transformers.LlamaTokenizer.save_vocabulary.save_directory",description:`<strong>save_directory</strong> (<code>str</code>) &#x2014;
The directory in which to save the vocabulary.`,name:"save_directory"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/tokenization_llama.py#L268",returnDescription:`
<p>Paths to the files saved.</p>
`,returnType:`
<p><code>Tuple(str)</code></p>
`}}),zt=new me({}),Et=new A({props:{name:"class transformers.LlamaTokenizerFast",anchor:"transformers.LlamaTokenizerFast",parameters:[{name:"vocab_file",val:" = None"},{name:"tokenizer_file",val:" = None"},{name:"clean_up_tokenization_spaces",val:" = False"},{name:"unk_token",val:" = '<unk>'"},{name:"bos_token",val:" = '<s>'"},{name:"eos_token",val:" = '</s>'"},{name:"add_bos_token",val:" = True"},{name:"add_eos_token",val:" = False"},{name:"use_default_system_prompt",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LlamaTokenizerFast.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
<a href="https://github.com/google/sentencepiece" rel="nofollow">SentencePiece</a> file (generally has a .model extension) that
contains the vocabulary necessary to instantiate a tokenizer.`,name:"vocab_file"},{anchor:"transformers.LlamaTokenizerFast.tokenizer_file",description:`<strong>tokenizer_file</strong> (<code>str</code>) &#x2014;
<a href="https://github.com/huggingface/tokenizers" rel="nofollow">tokenizers</a> file (generally has a .json extension) that
contains everything needed to load the tokenizer.`,name:"tokenizer_file"},{anchor:"transformers.LlamaTokenizerFast.clean_up_tokenization_spaces",description:`<strong>clean_up_tokenization_spaces</strong> (<code>str</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Wether to cleanup spaces after decoding, cleanup consists in removing potential artifacts like extra
spaces.`,name:"clean_up_tokenization_spaces"},{anchor:"transformers.LlamaTokenizerFast.bos_token",description:`<strong>bos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;s&gt;&quot;</code>) &#x2014;
The beginning of sequence token that was used during pretraining. Can be used a sequence classifier token.`,name:"bos_token"},{anchor:"transformers.LlamaTokenizerFast.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&quot;</code>) &#x2014;
The end of sequence token.`,name:"eos_token"},{anchor:"transformers.LlamaTokenizerFast.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;unk&gt;&quot;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/tokenization_llama_fast.py#L49"}}),ze=new rs({props:{anchor:"transformers.LlamaTokenizerFast.example",$$slots:{default:[rm]},$$scope:{ctx:F}}}),Ft=new A({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.LlamaTokenizerFast.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.LlamaTokenizerFast.build_inputs_with_special_tokens.token_ids_0",description:"<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014; The first tokenized sequence.",name:"token_ids_0"},{anchor:"transformers.LlamaTokenizerFast.build_inputs_with_special_tokens.token_ids_1",description:"<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014; The second tokenized sequence.",name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/tokenization_utils_base.py#L3237",returnDescription:`
<p>The model input with special tokens.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Ct=new A({props:{name:"get_special_tokens_mask",anchor:"transformers.LlamaTokenizerFast.get_special_tokens_mask",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"},{name:"already_has_special_tokens",val:": bool = False"}],parametersDescription:[{anchor:"transformers.LlamaTokenizerFast.get_special_tokens_mask.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of ids of the first sequence.`,name:"token_ids_0"},{anchor:"transformers.LlamaTokenizerFast.get_special_tokens_mask.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
List of ids of the second sequence.`,name:"token_ids_1"},{anchor:"transformers.LlamaTokenizerFast.get_special_tokens_mask.already_has_special_tokens",description:`<strong>already_has_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the token list is already formatted with special tokens for the model.`,name:"already_has_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/tokenization_utils_base.py#L3682",returnDescription:`
<p>1 for a special token, 0 for a sequence token.</p>
`,returnType:`
<p>A list of integers in the range [0, 1]</p>
`}}),Pt=new A({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.LlamaTokenizerFast.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.LlamaTokenizerFast.create_token_type_ids_from_sequences.token_ids_0",description:"<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014; The first tokenized sequence.",name:"token_ids_0"},{anchor:"transformers.LlamaTokenizerFast.create_token_type_ids_from_sequences.token_ids_1",description:"<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014; The second tokenized sequence.",name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/tokenization_utils_base.py#L3217",returnDescription:`
<p>The token type ids.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),qt=new A({props:{name:"update_post_processor",anchor:"transformers.LlamaTokenizerFast.update_post_processor",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/tokenization_llama_fast.py#L133"}}),It=new A({props:{name:"save_vocabulary",anchor:"transformers.LlamaTokenizerFast.save_vocabulary",parameters:[{name:"save_directory",val:": str"},{name:"filename_prefix",val:": typing.Optional[str] = None"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/tokenization_llama_fast.py#L173"}}),St=new me({}),Ut=new A({props:{name:"class transformers.LlamaModel",anchor:"transformers.LlamaModel",parameters:[{name:"config",val:": LlamaConfig"}],parametersDescription:[{anchor:"transformers.LlamaModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/llama2#transformers.LlamaConfig">LlamaConfig</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; LlamaConfig`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/modeling_llama.py#L563"}}),Wt=new A({props:{name:"forward",anchor:"transformers.LlamaModel.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.LlamaModel.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.LlamaModel.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.LlamaModel.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.LlamaModel.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.LlamaModel.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.LlamaModel.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.LlamaModel.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.LlamaModel.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.LlamaModel.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/llama/modeling_llama.py#L614"}}),Ce=new sd({props:{$$slots:{default:[im]},$$scope:{ctx:F}}}),Bt=new me({}),Ot=new A({props:{name:"class transformers.LlamaForCausalLM",anchor:"transformers.LlamaForCausalLM",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/modeling_llama.py#L742"}}),Jt=new A({props:{name:"forward",anchor:"transformers.LlamaForCausalLM.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.LlamaForCausalLM.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.LlamaForCausalLM.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.LlamaForCausalLM.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.LlamaForCausalLM.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.LlamaForCausalLM.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.LlamaForCausalLM.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.LlamaForCausalLM.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.LlamaForCausalLM.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.LlamaForCausalLM.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/llama/modeling_llama.py#L772",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/llama2#transformers.LlamaConfig"
>LlamaConfig</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>
`}}),qe=new sd({props:{$$slots:{default:[lm]},$$scope:{ctx:F}}}),Ie=new rs({props:{anchor:"transformers.LlamaForCausalLM.forward.example",$$slots:{default:[dm]},$$scope:{ctx:F}}}),Rt=new me({}),Gt=new A({props:{name:"class transformers.LlamaForSequenceClassification",anchor:"transformers.LlamaForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.LlamaForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/llama2#transformers.LlamaConfig">LlamaConfig</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/llama/modeling_llama.py#L921"}}),Xt=new A({props:{name:"forward",anchor:"transformers.LlamaForSequenceClassification.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.LlamaForSequenceClassification.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.LlamaForSequenceClassification.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.LlamaForSequenceClassification.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.LlamaForSequenceClassification.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.LlamaForSequenceClassification.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.LlamaForSequenceClassification.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.LlamaForSequenceClassification.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.LlamaForSequenceClassification.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.LlamaForSequenceClassification.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.LlamaForSequenceClassification.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/llama/modeling_llama.py#L937"}}),Ue=new sd({props:{$$slots:{default:[cm]},$$scope:{ctx:F}}}),{c(){p=a("meta"),T=d(),f=a("h1"),w=a("a"),$=a("span"),_(u.$$.fragment),L=d(),P=a("span"),ls=r("LLaMA"),Oa=d(),X=a("h2"),he=a("a"),Oo=a("span"),_(We.$$.fragment),ds=d(),Jo=a("span"),cs=r("Overview"),Ja=d(),pe=a("p"),ms=r("The LLaMA model was proposed in "),Be=a("a"),hs=r("LLaMA: Open and Efficient Foundation Language Models"),ps=r(" by Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timoth\xE9e Lacroix, Baptiste Rozi\xE8re, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Armand Joulin, Edouard Grave, Guillaume Lample. It is a collection of foundation language models ranging from 7B to 65B parameters."),Ra=d(),Kt=a("p"),fs=r("The abstract from the paper is the following:"),Ga=d(),eo=a("p"),Ro=a("em"),us=r("We introduce LLaMA, a collection of foundation language models ranging from 7B to 65B parameters. We train our models on trillions of tokens, and show that it is possible to train state-of-the-art models using publicly available datasets exclusively, without resorting to proprietary and inaccessible datasets. In particular, LLaMA-13B outperforms GPT-3 (175B) on most benchmarks, and LLaMA-65B is competitive with the best models, Chinchilla-70B and PaLM-540B. We release all our models to the research community."),Va=d(),to=a("p"),_s=r("Tips:"),Za=d(),fe=a("ul"),oo=a("li"),gs=r("Weights for the LLaMA models can be obtained from by filling out "),Oe=a("a"),bs=r("this form"),ks=d(),Je=a("li"),vs=r("After downloading the weights, they will need to be converted to the Hugging Face Transformers format using the "),Re=a("a"),ys=r("conversion script"),ws=r(". The script can be called with the following (example) command:"),Ha=d(),_(Ge.$$.fragment),Xa=d(),ao=a("ul"),Go=a("li"),Ls=r("After conversion, the model and tokenizer can be loaded via:"),Ya=d(),_(Ve.$$.fragment),Qa=d(),no=a("p"),Ts=r(`Note that executing the script requires enough CPU RAM to host the whole model in float16 precision (even if the biggest versions
come in several checkpoints they each contain a part of each weight of the model, so we need to load them all in RAM). For the 65B model, it\u2019s thus 130GB of RAM needed.`),Ka=d(),so=a("ul"),Ze=a("li"),$s=r("The LLaMA tokenizer is a BPE model based on "),He=a("a"),Ms=r("sentencepiece"),zs=r(". One quirk of sentencepiece is that when decoding a sequence, if the first token is the start of the word (e.g. \u201CBanana\u201D), the tokenizer does not prepend the prefix space to the string."),en=d(),q=a("p"),Es=r("This model was contributed by "),Xe=a("a"),As=r("zphang"),xs=r(" with contributions from "),Ye=a("a"),Fs=r("BlackSamorez"),Cs=r(". The code of the implementation in Hugging Face is based on GPT-NeoX "),Qe=a("a"),Ps=r("here"),qs=r(". The original code of the authors can be found "),Ke=a("a"),Is=r("here"),Ss=r("."),tn=d(),ro=a("p"),Us=r("Based on the original LLaMA model, Meta AI has released some follow-up works:"),on=d(),io=a("ul"),ue=a("li"),Vo=a("strong"),js=r("Llama2"),Ns=r(": Llama2 is an improved version of Llama with some architectural tweaks (Grouped Query Attention), and is pre-trained on 2Trillion tokens. Refer to the documentation of Llama2 which can be found "),lo=a("a"),Ds=r("here"),Ws=r("."),an=d(),Y=a("h2"),_e=a("a"),Zo=a("span"),_(et.$$.fragment),Bs=d(),Ho=a("span"),Os=r("Resources"),nn=d(),co=a("p"),Js=r("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with LLaMA. If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),sn=d(),_(tt.$$.fragment),rn=d(),mo=a("ul"),ot=a("li"),Rs=r("A "),at=a("a"),Gs=r("notebook"),Vs=r(" on how to use prompt tuning to adapt the LLaMA model for text classification task. \u{1F30E}"),ln=d(),_(nt.$$.fragment),dn=d(),ho=a("ul"),ge=a("li"),st=a("a"),Zs=r("StackLLaMA: A hands-on guide to train LLaMA with RLHF"),Hs=r(", a blog post about how to train LLaMA to answer questions on "),rt=a("a"),Xs=r("Stack Exchange"),Ys=r(" with RLHF."),cn=d(),po=a("p"),Qs=r("\u2697\uFE0F Optimization"),mn=d(),fo=a("ul"),it=a("li"),Ks=r("A "),lt=a("a"),er=r("notebook"),tr=r(" on how to fine-tune LLaMA model using xturing library on GPU which has limited memory. \u{1F30E}"),hn=d(),uo=a("p"),or=r("\u26A1\uFE0F Inference"),pn=d(),be=a("ul"),dt=a("li"),ar=r("A "),ct=a("a"),nr=r("notebook"),sr=r(" on how to run the LLaMA Model using PeftModel from the \u{1F917} PEFT library. \u{1F30E}"),rr=d(),mt=a("li"),ir=r("A "),ht=a("a"),lr=r("notebook"),dr=r(" on how to load a PEFT adapter LLaMA model with LangChain. \u{1F30E}"),fn=d(),_o=a("p"),cr=r("\u{1F680} Deploy"),un=d(),ke=a("ul"),pt=a("li"),mr=r("A "),ft=a("a"),hr=r("notebook"),pr=r(" on how to fine-tune LLaMA model using LoRA method via the \u{1F917} PEFT library with intuitive UI. \u{1F30E}"),fr=d(),ut=a("li"),ur=r("A "),_t=a("a"),_r=r("notebook"),gr=r(" on how to deploy Open-LLaMA model for text generation on Amazon SageMaker. \u{1F30E}"),_n=d(),Q=a("h2"),ve=a("a"),Xo=a("span"),_(gt.$$.fragment),br=d(),Yo=a("span"),kr=r("LlamaConfig"),gn=d(),S=a("div"),_(bt.$$.fragment),vr=d(),kt=a("p"),yr=r("This is the configuration class to store the configuration of a "),go=a("a"),wr=r("LlamaModel"),Lr=r(`. It is used to instantiate an LLaMA
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 LLaMA-7B.`),Tr=d(),K=a("p"),$r=r("Configuration objects inherit from "),bo=a("a"),Mr=r("PretrainedConfig"),zr=r(` and can be used to control the model outputs. Read the
documentation from `),ko=a("a"),Er=r("PretrainedConfig"),Ar=r(" for more information."),xr=d(),_(ye.$$.fragment),bn=d(),ee=a("h2"),we=a("a"),Qo=a("span"),_(vt.$$.fragment),Fr=d(),Ko=a("span"),Cr=r("LlamaTokenizer"),kn=d(),x=a("div"),_(yt.$$.fragment),Pr=d(),ea=a("p"),qr=r(`Construct a Llama tokenizer. Based on byte-level Byte-Pair-Encoding. The default padding token is unset as there is
no padding token in the original model.`),Ir=d(),vo=a("div"),_(wt.$$.fragment),Sr=d(),Le=a("div"),_(Lt.$$.fragment),Ur=d(),Tt=a("p"),jr=r(`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),ta=a("code"),Nr=r("prepare_for_model"),Dr=r(" method."),Wr=d(),N=a("div"),_($t.$$.fragment),Br=d(),oa=a("p"),Or=r("Creates a mask from the two sequences passed to be used in a sequence-pair classification task. An ALBERT"),Jr=d(),_(Te.$$.fragment),Rr=d(),aa=a("p"),Gr=r("if token_ids_1 is None, only returns the first portion of the mask (0s)."),Vr=d(),$e=a("div"),_(Mt.$$.fragment),Zr=d(),na=a("p"),Hr=r("Save the vocabulary and special tokens file to a directory."),vn=d(),te=a("h2"),Me=a("a"),sa=a("span"),_(zt.$$.fragment),Xr=d(),ra=a("span"),Yr=r("LlamaTokenizerFast"),yn=d(),M=a("div"),_(Et.$$.fragment),Qr=d(),ia=a("p"),Kr=r("Construct a Llama tokenizer. Based on byte-level Byte-Pair-Encoding."),ei=d(),la=a("p"),ti=r("This uses notably ByteFallback and no normalization."),oi=d(),_(ze.$$.fragment),ai=d(),U=a("p"),ni=r("If you want to change the "),da=a("code"),si=r("bos_token"),ri=r(" or the "),ca=a("code"),ii=r("eos_token"),li=r(`, make sure to specify them when initializing the model, or
call `),ma=a("code"),di=r("tokenizer.update_post_processor()"),ci=r(` to make sure that the post-processing is correctly done (otherwise the
values of the first token and final token of an encoded sequence will not be correct). For more details, checkout
[post-processors] (`),At=a("a"),mi=r("https://huggingface.co/docs/tokenizers/api/post-processors"),hi=r(") documentation."),pi=d(),xt=a("p"),fi=r("This tokenizer inherits from "),yo=a("a"),ui=r("PreTrainedTokenizerFast"),_i=r(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),gi=d(),B=a("div"),_(Ft.$$.fragment),bi=d(),ha=a("p"),ki=r(`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens.`),vi=d(),pa=a("p"),yi=r("This implementation does not add special tokens and this method should be overridden in a subclass."),wi=d(),Ee=a("div"),_(Ct.$$.fragment),Li=d(),oe=a("p"),Ti=r(`Retrieves sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),fa=a("code"),$i=r("prepare_for_model"),Mi=r(" or "),ua=a("code"),zi=r("encode_plus"),Ei=r(" methods."),Ai=d(),O=a("div"),_(Pt.$$.fragment),xi=d(),wo=a("p"),Fi=r("Create the token type IDs corresponding to the sequences passed. "),Lo=a("a"),Ci=r(`What are token type
IDs?`),Pi=d(),_a=a("p"),qi=r("Should be overridden in a subclass if the model has a special way of building those."),Ii=d(),Ae=a("div"),_(qt.$$.fragment),Si=d(),ae=a("p"),Ui=r("Updates the underlying post processor with the current "),ga=a("code"),ji=r("bos_token"),Ni=r(" and "),ba=a("code"),Di=r("eos_token"),Wi=r("."),Bi=d(),To=a("div"),_(It.$$.fragment),wn=d(),ne=a("h2"),xe=a("a"),ka=a("span"),_(St.$$.fragment),Oi=d(),va=a("span"),Ji=r("LlamaModel"),Ln=d(),C=a("div"),_(Ut.$$.fragment),Ri=d(),jt=a("p"),Gi=r(`The bare LLaMA Model outputting raw hidden-states without any specific head on top.
This model inherits from `),$o=a("a"),Vi=r("PreTrainedModel"),Zi=r(`. 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.)`),Hi=d(),Nt=a("p"),Xi=r("This model is also a PyTorch "),Dt=a("a"),Yi=r("torch.nn.Module"),Qi=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ki=d(),Fe=a("p"),el=r("Transformer decoder consisting of "),ya=a("em"),tl=r("config.num_hidden_layers"),ol=r(" layers. Each layer is a "),wa=a("code"),al=r("LlamaDecoderLayer"),nl=d(),J=a("div"),_(Wt.$$.fragment),sl=d(),se=a("p"),rl=r("The "),Mo=a("a"),il=r("LlamaModel"),ll=r(" forward method, overrides the "),La=a("code"),dl=r("__call__"),cl=r(" special method."),ml=d(),_(Ce.$$.fragment),Tn=d(),re=a("h2"),Pe=a("a"),Ta=a("span"),_(Bt.$$.fragment),hl=d(),$a=a("span"),pl=r("LlamaForCausalLM"),$n=d(),ie=a("div"),_(Ot.$$.fragment),fl=d(),D=a("div"),_(Jt.$$.fragment),ul=d(),le=a("p"),_l=r("The "),zo=a("a"),gl=r("LlamaForCausalLM"),bl=r(" forward method, overrides the "),Ma=a("code"),kl=r("__call__"),vl=r(" special method."),yl=d(),_(qe.$$.fragment),wl=d(),_(Ie.$$.fragment),Mn=d(),de=a("h2"),Se=a("a"),za=a("span"),_(Rt.$$.fragment),Ll=d(),Ea=a("span"),Tl=r("LlamaForSequenceClassification"),zn=d(),E=a("div"),_(Gt.$$.fragment),$l=d(),Aa=a("p"),Ml=r("The LLaMa Model transformer with a sequence classification head on top (linear layer)."),zl=d(),Eo=a("p"),Ao=a("a"),El=r("LlamaForSequenceClassification"),Al=r(` uses the last token in order to do the classification, as other causal models
(e.g. GPT-2) do.`),xl=d(),j=a("p"),Fl=r(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),xa=a("code"),Cl=r("pad_token_id"),Pl=r(` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Fa=a("code"),ql=r("pad_token_id"),Il=r(` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Ca=a("code"),Sl=r("inputs_embeds"),Ul=r(" are passed instead of "),Pa=a("code"),jl=r("input_ids"),Nl=r(`, it does the same (take the last value in
each row of the batch).`),Dl=d(),Vt=a("p"),Wl=r("This model inherits from "),xo=a("a"),Bl=r("PreTrainedModel"),Ol=r(`. 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.)`),Jl=d(),Zt=a("p"),Rl=r("This model is also a PyTorch "),Ht=a("a"),Gl=r("torch.nn.Module"),Vl=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Zl=d(),R=a("div"),_(Xt.$$.fragment),Hl=d(),ce=a("p"),Xl=r("The "),Fo=a("a"),Yl=r("LlamaForSequenceClassification"),Ql=r(" forward method, overrides the "),qa=a("code"),Kl=r("__call__"),ed=r(" special method."),td=d(),_(Ue.$$.fragment),this.h()},l(t){const m=om('[data-svelte="svelte-1phssyn"]',document.head);p=n(m,"META",{name:!0,content:!0}),m.forEach(o),T=c(t),f=n(t,"H1",{class:!0});var Yt=s(f);w=n(Yt,"A",{id:!0,class:!0,href:!0});var Ia=s(w);$=n(Ia,"SPAN",{});var Sa=s($);g(u.$$.fragment,Sa),Sa.forEach(o),Ia.forEach(o),L=c(Yt),P=n(Yt,"SPAN",{});var Ua=s(P);ls=i(Ua,"LLaMA"),Ua.forEach(o),Yt.forEach(o),Oa=c(t),X=n(t,"H2",{class:!0});var Qt=s(X);he=n(Qt,"A",{id:!0,class:!0,href:!0});var ja=s(he);Oo=n(ja,"SPAN",{});var Na=s(Oo);g(We.$$.fragment,Na),Na.forEach(o),ja.forEach(o),ds=c(Qt),Jo=n(Qt,"SPAN",{});var rd=s(Jo);cs=i(rd,"Overview"),rd.forEach(o),Qt.forEach(o),Ja=c(t),pe=n(t,"P",{});var An=s(pe);ms=i(An,"The LLaMA model was proposed in "),Be=n(An,"A",{href:!0,rel:!0});var id=s(Be);hs=i(id,"LLaMA: Open and Efficient Foundation Language Models"),id.forEach(o),ps=i(An," by Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timoth\xE9e Lacroix, Baptiste Rozi\xE8re, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Armand Joulin, Edouard Grave, Guillaume Lample. It is a collection of foundation language models ranging from 7B to 65B parameters."),An.forEach(o),Ra=c(t),Kt=n(t,"P",{});var ld=s(Kt);fs=i(ld,"The abstract from the paper is the following:"),ld.forEach(o),Ga=c(t),eo=n(t,"P",{});var dd=s(eo);Ro=n(dd,"EM",{});var cd=s(Ro);us=i(cd,"We introduce LLaMA, a collection of foundation language models ranging from 7B to 65B parameters. We train our models on trillions of tokens, and show that it is possible to train state-of-the-art models using publicly available datasets exclusively, without resorting to proprietary and inaccessible datasets. In particular, LLaMA-13B outperforms GPT-3 (175B) on most benchmarks, and LLaMA-65B is competitive with the best models, Chinchilla-70B and PaLM-540B. We release all our models to the research community."),cd.forEach(o),dd.forEach(o),Va=c(t),to=n(t,"P",{});var md=s(to);_s=i(md,"Tips:"),md.forEach(o),Za=c(t),fe=n(t,"UL",{});var xn=s(fe);oo=n(xn,"LI",{});var od=s(oo);gs=i(od,"Weights for the LLaMA models can be obtained from by filling out "),Oe=n(od,"A",{href:!0,rel:!0});var hd=s(Oe);bs=i(hd,"this form"),hd.forEach(o),od.forEach(o),ks=c(xn),Je=n(xn,"LI",{});var Fn=s(Je);vs=i(Fn,"After downloading the weights, they will need to be converted to the Hugging Face Transformers format using the "),Re=n(Fn,"A",{href:!0,rel:!0});var pd=s(Re);ys=i(pd,"conversion script"),pd.forEach(o),ws=i(Fn,". The script can be called with the following (example) command:"),Fn.forEach(o),xn.forEach(o),Ha=c(t),g(Ge.$$.fragment,t),Xa=c(t),ao=n(t,"UL",{});var fd=s(ao);Go=n(fd,"LI",{});var ud=s(Go);Ls=i(ud,"After conversion, the model and tokenizer can be loaded via:"),ud.forEach(o),fd.forEach(o),Ya=c(t),g(Ve.$$.fragment,t),Qa=c(t),no=n(t,"P",{});var _d=s(no);Ts=i(_d,`Note that executing the script requires enough CPU RAM to host the whole model in float16 precision (even if the biggest versions
come in several checkpoints they each contain a part of each weight of the model, so we need to load them all in RAM). For the 65B model, it\u2019s thus 130GB of RAM needed.`),_d.forEach(o),Ka=c(t),so=n(t,"UL",{});var gd=s(so);Ze=n(gd,"LI",{});var Cn=s(Ze);$s=i(Cn,"The LLaMA tokenizer is a BPE model based on "),He=n(Cn,"A",{href:!0,rel:!0});var bd=s(He);Ms=i(bd,"sentencepiece"),bd.forEach(o),zs=i(Cn,". One quirk of sentencepiece is that when decoding a sequence, if the first token is the start of the word (e.g. \u201CBanana\u201D), the tokenizer does not prepend the prefix space to the string."),Cn.forEach(o),gd.forEach(o),en=c(t),q=n(t,"P",{});var G=s(q);Es=i(G,"This model was contributed by "),Xe=n(G,"A",{href:!0,rel:!0});var kd=s(Xe);As=i(kd,"zphang"),kd.forEach(o),xs=i(G," with contributions from "),Ye=n(G,"A",{href:!0,rel:!0});var vd=s(Ye);Fs=i(vd,"BlackSamorez"),vd.forEach(o),Cs=i(G,". The code of the implementation in Hugging Face is based on GPT-NeoX "),Qe=n(G,"A",{href:!0,rel:!0});var yd=s(Qe);Ps=i(yd,"here"),yd.forEach(o),qs=i(G,". The original code of the authors can be found "),Ke=n(G,"A",{href:!0,rel:!0});var wd=s(Ke);Is=i(wd,"here"),wd.forEach(o),Ss=i(G,"."),G.forEach(o),tn=c(t),ro=n(t,"P",{});var Ld=s(ro);Us=i(Ld,"Based on the original LLaMA model, Meta AI has released some follow-up works:"),Ld.forEach(o),on=c(t),io=n(t,"UL",{});var Td=s(io);ue=n(Td,"LI",{});var Da=s(ue);Vo=n(Da,"STRONG",{});var $d=s(Vo);js=i($d,"Llama2"),$d.forEach(o),Ns=i(Da,": Llama2 is an improved version of Llama with some architectural tweaks (Grouped Query Attention), and is pre-trained on 2Trillion tokens. Refer to the documentation of Llama2 which can be found "),lo=n(Da,"A",{href:!0});var Md=s(lo);Ds=i(Md,"here"),Md.forEach(o),Ws=i(Da,"."),Da.forEach(o),Td.forEach(o),an=c(t),Y=n(t,"H2",{class:!0});var Pn=s(Y);_e=n(Pn,"A",{id:!0,class:!0,href:!0});var zd=s(_e);Zo=n(zd,"SPAN",{});var Ed=s(Zo);g(et.$$.fragment,Ed),Ed.forEach(o),zd.forEach(o),Bs=c(Pn),Ho=n(Pn,"SPAN",{});var Ad=s(Ho);Os=i(Ad,"Resources"),Ad.forEach(o),Pn.forEach(o),nn=c(t),co=n(t,"P",{});var xd=s(co);Js=i(xd,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with LLaMA. If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),xd.forEach(o),sn=c(t),g(tt.$$.fragment,t),rn=c(t),mo=n(t,"UL",{});var Fd=s(mo);ot=n(Fd,"LI",{});var qn=s(ot);Rs=i(qn,"A "),at=n(qn,"A",{href:!0,rel:!0});var Cd=s(at);Gs=i(Cd,"notebook"),Cd.forEach(o),Vs=i(qn," on how to use prompt tuning to adapt the LLaMA model for text classification task. \u{1F30E}"),qn.forEach(o),Fd.forEach(o),ln=c(t),g(nt.$$.fragment,t),dn=c(t),ho=n(t,"UL",{});var Pd=s(ho);ge=n(Pd,"LI",{});var Wa=s(ge);st=n(Wa,"A",{href:!0,rel:!0});var qd=s(st);Zs=i(qd,"StackLLaMA: A hands-on guide to train LLaMA with RLHF"),qd.forEach(o),Hs=i(Wa,", a blog post about how to train LLaMA to answer questions on "),rt=n(Wa,"A",{href:!0,rel:!0});var Id=s(rt);Xs=i(Id,"Stack Exchange"),Id.forEach(o),Ys=i(Wa," with RLHF."),Wa.forEach(o),Pd.forEach(o),cn=c(t),po=n(t,"P",{});var Sd=s(po);Qs=i(Sd,"\u2697\uFE0F Optimization"),Sd.forEach(o),mn=c(t),fo=n(t,"UL",{});var Ud=s(fo);it=n(Ud,"LI",{});var In=s(it);Ks=i(In,"A "),lt=n(In,"A",{href:!0,rel:!0});var jd=s(lt);er=i(jd,"notebook"),jd.forEach(o),tr=i(In," on how to fine-tune LLaMA model using xturing library on GPU which has limited memory. \u{1F30E}"),In.forEach(o),Ud.forEach(o),hn=c(t),uo=n(t,"P",{});var Nd=s(uo);or=i(Nd,"\u26A1\uFE0F Inference"),Nd.forEach(o),pn=c(t),be=n(t,"UL",{});var Sn=s(be);dt=n(Sn,"LI",{});var Un=s(dt);ar=i(Un,"A "),ct=n(Un,"A",{href:!0,rel:!0});var Dd=s(ct);nr=i(Dd,"notebook"),Dd.forEach(o),sr=i(Un," on how to run the LLaMA Model using PeftModel from the \u{1F917} PEFT library. \u{1F30E}"),Un.forEach(o),rr=c(Sn),mt=n(Sn,"LI",{});var jn=s(mt);ir=i(jn,"A "),ht=n(jn,"A",{href:!0,rel:!0});var Wd=s(ht);lr=i(Wd,"notebook"),Wd.forEach(o),dr=i(jn," on how to load a PEFT adapter LLaMA model with LangChain. \u{1F30E}"),jn.forEach(o),Sn.forEach(o),fn=c(t),_o=n(t,"P",{});var Bd=s(_o);cr=i(Bd,"\u{1F680} Deploy"),Bd.forEach(o),un=c(t),ke=n(t,"UL",{});var Nn=s(ke);pt=n(Nn,"LI",{});var Dn=s(pt);mr=i(Dn,"A "),ft=n(Dn,"A",{href:!0,rel:!0});var Od=s(ft);hr=i(Od,"notebook"),Od.forEach(o),pr=i(Dn," on how to fine-tune LLaMA model using LoRA method via the \u{1F917} PEFT library with intuitive UI. \u{1F30E}"),Dn.forEach(o),fr=c(Nn),ut=n(Nn,"LI",{});var Wn=s(ut);ur=i(Wn,"A "),_t=n(Wn,"A",{href:!0,rel:!0});var Jd=s(_t);_r=i(Jd,"notebook"),Jd.forEach(o),gr=i(Wn," on how to deploy Open-LLaMA model for text generation on Amazon SageMaker. \u{1F30E}"),Wn.forEach(o),Nn.forEach(o),_n=c(t),Q=n(t,"H2",{class:!0});var Bn=s(Q);ve=n(Bn,"A",{id:!0,class:!0,href:!0});var Rd=s(ve);Xo=n(Rd,"SPAN",{});var Gd=s(Xo);g(gt.$$.fragment,Gd),Gd.forEach(o),Rd.forEach(o),br=c(Bn),Yo=n(Bn,"SPAN",{});var Vd=s(Yo);kr=i(Vd,"LlamaConfig"),Vd.forEach(o),Bn.forEach(o),gn=c(t),S=n(t,"DIV",{class:!0});var je=s(S);g(bt.$$.fragment,je),vr=c(je),kt=n(je,"P",{});var On=s(kt);yr=i(On,"This is the configuration class to store the configuration of a "),go=n(On,"A",{href:!0});var Zd=s(go);wr=i(Zd,"LlamaModel"),Zd.forEach(o),Lr=i(On,`. It is used to instantiate an LLaMA
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 LLaMA-7B.`),On.forEach(o),Tr=c(je),K=n(je,"P",{});var Co=s(K);$r=i(Co,"Configuration objects inherit from "),bo=n(Co,"A",{href:!0});var Hd=s(bo);Mr=i(Hd,"PretrainedConfig"),Hd.forEach(o),zr=i(Co,` and can be used to control the model outputs. Read the
documentation from `),ko=n(Co,"A",{href:!0});var Xd=s(ko);Er=i(Xd,"PretrainedConfig"),Xd.forEach(o),Ar=i(Co," for more information."),Co.forEach(o),xr=c(je),g(ye.$$.fragment,je),je.forEach(o),bn=c(t),ee=n(t,"H2",{class:!0});var Jn=s(ee);we=n(Jn,"A",{id:!0,class:!0,href:!0});var Yd=s(we);Qo=n(Yd,"SPAN",{});var Qd=s(Qo);g(vt.$$.fragment,Qd),Qd.forEach(o),Yd.forEach(o),Fr=c(Jn),Ko=n(Jn,"SPAN",{});var Kd=s(Ko);Cr=i(Kd,"LlamaTokenizer"),Kd.forEach(o),Jn.forEach(o),kn=c(t),x=n(t,"DIV",{class:!0});var W=s(x);g(yt.$$.fragment,W),Pr=c(W),ea=n(W,"P",{});var ec=s(ea);qr=i(ec,`Construct a Llama tokenizer. Based on byte-level Byte-Pair-Encoding. The default padding token is unset as there is
no padding token in the original model.`),ec.forEach(o),Ir=c(W),vo=n(W,"DIV",{class:!0});var tc=s(vo);g(wt.$$.fragment,tc),tc.forEach(o),Sr=c(W),Le=n(W,"DIV",{class:!0});var Rn=s(Le);g(Lt.$$.fragment,Rn),Ur=c(Rn),Tt=n(Rn,"P",{});var Gn=s(Tt);jr=i(Gn,`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),ta=n(Gn,"CODE",{});var oc=s(ta);Nr=i(oc,"prepare_for_model"),oc.forEach(o),Dr=i(Gn," method."),Gn.forEach(o),Rn.forEach(o),Wr=c(W),N=n(W,"DIV",{class:!0});var Ne=s(N);g($t.$$.fragment,Ne),Br=c(Ne),oa=n(Ne,"P",{});var ac=s(oa);Or=i(ac,"Creates a mask from the two sequences passed to be used in a sequence-pair classification task. An ALBERT"),ac.forEach(o),Jr=c(Ne),g(Te.$$.fragment,Ne),Rr=c(Ne),aa=n(Ne,"P",{});var nc=s(aa);Gr=i(nc,"if token_ids_1 is None, only returns the first portion of the mask (0s)."),nc.forEach(o),Ne.forEach(o),Vr=c(W),$e=n(W,"DIV",{class:!0});var Vn=s($e);g(Mt.$$.fragment,Vn),Zr=c(Vn),na=n(Vn,"P",{});var sc=s(na);Hr=i(sc,"Save the vocabulary and special tokens file to a directory."),sc.forEach(o),Vn.forEach(o),W.forEach(o),vn=c(t),te=n(t,"H2",{class:!0});var Zn=s(te);Me=n(Zn,"A",{id:!0,class:!0,href:!0});var rc=s(Me);sa=n(rc,"SPAN",{});var ic=s(sa);g(zt.$$.fragment,ic),ic.forEach(o),rc.forEach(o),Xr=c(Zn),ra=n(Zn,"SPAN",{});var lc=s(ra);Yr=i(lc,"LlamaTokenizerFast"),lc.forEach(o),Zn.forEach(o),yn=c(t),M=n(t,"DIV",{class:!0});var z=s(M);g(Et.$$.fragment,z),Qr=c(z),ia=n(z,"P",{});var dc=s(ia);Kr=i(dc,"Construct a Llama tokenizer. Based on byte-level Byte-Pair-Encoding."),dc.forEach(o),ei=c(z),la=n(z,"P",{});var cc=s(la);ti=i(cc,"This uses notably ByteFallback and no normalization."),cc.forEach(o),oi=c(z),g(ze.$$.fragment,z),ai=c(z),U=n(z,"P",{});var V=s(U);ni=i(V,"If you want to change the "),da=n(V,"CODE",{});var mc=s(da);si=i(mc,"bos_token"),mc.forEach(o),ri=i(V," or the "),ca=n(V,"CODE",{});var hc=s(ca);ii=i(hc,"eos_token"),hc.forEach(o),li=i(V,`, make sure to specify them when initializing the model, or
call `),ma=n(V,"CODE",{});var pc=s(ma);di=i(pc,"tokenizer.update_post_processor()"),pc.forEach(o),ci=i(V,` to make sure that the post-processing is correctly done (otherwise the
values of the first token and final token of an encoded sequence will not be correct). For more details, checkout
[post-processors] (`),At=n(V,"A",{href:!0,rel:!0});var fc=s(At);mi=i(fc,"https://huggingface.co/docs/tokenizers/api/post-processors"),fc.forEach(o),hi=i(V,") documentation."),V.forEach(o),pi=c(z),xt=n(z,"P",{});var Hn=s(xt);fi=i(Hn,"This tokenizer inherits from "),yo=n(Hn,"A",{href:!0});var uc=s(yo);ui=i(uc,"PreTrainedTokenizerFast"),uc.forEach(o),_i=i(Hn,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),Hn.forEach(o),gi=c(z),B=n(z,"DIV",{class:!0});var Po=s(B);g(Ft.$$.fragment,Po),bi=c(Po),ha=n(Po,"P",{});var _c=s(ha);ki=i(_c,`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens.`),_c.forEach(o),vi=c(Po),pa=n(Po,"P",{});var gc=s(pa);yi=i(gc,"This implementation does not add special tokens and this method should be overridden in a subclass."),gc.forEach(o),Po.forEach(o),wi=c(z),Ee=n(z,"DIV",{class:!0});var Xn=s(Ee);g(Ct.$$.fragment,Xn),Li=c(Xn),oe=n(Xn,"P",{});var qo=s(oe);Ti=i(qo,`Retrieves sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),fa=n(qo,"CODE",{});var bc=s(fa);$i=i(bc,"prepare_for_model"),bc.forEach(o),Mi=i(qo," or "),ua=n(qo,"CODE",{});var kc=s(ua);zi=i(kc,"encode_plus"),kc.forEach(o),Ei=i(qo," methods."),qo.forEach(o),Xn.forEach(o),Ai=c(z),O=n(z,"DIV",{class:!0});var Io=s(O);g(Pt.$$.fragment,Io),xi=c(Io),wo=n(Io,"P",{});var ad=s(wo);Fi=i(ad,"Create the token type IDs corresponding to the sequences passed. "),Lo=n(ad,"A",{href:!0});var vc=s(Lo);Ci=i(vc,`What are token type
IDs?`),vc.forEach(o),ad.forEach(o),Pi=c(Io),_a=n(Io,"P",{});var yc=s(_a);qi=i(yc,"Should be overridden in a subclass if the model has a special way of building those."),yc.forEach(o),Io.forEach(o),Ii=c(z),Ae=n(z,"DIV",{class:!0});var Yn=s(Ae);g(qt.$$.fragment,Yn),Si=c(Yn),ae=n(Yn,"P",{});var So=s(ae);Ui=i(So,"Updates the underlying post processor with the current "),ga=n(So,"CODE",{});var wc=s(ga);ji=i(wc,"bos_token"),wc.forEach(o),Ni=i(So," and "),ba=n(So,"CODE",{});var Lc=s(ba);Di=i(Lc,"eos_token"),Lc.forEach(o),Wi=i(So,"."),So.forEach(o),Yn.forEach(o),Bi=c(z),To=n(z,"DIV",{class:!0});var Tc=s(To);g(It.$$.fragment,Tc),Tc.forEach(o),z.forEach(o),wn=c(t),ne=n(t,"H2",{class:!0});var Qn=s(ne);xe=n(Qn,"A",{id:!0,class:!0,href:!0});var $c=s(xe);ka=n($c,"SPAN",{});var Mc=s(ka);g(St.$$.fragment,Mc),Mc.forEach(o),$c.forEach(o),Oi=c(Qn),va=n(Qn,"SPAN",{});var zc=s(va);Ji=i(zc,"LlamaModel"),zc.forEach(o),Qn.forEach(o),Ln=c(t),C=n(t,"DIV",{class:!0});var Z=s(C);g(Ut.$$.fragment,Z),Ri=c(Z),jt=n(Z,"P",{});var Kn=s(jt);Gi=i(Kn,`The bare LLaMA Model outputting raw hidden-states without any specific head on top.
This model inherits from `),$o=n(Kn,"A",{href:!0});var Ec=s($o);Vi=i(Ec,"PreTrainedModel"),Ec.forEach(o),Zi=i(Kn,`. 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.)`),Kn.forEach(o),Hi=c(Z),Nt=n(Z,"P",{});var es=s(Nt);Xi=i(es,"This model is also a PyTorch "),Dt=n(es,"A",{href:!0,rel:!0});var Ac=s(Dt);Yi=i(Ac,"torch.nn.Module"),Ac.forEach(o),Qi=i(es,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),es.forEach(o),Ki=c(Z),Fe=n(Z,"P",{});var Ba=s(Fe);el=i(Ba,"Transformer decoder consisting of "),ya=n(Ba,"EM",{});var xc=s(ya);tl=i(xc,"config.num_hidden_layers"),xc.forEach(o),ol=i(Ba," layers. Each layer is a "),wa=n(Ba,"CODE",{});var Fc=s(wa);al=i(Fc,"LlamaDecoderLayer"),Fc.forEach(o),Ba.forEach(o),nl=c(Z),J=n(Z,"DIV",{class:!0});var Uo=s(J);g(Wt.$$.fragment,Uo),sl=c(Uo),se=n(Uo,"P",{});var jo=s(se);rl=i(jo,"The "),Mo=n(jo,"A",{href:!0});var Cc=s(Mo);il=i(Cc,"LlamaModel"),Cc.forEach(o),ll=i(jo," forward method, overrides the "),La=n(jo,"CODE",{});var Pc=s(La);dl=i(Pc,"__call__"),Pc.forEach(o),cl=i(jo," special method."),jo.forEach(o),ml=c(Uo),g(Ce.$$.fragment,Uo),Uo.forEach(o),Z.forEach(o),Tn=c(t),re=n(t,"H2",{class:!0});var ts=s(re);Pe=n(ts,"A",{id:!0,class:!0,href:!0});var qc=s(Pe);Ta=n(qc,"SPAN",{});var Ic=s(Ta);g(Bt.$$.fragment,Ic),Ic.forEach(o),qc.forEach(o),hl=c(ts),$a=n(ts,"SPAN",{});var Sc=s($a);pl=i(Sc,"LlamaForCausalLM"),Sc.forEach(o),ts.forEach(o),$n=c(t),ie=n(t,"DIV",{class:!0});var os=s(ie);g(Ot.$$.fragment,os),fl=c(os),D=n(os,"DIV",{class:!0});var De=s(D);g(Jt.$$.fragment,De),ul=c(De),le=n(De,"P",{});var No=s(le);_l=i(No,"The "),zo=n(No,"A",{href:!0});var Uc=s(zo);gl=i(Uc,"LlamaForCausalLM"),Uc.forEach(o),bl=i(No," forward method, overrides the "),Ma=n(No,"CODE",{});var jc=s(Ma);kl=i(jc,"__call__"),jc.forEach(o),vl=i(No," special method."),No.forEach(o),yl=c(De),g(qe.$$.fragment,De),wl=c(De),g(Ie.$$.fragment,De),De.forEach(o),os.forEach(o),Mn=c(t),de=n(t,"H2",{class:!0});var as=s(de);Se=n(as,"A",{id:!0,class:!0,href:!0});var Nc=s(Se);za=n(Nc,"SPAN",{});var Dc=s(za);g(Rt.$$.fragment,Dc),Dc.forEach(o),Nc.forEach(o),Ll=c(as),Ea=n(as,"SPAN",{});var Wc=s(Ea);Tl=i(Wc,"LlamaForSequenceClassification"),Wc.forEach(o),as.forEach(o),zn=c(t),E=n(t,"DIV",{class:!0});var I=s(E);g(Gt.$$.fragment,I),$l=c(I),Aa=n(I,"P",{});var Bc=s(Aa);Ml=i(Bc,"The LLaMa Model transformer with a sequence classification head on top (linear layer)."),Bc.forEach(o),zl=c(I),Eo=n(I,"P",{});var nd=s(Eo);Ao=n(nd,"A",{href:!0});var Oc=s(Ao);El=i(Oc,"LlamaForSequenceClassification"),Oc.forEach(o),Al=i(nd,` uses the last token in order to do the classification, as other causal models
(e.g. GPT-2) do.`),nd.forEach(o),xl=c(I),j=n(I,"P",{});var H=s(j);Fl=i(H,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),xa=n(H,"CODE",{});var Jc=s(xa);Cl=i(Jc,"pad_token_id"),Jc.forEach(o),Pl=i(H,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Fa=n(H,"CODE",{});var Rc=s(Fa);ql=i(Rc,"pad_token_id"),Rc.forEach(o),Il=i(H,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Ca=n(H,"CODE",{});var Gc=s(Ca);Sl=i(Gc,"inputs_embeds"),Gc.forEach(o),Ul=i(H," are passed instead of "),Pa=n(H,"CODE",{});var Vc=s(Pa);jl=i(Vc,"input_ids"),Vc.forEach(o),Nl=i(H,`, it does the same (take the last value in
each row of the batch).`),H.forEach(o),Dl=c(I),Vt=n(I,"P",{});var ns=s(Vt);Wl=i(ns,"This model inherits from "),xo=n(ns,"A",{href:!0});var Zc=s(xo);Bl=i(Zc,"PreTrainedModel"),Zc.forEach(o),Ol=i(ns,`. 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.)`),ns.forEach(o),Jl=c(I),Zt=n(I,"P",{});var ss=s(Zt);Rl=i(ss,"This model is also a PyTorch "),Ht=n(ss,"A",{href:!0,rel:!0});var Hc=s(Ht);Gl=i(Hc,"torch.nn.Module"),Hc.forEach(o),Vl=i(ss,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ss.forEach(o),Zl=c(I),R=n(I,"DIV",{class:!0});var Do=s(R);g(Xt.$$.fragment,Do),Hl=c(Do),ce=n(Do,"P",{});var Wo=s(ce);Xl=i(Wo,"The "),Fo=n(Wo,"A",{href:!0});var Xc=s(Fo);Yl=i(Xc,"LlamaForSequenceClassification"),Xc.forEach(o),Ql=i(Wo," forward method, overrides the "),qa=n(Wo,"CODE",{});var Yc=s(qa);Kl=i(Yc,"__call__"),Yc.forEach(o),ed=i(Wo," special method."),Wo.forEach(o),td=c(Do),g(Ue.$$.fragment,Do),Do.forEach(o),I.forEach(o),this.h()},h(){l(p,"name","hf:doc:metadata"),l(p,"content",JSON.stringify(hm)),l(w,"id","llama"),l(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"),l(w,"href","#llama"),l(f,"class","relative group"),l(he,"id","overview"),l(he,"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"),l(he,"href","#overview"),l(X,"class","relative group"),l(Be,"href","https://arxiv.org/abs/2302.13971"),l(Be,"rel","nofollow"),l(Oe,"href","https://docs.google.com/forms/d/e/1FAIpQLSfqNECQnMkycAp2jP4Z9TFX0cGR4uf7b_fBxjY_OjhJILlKGA/viewform?usp=send_form"),l(Oe,"rel","nofollow"),l(Re,"href","https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/convert_llama_weights_to_hf.py"),l(Re,"rel","nofollow"),l(He,"href","https://github.com/google/sentencepiece"),l(He,"rel","nofollow"),l(Xe,"href","https://huggingface.co/zphang"),l(Xe,"rel","nofollow"),l(Ye,"href","https://huggingface.co/BlackSamorez"),l(Ye,"rel","nofollow"),l(Qe,"href","https://github.com/EleutherAI/gpt-neox"),l(Qe,"rel","nofollow"),l(Ke,"href","https://github.com/facebookresearch/llama"),l(Ke,"rel","nofollow"),l(lo,"href","llama2"),l(_e,"id","resources"),l(_e,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(_e,"href","#resources"),l(Y,"class","relative group"),l(at,"href","https://colab.research.google.com/github/bigscience-workshop/petals/blob/main/examples/prompt-tuning-sst2.ipynb#scrollTo=f04ba4d2"),l(at,"rel","nofollow"),l(st,"href","https://huggingface.co/blog/stackllama#stackllama-a-hands-on-guide-to-train-llama-with-rlhf"),l(st,"rel","nofollow"),l(rt,"href","https://stackexchange.com/"),l(rt,"rel","nofollow"),l(lt,"href","https://colab.research.google.com/drive/1SQUXq1AMZPSLD4mk3A3swUIc6Y2dclme?usp=sharing"),l(lt,"rel","nofollow"),l(ct,"href","https://colab.research.google.com/github/DominguesM/alpaca-lora-ptbr-7b/blob/main/notebooks/02%20-%20Evaluate.ipynb"),l(ct,"rel","nofollow"),l(ht,"href","https://colab.research.google.com/drive/1l2GiSSPbajVyp2Nk3CFT4t3uH6-5TiBe?usp=sharing"),l(ht,"rel","nofollow"),l(ft,"href","https://colab.research.google.com/github/lxe/simple-llama-finetuner/blob/master/Simple_LLaMA_FineTuner.ipynb#scrollTo=3PM_DilAZD8T"),l(ft,"rel","nofollow"),l(_t,"href","https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart-foundation-models/text-generation-open-llama.ipynb"),l(_t,"rel","nofollow"),l(ve,"id","transformers.LlamaConfig"),l(ve,"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"),l(ve,"href","#transformers.LlamaConfig"),l(Q,"class","relative group"),l(go,"href","/docs/transformers/main/en/model_doc/llama2#transformers.LlamaModel"),l(bo,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),l(ko,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),l(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(we,"id","transformers.LlamaTokenizer"),l(we,"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"),l(we,"href","#transformers.LlamaTokenizer"),l(ee,"class","relative group"),l(vo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l($e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Me,"id","transformers.LlamaTokenizerFast"),l(Me,"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"),l(Me,"href","#transformers.LlamaTokenizerFast"),l(te,"class","relative group"),l(At,"href","https://huggingface.co/docs/tokenizers/api/post-processors"),l(At,"rel","nofollow"),l(yo,"href","/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast"),l(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Lo,"href","../glossary#token-type-ids"),l(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(To,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(xe,"id","transformers.LlamaModel"),l(xe,"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"),l(xe,"href","#transformers.LlamaModel"),l(ne,"class","relative group"),l($o,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),l(Dt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Dt,"rel","nofollow"),l(Mo,"href","/docs/transformers/main/en/model_doc/llama2#transformers.LlamaModel"),l(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Pe,"id","transformers.LlamaForCausalLM"),l(Pe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Pe,"href","#transformers.LlamaForCausalLM"),l(re,"class","relative group"),l(zo,"href","/docs/transformers/main/en/model_doc/llama2#transformers.LlamaForCausalLM"),l(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Se,"id","transformers.LlamaForSequenceClassification"),l(Se,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(Se,"href","#transformers.LlamaForSequenceClassification"),l(de,"class","relative group"),l(Ao,"href","/docs/transformers/main/en/model_doc/llama2#transformers.LlamaForSequenceClassification"),l(xo,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),l(Ht,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Ht,"rel","nofollow"),l(Fo,"href","/docs/transformers/main/en/model_doc/llama2#transformers.LlamaForSequenceClassification"),l(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,m){e(document.head,p),h(t,T,m),h(t,f,m),e(f,w),e(w,$),b(u,$,null),e(f,L),e(f,P),e(P,ls),h(t,Oa,m),h(t,X,m),e(X,he),e(he,Oo),b(We,Oo,null),e(X,ds),e(X,Jo),e(Jo,cs),h(t,Ja,m),h(t,pe,m),e(pe,ms),e(pe,Be),e(Be,hs),e(pe,ps),h(t,Ra,m),h(t,Kt,m),e(Kt,fs),h(t,Ga,m),h(t,eo,m),e(eo,Ro),e(Ro,us),h(t,Va,m),h(t,to,m),e(to,_s),h(t,Za,m),h(t,fe,m),e(fe,oo),e(oo,gs),e(oo,Oe),e(Oe,bs),e(fe,ks),e(fe,Je),e(Je,vs),e(Je,Re),e(Re,ys),e(Je,ws),h(t,Ha,m),b(Ge,t,m),h(t,Xa,m),h(t,ao,m),e(ao,Go),e(Go,Ls),h(t,Ya,m),b(Ve,t,m),h(t,Qa,m),h(t,no,m),e(no,Ts),h(t,Ka,m),h(t,so,m),e(so,Ze),e(Ze,$s),e(Ze,He),e(He,Ms),e(Ze,zs),h(t,en,m),h(t,q,m),e(q,Es),e(q,Xe),e(Xe,As),e(q,xs),e(q,Ye),e(Ye,Fs),e(q,Cs),e(q,Qe),e(Qe,Ps),e(q,qs),e(q,Ke),e(Ke,Is),e(q,Ss),h(t,tn,m),h(t,ro,m),e(ro,Us),h(t,on,m),h(t,io,m),e(io,ue),e(ue,Vo),e(Vo,js),e(ue,Ns),e(ue,lo),e(lo,Ds),e(ue,Ws),h(t,an,m),h(t,Y,m),e(Y,_e),e(_e,Zo),b(et,Zo,null),e(Y,Bs),e(Y,Ho),e(Ho,Os),h(t,nn,m),h(t,co,m),e(co,Js),h(t,sn,m),b(tt,t,m),h(t,rn,m),h(t,mo,m),e(mo,ot),e(ot,Rs),e(ot,at),e(at,Gs),e(ot,Vs),h(t,ln,m),b(nt,t,m),h(t,dn,m),h(t,ho,m),e(ho,ge),e(ge,st),e(st,Zs),e(ge,Hs),e(ge,rt),e(rt,Xs),e(ge,Ys),h(t,cn,m),h(t,po,m),e(po,Qs),h(t,mn,m),h(t,fo,m),e(fo,it),e(it,Ks),e(it,lt),e(lt,er),e(it,tr),h(t,hn,m),h(t,uo,m),e(uo,or),h(t,pn,m),h(t,be,m),e(be,dt),e(dt,ar),e(dt,ct),e(ct,nr),e(dt,sr),e(be,rr),e(be,mt),e(mt,ir),e(mt,ht),e(ht,lr),e(mt,dr),h(t,fn,m),h(t,_o,m),e(_o,cr),h(t,un,m),h(t,ke,m),e(ke,pt),e(pt,mr),e(pt,ft),e(ft,hr),e(pt,pr),e(ke,fr),e(ke,ut),e(ut,ur),e(ut,_t),e(_t,_r),e(ut,gr),h(t,_n,m),h(t,Q,m),e(Q,ve),e(ve,Xo),b(gt,Xo,null),e(Q,br),e(Q,Yo),e(Yo,kr),h(t,gn,m),h(t,S,m),b(bt,S,null),e(S,vr),e(S,kt),e(kt,yr),e(kt,go),e(go,wr),e(kt,Lr),e(S,Tr),e(S,K),e(K,$r),e(K,bo),e(bo,Mr),e(K,zr),e(K,ko),e(ko,Er),e(K,Ar),e(S,xr),b(ye,S,null),h(t,bn,m),h(t,ee,m),e(ee,we),e(we,Qo),b(vt,Qo,null),e(ee,Fr),e(ee,Ko),e(Ko,Cr),h(t,kn,m),h(t,x,m),b(yt,x,null),e(x,Pr),e(x,ea),e(ea,qr),e(x,Ir),e(x,vo),b(wt,vo,null),e(x,Sr),e(x,Le),b(Lt,Le,null),e(Le,Ur),e(Le,Tt),e(Tt,jr),e(Tt,ta),e(ta,Nr),e(Tt,Dr),e(x,Wr),e(x,N),b($t,N,null),e(N,Br),e(N,oa),e(oa,Or),e(N,Jr),b(Te,N,null),e(N,Rr),e(N,aa),e(aa,Gr),e(x,Vr),e(x,$e),b(Mt,$e,null),e($e,Zr),e($e,na),e(na,Hr),h(t,vn,m),h(t,te,m),e(te,Me),e(Me,sa),b(zt,sa,null),e(te,Xr),e(te,ra),e(ra,Yr),h(t,yn,m),h(t,M,m),b(Et,M,null),e(M,Qr),e(M,ia),e(ia,Kr),e(M,ei),e(M,la),e(la,ti),e(M,oi),b(ze,M,null),e(M,ai),e(M,U),e(U,ni),e(U,da),e(da,si),e(U,ri),e(U,ca),e(ca,ii),e(U,li),e(U,ma),e(ma,di),e(U,ci),e(U,At),e(At,mi),e(U,hi),e(M,pi),e(M,xt),e(xt,fi),e(xt,yo),e(yo,ui),e(xt,_i),e(M,gi),e(M,B),b(Ft,B,null),e(B,bi),e(B,ha),e(ha,ki),e(B,vi),e(B,pa),e(pa,yi),e(M,wi),e(M,Ee),b(Ct,Ee,null),e(Ee,Li),e(Ee,oe),e(oe,Ti),e(oe,fa),e(fa,$i),e(oe,Mi),e(oe,ua),e(ua,zi),e(oe,Ei),e(M,Ai),e(M,O),b(Pt,O,null),e(O,xi),e(O,wo),e(wo,Fi),e(wo,Lo),e(Lo,Ci),e(O,Pi),e(O,_a),e(_a,qi),e(M,Ii),e(M,Ae),b(qt,Ae,null),e(Ae,Si),e(Ae,ae),e(ae,Ui),e(ae,ga),e(ga,ji),e(ae,Ni),e(ae,ba),e(ba,Di),e(ae,Wi),e(M,Bi),e(M,To),b(It,To,null),h(t,wn,m),h(t,ne,m),e(ne,xe),e(xe,ka),b(St,ka,null),e(ne,Oi),e(ne,va),e(va,Ji),h(t,Ln,m),h(t,C,m),b(Ut,C,null),e(C,Ri),e(C,jt),e(jt,Gi),e(jt,$o),e($o,Vi),e(jt,Zi),e(C,Hi),e(C,Nt),e(Nt,Xi),e(Nt,Dt),e(Dt,Yi),e(Nt,Qi),e(C,Ki),e(C,Fe),e(Fe,el),e(Fe,ya),e(ya,tl),e(Fe,ol),e(Fe,wa),e(wa,al),e(C,nl),e(C,J),b(Wt,J,null),e(J,sl),e(J,se),e(se,rl),e(se,Mo),e(Mo,il),e(se,ll),e(se,La),e(La,dl),e(se,cl),e(J,ml),b(Ce,J,null),h(t,Tn,m),h(t,re,m),e(re,Pe),e(Pe,Ta),b(Bt,Ta,null),e(re,hl),e(re,$a),e($a,pl),h(t,$n,m),h(t,ie,m),b(Ot,ie,null),e(ie,fl),e(ie,D),b(Jt,D,null),e(D,ul),e(D,le),e(le,_l),e(le,zo),e(zo,gl),e(le,bl),e(le,Ma),e(Ma,kl),e(le,vl),e(D,yl),b(qe,D,null),e(D,wl),b(Ie,D,null),h(t,Mn,m),h(t,de,m),e(de,Se),e(Se,za),b(Rt,za,null),e(de,Ll),e(de,Ea),e(Ea,Tl),h(t,zn,m),h(t,E,m),b(Gt,E,null),e(E,$l),e(E,Aa),e(Aa,Ml),e(E,zl),e(E,Eo),e(Eo,Ao),e(Ao,El),e(Eo,Al),e(E,xl),e(E,j),e(j,Fl),e(j,xa),e(xa,Cl),e(j,Pl),e(j,Fa),e(Fa,ql),e(j,Il),e(j,Ca),e(Ca,Sl),e(j,Ul),e(j,Pa),e(Pa,jl),e(j,Nl),e(E,Dl),e(E,Vt),e(Vt,Wl),e(Vt,xo),e(xo,Bl),e(Vt,Ol),e(E,Jl),e(E,Zt),e(Zt,Rl),e(Zt,Ht),e(Ht,Gl),e(Zt,Vl),e(E,Zl),e(E,R),b(Xt,R,null),e(R,Hl),e(R,ce),e(ce,Xl),e(ce,Fo),e(Fo,Yl),e(ce,Ql),e(ce,qa),e(qa,Kl),e(ce,ed),e(R,td),b(Ue,R,null),En=!0},p(t,[m]){const Yt={};m&2&&(Yt.$$scope={dirty:m,ctx:t}),ye.$set(Yt);const Ia={};m&2&&(Ia.$$scope={dirty:m,ctx:t}),Te.$set(Ia);const Sa={};m&2&&(Sa.$$scope={dirty:m,ctx:t}),ze.$set(Sa);const Ua={};m&2&&(Ua.$$scope={dirty:m,ctx:t}),Ce.$set(Ua);const Qt={};m&2&&(Qt.$$scope={dirty:m,ctx:t}),qe.$set(Qt);const ja={};m&2&&(ja.$$scope={dirty:m,ctx:t}),Ie.$set(ja);const Na={};m&2&&(Na.$$scope={dirty:m,ctx:t}),Ue.$set(Na)},i(t){En||(k(u.$$.fragment,t),k(We.$$.fragment,t),k(Ge.$$.fragment,t),k(Ve.$$.fragment,t),k(et.$$.fragment,t),k(tt.$$.fragment,t),k(nt.$$.fragment,t),k(gt.$$.fragment,t),k(bt.$$.fragment,t),k(ye.$$.fragment,t),k(vt.$$.fragment,t),k(yt.$$.fragment,t),k(wt.$$.fragment,t),k(Lt.$$.fragment,t),k($t.$$.fragment,t),k(Te.$$.fragment,t),k(Mt.$$.fragment,t),k(zt.$$.fragment,t),k(Et.$$.fragment,t),k(ze.$$.fragment,t),k(Ft.$$.fragment,t),k(Ct.$$.fragment,t),k(Pt.$$.fragment,t),k(qt.$$.fragment,t),k(It.$$.fragment,t),k(St.$$.fragment,t),k(Ut.$$.fragment,t),k(Wt.$$.fragment,t),k(Ce.$$.fragment,t),k(Bt.$$.fragment,t),k(Ot.$$.fragment,t),k(Jt.$$.fragment,t),k(qe.$$.fragment,t),k(Ie.$$.fragment,t),k(Rt.$$.fragment,t),k(Gt.$$.fragment,t),k(Xt.$$.fragment,t),k(Ue.$$.fragment,t),En=!0)},o(t){v(u.$$.fragment,t),v(We.$$.fragment,t),v(Ge.$$.fragment,t),v(Ve.$$.fragment,t),v(et.$$.fragment,t),v(tt.$$.fragment,t),v(nt.$$.fragment,t),v(gt.$$.fragment,t),v(bt.$$.fragment,t),v(ye.$$.fragment,t),v(vt.$$.fragment,t),v(yt.$$.fragment,t),v(wt.$$.fragment,t),v(Lt.$$.fragment,t),v($t.$$.fragment,t),v(Te.$$.fragment,t),v(Mt.$$.fragment,t),v(zt.$$.fragment,t),v(Et.$$.fragment,t),v(ze.$$.fragment,t),v(Ft.$$.fragment,t),v(Ct.$$.fragment,t),v(Pt.$$.fragment,t),v(qt.$$.fragment,t),v(It.$$.fragment,t),v(St.$$.fragment,t),v(Ut.$$.fragment,t),v(Wt.$$.fragment,t),v(Ce.$$.fragment,t),v(Bt.$$.fragment,t),v(Ot.$$.fragment,t),v(Jt.$$.fragment,t),v(qe.$$.fragment,t),v(Ie.$$.fragment,t),v(Rt.$$.fragment,t),v(Gt.$$.fragment,t),v(Xt.$$.fragment,t),v(Ue.$$.fragment,t),En=!1},d(t){o(p),t&&o(T),t&&o(f),y(u),t&&o(Oa),t&&o(X),y(We),t&&o(Ja),t&&o(pe),t&&o(Ra),t&&o(Kt),t&&o(Ga),t&&o(eo),t&&o(Va),t&&o(to),t&&o(Za),t&&o(fe),t&&o(Ha),y(Ge,t),t&&o(Xa),t&&o(ao),t&&o(Ya),y(Ve,t),t&&o(Qa),t&&o(no),t&&o(Ka),t&&o(so),t&&o(en),t&&o(q),t&&o(tn),t&&o(ro),t&&o(on),t&&o(io),t&&o(an),t&&o(Y),y(et),t&&o(nn),t&&o(co),t&&o(sn),y(tt,t),t&&o(rn),t&&o(mo),t&&o(ln),y(nt,t),t&&o(dn),t&&o(ho),t&&o(cn),t&&o(po),t&&o(mn),t&&o(fo),t&&o(hn),t&&o(uo),t&&o(pn),t&&o(be),t&&o(fn),t&&o(_o),t&&o(un),t&&o(ke),t&&o(_n),t&&o(Q),y(gt),t&&o(gn),t&&o(S),y(bt),y(ye),t&&o(bn),t&&o(ee),y(vt),t&&o(kn),t&&o(x),y(yt),y(wt),y(Lt),y($t),y(Te),y(Mt),t&&o(vn),t&&o(te),y(zt),t&&o(yn),t&&o(M),y(Et),y(ze),y(Ft),y(Ct),y(Pt),y(qt),y(It),t&&o(wn),t&&o(ne),y(St),t&&o(Ln),t&&o(C),y(Ut),y(Wt),y(Ce),t&&o(Tn),t&&o(re),y(Bt),t&&o($n),t&&o(ie),y(Ot),y(Jt),y(qe),y(Ie),t&&o(Mn),t&&o(de),y(Rt),t&&o(zn),t&&o(E),y(Gt),y(Xt),y(Ue)}}}const hm={local:"llama",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.LlamaConfig",title:"LlamaConfig"},{local:"transformers.LlamaTokenizer",title:"LlamaTokenizer"},{local:"transformers.LlamaTokenizerFast",title:"LlamaTokenizerFast"},{local:"transformers.LlamaModel",title:"LlamaModel"},{local:"transformers.LlamaForCausalLM",title:"LlamaForCausalLM"},{local:"transformers.LlamaForSequenceClassification",title:"LlamaForSequenceClassification"}],title:"LLaMA"};function pm(F){return am(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ym extends Kc{constructor(p){super();em(this,p,pm,mm,tm,{})}}export{ym as default,hm as metadata};
