import{S as Hd,i as Qd,s as Ud,e as n,k as p,w as v,t as a,M as Kd,c as s,d as t,m as u,a as i,x as k,h as r,b as h,G as e,g,y as w,q as $,o as P,B as O,v as Vd,L as dt}from"../../chunks/vendor-hf-doc-builder.js";import{T as In}from"../../chunks/Tip-hf-doc-builder.js";import{D as te}from"../../chunks/Docstring-hf-doc-builder.js";import{C as ct}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as et}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as lt}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Gd(z){let d,b,f,m,T;return m=new ct({props:{code:`from transformers import OPTConfig, OPTModel

# Initializing a OPT facebook/opt-large style configuration
configuration = OPTConfig()

# Initializing a model (with random weights) from the facebook/opt-large style configuration
model = OPTModel(configuration)

# Accessing the model configuration
configuration = model.config`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> OPTConfig, OPTModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a OPT facebook/opt-large style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = OPTConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the facebook/opt-large style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OPTModel(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(){d=n("p"),b=a("Example:"),f=p(),v(m.$$.fragment)},l(l){d=s(l,"P",{});var c=i(d);b=r(c,"Example:"),c.forEach(t),f=u(l),k(m.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(m,l,c),T=!0},p:dt,i(l){T||($(m.$$.fragment,l),T=!0)},o(l){P(m.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(f),O(m,l)}}}function Zd(z){let d,b,f,m,T;return{c(){d=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),m=a("Module"),T=a(`
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(l){d=s(l,"P",{});var c=i(d);b=r(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s(c,"CODE",{});var E=i(f);m=r(E,"Module"),E.forEach(t),T=r(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(l,c){g(l,d,c),e(d,b),e(d,f),e(f,m),e(d,T)},d(l){l&&t(d)}}}function Rd(z){let d,b,f,m,T;return m=new ct({props:{code:`from transformers import AutoTokenizer, OPTModel
import torch

tokenizer = AutoTokenizer.from_pretrained("facebook/opt-350m")
model = OPTModel.from_pretrained("facebook/opt-350m")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, OPTModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/opt-350m&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OPTModel.from_pretrained(<span class="hljs-string">&quot;facebook/opt-350m&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){d=n("p"),b=a("Example:"),f=p(),v(m.$$.fragment)},l(l){d=s(l,"P",{});var c=i(d);b=r(c,"Example:"),c.forEach(t),f=u(l),k(m.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(m,l,c),T=!0},p:dt,i(l){T||($(m.$$.fragment,l),T=!0)},o(l){P(m.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(f),O(m,l)}}}function Jd(z){let d,b,f,m,T;return m=new ct({props:{code:`from transformers import AutoTokenizer, OPTForCausalLM

model = OPTForCausalLM.from_pretrained("facebook/opt-350m")
tokenizer = AutoTokenizer.from_pretrained("facebook/opt-350m")

prompt = "Hey, are you consciours? Can you talk to me?"
inputs = tokenizer(prompt, return_tensors="pt")

# Generate
generate_ids = model.generate(inputs.input_ids, max_length=30)
tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, OPTForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = OPTForCausalLM.from_pretrained(<span class="hljs-string">&quot;facebook/opt-350m&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/opt-350m&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;Hey, are you consciours? 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 consciours? Can you talk to me?\\nI&#x27;m not consciours, but I can talk to you.&quot;</span>`}}),{c(){d=n("p"),b=a("Example:"),f=p(),v(m.$$.fragment)},l(l){d=s(l,"P",{});var c=i(d);b=r(c,"Example:"),c.forEach(t),f=u(l),k(m.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(m,l,c),T=!0},p:dt,i(l){T||($(m.$$.fragment,l),T=!0)},o(l){P(m.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(f),O(m,l)}}}function Xd(z){let d,b,f,m,T,l,c,E,Ae,Oe,A,oe,se,F,Le,R,Ne,Fe,W,Ie,ae,re,Se,ze,V,De,xe,G,Te,We,he,C,L,Me,B,ie,Be,J,He,Qe,N,I,le,be,Ue,de,ye,Ke,X,ve,ce,Ve,ne,S,Ge,H,j,Ze;return{c(){d=n("p"),b=a("TensorFlow models and layers in "),f=n("code"),m=a("transformers"),T=a(" accept two formats as input:"),l=p(),c=n("ul"),E=n("li"),Ae=a("having all inputs as keyword arguments (like PyTorch models), or"),Oe=p(),A=n("li"),oe=a("having all inputs as a list, tuple or dict in the first positional argument."),se=p(),F=n("p"),Le=a(`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),R=n("code"),Ne=a("model.fit()"),Fe=a(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),W=n("code"),Ie=a("model.fit()"),ae=a(` supports! If, however, you want to use the second
format outside of Keras methods like `),re=n("code"),Se=a("fit()"),ze=a(" and "),V=n("code"),De=a("predict()"),xe=a(`, such as when creating your own layers or models with
the Keras `),G=n("code"),Te=a("Functional"),We=a(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),he=p(),C=n("ul"),L=n("li"),Me=a("a single Tensor with "),B=n("code"),ie=a("input_ids"),Be=a(" only and nothing else: "),J=n("code"),He=a("model(input_ids)"),Qe=p(),N=n("li"),I=a(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),le=n("code"),be=a("model([input_ids, attention_mask])"),Ue=a(" or "),de=n("code"),ye=a("model([input_ids, attention_mask, token_type_ids])"),Ke=p(),X=n("li"),ve=a(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),ce=n("code"),Ve=a('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ne=p(),S=n("p"),Ge=a(`Note that when creating models and layers with
`),H=n("a"),j=a("subclassing"),Ze=a(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(y){d=s(y,"P",{});var x=i(d);b=r(x,"TensorFlow models and layers in "),f=s(x,"CODE",{});var pt=i(f);m=r(pt,"transformers"),pt.forEach(t),T=r(x," accept two formats as input:"),x.forEach(t),l=u(y),c=s(y,"UL",{});var Y=i(c);E=s(Y,"LI",{});var ut=i(E);Ae=r(ut,"having all inputs as keyword arguments (like PyTorch models), or"),ut.forEach(t),Oe=u(Y),A=s(Y,"LI",{});var ht=i(A);oe=r(ht,"having all inputs as a list, tuple or dict in the first positional argument."),ht.forEach(t),Y.forEach(t),se=u(y),F=s(y,"P",{});var M=i(F);Le=r(M,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),R=s(M,"CODE",{});var mt=i(R);Ne=r(mt,"model.fit()"),mt.forEach(t),Fe=r(M,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),W=s(M,"CODE",{});var ft=i(W);Ie=r(ft,"model.fit()"),ft.forEach(t),ae=r(M,` supports! If, however, you want to use the second
format outside of Keras methods like `),re=s(M,"CODE",{});var ke=i(re);Se=r(ke,"fit()"),ke.forEach(t),ze=r(M," and "),V=s(M,"CODE",{});var gt=i(V);De=r(gt,"predict()"),gt.forEach(t),xe=r(M,`, such as when creating your own layers or models with
the Keras `),G=s(M,"CODE",{});var _t=i(G);Te=r(_t,"Functional"),_t.forEach(t),We=r(M,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),M.forEach(t),he=u(y),C=s(y,"UL",{});var Z=i(C);L=s(Z,"LI",{});var D=i(L);Me=r(D,"a single Tensor with "),B=s(D,"CODE",{});var me=i(B);ie=r(me,"input_ids"),me.forEach(t),Be=r(D," only and nothing else: "),J=s(D,"CODE",{});var Re=i(J);He=r(Re,"model(input_ids)"),Re.forEach(t),D.forEach(t),Qe=u(Z),N=s(Z,"LI",{});var Q=i(N);I=r(Q,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),le=s(Q,"CODE",{});var Tt=i(le);be=r(Tt,"model([input_ids, attention_mask])"),Tt.forEach(t),Ue=r(Q," or "),de=s(Q,"CODE",{});var Je=i(de);ye=r(Je,"model([input_ids, attention_mask, token_type_ids])"),Je.forEach(t),Q.forEach(t),Ke=u(Z),X=s(Z,"LI",{});var Xe=i(X);ve=r(Xe,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),ce=s(Xe,"CODE",{});var tt=i(ce);Ve=r(tt,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),tt.forEach(t),Xe.forEach(t),Z.forEach(t),ne=u(y),S=s(y,"P",{});var q=i(S);Ge=r(q,`Note that when creating models and layers with
`),H=s(q,"A",{href:!0,rel:!0});var we=i(H);j=r(we,"subclassing"),we.forEach(t),Ze=r(q,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),q.forEach(t),this.h()},h(){h(H,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),h(H,"rel","nofollow")},m(y,x){g(y,d,x),e(d,b),e(d,f),e(f,m),e(d,T),g(y,l,x),g(y,c,x),e(c,E),e(E,Ae),e(c,Oe),e(c,A),e(A,oe),g(y,se,x),g(y,F,x),e(F,Le),e(F,R),e(R,Ne),e(F,Fe),e(F,W),e(W,Ie),e(F,ae),e(F,re),e(re,Se),e(F,ze),e(F,V),e(V,De),e(F,xe),e(F,G),e(G,Te),e(F,We),g(y,he,x),g(y,C,x),e(C,L),e(L,Me),e(L,B),e(B,ie),e(L,Be),e(L,J),e(J,He),e(C,Qe),e(C,N),e(N,I),e(N,le),e(le,be),e(N,Ue),e(N,de),e(de,ye),e(C,Ke),e(C,X),e(X,ve),e(X,ce),e(ce,Ve),g(y,ne,x),g(y,S,x),e(S,Ge),e(S,H),e(H,j),e(S,Ze)},d(y){y&&t(d),y&&t(l),y&&t(c),y&&t(se),y&&t(F),y&&t(he),y&&t(C),y&&t(ne),y&&t(S)}}}function Yd(z){let d,b,f,m,T;return{c(){d=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),m=a("Module"),T=a(`
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(l){d=s(l,"P",{});var c=i(d);b=r(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s(c,"CODE",{});var E=i(f);m=r(E,"Module"),E.forEach(t),T=r(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(l,c){g(l,d,c),e(d,b),e(d,f),e(f,m),e(d,T)},d(l){l&&t(d)}}}function ec(z){let d,b,f,m,T;return m=new ct({props:{code:`from transformers import AutoTokenizer, TFOPTModel
import tensorflow as tf

tokenizer = AutoTokenizer.from_pretrained("facebook/opt-350m")
model = TFOPTModel.from_pretrained("facebook/opt-350m")

inputs = tokenizer("Hello, my dog is cute", return_tensors="tf")
outputs = model(inputs)

last_hidden_states = outputs.last_hidden_state`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFOPTModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/opt-350m&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFOPTModel.from_pretrained(<span class="hljs-string">&quot;facebook/opt-350m&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){d=n("p"),b=a("Example:"),f=p(),v(m.$$.fragment)},l(l){d=s(l,"P",{});var c=i(d);b=r(c,"Example:"),c.forEach(t),f=u(l),k(m.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(m,l,c),T=!0},p:dt,i(l){T||($(m.$$.fragment,l),T=!0)},o(l){P(m.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(f),O(m,l)}}}function tc(z){let d,b,f,m,T,l,c,E,Ae,Oe,A,oe,se,F,Le,R,Ne,Fe,W,Ie,ae,re,Se,ze,V,De,xe,G,Te,We,he,C,L,Me,B,ie,Be,J,He,Qe,N,I,le,be,Ue,de,ye,Ke,X,ve,ce,Ve,ne,S,Ge,H,j,Ze;return{c(){d=n("p"),b=a("TensorFlow models and layers in "),f=n("code"),m=a("transformers"),T=a(" accept two formats as input:"),l=p(),c=n("ul"),E=n("li"),Ae=a("having all inputs as keyword arguments (like PyTorch models), or"),Oe=p(),A=n("li"),oe=a("having all inputs as a list, tuple or dict in the first positional argument."),se=p(),F=n("p"),Le=a(`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),R=n("code"),Ne=a("model.fit()"),Fe=a(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),W=n("code"),Ie=a("model.fit()"),ae=a(` supports! If, however, you want to use the second
format outside of Keras methods like `),re=n("code"),Se=a("fit()"),ze=a(" and "),V=n("code"),De=a("predict()"),xe=a(`, such as when creating your own layers or models with
the Keras `),G=n("code"),Te=a("Functional"),We=a(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),he=p(),C=n("ul"),L=n("li"),Me=a("a single Tensor with "),B=n("code"),ie=a("input_ids"),Be=a(" only and nothing else: "),J=n("code"),He=a("model(input_ids)"),Qe=p(),N=n("li"),I=a(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),le=n("code"),be=a("model([input_ids, attention_mask])"),Ue=a(" or "),de=n("code"),ye=a("model([input_ids, attention_mask, token_type_ids])"),Ke=p(),X=n("li"),ve=a(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),ce=n("code"),Ve=a('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ne=p(),S=n("p"),Ge=a(`Note that when creating models and layers with
`),H=n("a"),j=a("subclassing"),Ze=a(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(y){d=s(y,"P",{});var x=i(d);b=r(x,"TensorFlow models and layers in "),f=s(x,"CODE",{});var pt=i(f);m=r(pt,"transformers"),pt.forEach(t),T=r(x," accept two formats as input:"),x.forEach(t),l=u(y),c=s(y,"UL",{});var Y=i(c);E=s(Y,"LI",{});var ut=i(E);Ae=r(ut,"having all inputs as keyword arguments (like PyTorch models), or"),ut.forEach(t),Oe=u(Y),A=s(Y,"LI",{});var ht=i(A);oe=r(ht,"having all inputs as a list, tuple or dict in the first positional argument."),ht.forEach(t),Y.forEach(t),se=u(y),F=s(y,"P",{});var M=i(F);Le=r(M,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),R=s(M,"CODE",{});var mt=i(R);Ne=r(mt,"model.fit()"),mt.forEach(t),Fe=r(M,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),W=s(M,"CODE",{});var ft=i(W);Ie=r(ft,"model.fit()"),ft.forEach(t),ae=r(M,` supports! If, however, you want to use the second
format outside of Keras methods like `),re=s(M,"CODE",{});var ke=i(re);Se=r(ke,"fit()"),ke.forEach(t),ze=r(M," and "),V=s(M,"CODE",{});var gt=i(V);De=r(gt,"predict()"),gt.forEach(t),xe=r(M,`, such as when creating your own layers or models with
the Keras `),G=s(M,"CODE",{});var _t=i(G);Te=r(_t,"Functional"),_t.forEach(t),We=r(M,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),M.forEach(t),he=u(y),C=s(y,"UL",{});var Z=i(C);L=s(Z,"LI",{});var D=i(L);Me=r(D,"a single Tensor with "),B=s(D,"CODE",{});var me=i(B);ie=r(me,"input_ids"),me.forEach(t),Be=r(D," only and nothing else: "),J=s(D,"CODE",{});var Re=i(J);He=r(Re,"model(input_ids)"),Re.forEach(t),D.forEach(t),Qe=u(Z),N=s(Z,"LI",{});var Q=i(N);I=r(Q,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),le=s(Q,"CODE",{});var Tt=i(le);be=r(Tt,"model([input_ids, attention_mask])"),Tt.forEach(t),Ue=r(Q," or "),de=s(Q,"CODE",{});var Je=i(de);ye=r(Je,"model([input_ids, attention_mask, token_type_ids])"),Je.forEach(t),Q.forEach(t),Ke=u(Z),X=s(Z,"LI",{});var Xe=i(X);ve=r(Xe,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),ce=s(Xe,"CODE",{});var tt=i(ce);Ve=r(tt,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),tt.forEach(t),Xe.forEach(t),Z.forEach(t),ne=u(y),S=s(y,"P",{});var q=i(S);Ge=r(q,`Note that when creating models and layers with
`),H=s(q,"A",{href:!0,rel:!0});var we=i(H);j=r(we,"subclassing"),we.forEach(t),Ze=r(q,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),q.forEach(t),this.h()},h(){h(H,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),h(H,"rel","nofollow")},m(y,x){g(y,d,x),e(d,b),e(d,f),e(f,m),e(d,T),g(y,l,x),g(y,c,x),e(c,E),e(E,Ae),e(c,Oe),e(c,A),e(A,oe),g(y,se,x),g(y,F,x),e(F,Le),e(F,R),e(R,Ne),e(F,Fe),e(F,W),e(W,Ie),e(F,ae),e(F,re),e(re,Se),e(F,ze),e(F,V),e(V,De),e(F,xe),e(F,G),e(G,Te),e(F,We),g(y,he,x),g(y,C,x),e(C,L),e(L,Me),e(L,B),e(B,ie),e(L,Be),e(L,J),e(J,He),e(C,Qe),e(C,N),e(N,I),e(N,le),e(le,be),e(N,Ue),e(N,de),e(de,ye),e(C,Ke),e(C,X),e(X,ve),e(X,ce),e(ce,Ve),g(y,ne,x),g(y,S,x),e(S,Ge),e(S,H),e(H,j),e(S,Ze)},d(y){y&&t(d),y&&t(l),y&&t(c),y&&t(se),y&&t(F),y&&t(he),y&&t(C),y&&t(ne),y&&t(S)}}}function oc(z){let d,b,f,m,T;return m=new ct({props:{code:`from transformers import AutoTokenizer, TFOPTForCausalLM
import tensorflow as tf

tokenizer = AutoTokenizer.from_pretrained("facebook/opt-350m")
model = TFOPTForCausalLM.from_pretrained("facebook/opt-350m")

inputs = tokenizer("Hello, my dog is cute", return_tensors="tf")
outputs = model(inputs)
logits = outputs.logits`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFOPTForCausalLM
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/opt-350m&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFOPTForCausalLM.from_pretrained(<span class="hljs-string">&quot;facebook/opt-350m&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){d=n("p"),b=a("Example:"),f=p(),v(m.$$.fragment)},l(l){d=s(l,"P",{});var c=i(d);b=r(c,"Example:"),c.forEach(t),f=u(l),k(m.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(m,l,c),T=!0},p:dt,i(l){T||($(m.$$.fragment,l),T=!0)},o(l){P(m.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(f),O(m,l)}}}function nc(z){let d,b,f,m,T;return{c(){d=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),m=a("Module"),T=a(`
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(l){d=s(l,"P",{});var c=i(d);b=r(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s(c,"CODE",{});var E=i(f);m=r(E,"Module"),E.forEach(t),T=r(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(l,c){g(l,d,c),e(d,b),e(d,f),e(f,m),e(d,T)},d(l){l&&t(d)}}}function sc(z){let d,b,f,m,T;return m=new ct({props:{code:`import torch
from transformers import AutoTokenizer, OPTForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("ArthurZ/opt-350m-dummy-sc")
model = OPTForSequenceClassification.from_pretrained("ArthurZ/opt-350m-dummy-sc")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")

with torch.no_grad():
    logits = model(**inputs).logits

predicted_class_id = logits.argmax().item()
model.config.id2label[predicted_class_id]

# To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`
num_labels = len(model.config.id2label)
model = OPTForSequenceClassification.from_pretrained("ArthurZ/opt-350m-dummy-sc", num_labels=num_labels)

labels = torch.tensor([1])
loss = model(**inputs, labels=labels).loss
round(loss.item(), 2)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, OPTForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;ArthurZ/opt-350m-dummy-sc&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OPTForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;ArthurZ/opt-350m-dummy-sc&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_id = logits.argmax().item()
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.id2label[predicted_class_id]
<span class="hljs-string">&#x27;LABEL_0&#x27;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OPTForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;ArthurZ/opt-350m-dummy-sc&quot;</span>, num_labels=num_labels)

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.tensor([<span class="hljs-number">1</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">round</span>(loss.item(), <span class="hljs-number">2</span>)
<span class="hljs-number">1.71</span>`}}),{c(){d=n("p"),b=a("Example of single-label classification:"),f=p(),v(m.$$.fragment)},l(l){d=s(l,"P",{});var c=i(d);b=r(c,"Example of single-label classification:"),c.forEach(t),f=u(l),k(m.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(m,l,c),T=!0},p:dt,i(l){T||($(m.$$.fragment,l),T=!0)},o(l){P(m.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(f),O(m,l)}}}function ac(z){let d,b,f,m,T;return m=new ct({props:{code:`import torch
from transformers import AutoTokenizer, OPTForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("ArthurZ/opt-350m-dummy-sc")
model = OPTForSequenceClassification.from_pretrained("ArthurZ/opt-350m-dummy-sc", problem_type="multi_label_classification")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")

with torch.no_grad():
    logits = model(**inputs).logits

predicted_class_ids = torch.arange(0, logits.shape[-1])[torch.sigmoid(logits).squeeze(dim=0) > 0.5]

# To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`
num_labels = len(model.config.id2label)
model = OPTForSequenceClassification.from_pretrained(
    "ArthurZ/opt-350m-dummy-sc", num_labels=num_labels, problem_type="multi_label_classification"
)

labels = torch.sum(
    torch.nn.functional.one_hot(predicted_class_ids[None, :].clone(), num_classes=num_labels), dim=1
).to(torch.float)
loss = model(**inputs, labels=labels).loss`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, OPTForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;ArthurZ/opt-350m-dummy-sc&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OPTForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;ArthurZ/opt-350m-dummy-sc&quot;</span>, problem_type=<span class="hljs-string">&quot;multi_label_classification&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_ids = torch.arange(<span class="hljs-number">0</span>, logits.shape[-<span class="hljs-number">1</span>])[torch.sigmoid(logits).squeeze(dim=<span class="hljs-number">0</span>) &gt; <span class="hljs-number">0.5</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OPTForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;ArthurZ/opt-350m-dummy-sc&quot;</span>, num_labels=num_labels, problem_type=<span class="hljs-string">&quot;multi_label_classification&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.<span class="hljs-built_in">sum</span>(
<span class="hljs-meta">... </span>    torch.nn.functional.one_hot(predicted_class_ids[<span class="hljs-literal">None</span>, :].clone(), num_classes=num_labels), dim=<span class="hljs-number">1</span>
<span class="hljs-meta">... </span>).to(torch.<span class="hljs-built_in">float</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){d=n("p"),b=a("Example of multi-label classification:"),f=p(),v(m.$$.fragment)},l(l){d=s(l,"P",{});var c=i(d);b=r(c,"Example of multi-label classification:"),c.forEach(t),f=u(l),k(m.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(m,l,c),T=!0},p:dt,i(l){T||($(m.$$.fragment,l),T=!0)},o(l){P(m.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(f),O(m,l)}}}function rc(z){let d,b,f,m,T;return{c(){d=n("p"),b=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),m=a("Module"),T=a(`
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(l){d=s(l,"P",{});var c=i(d);b=r(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s(c,"CODE",{});var E=i(f);m=r(E,"Module"),E.forEach(t),T=r(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(l,c){g(l,d,c),e(d,b),e(d,f),e(f,m),e(d,T)},d(l){l&&t(d)}}}function ic(z){let d,b,f,m,T;return m=new ct({props:{code:`from transformers import AutoTokenizer, OPTForQuestionAnswering
import torch

torch.manual_seed(4)
tokenizer = AutoTokenizer.from_pretrained("facebook/opt-350m")

# note: we are loading a OPTForQuestionAnswering from the hub here,
# so the head will be randomly initialized, hence the predictions will be random
model = OPTForQuestionAnswering.from_pretrained("facebook/opt-350m")

question, text = "Who was Jim Henson?", "Jim Henson was a nice puppet"

inputs = tokenizer(question, text, return_tensors="pt")
with torch.no_grad():
    outputs = model(**inputs)

answer_start_index = outputs.start_logits.argmax()
answer_end_index = outputs.end_logits.argmax()

predict_answer_tokens = inputs.input_ids[0, answer_start_index : answer_end_index + 1]
predicted = tokenizer.decode(predict_answer_tokens)
predicted`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, OPTForQuestionAnswering
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>torch.manual_seed(<span class="hljs-number">4</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/opt-350m&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># note: we are loading a OPTForQuestionAnswering from the hub here,</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># so the head will be randomly initialized, hence the predictions will be random</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OPTForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;facebook/opt-350m&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>question, text = <span class="hljs-string">&quot;Who was Jim Henson?&quot;</span>, <span class="hljs-string">&quot;Jim Henson was a nice puppet&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(question, text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>answer_start_index = outputs.start_logits.argmax()
<span class="hljs-meta">&gt;&gt;&gt; </span>answer_end_index = outputs.end_logits.argmax()

<span class="hljs-meta">&gt;&gt;&gt; </span>predict_answer_tokens = inputs.input_ids[<span class="hljs-number">0</span>, answer_start_index : answer_end_index + <span class="hljs-number">1</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted = tokenizer.decode(predict_answer_tokens)
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted
<span class="hljs-string">&#x27; Henson?&#x27;</span>`}}),{c(){d=n("p"),b=a("Example:"),f=p(),v(m.$$.fragment)},l(l){d=s(l,"P",{});var c=i(d);b=r(c,"Example:"),c.forEach(t),f=u(l),k(m.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(m,l,c),T=!0},p:dt,i(l){T||($(m.$$.fragment,l),T=!0)},o(l){P(m.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(f),O(m,l)}}}function lc(z){let d,b,f,m,T;return m=new ct({props:{code:`from transformers import AutoTokenizer, FlaxOPTModel

tokenizer = AutoTokenizer.from_pretrained("facebook/opt-350m")
model = FlaxOPTModel.from_pretrained("facebook/opt-350m")

inputs = tokenizer("Hello, my dog is cute", return_tensors="jax")
outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FlaxOPTModel

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/opt-350m&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxOPTModel.from_pretrained(<span class="hljs-string">&quot;facebook/opt-350m&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;jax&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){d=n("p"),b=a("Example:"),f=p(),v(m.$$.fragment)},l(l){d=s(l,"P",{});var c=i(d);b=r(c,"Example:"),c.forEach(t),f=u(l),k(m.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(m,l,c),T=!0},p:dt,i(l){T||($(m.$$.fragment,l),T=!0)},o(l){P(m.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(f),O(m,l)}}}function dc(z){let d,b,f,m,T;return m=new ct({props:{code:`from transformers import AutoTokenizer, FlaxOPTForCausalLM

tokenizer = AutoTokenizer.from_pretrained("facebook/opt-350m")
model = FlaxOPTForCausalLM.from_pretrained("facebook/opt-350m")

inputs = tokenizer("Hello, my dog is cute", return_tensors="np")
outputs = model(**inputs)

# retrieve logts for next token
next_token_logits = outputs.logits[:, -1]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FlaxOPTForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/opt-350m&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxOPTForCausalLM.from_pretrained(<span class="hljs-string">&quot;facebook/opt-350m&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;np&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># retrieve logts for next token</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>next_token_logits = outputs.logits[:, -<span class="hljs-number">1</span>]`}}),{c(){d=n("p"),b=a("Example:"),f=p(),v(m.$$.fragment)},l(l){d=s(l,"P",{});var c=i(d);b=r(c,"Example:"),c.forEach(t),f=u(l),k(m.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(m,l,c),T=!0},p:dt,i(l){T||($(m.$$.fragment,l),T=!0)},o(l){P(m.$$.fragment,l),T=!1},d(l){l&&t(d),l&&t(f),O(m,l)}}}function cc(z){let d,b,f,m,T,l,c,E,Ae,Oe,A,oe,se,F,Le,R,Ne,Fe,W,Ie,ae,re,Se,ze,V,De,xe,G,Te,We,he,C,L,Me,B,ie,Be,J,He,Qe,N,I,le,be,Ue,de,ye,Ke,X,ve,ce,Ve,ne,S,Ge,H,j,Ze,y,x,pt,Y,ut,ht,M,mt,ft,ke,gt,_t,Z,D,me,Re,Q,Tt,Je,Xe,tt,q,we,ya,bt,va,gn,ka,wa,_o,$a,Pa,Oa,yt,Fa,_n,za,xa,Tn,Ma,Ea,Ca,Lt,Ms,vt,Nt,Sn,To,qa,Dn,ja,Es,$e,bo,Aa,yo,La,bn,Na,Ia,Sa,vo,Da,ko,Wa,Ba,Ha,Ee,wo,Qa,kt,Ua,yn,Ka,Va,Wn,Ga,Za,Ra,It,Ja,St,Cs,wt,Dt,Bn,$o,Xa,Hn,Ya,qs,$t,Po,er,Wt,Oo,tr,Bt,js,Pt,Ht,Qn,Fo,or,Un,nr,As,pe,zo,sr,xo,ar,vn,rr,ir,lr,Mo,dr,Eo,cr,pr,ur,Qt,hr,Ce,Co,mr,Ot,fr,kn,gr,_r,Kn,Tr,br,yr,Ut,vr,Kt,Ls,Ft,Vt,Vn,qo,kr,Gn,wr,Ns,ee,jo,$r,Zn,Pr,Or,Ao,Fr,wn,zr,xr,Mr,Lo,Er,No,Cr,qr,jr,Gt,Ar,Zt,Io,Lr,Rt,Is,zt,Jt,Rn,So,Nr,Jn,Ir,Ss,U,Do,Sr,Xn,Dr,Wr,$n,Pn,Br,Hr,Qr,Pe,Ur,Yn,Kr,Vr,es,Gr,Zr,ts,Rr,Jr,os,Xr,Yr,ei,Wo,ti,On,oi,ni,si,Bo,ai,Ho,ri,ii,li,fe,Qo,di,xt,ci,Fn,pi,ui,ns,hi,mi,fi,Xt,gi,Yt,_i,eo,Ds,Mt,to,ss,Uo,Ti,as,bi,Ws,ue,Ko,yi,Et,vi,rs,ki,wi,is,$i,Pi,Oi,Vo,Fi,zn,zi,xi,Mi,Go,Ei,Zo,Ci,qi,ji,qe,Ro,Ai,Ct,Li,xn,Ni,Ii,ls,Si,Di,Wi,oo,Bi,no,Bs,qt,so,ds,Jo,Hi,cs,Qi,Hs,jt,Xo,Ui,ao,Yo,Ki,ro,Qs,At,io,ps,en,Vi,us,Gi,Us,K,tn,Zi,hs,Ri,Ji,on,Xi,Mn,Yi,el,tl,nn,ol,sn,nl,sl,al,ms,rl,il,Ye,fs,an,ll,dl,gs,rn,cl,pl,_s,ln,ul,hl,Ts,dn,ml,fl,lo,cn,gl,co,Ks;return l=new et({}),F=new et({}),Q=new et({}),we=new te({props:{name:"class transformers.OPTConfig",anchor:"transformers.OPTConfig",parameters:[{name:"vocab_size",val:" = 50272"},{name:"hidden_size",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"ffn_dim",val:" = 3072"},{name:"max_position_embeddings",val:" = 2048"},{name:"do_layer_norm_before",val:" = True"},{name:"_remove_final_layer_norm",val:" = False"},{name:"word_embed_proj_dim",val:" = None"},{name:"dropout",val:" = 0.1"},{name:"attention_dropout",val:" = 0.0"},{name:"num_attention_heads",val:" = 12"},{name:"activation_function",val:" = 'relu'"},{name:"layerdrop",val:" = 0.0"},{name:"init_std",val:" = 0.02"},{name:"use_cache",val:" = True"},{name:"pad_token_id",val:" = 1"},{name:"bos_token_id",val:" = 2"},{name:"eos_token_id",val:" = 2"},{name:"enable_bias",val:" = True"},{name:"layer_norm_elementwise_affine",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.OPTConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 50272) &#x2014;
Vocabulary size of the OPT 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/opt#transformers.OPTModel">OPTModel</a>`,name:"vocab_size"},{anchor:"transformers.OPTConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.OPTConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of decoder layers.`,name:"num_hidden_layers"},{anchor:"transformers.OPTConfig.ffn_dim",description:`<strong>ffn_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (often named feed-forward) layer in decoder.`,name:"ffn_dim"},{anchor:"transformers.OPTConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer decoder.`,name:"num_attention_heads"},{anchor:"transformers.OPTConfig.activation_function",description:`<strong>activation_function</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;relu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;silu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"activation_function"},{anchor:"transformers.OPTConfig.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. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.OPTConfig.do_layer_norm_before",description:`<strong>do_layer_norm_before</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to perform layer normalization before the attention block.`,name:"do_layer_norm_before"},{anchor:"transformers.OPTConfig.word_embed_proj_dim",description:`<strong>word_embed_proj_dim</strong> (<code>int</code>, <em>optional</em>) &#x2014;
<code>word_embed_proj_dim</code> can be set to down-project word embeddings, <em>e.g.</em> <code>opt-350m</code>. Defaults to
<code>hidden_size</code>.`,name:"word_embed_proj_dim"},{anchor:"transformers.OPTConfig.dropout",description:`<strong>dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"dropout"},{anchor:"transformers.OPTConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.
layerdrop &#x2014; (<code>float</code>, <em>optional</em>, defaults to 0.0):
The LayerDrop probability. See the [LayerDrop paper](see <a href="https://arxiv.org/abs/1909.11556" rel="nofollow">https://arxiv.org/abs/1909.11556</a>) for more
details.`,name:"attention_dropout"},{anchor:"transformers.OPTConfig.init_std",description:`<strong>init_std</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:"init_std"},{anchor:"transformers.OPTConfig.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).`,name:"use_cache"},{anchor:"transformers.OPTConfig.enable_bias",description:`<strong>enable_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not if the linear layers in the attention blocks should use the bias term.`,name:"enable_bias"},{anchor:"transformers.OPTConfig.layer_norm_elementwise_affine",description:`<strong>layer_norm_elementwise_affine</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not if the layer norms should have learnable parameters.`,name:"layer_norm_elementwise_affine"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/opt/configuration_opt.py#L32"}}),Lt=new lt({props:{anchor:"transformers.OPTConfig.example",$$slots:{default:[Gd]},$$scope:{ctx:z}}}),To=new et({}),bo=new te({props:{name:"class transformers.OPTModel",anchor:"transformers.OPTModel",parameters:[{name:"config",val:": OPTConfig"}],parametersDescription:[{anchor:"transformers.OPTModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/opt#transformers.OPTConfig">OPTConfig</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/opt/modeling_opt.py#L739"}}),wo=new te({props:{name:"forward",anchor:"transformers.OPTModel.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = 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.OPTModel.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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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.OPTModel.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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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.`,name:"attention_mask"},{anchor:"transformers.OPTModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> of shape <code>(encoder_layers, encoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the encoder. Mask values selected in <code>[0, 1]</code>:</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:"head_mask"},{anchor:"transformers.OPTModel.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.OPTModel.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.OPTModel.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.OPTModel.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.OPTModel.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.OPTModel.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/opt/modeling_opt.py#L755",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast"
>transformers.modeling_outputs.BaseModelOutputWithPast</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/opt#transformers.OPTConfig"
>OPTConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
<p>If <code>past_key_values</code> is used only the last hidden-state of the sequences of shape <code>(batch_size, 1, hidden_size)</code> is output.</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>) and optionally if
<code>config.is_encoder_decoder=True</code> 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 optionally if
<code>config.is_encoder_decoder=True</code> in the cross-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.BaseModelOutputWithPast"
>transformers.modeling_outputs.BaseModelOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),It=new In({props:{$$slots:{default:[Zd]},$$scope:{ctx:z}}}),St=new lt({props:{anchor:"transformers.OPTModel.forward.example",$$slots:{default:[Rd]},$$scope:{ctx:z}}}),$o=new et({}),Po=new te({props:{name:"class transformers.OPTForCausalLM",anchor:"transformers.OPTForCausalLM",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/opt/modeling_opt.py#L806"}}),Oo=new te({props:{name:"forward",anchor:"transformers.OPTForCausalLM.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = 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.OPTForCausalLM.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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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.OPTForCausalLM.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>`,name:"attention_mask"},{anchor:"transformers.OPTForCausalLM.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_hidden_layers, num_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules. Mask values selected in <code>[0, 1]</code>:</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:"head_mask"},{anchor:"transformers.OPTForCausalLM.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>. The two additional
tensors are only required when the model is used as a decoder in a Sequence to Sequence model.</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.OPTForCausalLM.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.OPTForCausalLM.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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:"labels"},{anchor:"transformers.OPTForCausalLM.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.OPTForCausalLM.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.OPTForCausalLM.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.OPTForCausalLM.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/opt/modeling_opt.py#L837",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/opt#transformers.OPTConfig"
>OPTConfig</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>
`}}),Bt=new lt({props:{anchor:"transformers.OPTForCausalLM.forward.example",$$slots:{default:[Jd]},$$scope:{ctx:z}}}),Fo=new et({}),zo=new te({props:{name:"class transformers.TFOPTModel",anchor:"transformers.TFOPTModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFOPTModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/opt#transformers.OPTConfig">OPTConfig</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.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/opt/modeling_tf_opt.py#L784"}}),Qt=new In({props:{$$slots:{default:[Xd]},$$scope:{ctx:z}}}),Co=new te({props:{name:"call",anchor:"transformers.TFOPTModel.call",parameters:[{name:"input_ids",val:": typing.Union[typing.List[tensorflow.python.framework.ops.Tensor], typing.List[numpy.ndarray], typing.List[keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, keras.engine.keras_tensor.KerasTensor, NoneType] = None"},{name:"attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"past_key_values",val:": typing.Union[typing.Tuple[typing.Tuple[typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor]]], NoneType] = None"},{name:"inputs_embeds",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = 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"},{name:"training",val:": typing.Optional[bool] = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFOPTModel.call.input_ids",description:`<strong>input_ids</strong> (<code>tf.Tensor</code> of shape <code>({0})</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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.TFOPTModel.call.attention_mask",description:`<strong>attention_mask</strong> (<code>tf.Tensor</code> of shape <code>({0})</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>`,name:"attention_mask"},{anchor:"transformers.TFOPTModel.call.head_mask",description:`<strong>head_mask</strong> (<code>tf.Tensor</code> of shape <code>(encoder_layers, encoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the encoder. Mask values selected in <code>[0, 1]</code>:</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:"head_mask"},{anchor:"transformers.TFOPTModel.call.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[tf.Tensor]]</code> of length <code>config.n_layers</code>) &#x2014;
contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding.
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.TFOPTModel.call.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#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>). Set to <code>False</code> during training, <code>True</code> during generation`,name:"use_cache"},{anchor:"transformers.TFOPTModel.call.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. This argument can be used only in eager mode, in graph mode the value in the
config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFOPTModel.call.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. This argument can be used only in eager mode, in graph mode the value in the config will be
used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFOPTModel.call.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. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFOPTModel.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use the model in training mode (some modules like dropout modules have different
behaviors between training and evaluation).`,name:"training"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/opt/modeling_tf_opt.py#L798",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPast"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPast</a> or a tuple of <code>tf.Tensor</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/opt#transformers.OPTConfig"
>OPTConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
<p>If <code>past_key_values</code> is used only the last hidden-state of the sequences of shape <code>(batch_size, 1, hidden_size)</code> is output.</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>List[tf.Tensor]</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 List of <code>tf.Tensor</code> of length <code>config.n_layers</code>, with each tensor of shape <code>(2, batch_size, num_heads, sequence_length, embed_size_per_head)</code>).</p>
<p>Contains pre-computed hidden-states (key and values in the 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(tf.Tensor)</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>tf.Tensor</code> (one for the output of the embeddings + 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 initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</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>tf.Tensor</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_tf_outputs.TFBaseModelOutputWithPast"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPast</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Ut=new In({props:{$$slots:{default:[Yd]},$$scope:{ctx:z}}}),Kt=new lt({props:{anchor:"transformers.TFOPTModel.call.example",$$slots:{default:[ec]},$$scope:{ctx:z}}}),qo=new et({}),jo=new te({props:{name:"class transformers.TFOPTForCausalLM",anchor:"transformers.TFOPTForCausalLM",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFOPTForCausalLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/opt#transformers.OPTConfig">OPTConfig</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.TFPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/opt/modeling_tf_opt.py#L871"}}),Gt=new In({props:{$$slots:{default:[tc]},$$scope:{ctx:z}}}),Io=new te({props:{name:"call",anchor:"transformers.TFOPTForCausalLM.call",parameters:[{name:"input_ids",val:": typing.Union[typing.List[tensorflow.python.framework.ops.Tensor], typing.List[numpy.ndarray], typing.List[keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, keras.engine.keras_tensor.KerasTensor, NoneType] = None"},{name:"past_key_values",val:": typing.Union[typing.Tuple[typing.Tuple[typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor]]], NoneType] = None"},{name:"attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"position_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"inputs_embeds",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"labels",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = 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"},{name:"training",val:": typing.Optional[bool] = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFOPTForCausalLM.call.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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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.TFOPTForCausalLM.call.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>`,name:"attention_mask"},{anchor:"transformers.TFOPTForCausalLM.call.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> of shape <code>(num_hidden_layers, num_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules. Mask values selected in <code>[0, 1]</code>:</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:"head_mask"},{anchor:"transformers.TFOPTForCausalLM.call.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>. The two additional
tensors are only required when the model is used as a decoder in a Sequence to Sequence model.</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>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.TFOPTForCausalLM.call.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.TFOPTForCausalLM.call.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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:"labels"},{anchor:"transformers.TFOPTForCausalLM.call.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.TFOPTForCausalLM.call.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.TFOPTForCausalLM.call.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.TFOPTForCausalLM.call.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/opt/modeling_tf_opt.py#L896",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFCausalLMOutputWithPast"
>transformers.modeling_tf_outputs.TFCausalLMOutputWithPast</a> or a tuple of <code>tf.Tensor</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/opt#transformers.OPTConfig"
>OPTConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(n,)</code>, <em>optional</em>, where n is the number of non-masked labels, returned when <code>labels</code> is provided) \u2014 Language modeling loss (for next-token prediction).</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</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>List[tf.Tensor]</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 List of <code>tf.Tensor</code> of length <code>config.n_layers</code>, with each tensor of shape <code>(2, batch_size, num_heads, sequence_length, embed_size_per_head)</code>).</p>
<p>Contains pre-computed hidden-states (key and values in the 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(tf.Tensor)</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>tf.Tensor</code> (one for the output of the embeddings + 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 initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</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>tf.Tensor</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>
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFCausalLMOutputWithPast"
>transformers.modeling_tf_outputs.TFCausalLMOutputWithPast</a> or <code>tuple(tf.Tensor)</code>: A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFCausalLMOutputWithPast"
>transformers.modeling_tf_outputs.TFCausalLMOutputWithPast</a> or a tuple of <code>tf.Tensor</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/opt#transformers.OPTConfig"
>OPTConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(n,)</code>, <em>optional</em>, where n is the number of non-masked labels, returned when <code>labels</code> is provided) \u2014 Language modeling loss (for next-token prediction).</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</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>List[tf.Tensor]</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 List of <code>tf.Tensor</code> of length <code>config.n_layers</code>, with each tensor of shape <code>(2, batch_size, num_heads, sequence_length, embed_size_per_head)</code>).</p>
<p>Contains pre-computed hidden-states (key and values in the 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(tf.Tensor)</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>tf.Tensor</code> (one for the output of the embeddings + 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 initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</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>tf.Tensor</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_tf_outputs.TFCausalLMOutputWithPast"
>transformers.modeling_tf_outputs.TFCausalLMOutputWithPast</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Rt=new lt({props:{anchor:"transformers.TFOPTForCausalLM.call.example",$$slots:{default:[oc]},$$scope:{ctx:z}}}),So=new et({}),Do=new te({props:{name:"class transformers.OPTForSequenceClassification",anchor:"transformers.OPTForSequenceClassification",parameters:[{name:"config",val:": OPTConfig"}],parametersDescription:[{anchor:"transformers.OPTForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/opt#transformers.OPTConfig">OPTConfig</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/opt/modeling_opt.py#L1007"}}),Qo=new te({props:{name:"forward",anchor:"transformers.OPTForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.Tensor]]] = 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.OPTForSequenceClassification.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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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.OPTForSequenceClassification.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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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.`,name:"attention_mask"},{anchor:"transformers.OPTForSequenceClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> of shape <code>(encoder_layers, encoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the encoder. Mask values selected in <code>[0, 1]</code>:</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:"head_mask"},{anchor:"transformers.OPTForSequenceClassification.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.OPTForSequenceClassification.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.OPTForSequenceClassification.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.OPTForSequenceClassification.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.OPTForSequenceClassification.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.OPTForSequenceClassification.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.OPTForSequenceClassification.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/opt/modeling_opt.py#L1019",returnDescription:`
<p>A <code>transformers.modeling_outputs.SequenceClassifierOutputWithPast</code> 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/opt#transformers.OPTConfig"
>OPTConfig</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 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (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><code>transformers.modeling_outputs.SequenceClassifierOutputWithPast</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Xt=new In({props:{$$slots:{default:[nc]},$$scope:{ctx:z}}}),Yt=new lt({props:{anchor:"transformers.OPTForSequenceClassification.forward.example",$$slots:{default:[sc]},$$scope:{ctx:z}}}),eo=new lt({props:{anchor:"transformers.OPTForSequenceClassification.forward.example-2",$$slots:{default:[ac]},$$scope:{ctx:z}}}),Uo=new et({}),Ko=new te({props:{name:"class transformers.OPTForQuestionAnswering",anchor:"transformers.OPTForQuestionAnswering",parameters:[{name:"config",val:": OPTConfig"}],parametersDescription:[{anchor:"transformers.OPTForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/opt#transformers.OPTConfig">OPTConfig</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/opt/modeling_opt.py#L1129"}}),Ro=new te({props:{name:"forward",anchor:"transformers.OPTForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.Tensor]]] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"start_positions",val:": typing.Optional[torch.LongTensor] = None"},{name:"end_positions",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.OPTForQuestionAnswering.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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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.OPTForQuestionAnswering.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/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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.`,name:"attention_mask"},{anchor:"transformers.OPTForQuestionAnswering.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> of shape <code>(encoder_layers, encoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the encoder. Mask values selected in <code>[0, 1]</code>:</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:"head_mask"},{anchor:"transformers.OPTForQuestionAnswering.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.OPTForQuestionAnswering.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.OPTForQuestionAnswering.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.OPTForQuestionAnswering.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.OPTForQuestionAnswering.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.OPTForQuestionAnswering.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.OPTForQuestionAnswering.forward.start_positions",description:`<strong>start_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the start of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"start_positions"},{anchor:"transformers.OPTForQuestionAnswering.forward.end_positions",description:`<strong>end_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the end of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"end_positions"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/opt/modeling_opt.py#L1140",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</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/opt#transformers.OPTConfig"
>OPTConfig</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 Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.</p>
</li>
<li>
<p><strong>start_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-start scores (before SoftMax).</p>
</li>
<li>
<p><strong>end_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-end scores (before SoftMax).</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.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),oo=new In({props:{$$slots:{default:[rc]},$$scope:{ctx:z}}}),no=new lt({props:{anchor:"transformers.OPTForQuestionAnswering.forward.example",$$slots:{default:[ic]},$$scope:{ctx:z}}}),Jo=new et({}),Xo=new te({props:{name:"class transformers.FlaxOPTModel",anchor:"transformers.FlaxOPTModel",parameters:[{name:"config",val:": OPTConfig"},{name:"input_shape",val:": typing.Tuple[int] = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/opt/modeling_flax_opt.py#L692"}}),Yo=new te({props:{name:"__call__",anchor:"transformers.FlaxOPTModel.__call__",parameters:[{name:"input_ids",val:": ndarray"},{name:"attention_mask",val:": typing.Optional[jax._src.numpy.ndarray.ndarray] = None"},{name:"position_ids",val:": typing.Optional[jax._src.numpy.ndarray.ndarray] = None"},{name:"params",val:": dict = None"},{name:"past_key_values",val:": dict = 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"},{name:"dropout_rng",val:": PRNGKey = None"},{name:"deterministic",val:": bool = True"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/opt/modeling_flax_opt.py#L584",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_flax_outputs.FlaxBaseModelOutput"
>transformers.modeling_flax_outputs.FlaxBaseModelOutput</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/opt#transformers.OPTConfig"
>OPTConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(jnp.ndarray)</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>jnp.ndarray</code> (one for the output of the embeddings + 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 initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(jnp.ndarray)</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>jnp.ndarray</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_flax_outputs.FlaxBaseModelOutput"
>transformers.modeling_flax_outputs.FlaxBaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ro=new lt({props:{anchor:"transformers.FlaxOPTModel.__call__.example",$$slots:{default:[lc]},$$scope:{ctx:z}}}),en=new et({}),tn=new te({props:{name:"class transformers.FlaxOPTForCausalLM",anchor:"transformers.FlaxOPTForCausalLM",parameters:[{name:"config",val:": OPTConfig"},{name:"input_shape",val:": typing.Tuple[int] = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxOPTForCausalLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/opt#transformers.OPTConfig">OPTConfig</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.FlaxPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.FlaxOPTForCausalLM.dtype",description:`<strong>dtype</strong> (<code>jax.numpy.dtype</code>, <em>optional</em>, defaults to <code>jax.numpy.float32</code>) &#x2014;
The data type of the computation. Can be one of <code>jax.numpy.float32</code>, <code>jax.numpy.float16</code> (on GPUs) and
<code>jax.numpy.bfloat16</code> (on TPUs).</p>
<p>This can be used to enable mixed-precision training or half-precision inference on GPUs or TPUs. If
specified all the computation will be performed with the given <code>dtype</code>.</p>
<p><strong>Note that this only specifies the dtype of the computation and does not influence the dtype of model
parameters.</strong></p>
<p>If you wish to change the dtype of the model parameters, see <a href="/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/opt/modeling_flax_opt.py#L766"}}),cn=new te({props:{name:"__call__",anchor:"transformers.FlaxOPTForCausalLM.__call__",parameters:[{name:"input_ids",val:": ndarray"},{name:"attention_mask",val:": typing.Optional[jax._src.numpy.ndarray.ndarray] = None"},{name:"position_ids",val:": typing.Optional[jax._src.numpy.ndarray.ndarray] = None"},{name:"params",val:": dict = None"},{name:"past_key_values",val:": dict = 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"},{name:"dropout_rng",val:": PRNGKey = None"},{name:"deterministic",val:": bool = True"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/opt/modeling_flax_opt.py#L584",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_flax_outputs.FlaxBaseModelOutput"
>transformers.modeling_flax_outputs.FlaxBaseModelOutput</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/opt#transformers.OPTConfig"
>OPTConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(jnp.ndarray)</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>jnp.ndarray</code> (one for the output of the embeddings + 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 initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(jnp.ndarray)</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>jnp.ndarray</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_flax_outputs.FlaxBaseModelOutput"
>transformers.modeling_flax_outputs.FlaxBaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),co=new lt({props:{anchor:"transformers.FlaxOPTForCausalLM.__call__.example",$$slots:{default:[dc]},$$scope:{ctx:z}}}),{c(){d=n("meta"),b=p(),f=n("h1"),m=n("a"),T=n("span"),v(l.$$.fragment),c=p(),E=n("span"),Ae=a("OPT"),Oe=p(),A=n("h2"),oe=n("a"),se=n("span"),v(F.$$.fragment),Le=p(),R=n("span"),Ne=a("Overview"),Fe=p(),W=n("p"),Ie=a("The OPT model was proposed in "),ae=n("a"),re=a("Open Pre-trained Transformer Language Models"),Se=a(` by Meta AI.
OPT is a series of open-sourced large causal language models which perform similar in performance to GPT3.`),ze=p(),V=n("p"),De=a("The abstract from the paper is the following:"),xe=p(),G=n("p"),Te=n("em"),We=a("Large language models, which are often trained for hundreds of thousands of compute days, have shown remarkable capabilities for zero- and few-shot learning. Given their computational cost, these models are difficult to replicate without significant capital. For the few that are available through APIs, no access is granted to the full model weights, making them difficult to study. We present Open Pre-trained Transformers (OPT), a suite of decoder-only pre-trained transformers ranging from 125M to 175B parameters, which we aim to fully and responsibly share with interested researchers. We show that OPT-175B is comparable to GPT-3, while requiring only 1/7th the carbon footprint to develop. We are also releasing our logbook detailing the infrastructure challenges we faced, along with code for experimenting with all of the released models."),he=p(),C=n("p"),L=a("Tips:"),Me=p(),B=n("ul"),ie=n("li"),Be=a("OPT has the same architecture as "),J=n("code"),He=a("BartDecoder"),Qe=a("."),N=p(),I=n("li"),le=a("Contrary to GPT2, OPT adds the EOS token "),be=n("code"),Ue=a("</s>"),de=a(" to the beginning of every prompt. "),ye=n("strong"),Ke=a("Note"),X=a(": Make sure to pass "),ve=n("code"),ce=a("use_fast=False"),Ve=a(" when loading OPT\u2019s tokenizer with "),ne=n("a"),S=a("AutoTokenizer"),Ge=a(" to get the correct tokenizer."),H=p(),j=n("p"),Ze=a("This model was contributed by "),y=n("a"),x=a("Arthur Zucker"),pt=a(", "),Y=n("a"),ut=a("Younes Belkada"),ht=a(", and "),M=n("a"),mt=a("Patrick Von Platen"),ft=a(`.
The original code can be found `),ke=n("a"),gt=a("here"),_t=a("."),Z=p(),D=n("h2"),me=n("a"),Re=n("span"),v(Q.$$.fragment),Tt=p(),Je=n("span"),Xe=a("OPTConfig"),tt=p(),q=n("div"),v(we.$$.fragment),ya=p(),bt=n("p"),va=a("This is the configuration class to store the configuration of a "),gn=n("a"),ka=a("OPTModel"),wa=a(`. It is used to instantiate a OPT 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 OPT
`),_o=n("a"),$a=a("facebook/opt-350m"),Pa=a(" architecture."),Oa=p(),yt=n("p"),Fa=a("Configuration objects inherit from "),_n=n("a"),za=a("PretrainedConfig"),xa=a(` and can be used to control the model outputs. Read the
documentation from `),Tn=n("a"),Ma=a("PretrainedConfig"),Ea=a(" for more information."),Ca=p(),v(Lt.$$.fragment),Ms=p(),vt=n("h2"),Nt=n("a"),Sn=n("span"),v(To.$$.fragment),qa=p(),Dn=n("span"),ja=a("OPTModel"),Es=p(),$e=n("div"),v(bo.$$.fragment),Aa=p(),yo=n("p"),La=a(`The bare OPT Model outputting raw hidden-states without any specific head on top.
This model inherits from `),bn=n("a"),Na=a("PreTrainedModel"),Ia=a(`. 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.)`),Sa=p(),vo=n("p"),Da=a("This model is also a PyTorch "),ko=n("a"),Wa=a("torch.nn.Module"),Ba=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ha=p(),Ee=n("div"),v(wo.$$.fragment),Qa=p(),kt=n("p"),Ua=a("The "),yn=n("a"),Ka=a("OPTModel"),Va=a(" forward method, overrides the "),Wn=n("code"),Ga=a("__call__"),Za=a(" special method."),Ra=p(),v(It.$$.fragment),Ja=p(),v(St.$$.fragment),Cs=p(),wt=n("h2"),Dt=n("a"),Bn=n("span"),v($o.$$.fragment),Xa=p(),Hn=n("span"),Ya=a("OPTForCausalLM"),qs=p(),$t=n("div"),v(Po.$$.fragment),er=p(),Wt=n("div"),v(Oo.$$.fragment),tr=p(),v(Bt.$$.fragment),js=p(),Pt=n("h2"),Ht=n("a"),Qn=n("span"),v(Fo.$$.fragment),or=p(),Un=n("span"),nr=a("TFOPTModel"),As=p(),pe=n("div"),v(zo.$$.fragment),sr=p(),xo=n("p"),ar=a(`The bare TF OPT Model outputting raw hidden-states without any specific head on top.
This model inherits from `),vn=n("a"),rr=a("TFPreTrainedModel"),ir=a(`. 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.)`),lr=p(),Mo=n("p"),dr=a("This model is also a "),Eo=n("a"),cr=a("tf.keras.Model"),pr=a(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),ur=p(),v(Qt.$$.fragment),hr=p(),Ce=n("div"),v(Co.$$.fragment),mr=p(),Ot=n("p"),fr=a("The "),kn=n("a"),gr=a("TFOPTModel"),_r=a(" forward method, overrides the "),Kn=n("code"),Tr=a("__call__"),br=a(" special method."),yr=p(),v(Ut.$$.fragment),vr=p(),v(Kt.$$.fragment),Ls=p(),Ft=n("h2"),Vt=n("a"),Vn=n("span"),v(qo.$$.fragment),kr=p(),Gn=n("span"),wr=a("TFOPTForCausalLM"),Ns=p(),ee=n("div"),v(jo.$$.fragment),$r=p(),Zn=n("p"),Pr=a("The OPT Model transformer with a language modeling head on top."),Or=p(),Ao=n("p"),Fr=a("This model inherits from "),wn=n("a"),zr=a("TFPreTrainedModel"),xr=a(`. 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.)`),Mr=p(),Lo=n("p"),Er=a("This model is also a "),No=n("a"),Cr=a("tf.keras.Model"),qr=a(` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),jr=p(),v(Gt.$$.fragment),Ar=p(),Zt=n("div"),v(Io.$$.fragment),Lr=p(),v(Rt.$$.fragment),Is=p(),zt=n("h2"),Jt=n("a"),Rn=n("span"),v(So.$$.fragment),Nr=p(),Jn=n("span"),Ir=a("OPTForSequenceClassification"),Ss=p(),U=n("div"),v(Do.$$.fragment),Sr=p(),Xn=n("p"),Dr=a("The OPT Model transformer with a sequence classification head on top (linear layer)."),Wr=p(),$n=n("p"),Pn=n("a"),Br=a("OPTForSequenceClassification"),Hr=a(` uses the last token in order to do the classification, as other causal models
(e.g. GPT-2) do.`),Qr=p(),Pe=n("p"),Ur=a(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Yn=n("code"),Kr=a("pad_token_id"),Vr=a(` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),es=n("code"),Gr=a("pad_token_id"),Zr=a(` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),ts=n("code"),Rr=a("inputs_embeds"),Jr=a(" are passed instead of "),os=n("code"),Xr=a("input_ids"),Yr=a(`, it does the same (take the last value in
each row of the batch).`),ei=p(),Wo=n("p"),ti=a("This model inherits from "),On=n("a"),oi=a("PreTrainedModel"),ni=a(`. 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.)`),si=p(),Bo=n("p"),ai=a("This model is also a PyTorch "),Ho=n("a"),ri=a("torch.nn.Module"),ii=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),li=p(),fe=n("div"),v(Qo.$$.fragment),di=p(),xt=n("p"),ci=a("The "),Fn=n("a"),pi=a("OPTForSequenceClassification"),ui=a(" forward method, overrides the "),ns=n("code"),hi=a("__call__"),mi=a(" special method."),fi=p(),v(Xt.$$.fragment),gi=p(),v(Yt.$$.fragment),_i=p(),v(eo.$$.fragment),Ds=p(),Mt=n("h2"),to=n("a"),ss=n("span"),v(Uo.$$.fragment),Ti=p(),as=n("span"),bi=a("OPTForQuestionAnswering"),Ws=p(),ue=n("div"),v(Ko.$$.fragment),yi=p(),Et=n("p"),vi=a(`The OPT Model transformer with a span classification head on top for extractive question-answering tasks like SQuAD
(a linear layers on top of the hidden-states output to compute `),rs=n("code"),ki=a("span start logits"),wi=a(" and "),is=n("code"),$i=a("span end logits"),Pi=a(")."),Oi=p(),Vo=n("p"),Fi=a("This model inherits from "),zn=n("a"),zi=a("PreTrainedModel"),xi=a(`. 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.)`),Mi=p(),Go=n("p"),Ei=a("This model is also a PyTorch "),Zo=n("a"),Ci=a("torch.nn.Module"),qi=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ji=p(),qe=n("div"),v(Ro.$$.fragment),Ai=p(),Ct=n("p"),Li=a("The "),xn=n("a"),Ni=a("OPTForQuestionAnswering"),Ii=a(" forward method, overrides the "),ls=n("code"),Si=a("__call__"),Di=a(" special method."),Wi=p(),v(oo.$$.fragment),Bi=p(),v(no.$$.fragment),Bs=p(),qt=n("h2"),so=n("a"),ds=n("span"),v(Jo.$$.fragment),Hi=p(),cs=n("span"),Qi=a("FlaxOPTModel"),Hs=p(),jt=n("div"),v(Xo.$$.fragment),Ui=p(),ao=n("div"),v(Yo.$$.fragment),Ki=p(),v(ro.$$.fragment),Qs=p(),At=n("h2"),io=n("a"),ps=n("span"),v(en.$$.fragment),Vi=p(),us=n("span"),Gi=a("FlaxOPTForCausalLM"),Us=p(),K=n("div"),v(tn.$$.fragment),Zi=p(),hs=n("p"),Ri=a(`OPT Model with a language modeling head on top (linear layer with weights tied to the input embeddings) e.g for
autoregressive tasks.`),Ji=p(),on=n("p"),Xi=a("This model inherits from "),Mn=n("a"),Yi=a("FlaxPreTrainedModel"),el=a(`. 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.)`),tl=p(),nn=n("p"),ol=a(`This model is also a Flax Linen
`),sn=n("a"),nl=a("flax.nn.Module"),sl=a(` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),al=p(),ms=n("p"),rl=a("Finally, this model supports inherent JAX features such as:"),il=p(),Ye=n("ul"),fs=n("li"),an=n("a"),ll=a("Just-In-Time (JIT) compilation"),dl=p(),gs=n("li"),rn=n("a"),cl=a("Automatic Differentiation"),pl=p(),_s=n("li"),ln=n("a"),ul=a("Vectorization"),hl=p(),Ts=n("li"),dn=n("a"),ml=a("Parallelization"),fl=p(),lo=n("div"),v(cn.$$.fragment),gl=p(),v(co.$$.fragment),this.h()},l(o){const _=Kd('[data-svelte="svelte-1phssyn"]',document.head);d=s(_,"META",{name:!0,content:!0}),_.forEach(t),b=u(o),f=s(o,"H1",{class:!0});var pn=i(f);m=s(pn,"A",{id:!0,class:!0,href:!0});var bs=i(m);T=s(bs,"SPAN",{});var ys=i(T);k(l.$$.fragment,ys),ys.forEach(t),bs.forEach(t),c=u(pn),E=s(pn,"SPAN",{});var vs=i(E);Ae=r(vs,"OPT"),vs.forEach(t),pn.forEach(t),Oe=u(o),A=s(o,"H2",{class:!0});var un=i(A);oe=s(un,"A",{id:!0,class:!0,href:!0});var ks=i(oe);se=s(ks,"SPAN",{});var ws=i(se);k(F.$$.fragment,ws),ws.forEach(t),ks.forEach(t),Le=u(un),R=s(un,"SPAN",{});var $s=i(R);Ne=r($s,"Overview"),$s.forEach(t),un.forEach(t),Fe=u(o),W=s(o,"P",{});var hn=i(W);Ie=r(hn,"The OPT model was proposed in "),ae=s(hn,"A",{href:!0,rel:!0});var Ps=i(ae);re=r(Ps,"Open Pre-trained Transformer Language Models"),Ps.forEach(t),Se=r(hn,` by Meta AI.
OPT is a series of open-sourced large causal language models which perform similar in performance to GPT3.`),hn.forEach(t),ze=u(o),V=s(o,"P",{});var Os=i(V);De=r(Os,"The abstract from the paper is the following:"),Os.forEach(t),xe=u(o),G=s(o,"P",{});var Fs=i(G);Te=s(Fs,"EM",{});var zs=i(Te);We=r(zs,"Large language models, which are often trained for hundreds of thousands of compute days, have shown remarkable capabilities for zero- and few-shot learning. Given their computational cost, these models are difficult to replicate without significant capital. For the few that are available through APIs, no access is granted to the full model weights, making them difficult to study. We present Open Pre-trained Transformers (OPT), a suite of decoder-only pre-trained transformers ranging from 125M to 175B parameters, which we aim to fully and responsibly share with interested researchers. We show that OPT-175B is comparable to GPT-3, while requiring only 1/7th the carbon footprint to develop. We are also releasing our logbook detailing the infrastructure challenges we faced, along with code for experimenting with all of the released models."),zs.forEach(t),Fs.forEach(t),he=u(o),C=s(o,"P",{});var xs=i(C);L=r(xs,"Tips:"),xs.forEach(t),Me=u(o),B=s(o,"UL",{});var mn=i(B);ie=s(mn,"LI",{});var fn=i(ie);Be=r(fn,"OPT has the same architecture as "),J=s(fn,"CODE",{});var Tl=i(J);He=r(Tl,"BartDecoder"),Tl.forEach(t),Qe=r(fn,"."),fn.forEach(t),N=u(mn),I=s(mn,"LI",{});var ot=i(I);le=r(ot,"Contrary to GPT2, OPT adds the EOS token "),be=s(ot,"CODE",{});var bl=i(be);Ue=r(bl,"</s>"),bl.forEach(t),de=r(ot," to the beginning of every prompt. "),ye=s(ot,"STRONG",{});var yl=i(ye);Ke=r(yl,"Note"),yl.forEach(t),X=r(ot,": Make sure to pass "),ve=s(ot,"CODE",{});var vl=i(ve);ce=r(vl,"use_fast=False"),vl.forEach(t),Ve=r(ot," when loading OPT\u2019s tokenizer with "),ne=s(ot,"A",{href:!0});var kl=i(ne);S=r(kl,"AutoTokenizer"),kl.forEach(t),Ge=r(ot," to get the correct tokenizer."),ot.forEach(t),mn.forEach(t),H=u(o),j=s(o,"P",{});var nt=i(j);Ze=r(nt,"This model was contributed by "),y=s(nt,"A",{href:!0,rel:!0});var wl=i(y);x=r(wl,"Arthur Zucker"),wl.forEach(t),pt=r(nt,", "),Y=s(nt,"A",{href:!0,rel:!0});var $l=i(Y);ut=r($l,"Younes Belkada"),$l.forEach(t),ht=r(nt,", and "),M=s(nt,"A",{href:!0,rel:!0});var Pl=i(M);mt=r(Pl,"Patrick Von Platen"),Pl.forEach(t),ft=r(nt,`.
The original code can be found `),ke=s(nt,"A",{href:!0,rel:!0});var Ol=i(ke);gt=r(Ol,"here"),Ol.forEach(t),_t=r(nt,"."),nt.forEach(t),Z=u(o),D=s(o,"H2",{class:!0});var Vs=i(D);me=s(Vs,"A",{id:!0,class:!0,href:!0});var Fl=i(me);Re=s(Fl,"SPAN",{});var zl=i(Re);k(Q.$$.fragment,zl),zl.forEach(t),Fl.forEach(t),Tt=u(Vs),Je=s(Vs,"SPAN",{});var xl=i(Je);Xe=r(xl,"OPTConfig"),xl.forEach(t),Vs.forEach(t),tt=u(o),q=s(o,"DIV",{class:!0});var po=i(q);k(we.$$.fragment,po),ya=u(po),bt=s(po,"P",{});var En=i(bt);va=r(En,"This is the configuration class to store the configuration of a "),gn=s(En,"A",{href:!0});var Ml=i(gn);ka=r(Ml,"OPTModel"),Ml.forEach(t),wa=r(En,`. It is used to instantiate a OPT 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 OPT
`),_o=s(En,"A",{href:!0,rel:!0});var El=i(_o);$a=r(El,"facebook/opt-350m"),El.forEach(t),Pa=r(En," architecture."),En.forEach(t),Oa=u(po),yt=s(po,"P",{});var Cn=i(yt);Fa=r(Cn,"Configuration objects inherit from "),_n=s(Cn,"A",{href:!0});var Cl=i(_n);za=r(Cl,"PretrainedConfig"),Cl.forEach(t),xa=r(Cn,` and can be used to control the model outputs. Read the
documentation from `),Tn=s(Cn,"A",{href:!0});var ql=i(Tn);Ma=r(ql,"PretrainedConfig"),ql.forEach(t),Ea=r(Cn," for more information."),Cn.forEach(t),Ca=u(po),k(Lt.$$.fragment,po),po.forEach(t),Ms=u(o),vt=s(o,"H2",{class:!0});var Gs=i(vt);Nt=s(Gs,"A",{id:!0,class:!0,href:!0});var jl=i(Nt);Sn=s(jl,"SPAN",{});var Al=i(Sn);k(To.$$.fragment,Al),Al.forEach(t),jl.forEach(t),qa=u(Gs),Dn=s(Gs,"SPAN",{});var Ll=i(Dn);ja=r(Ll,"OPTModel"),Ll.forEach(t),Gs.forEach(t),Es=u(o),$e=s(o,"DIV",{class:!0});var uo=i($e);k(bo.$$.fragment,uo),Aa=u(uo),yo=s(uo,"P",{});var Zs=i(yo);La=r(Zs,`The bare OPT Model outputting raw hidden-states without any specific head on top.
This model inherits from `),bn=s(Zs,"A",{href:!0});var Nl=i(bn);Na=r(Nl,"PreTrainedModel"),Nl.forEach(t),Ia=r(Zs,`. 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.)`),Zs.forEach(t),Sa=u(uo),vo=s(uo,"P",{});var Rs=i(vo);Da=r(Rs,"This model is also a PyTorch "),ko=s(Rs,"A",{href:!0,rel:!0});var Il=i(ko);Wa=r(Il,"torch.nn.Module"),Il.forEach(t),Ba=r(Rs,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Rs.forEach(t),Ha=u(uo),Ee=s(uo,"DIV",{class:!0});var ho=i(Ee);k(wo.$$.fragment,ho),Qa=u(ho),kt=s(ho,"P",{});var qn=i(kt);Ua=r(qn,"The "),yn=s(qn,"A",{href:!0});var Sl=i(yn);Ka=r(Sl,"OPTModel"),Sl.forEach(t),Va=r(qn," forward method, overrides the "),Wn=s(qn,"CODE",{});var Dl=i(Wn);Ga=r(Dl,"__call__"),Dl.forEach(t),Za=r(qn," special method."),qn.forEach(t),Ra=u(ho),k(It.$$.fragment,ho),Ja=u(ho),k(St.$$.fragment,ho),ho.forEach(t),uo.forEach(t),Cs=u(o),wt=s(o,"H2",{class:!0});var Js=i(wt);Dt=s(Js,"A",{id:!0,class:!0,href:!0});var Wl=i(Dt);Bn=s(Wl,"SPAN",{});var Bl=i(Bn);k($o.$$.fragment,Bl),Bl.forEach(t),Wl.forEach(t),Xa=u(Js),Hn=s(Js,"SPAN",{});var Hl=i(Hn);Ya=r(Hl,"OPTForCausalLM"),Hl.forEach(t),Js.forEach(t),qs=u(o),$t=s(o,"DIV",{class:!0});var Xs=i($t);k(Po.$$.fragment,Xs),er=u(Xs),Wt=s(Xs,"DIV",{class:!0});var Ys=i(Wt);k(Oo.$$.fragment,Ys),tr=u(Ys),k(Bt.$$.fragment,Ys),Ys.forEach(t),Xs.forEach(t),js=u(o),Pt=s(o,"H2",{class:!0});var ea=i(Pt);Ht=s(ea,"A",{id:!0,class:!0,href:!0});var Ql=i(Ht);Qn=s(Ql,"SPAN",{});var Ul=i(Qn);k(Fo.$$.fragment,Ul),Ul.forEach(t),Ql.forEach(t),or=u(ea),Un=s(ea,"SPAN",{});var Kl=i(Un);nr=r(Kl,"TFOPTModel"),Kl.forEach(t),ea.forEach(t),As=u(o),pe=s(o,"DIV",{class:!0});var st=i(pe);k(zo.$$.fragment,st),sr=u(st),xo=s(st,"P",{});var ta=i(xo);ar=r(ta,`The bare TF OPT Model outputting raw hidden-states without any specific head on top.
This model inherits from `),vn=s(ta,"A",{href:!0});var Vl=i(vn);rr=r(Vl,"TFPreTrainedModel"),Vl.forEach(t),ir=r(ta,`. 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.)`),ta.forEach(t),lr=u(st),Mo=s(st,"P",{});var oa=i(Mo);dr=r(oa,"This model is also a "),Eo=s(oa,"A",{href:!0,rel:!0});var Gl=i(Eo);cr=r(Gl,"tf.keras.Model"),Gl.forEach(t),pr=r(oa,` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),oa.forEach(t),ur=u(st),k(Qt.$$.fragment,st),hr=u(st),Ce=s(st,"DIV",{class:!0});var mo=i(Ce);k(Co.$$.fragment,mo),mr=u(mo),Ot=s(mo,"P",{});var jn=i(Ot);fr=r(jn,"The "),kn=s(jn,"A",{href:!0});var Zl=i(kn);gr=r(Zl,"TFOPTModel"),Zl.forEach(t),_r=r(jn," forward method, overrides the "),Kn=s(jn,"CODE",{});var Rl=i(Kn);Tr=r(Rl,"__call__"),Rl.forEach(t),br=r(jn," special method."),jn.forEach(t),yr=u(mo),k(Ut.$$.fragment,mo),vr=u(mo),k(Kt.$$.fragment,mo),mo.forEach(t),st.forEach(t),Ls=u(o),Ft=s(o,"H2",{class:!0});var na=i(Ft);Vt=s(na,"A",{id:!0,class:!0,href:!0});var Jl=i(Vt);Vn=s(Jl,"SPAN",{});var Xl=i(Vn);k(qo.$$.fragment,Xl),Xl.forEach(t),Jl.forEach(t),kr=u(na),Gn=s(na,"SPAN",{});var Yl=i(Gn);wr=r(Yl,"TFOPTForCausalLM"),Yl.forEach(t),na.forEach(t),Ns=u(o),ee=s(o,"DIV",{class:!0});var je=i(ee);k(jo.$$.fragment,je),$r=u(je),Zn=s(je,"P",{});var ed=i(Zn);Pr=r(ed,"The OPT Model transformer with a language modeling head on top."),ed.forEach(t),Or=u(je),Ao=s(je,"P",{});var sa=i(Ao);Fr=r(sa,"This model inherits from "),wn=s(sa,"A",{href:!0});var td=i(wn);zr=r(td,"TFPreTrainedModel"),td.forEach(t),xr=r(sa,`. 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.)`),sa.forEach(t),Mr=u(je),Lo=s(je,"P",{});var aa=i(Lo);Er=r(aa,"This model is also a "),No=s(aa,"A",{href:!0,rel:!0});var od=i(No);Cr=r(od,"tf.keras.Model"),od.forEach(t),qr=r(aa,` subclass. Use it
as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and
behavior.`),aa.forEach(t),jr=u(je),k(Gt.$$.fragment,je),Ar=u(je),Zt=s(je,"DIV",{class:!0});var ra=i(Zt);k(Io.$$.fragment,ra),Lr=u(ra),k(Rt.$$.fragment,ra),ra.forEach(t),je.forEach(t),Is=u(o),zt=s(o,"H2",{class:!0});var ia=i(zt);Jt=s(ia,"A",{id:!0,class:!0,href:!0});var nd=i(Jt);Rn=s(nd,"SPAN",{});var sd=i(Rn);k(So.$$.fragment,sd),sd.forEach(t),nd.forEach(t),Nr=u(ia),Jn=s(ia,"SPAN",{});var ad=i(Jn);Ir=r(ad,"OPTForSequenceClassification"),ad.forEach(t),ia.forEach(t),Ss=u(o),U=s(o,"DIV",{class:!0});var ge=i(U);k(Do.$$.fragment,ge),Sr=u(ge),Xn=s(ge,"P",{});var rd=i(Xn);Dr=r(rd,"The OPT Model transformer with a sequence classification head on top (linear layer)."),rd.forEach(t),Wr=u(ge),$n=s(ge,"P",{});var _l=i($n);Pn=s(_l,"A",{href:!0});var id=i(Pn);Br=r(id,"OPTForSequenceClassification"),id.forEach(t),Hr=r(_l,` uses the last token in order to do the classification, as other causal models
(e.g. GPT-2) do.`),_l.forEach(t),Qr=u(ge),Pe=s(ge,"P",{});var at=i(Pe);Ur=r(at,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Yn=s(at,"CODE",{});var ld=i(Yn);Kr=r(ld,"pad_token_id"),ld.forEach(t),Vr=r(at,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),es=s(at,"CODE",{});var dd=i(es);Gr=r(dd,"pad_token_id"),dd.forEach(t),Zr=r(at,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),ts=s(at,"CODE",{});var cd=i(ts);Rr=r(cd,"inputs_embeds"),cd.forEach(t),Jr=r(at," are passed instead of "),os=s(at,"CODE",{});var pd=i(os);Xr=r(pd,"input_ids"),pd.forEach(t),Yr=r(at,`, it does the same (take the last value in
each row of the batch).`),at.forEach(t),ei=u(ge),Wo=s(ge,"P",{});var la=i(Wo);ti=r(la,"This model inherits from "),On=s(la,"A",{href:!0});var ud=i(On);oi=r(ud,"PreTrainedModel"),ud.forEach(t),ni=r(la,`. 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.)`),la.forEach(t),si=u(ge),Bo=s(ge,"P",{});var da=i(Bo);ai=r(da,"This model is also a PyTorch "),Ho=s(da,"A",{href:!0,rel:!0});var hd=i(Ho);ri=r(hd,"torch.nn.Module"),hd.forEach(t),ii=r(da,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),da.forEach(t),li=u(ge),fe=s(ge,"DIV",{class:!0});var rt=i(fe);k(Qo.$$.fragment,rt),di=u(rt),xt=s(rt,"P",{});var An=i(xt);ci=r(An,"The "),Fn=s(An,"A",{href:!0});var md=i(Fn);pi=r(md,"OPTForSequenceClassification"),md.forEach(t),ui=r(An," forward method, overrides the "),ns=s(An,"CODE",{});var fd=i(ns);hi=r(fd,"__call__"),fd.forEach(t),mi=r(An," special method."),An.forEach(t),fi=u(rt),k(Xt.$$.fragment,rt),gi=u(rt),k(Yt.$$.fragment,rt),_i=u(rt),k(eo.$$.fragment,rt),rt.forEach(t),ge.forEach(t),Ds=u(o),Mt=s(o,"H2",{class:!0});var ca=i(Mt);to=s(ca,"A",{id:!0,class:!0,href:!0});var gd=i(to);ss=s(gd,"SPAN",{});var _d=i(ss);k(Uo.$$.fragment,_d),_d.forEach(t),gd.forEach(t),Ti=u(ca),as=s(ca,"SPAN",{});var Td=i(as);bi=r(Td,"OPTForQuestionAnswering"),Td.forEach(t),ca.forEach(t),Ws=u(o),ue=s(o,"DIV",{class:!0});var it=i(ue);k(Ko.$$.fragment,it),yi=u(it),Et=s(it,"P",{});var Ln=i(Et);vi=r(Ln,`The OPT Model transformer with a span classification head on top for extractive question-answering tasks like SQuAD
(a linear layers on top of the hidden-states output to compute `),rs=s(Ln,"CODE",{});var bd=i(rs);ki=r(bd,"span start logits"),bd.forEach(t),wi=r(Ln," and "),is=s(Ln,"CODE",{});var yd=i(is);$i=r(yd,"span end logits"),yd.forEach(t),Pi=r(Ln,")."),Ln.forEach(t),Oi=u(it),Vo=s(it,"P",{});var pa=i(Vo);Fi=r(pa,"This model inherits from "),zn=s(pa,"A",{href:!0});var vd=i(zn);zi=r(vd,"PreTrainedModel"),vd.forEach(t),xi=r(pa,`. 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.)`),pa.forEach(t),Mi=u(it),Go=s(it,"P",{});var ua=i(Go);Ei=r(ua,"This model is also a PyTorch "),Zo=s(ua,"A",{href:!0,rel:!0});var kd=i(Zo);Ci=r(kd,"torch.nn.Module"),kd.forEach(t),qi=r(ua,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ua.forEach(t),ji=u(it),qe=s(it,"DIV",{class:!0});var fo=i(qe);k(Ro.$$.fragment,fo),Ai=u(fo),Ct=s(fo,"P",{});var Nn=i(Ct);Li=r(Nn,"The "),xn=s(Nn,"A",{href:!0});var wd=i(xn);Ni=r(wd,"OPTForQuestionAnswering"),wd.forEach(t),Ii=r(Nn," forward method, overrides the "),ls=s(Nn,"CODE",{});var $d=i(ls);Si=r($d,"__call__"),$d.forEach(t),Di=r(Nn," special method."),Nn.forEach(t),Wi=u(fo),k(oo.$$.fragment,fo),Bi=u(fo),k(no.$$.fragment,fo),fo.forEach(t),it.forEach(t),Bs=u(o),qt=s(o,"H2",{class:!0});var ha=i(qt);so=s(ha,"A",{id:!0,class:!0,href:!0});var Pd=i(so);ds=s(Pd,"SPAN",{});var Od=i(ds);k(Jo.$$.fragment,Od),Od.forEach(t),Pd.forEach(t),Hi=u(ha),cs=s(ha,"SPAN",{});var Fd=i(cs);Qi=r(Fd,"FlaxOPTModel"),Fd.forEach(t),ha.forEach(t),Hs=u(o),jt=s(o,"DIV",{class:!0});var ma=i(jt);k(Xo.$$.fragment,ma),Ui=u(ma),ao=s(ma,"DIV",{class:!0});var fa=i(ao);k(Yo.$$.fragment,fa),Ki=u(fa),k(ro.$$.fragment,fa),fa.forEach(t),ma.forEach(t),Qs=u(o),At=s(o,"H2",{class:!0});var ga=i(At);io=s(ga,"A",{id:!0,class:!0,href:!0});var zd=i(io);ps=s(zd,"SPAN",{});var xd=i(ps);k(en.$$.fragment,xd),xd.forEach(t),zd.forEach(t),Vi=u(ga),us=s(ga,"SPAN",{});var Md=i(us);Gi=r(Md,"FlaxOPTForCausalLM"),Md.forEach(t),ga.forEach(t),Us=u(o),K=s(o,"DIV",{class:!0});var _e=i(K);k(tn.$$.fragment,_e),Zi=u(_e),hs=s(_e,"P",{});var Ed=i(hs);Ri=r(Ed,`OPT Model with a language modeling head on top (linear layer with weights tied to the input embeddings) e.g for
autoregressive tasks.`),Ed.forEach(t),Ji=u(_e),on=s(_e,"P",{});var _a=i(on);Xi=r(_a,"This model inherits from "),Mn=s(_a,"A",{href:!0});var Cd=i(Mn);Yi=r(Cd,"FlaxPreTrainedModel"),Cd.forEach(t),el=r(_a,`. 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.)`),_a.forEach(t),tl=u(_e),nn=s(_e,"P",{});var Ta=i(nn);ol=r(Ta,`This model is also a Flax Linen
`),sn=s(Ta,"A",{href:!0,rel:!0});var qd=i(sn);nl=r(qd,"flax.nn.Module"),qd.forEach(t),sl=r(Ta,` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),Ta.forEach(t),al=u(_e),ms=s(_e,"P",{});var jd=i(ms);rl=r(jd,"Finally, this model supports inherent JAX features such as:"),jd.forEach(t),il=u(_e),Ye=s(_e,"UL",{});var go=i(Ye);fs=s(go,"LI",{});var Ad=i(fs);an=s(Ad,"A",{href:!0,rel:!0});var Ld=i(an);ll=r(Ld,"Just-In-Time (JIT) compilation"),Ld.forEach(t),Ad.forEach(t),dl=u(go),gs=s(go,"LI",{});var Nd=i(gs);rn=s(Nd,"A",{href:!0,rel:!0});var Id=i(rn);cl=r(Id,"Automatic Differentiation"),Id.forEach(t),Nd.forEach(t),pl=u(go),_s=s(go,"LI",{});var Sd=i(_s);ln=s(Sd,"A",{href:!0,rel:!0});var Dd=i(ln);ul=r(Dd,"Vectorization"),Dd.forEach(t),Sd.forEach(t),hl=u(go),Ts=s(go,"LI",{});var Wd=i(Ts);dn=s(Wd,"A",{href:!0,rel:!0});var Bd=i(dn);ml=r(Bd,"Parallelization"),Bd.forEach(t),Wd.forEach(t),go.forEach(t),fl=u(_e),lo=s(_e,"DIV",{class:!0});var ba=i(lo);k(cn.$$.fragment,ba),gl=u(ba),k(co.$$.fragment,ba),ba.forEach(t),_e.forEach(t),this.h()},h(){h(d,"name","hf:doc:metadata"),h(d,"content",JSON.stringify(pc)),h(m,"id","opt"),h(m,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(m,"href","#opt"),h(f,"class","relative group"),h(oe,"id","overview"),h(oe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(oe,"href","#overview"),h(A,"class","relative group"),h(ae,"href","https://arxiv.org/pdf/2205.01068"),h(ae,"rel","nofollow"),h(ne,"href","/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer"),h(y,"href","https://huggingface.co/ArthurZ"),h(y,"rel","nofollow"),h(Y,"href","https://huggingface.co/ybelkada"),h(Y,"rel","nofollow"),h(M,"href","https://huggingface.co/patrickvonplaten"),h(M,"rel","nofollow"),h(ke,"href","https://github.com/facebookresearch/metaseq"),h(ke,"rel","nofollow"),h(me,"id","transformers.OPTConfig"),h(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"),h(me,"href","#transformers.OPTConfig"),h(D,"class","relative group"),h(gn,"href","/docs/transformers/main/en/model_doc/opt#transformers.OPTModel"),h(_o,"href","https://huggingface.co/facebook/opt-350m"),h(_o,"rel","nofollow"),h(_n,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),h(Tn,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),h(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Nt,"id","transformers.OPTModel"),h(Nt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Nt,"href","#transformers.OPTModel"),h(vt,"class","relative group"),h(bn,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),h(ko,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(ko,"rel","nofollow"),h(yn,"href","/docs/transformers/main/en/model_doc/opt#transformers.OPTModel"),h(Ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h($e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Dt,"id","transformers.OPTForCausalLM"),h(Dt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Dt,"href","#transformers.OPTForCausalLM"),h(wt,"class","relative group"),h(Wt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h($t,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ht,"id","transformers.TFOPTModel"),h(Ht,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Ht,"href","#transformers.TFOPTModel"),h(Pt,"class","relative group"),h(vn,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),h(Eo,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),h(Eo,"rel","nofollow"),h(kn,"href","/docs/transformers/main/en/model_doc/opt#transformers.TFOPTModel"),h(Ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Vt,"id","transformers.TFOPTForCausalLM"),h(Vt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Vt,"href","#transformers.TFOPTForCausalLM"),h(Ft,"class","relative group"),h(wn,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),h(No,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),h(No,"rel","nofollow"),h(Zt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Jt,"id","transformers.OPTForSequenceClassification"),h(Jt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Jt,"href","#transformers.OPTForSequenceClassification"),h(zt,"class","relative group"),h(Pn,"href","/docs/transformers/main/en/model_doc/opt#transformers.OPTForSequenceClassification"),h(On,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),h(Ho,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Ho,"rel","nofollow"),h(Fn,"href","/docs/transformers/main/en/model_doc/opt#transformers.OPTForSequenceClassification"),h(fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(to,"id","transformers.OPTForQuestionAnswering"),h(to,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(to,"href","#transformers.OPTForQuestionAnswering"),h(Mt,"class","relative group"),h(zn,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),h(Zo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Zo,"rel","nofollow"),h(xn,"href","/docs/transformers/main/en/model_doc/opt#transformers.OPTForQuestionAnswering"),h(qe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(so,"id","transformers.FlaxOPTModel"),h(so,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(so,"href","#transformers.FlaxOPTModel"),h(qt,"class","relative group"),h(ao,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(jt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(io,"id","transformers.FlaxOPTForCausalLM"),h(io,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(io,"href","#transformers.FlaxOPTForCausalLM"),h(At,"class","relative group"),h(Mn,"href","/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel"),h(sn,"href","https://flax.readthedocs.io/en/latest/_autosummary/flax.nn.module.html"),h(sn,"rel","nofollow"),h(an,"href","https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit"),h(an,"rel","nofollow"),h(rn,"href","https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation"),h(rn,"rel","nofollow"),h(ln,"href","https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap"),h(ln,"rel","nofollow"),h(dn,"href","https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap"),h(dn,"rel","nofollow"),h(lo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,_){e(document.head,d),g(o,b,_),g(o,f,_),e(f,m),e(m,T),w(l,T,null),e(f,c),e(f,E),e(E,Ae),g(o,Oe,_),g(o,A,_),e(A,oe),e(oe,se),w(F,se,null),e(A,Le),e(A,R),e(R,Ne),g(o,Fe,_),g(o,W,_),e(W,Ie),e(W,ae),e(ae,re),e(W,Se),g(o,ze,_),g(o,V,_),e(V,De),g(o,xe,_),g(o,G,_),e(G,Te),e(Te,We),g(o,he,_),g(o,C,_),e(C,L),g(o,Me,_),g(o,B,_),e(B,ie),e(ie,Be),e(ie,J),e(J,He),e(ie,Qe),e(B,N),e(B,I),e(I,le),e(I,be),e(be,Ue),e(I,de),e(I,ye),e(ye,Ke),e(I,X),e(I,ve),e(ve,ce),e(I,Ve),e(I,ne),e(ne,S),e(I,Ge),g(o,H,_),g(o,j,_),e(j,Ze),e(j,y),e(y,x),e(j,pt),e(j,Y),e(Y,ut),e(j,ht),e(j,M),e(M,mt),e(j,ft),e(j,ke),e(ke,gt),e(j,_t),g(o,Z,_),g(o,D,_),e(D,me),e(me,Re),w(Q,Re,null),e(D,Tt),e(D,Je),e(Je,Xe),g(o,tt,_),g(o,q,_),w(we,q,null),e(q,ya),e(q,bt),e(bt,va),e(bt,gn),e(gn,ka),e(bt,wa),e(bt,_o),e(_o,$a),e(bt,Pa),e(q,Oa),e(q,yt),e(yt,Fa),e(yt,_n),e(_n,za),e(yt,xa),e(yt,Tn),e(Tn,Ma),e(yt,Ea),e(q,Ca),w(Lt,q,null),g(o,Ms,_),g(o,vt,_),e(vt,Nt),e(Nt,Sn),w(To,Sn,null),e(vt,qa),e(vt,Dn),e(Dn,ja),g(o,Es,_),g(o,$e,_),w(bo,$e,null),e($e,Aa),e($e,yo),e(yo,La),e(yo,bn),e(bn,Na),e(yo,Ia),e($e,Sa),e($e,vo),e(vo,Da),e(vo,ko),e(ko,Wa),e(vo,Ba),e($e,Ha),e($e,Ee),w(wo,Ee,null),e(Ee,Qa),e(Ee,kt),e(kt,Ua),e(kt,yn),e(yn,Ka),e(kt,Va),e(kt,Wn),e(Wn,Ga),e(kt,Za),e(Ee,Ra),w(It,Ee,null),e(Ee,Ja),w(St,Ee,null),g(o,Cs,_),g(o,wt,_),e(wt,Dt),e(Dt,Bn),w($o,Bn,null),e(wt,Xa),e(wt,Hn),e(Hn,Ya),g(o,qs,_),g(o,$t,_),w(Po,$t,null),e($t,er),e($t,Wt),w(Oo,Wt,null),e(Wt,tr),w(Bt,Wt,null),g(o,js,_),g(o,Pt,_),e(Pt,Ht),e(Ht,Qn),w(Fo,Qn,null),e(Pt,or),e(Pt,Un),e(Un,nr),g(o,As,_),g(o,pe,_),w(zo,pe,null),e(pe,sr),e(pe,xo),e(xo,ar),e(xo,vn),e(vn,rr),e(xo,ir),e(pe,lr),e(pe,Mo),e(Mo,dr),e(Mo,Eo),e(Eo,cr),e(Mo,pr),e(pe,ur),w(Qt,pe,null),e(pe,hr),e(pe,Ce),w(Co,Ce,null),e(Ce,mr),e(Ce,Ot),e(Ot,fr),e(Ot,kn),e(kn,gr),e(Ot,_r),e(Ot,Kn),e(Kn,Tr),e(Ot,br),e(Ce,yr),w(Ut,Ce,null),e(Ce,vr),w(Kt,Ce,null),g(o,Ls,_),g(o,Ft,_),e(Ft,Vt),e(Vt,Vn),w(qo,Vn,null),e(Ft,kr),e(Ft,Gn),e(Gn,wr),g(o,Ns,_),g(o,ee,_),w(jo,ee,null),e(ee,$r),e(ee,Zn),e(Zn,Pr),e(ee,Or),e(ee,Ao),e(Ao,Fr),e(Ao,wn),e(wn,zr),e(Ao,xr),e(ee,Mr),e(ee,Lo),e(Lo,Er),e(Lo,No),e(No,Cr),e(Lo,qr),e(ee,jr),w(Gt,ee,null),e(ee,Ar),e(ee,Zt),w(Io,Zt,null),e(Zt,Lr),w(Rt,Zt,null),g(o,Is,_),g(o,zt,_),e(zt,Jt),e(Jt,Rn),w(So,Rn,null),e(zt,Nr),e(zt,Jn),e(Jn,Ir),g(o,Ss,_),g(o,U,_),w(Do,U,null),e(U,Sr),e(U,Xn),e(Xn,Dr),e(U,Wr),e(U,$n),e($n,Pn),e(Pn,Br),e($n,Hr),e(U,Qr),e(U,Pe),e(Pe,Ur),e(Pe,Yn),e(Yn,Kr),e(Pe,Vr),e(Pe,es),e(es,Gr),e(Pe,Zr),e(Pe,ts),e(ts,Rr),e(Pe,Jr),e(Pe,os),e(os,Xr),e(Pe,Yr),e(U,ei),e(U,Wo),e(Wo,ti),e(Wo,On),e(On,oi),e(Wo,ni),e(U,si),e(U,Bo),e(Bo,ai),e(Bo,Ho),e(Ho,ri),e(Bo,ii),e(U,li),e(U,fe),w(Qo,fe,null),e(fe,di),e(fe,xt),e(xt,ci),e(xt,Fn),e(Fn,pi),e(xt,ui),e(xt,ns),e(ns,hi),e(xt,mi),e(fe,fi),w(Xt,fe,null),e(fe,gi),w(Yt,fe,null),e(fe,_i),w(eo,fe,null),g(o,Ds,_),g(o,Mt,_),e(Mt,to),e(to,ss),w(Uo,ss,null),e(Mt,Ti),e(Mt,as),e(as,bi),g(o,Ws,_),g(o,ue,_),w(Ko,ue,null),e(ue,yi),e(ue,Et),e(Et,vi),e(Et,rs),e(rs,ki),e(Et,wi),e(Et,is),e(is,$i),e(Et,Pi),e(ue,Oi),e(ue,Vo),e(Vo,Fi),e(Vo,zn),e(zn,zi),e(Vo,xi),e(ue,Mi),e(ue,Go),e(Go,Ei),e(Go,Zo),e(Zo,Ci),e(Go,qi),e(ue,ji),e(ue,qe),w(Ro,qe,null),e(qe,Ai),e(qe,Ct),e(Ct,Li),e(Ct,xn),e(xn,Ni),e(Ct,Ii),e(Ct,ls),e(ls,Si),e(Ct,Di),e(qe,Wi),w(oo,qe,null),e(qe,Bi),w(no,qe,null),g(o,Bs,_),g(o,qt,_),e(qt,so),e(so,ds),w(Jo,ds,null),e(qt,Hi),e(qt,cs),e(cs,Qi),g(o,Hs,_),g(o,jt,_),w(Xo,jt,null),e(jt,Ui),e(jt,ao),w(Yo,ao,null),e(ao,Ki),w(ro,ao,null),g(o,Qs,_),g(o,At,_),e(At,io),e(io,ps),w(en,ps,null),e(At,Vi),e(At,us),e(us,Gi),g(o,Us,_),g(o,K,_),w(tn,K,null),e(K,Zi),e(K,hs),e(hs,Ri),e(K,Ji),e(K,on),e(on,Xi),e(on,Mn),e(Mn,Yi),e(on,el),e(K,tl),e(K,nn),e(nn,ol),e(nn,sn),e(sn,nl),e(nn,sl),e(K,al),e(K,ms),e(ms,rl),e(K,il),e(K,Ye),e(Ye,fs),e(fs,an),e(an,ll),e(Ye,dl),e(Ye,gs),e(gs,rn),e(rn,cl),e(Ye,pl),e(Ye,_s),e(_s,ln),e(ln,ul),e(Ye,hl),e(Ye,Ts),e(Ts,dn),e(dn,ml),e(K,fl),e(K,lo),w(cn,lo,null),e(lo,gl),w(co,lo,null),Ks=!0},p(o,[_]){const pn={};_&2&&(pn.$$scope={dirty:_,ctx:o}),Lt.$set(pn);const bs={};_&2&&(bs.$$scope={dirty:_,ctx:o}),It.$set(bs);const ys={};_&2&&(ys.$$scope={dirty:_,ctx:o}),St.$set(ys);const vs={};_&2&&(vs.$$scope={dirty:_,ctx:o}),Bt.$set(vs);const un={};_&2&&(un.$$scope={dirty:_,ctx:o}),Qt.$set(un);const ks={};_&2&&(ks.$$scope={dirty:_,ctx:o}),Ut.$set(ks);const ws={};_&2&&(ws.$$scope={dirty:_,ctx:o}),Kt.$set(ws);const $s={};_&2&&($s.$$scope={dirty:_,ctx:o}),Gt.$set($s);const hn={};_&2&&(hn.$$scope={dirty:_,ctx:o}),Rt.$set(hn);const Ps={};_&2&&(Ps.$$scope={dirty:_,ctx:o}),Xt.$set(Ps);const Os={};_&2&&(Os.$$scope={dirty:_,ctx:o}),Yt.$set(Os);const Fs={};_&2&&(Fs.$$scope={dirty:_,ctx:o}),eo.$set(Fs);const zs={};_&2&&(zs.$$scope={dirty:_,ctx:o}),oo.$set(zs);const xs={};_&2&&(xs.$$scope={dirty:_,ctx:o}),no.$set(xs);const mn={};_&2&&(mn.$$scope={dirty:_,ctx:o}),ro.$set(mn);const fn={};_&2&&(fn.$$scope={dirty:_,ctx:o}),co.$set(fn)},i(o){Ks||($(l.$$.fragment,o),$(F.$$.fragment,o),$(Q.$$.fragment,o),$(we.$$.fragment,o),$(Lt.$$.fragment,o),$(To.$$.fragment,o),$(bo.$$.fragment,o),$(wo.$$.fragment,o),$(It.$$.fragment,o),$(St.$$.fragment,o),$($o.$$.fragment,o),$(Po.$$.fragment,o),$(Oo.$$.fragment,o),$(Bt.$$.fragment,o),$(Fo.$$.fragment,o),$(zo.$$.fragment,o),$(Qt.$$.fragment,o),$(Co.$$.fragment,o),$(Ut.$$.fragment,o),$(Kt.$$.fragment,o),$(qo.$$.fragment,o),$(jo.$$.fragment,o),$(Gt.$$.fragment,o),$(Io.$$.fragment,o),$(Rt.$$.fragment,o),$(So.$$.fragment,o),$(Do.$$.fragment,o),$(Qo.$$.fragment,o),$(Xt.$$.fragment,o),$(Yt.$$.fragment,o),$(eo.$$.fragment,o),$(Uo.$$.fragment,o),$(Ko.$$.fragment,o),$(Ro.$$.fragment,o),$(oo.$$.fragment,o),$(no.$$.fragment,o),$(Jo.$$.fragment,o),$(Xo.$$.fragment,o),$(Yo.$$.fragment,o),$(ro.$$.fragment,o),$(en.$$.fragment,o),$(tn.$$.fragment,o),$(cn.$$.fragment,o),$(co.$$.fragment,o),Ks=!0)},o(o){P(l.$$.fragment,o),P(F.$$.fragment,o),P(Q.$$.fragment,o),P(we.$$.fragment,o),P(Lt.$$.fragment,o),P(To.$$.fragment,o),P(bo.$$.fragment,o),P(wo.$$.fragment,o),P(It.$$.fragment,o),P(St.$$.fragment,o),P($o.$$.fragment,o),P(Po.$$.fragment,o),P(Oo.$$.fragment,o),P(Bt.$$.fragment,o),P(Fo.$$.fragment,o),P(zo.$$.fragment,o),P(Qt.$$.fragment,o),P(Co.$$.fragment,o),P(Ut.$$.fragment,o),P(Kt.$$.fragment,o),P(qo.$$.fragment,o),P(jo.$$.fragment,o),P(Gt.$$.fragment,o),P(Io.$$.fragment,o),P(Rt.$$.fragment,o),P(So.$$.fragment,o),P(Do.$$.fragment,o),P(Qo.$$.fragment,o),P(Xt.$$.fragment,o),P(Yt.$$.fragment,o),P(eo.$$.fragment,o),P(Uo.$$.fragment,o),P(Ko.$$.fragment,o),P(Ro.$$.fragment,o),P(oo.$$.fragment,o),P(no.$$.fragment,o),P(Jo.$$.fragment,o),P(Xo.$$.fragment,o),P(Yo.$$.fragment,o),P(ro.$$.fragment,o),P(en.$$.fragment,o),P(tn.$$.fragment,o),P(cn.$$.fragment,o),P(co.$$.fragment,o),Ks=!1},d(o){t(d),o&&t(b),o&&t(f),O(l),o&&t(Oe),o&&t(A),O(F),o&&t(Fe),o&&t(W),o&&t(ze),o&&t(V),o&&t(xe),o&&t(G),o&&t(he),o&&t(C),o&&t(Me),o&&t(B),o&&t(H),o&&t(j),o&&t(Z),o&&t(D),O(Q),o&&t(tt),o&&t(q),O(we),O(Lt),o&&t(Ms),o&&t(vt),O(To),o&&t(Es),o&&t($e),O(bo),O(wo),O(It),O(St),o&&t(Cs),o&&t(wt),O($o),o&&t(qs),o&&t($t),O(Po),O(Oo),O(Bt),o&&t(js),o&&t(Pt),O(Fo),o&&t(As),o&&t(pe),O(zo),O(Qt),O(Co),O(Ut),O(Kt),o&&t(Ls),o&&t(Ft),O(qo),o&&t(Ns),o&&t(ee),O(jo),O(Gt),O(Io),O(Rt),o&&t(Is),o&&t(zt),O(So),o&&t(Ss),o&&t(U),O(Do),O(Qo),O(Xt),O(Yt),O(eo),o&&t(Ds),o&&t(Mt),O(Uo),o&&t(Ws),o&&t(ue),O(Ko),O(Ro),O(oo),O(no),o&&t(Bs),o&&t(qt),O(Jo),o&&t(Hs),o&&t(jt),O(Xo),O(Yo),O(ro),o&&t(Qs),o&&t(At),O(en),o&&t(Us),o&&t(K),O(tn),O(cn),O(co)}}}const pc={local:"opt",sections:[{local:"overview",title:"Overview"},{local:"transformers.OPTConfig",title:"OPTConfig"},{local:"transformers.OPTModel",title:"OPTModel"},{local:"transformers.OPTForCausalLM",title:"OPTForCausalLM"},{local:"transformers.TFOPTModel",title:"TFOPTModel"},{local:"transformers.TFOPTForCausalLM",title:"TFOPTForCausalLM"},{local:"transformers.OPTForSequenceClassification",title:"OPTForSequenceClassification"},{local:"transformers.OPTForQuestionAnswering",title:"OPTForQuestionAnswering"},{local:"transformers.FlaxOPTModel",title:"FlaxOPTModel"},{local:"transformers.FlaxOPTForCausalLM",title:"FlaxOPTForCausalLM"}],title:"OPT"};function uc(z){return Vd(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class bc extends Hd{constructor(d){super();Qd(this,d,uc,cc,Ud,{})}}export{bc as default,pc as metadata};
