import{S as bu,i as yu,s as vu,e as a,k as p,w as v,t as n,M as wu,c as r,d as t,m as u,a as l,x as w,h as s,b as d,G as e,g as f,y as M,q as k,o as $,B as P,v as Mu,L as Tt}from"../../chunks/vendor-hf-doc-builder.js";import{T as Fs}from"../../chunks/Tip-hf-doc-builder.js";import{D}from"../../chunks/Docstring-hf-doc-builder.js";import{C as bt}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Be}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as _t}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as Mc}from"../../chunks/PipelineTag-hf-doc-builder.js";function ku(O){let c,b,_,m,T;return m=new bt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME9QVENvbmZpZyUyQyUyME9QVE1vZGVsJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyME9QVCUyMGZhY2Vib29rJTJGb3B0LWxhcmdlJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyME9QVENvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBmYWNlYm9vayUyRm9wdC1sYXJnZSUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwT1BUTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",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(){c=a("p"),b=n("Example:"),_=p(),v(m.$$.fragment)},l(i){c=r(i,"P",{});var h=l(c);b=s(h,"Example:"),h.forEach(t),_=u(i),w(m.$$.fragment,i)},m(i,h){f(i,c,h),e(c,b),f(i,_,h),M(m,i,h),T=!0},p:Tt,i(i){T||(k(m.$$.fragment,i),T=!0)},o(i){$(m.$$.fragment,i),T=!1},d(i){i&&t(c),i&&t(_),P(m,i)}}}function $u(O){let c,b,_,m,T;return{c(){c=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),m=n("Module"),T=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){c=r(i,"P",{});var h=l(c);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r(h,"CODE",{});var C=l(_);m=s(C,"Module"),C.forEach(t),T=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(i,h){f(i,c,h),e(c,b),e(c,_),e(_,m),e(c,T)},d(i){i&&t(c)}}}function Pu(O){let c,b,_,m,T;return m=new bt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBPUFRNb2RlbCUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZvcHQtMzUwbSUyMiklMEFtb2RlbCUyMCUzRCUyME9QVE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRm9wdC0zNTBtJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBbGFzdF9oaWRkZW5fc3RhdGVzJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZQ==",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(){c=a("p"),b=n("Example:"),_=p(),v(m.$$.fragment)},l(i){c=r(i,"P",{});var h=l(c);b=s(h,"Example:"),h.forEach(t),_=u(i),w(m.$$.fragment,i)},m(i,h){f(i,c,h),e(c,b),f(i,_,h),M(m,i,h),T=!0},p:Tt,i(i){T||(k(m.$$.fragment,i),T=!0)},o(i){$(m.$$.fragment,i),T=!1},d(i){i&&t(c),i&&t(_),P(m,i)}}}function Fu(O){let c,b,_,m,T;return m=new bt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBPUFRGb3JDYXVzYWxMTSUwQSUwQW1vZGVsJTIwJTNEJTIwT1BURm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGb3B0LTM1MG0lMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZvcHQtMzUwbSUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJIZXklMkMlMjBhcmUlMjB5b3UlMjBjb25zY2lvdXMlM0YlMjBDYW4lMjB5b3UlMjB0YWxrJTIwdG8lMjBtZSUzRiUyMiUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihwcm9tcHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQSUyMyUyMEdlbmVyYXRlJTBBZ2VuZXJhdGVfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRzLmlucHV0X2lkcyUyQyUyMG1heF9sZW5ndGglM0QzMCklMEF0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKGdlbmVyYXRlX2lkcyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlJTJDJTIwY2xlYW5fdXBfdG9rZW5pemF0aW9uX3NwYWNlcyUzREZhbHNlKSU1QjAlNUQ=",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 conscious? Can you talk to me?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(prompt, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Generate</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>generate_ids = model.generate(inputs.input_ids, max_length=<span class="hljs-number">30</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(generate_ids, skip_special_tokens=<span class="hljs-literal">True</span>, clean_up_tokenization_spaces=<span class="hljs-literal">False</span>)[<span class="hljs-number">0</span>]
<span class="hljs-string">&quot;Hey, are you conscious? Can you talk to me?\\nI&#x27;m not conscious. I&#x27;m just a little bit of a weirdo.&quot;</span>`}}),{c(){c=a("p"),b=n("Example:"),_=p(),v(m.$$.fragment)},l(i){c=r(i,"P",{});var h=l(c);b=s(h,"Example:"),h.forEach(t),_=u(i),w(m.$$.fragment,i)},m(i,h){f(i,c,h),e(c,b),f(i,_,h),M(m,i,h),T=!0},p:Tt,i(i){T||(k(m.$$.fragment,i),T=!0)},o(i){$(m.$$.fragment,i),T=!1},d(i){i&&t(c),i&&t(_),P(m,i)}}}function Ou(O){let c,b,_,m,T,i,h,C,Ne,je,I,K,te,F,Ge,S,Ve,Ce,A,Le,oe,ne,Re,ze,L,Se,xe,R,ye,Qe,me,z,W,Je,B,se,Xe,Q,He,Ye,Z,ae,re,ve,De,le,Ue,J,X,ie,de,Ke,H,q,et,x,tt,ot;return{c(){c=a("p"),b=n("TensorFlow models and layers in "),_=a("code"),m=n("transformers"),T=n(" accept two formats as input:"),i=p(),h=a("ul"),C=a("li"),Ne=n("having all inputs as keyword arguments (like PyTorch models), or"),je=p(),I=a("li"),K=n("having all inputs as a list, tuple or dict in the first positional argument."),te=p(),F=a("p"),Ge=n(`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 `),S=a("code"),Ve=n("model.fit()"),Ce=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),A=a("code"),Le=n("model.fit()"),oe=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),ne=a("code"),Re=n("fit()"),ze=n(" and "),L=a("code"),Se=n("predict()"),xe=n(`, such as when creating your own layers or models with
the Keras `),R=a("code"),ye=n("Functional"),Qe=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),me=p(),z=a("ul"),W=a("li"),Je=n("a single Tensor with "),B=a("code"),se=n("input_ids"),Xe=n(" only and nothing else: "),Q=a("code"),He=n("model(input_ids)"),Ye=p(),Z=a("li"),ae=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),re=a("code"),ve=n("model([input_ids, attention_mask])"),De=n(" or "),le=a("code"),Ue=n("model([input_ids, attention_mask, token_type_ids])"),J=p(),X=a("li"),ie=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),de=a("code"),Ke=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),H=p(),q=a("p"),et=n(`Note that when creating models and layers with
`),x=a("a"),tt=n("subclassing"),ot=n(` 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){c=r(y,"P",{});var E=l(c);b=s(E,"TensorFlow models and layers in "),_=r(E,"CODE",{});var yt=l(_);m=s(yt,"transformers"),yt.forEach(t),T=s(E," accept two formats as input:"),E.forEach(t),i=u(y),h=r(y,"UL",{});var fe=l(h);C=r(fe,"LI",{});var ce=l(C);Ne=s(ce,"having all inputs as keyword arguments (like PyTorch models), or"),ce.forEach(t),je=u(fe),I=r(fe,"LI",{});var ge=l(I);K=s(ge,"having all inputs as a list, tuple or dict in the first positional argument."),ge.forEach(t),fe.forEach(t),te=u(y),F=r(y,"P",{});var j=l(F);Ge=s(j,`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 `),S=r(j,"CODE",{});var we=l(S);Ve=s(we,"model.fit()"),we.forEach(t),Ce=s(j,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),A=r(j,"CODE",{});var vt=l(A);Le=s(vt,"model.fit()"),vt.forEach(t),oe=s(j,` supports! If, however, you want to use the second
format outside of Keras methods like `),ne=r(j,"CODE",{});var nt=l(ne);Re=s(nt,"fit()"),nt.forEach(t),ze=s(j," and "),L=r(j,"CODE",{});var wt=l(L);Se=s(wt,"predict()"),wt.forEach(t),xe=s(j,`, such as when creating your own layers or models with
the Keras `),R=r(j,"CODE",{});var rt=l(R);ye=s(rt,"Functional"),rt.forEach(t),Qe=s(j,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),j.forEach(t),me=u(y),z=r(y,"UL",{});var N=l(z);W=r(N,"LI",{});var pe=l(W);Je=s(pe,"a single Tensor with "),B=r(pe,"CODE",{});var lt=l(B);se=s(lt,"input_ids"),lt.forEach(t),Xe=s(pe," only and nothing else: "),Q=r(pe,"CODE",{});var Me=l(Q);He=s(Me,"model(input_ids)"),Me.forEach(t),pe.forEach(t),Ye=u(N),Z=r(N,"LI",{});var ee=l(Z);ae=s(ee,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),re=r(ee,"CODE",{});var U=l(re);ve=s(U,"model([input_ids, attention_mask])"),U.forEach(t),De=s(ee," or "),le=r(ee,"CODE",{});var ke=l(le);Ue=s(ke,"model([input_ids, attention_mask, token_type_ids])"),ke.forEach(t),ee.forEach(t),J=u(N),X=r(N,"LI",{});var st=l(X);ie=s(st,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),de=r(st,"CODE",{});var $e=l(de);Ke=s($e,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),$e.forEach(t),st.forEach(t),N.forEach(t),H=u(y),q=r(y,"P",{});var Pe=l(q);et=s(Pe,`Note that when creating models and layers with
`),x=r(Pe,"A",{href:!0,rel:!0});var Mt=l(x);tt=s(Mt,"subclassing"),Mt.forEach(t),ot=s(Pe,` 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!`),Pe.forEach(t),this.h()},h(){d(x,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),d(x,"rel","nofollow")},m(y,E){f(y,c,E),e(c,b),e(c,_),e(_,m),e(c,T),f(y,i,E),f(y,h,E),e(h,C),e(C,Ne),e(h,je),e(h,I),e(I,K),f(y,te,E),f(y,F,E),e(F,Ge),e(F,S),e(S,Ve),e(F,Ce),e(F,A),e(A,Le),e(F,oe),e(F,ne),e(ne,Re),e(F,ze),e(F,L),e(L,Se),e(F,xe),e(F,R),e(R,ye),e(F,Qe),f(y,me,E),f(y,z,E),e(z,W),e(W,Je),e(W,B),e(B,se),e(W,Xe),e(W,Q),e(Q,He),e(z,Ye),e(z,Z),e(Z,ae),e(Z,re),e(re,ve),e(Z,De),e(Z,le),e(le,Ue),e(z,J),e(z,X),e(X,ie),e(X,de),e(de,Ke),f(y,H,E),f(y,q,E),e(q,et),e(q,x),e(x,tt),e(q,ot)},d(y){y&&t(c),y&&t(i),y&&t(h),y&&t(te),y&&t(F),y&&t(me),y&&t(z),y&&t(H),y&&t(q)}}}function Eu(O){let c,b,_,m,T;return{c(){c=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),m=n("Module"),T=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){c=r(i,"P",{});var h=l(c);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r(h,"CODE",{});var C=l(_);m=s(C,"Module"),C.forEach(t),T=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(i,h){f(i,c,h),e(c,b),e(c,_),e(_,m),e(c,T)},d(i){i&&t(c)}}}function ju(O){let c,b,_,m,T;return m=new bt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURk9QVE1vZGVsJTBBaW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRm9wdC0zNTBtJTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZPUFRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZvcHQtMzUwbSUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0cyklMEElMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRl",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(){c=a("p"),b=n("Example:"),_=p(),v(m.$$.fragment)},l(i){c=r(i,"P",{});var h=l(c);b=s(h,"Example:"),h.forEach(t),_=u(i),w(m.$$.fragment,i)},m(i,h){f(i,c,h),e(c,b),f(i,_,h),M(m,i,h),T=!0},p:Tt,i(i){T||(k(m.$$.fragment,i),T=!0)},o(i){$(m.$$.fragment,i),T=!1},d(i){i&&t(c),i&&t(_),P(m,i)}}}function Cu(O){let c,b,_,m,T,i,h,C,Ne,je,I,K,te,F,Ge,S,Ve,Ce,A,Le,oe,ne,Re,ze,L,Se,xe,R,ye,Qe,me,z,W,Je,B,se,Xe,Q,He,Ye,Z,ae,re,ve,De,le,Ue,J,X,ie,de,Ke,H,q,et,x,tt,ot;return{c(){c=a("p"),b=n("TensorFlow models and layers in "),_=a("code"),m=n("transformers"),T=n(" accept two formats as input:"),i=p(),h=a("ul"),C=a("li"),Ne=n("having all inputs as keyword arguments (like PyTorch models), or"),je=p(),I=a("li"),K=n("having all inputs as a list, tuple or dict in the first positional argument."),te=p(),F=a("p"),Ge=n(`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 `),S=a("code"),Ve=n("model.fit()"),Ce=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),A=a("code"),Le=n("model.fit()"),oe=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),ne=a("code"),Re=n("fit()"),ze=n(" and "),L=a("code"),Se=n("predict()"),xe=n(`, such as when creating your own layers or models with
the Keras `),R=a("code"),ye=n("Functional"),Qe=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),me=p(),z=a("ul"),W=a("li"),Je=n("a single Tensor with "),B=a("code"),se=n("input_ids"),Xe=n(" only and nothing else: "),Q=a("code"),He=n("model(input_ids)"),Ye=p(),Z=a("li"),ae=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),re=a("code"),ve=n("model([input_ids, attention_mask])"),De=n(" or "),le=a("code"),Ue=n("model([input_ids, attention_mask, token_type_ids])"),J=p(),X=a("li"),ie=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),de=a("code"),Ke=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),H=p(),q=a("p"),et=n(`Note that when creating models and layers with
`),x=a("a"),tt=n("subclassing"),ot=n(` 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){c=r(y,"P",{});var E=l(c);b=s(E,"TensorFlow models and layers in "),_=r(E,"CODE",{});var yt=l(_);m=s(yt,"transformers"),yt.forEach(t),T=s(E," accept two formats as input:"),E.forEach(t),i=u(y),h=r(y,"UL",{});var fe=l(h);C=r(fe,"LI",{});var ce=l(C);Ne=s(ce,"having all inputs as keyword arguments (like PyTorch models), or"),ce.forEach(t),je=u(fe),I=r(fe,"LI",{});var ge=l(I);K=s(ge,"having all inputs as a list, tuple or dict in the first positional argument."),ge.forEach(t),fe.forEach(t),te=u(y),F=r(y,"P",{});var j=l(F);Ge=s(j,`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 `),S=r(j,"CODE",{});var we=l(S);Ve=s(we,"model.fit()"),we.forEach(t),Ce=s(j,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),A=r(j,"CODE",{});var vt=l(A);Le=s(vt,"model.fit()"),vt.forEach(t),oe=s(j,` supports! If, however, you want to use the second
format outside of Keras methods like `),ne=r(j,"CODE",{});var nt=l(ne);Re=s(nt,"fit()"),nt.forEach(t),ze=s(j," and "),L=r(j,"CODE",{});var wt=l(L);Se=s(wt,"predict()"),wt.forEach(t),xe=s(j,`, such as when creating your own layers or models with
the Keras `),R=r(j,"CODE",{});var rt=l(R);ye=s(rt,"Functional"),rt.forEach(t),Qe=s(j,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),j.forEach(t),me=u(y),z=r(y,"UL",{});var N=l(z);W=r(N,"LI",{});var pe=l(W);Je=s(pe,"a single Tensor with "),B=r(pe,"CODE",{});var lt=l(B);se=s(lt,"input_ids"),lt.forEach(t),Xe=s(pe," only and nothing else: "),Q=r(pe,"CODE",{});var Me=l(Q);He=s(Me,"model(input_ids)"),Me.forEach(t),pe.forEach(t),Ye=u(N),Z=r(N,"LI",{});var ee=l(Z);ae=s(ee,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),re=r(ee,"CODE",{});var U=l(re);ve=s(U,"model([input_ids, attention_mask])"),U.forEach(t),De=s(ee," or "),le=r(ee,"CODE",{});var ke=l(le);Ue=s(ke,"model([input_ids, attention_mask, token_type_ids])"),ke.forEach(t),ee.forEach(t),J=u(N),X=r(N,"LI",{});var st=l(X);ie=s(st,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),de=r(st,"CODE",{});var $e=l(de);Ke=s($e,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),$e.forEach(t),st.forEach(t),N.forEach(t),H=u(y),q=r(y,"P",{});var Pe=l(q);et=s(Pe,`Note that when creating models and layers with
`),x=r(Pe,"A",{href:!0,rel:!0});var Mt=l(x);tt=s(Mt,"subclassing"),Mt.forEach(t),ot=s(Pe,` 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!`),Pe.forEach(t),this.h()},h(){d(x,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),d(x,"rel","nofollow")},m(y,E){f(y,c,E),e(c,b),e(c,_),e(_,m),e(c,T),f(y,i,E),f(y,h,E),e(h,C),e(C,Ne),e(h,je),e(h,I),e(I,K),f(y,te,E),f(y,F,E),e(F,Ge),e(F,S),e(S,Ve),e(F,Ce),e(F,A),e(A,Le),e(F,oe),e(F,ne),e(ne,Re),e(F,ze),e(F,L),e(L,Se),e(F,xe),e(F,R),e(R,ye),e(F,Qe),f(y,me,E),f(y,z,E),e(z,W),e(W,Je),e(W,B),e(B,se),e(W,Xe),e(W,Q),e(Q,He),e(z,Ye),e(z,Z),e(Z,ae),e(Z,re),e(re,ve),e(Z,De),e(Z,le),e(le,Ue),e(z,J),e(z,X),e(X,ie),e(X,de),e(de,Ke),f(y,H,E),f(y,q,E),e(q,et),e(q,x),e(x,tt),e(q,ot)},d(y){y&&t(c),y&&t(i),y&&t(h),y&&t(te),y&&t(F),y&&t(me),y&&t(z),y&&t(H),y&&t(q)}}}function zu(O){let c,b,_,m,T;return m=new bt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURk9QVEZvckNhdXNhbExNJTBBaW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRm9wdC0zNTBtJTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZPUFRGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZvcHQtMzUwbSUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0cyklMEFsb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0cw==",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(){c=a("p"),b=n("Example:"),_=p(),v(m.$$.fragment)},l(i){c=r(i,"P",{});var h=l(c);b=s(h,"Example:"),h.forEach(t),_=u(i),w(m.$$.fragment,i)},m(i,h){f(i,c,h),e(c,b),f(i,_,h),M(m,i,h),T=!0},p:Tt,i(i){T||(k(m.$$.fragment,i),T=!0)},o(i){$(m.$$.fragment,i),T=!1},d(i){i&&t(c),i&&t(_),P(m,i)}}}function xu(O){let c,b,_,m,T;return{c(){c=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),m=n("Module"),T=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){c=r(i,"P",{});var h=l(c);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r(h,"CODE",{});var C=l(_);m=s(C,"Module"),C.forEach(t),T=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(i,h){f(i,c,h),e(c,b),e(c,_),e(_,m),e(c,T)},d(i){i&&t(c)}}}function Ju(O){let c,b,_,m,T;return m=new bt({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyME9QVEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJBcnRodXJaJTJGb3B0LTM1MG0tZHVtbXktc2MlMjIpJTBBbW9kZWwlMjAlM0QlMjBPUFRGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJBcnRodXJaJTJGb3B0LTM1MG0tZHVtbXktc2MlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBcHJlZGljdGVkX2NsYXNzX2lkJTIwJTNEJTIwbG9naXRzLmFyZ21heCgpLml0ZW0oKSUwQW1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnByZWRpY3RlZF9jbGFzc19pZCU1RCUwQSUwQSUyMyUyMFRvJTIwdHJhaW4lMjBhJTIwbW9kZWwlMjBvbiUyMCU2MG51bV9sYWJlbHMlNjAlMjBjbGFzc2VzJTJDJTIweW91JTIwY2FuJTIwcGFzcyUyMCU2MG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTYwJTIwdG8lMjAlNjAuZnJvbV9wcmV0cmFpbmVkKC4uLiklNjAlMEFudW1fbGFiZWxzJTIwJTNEJTIwbGVuKG1vZGVsLmNvbmZpZy5pZDJsYWJlbCklMEFtb2RlbCUyMCUzRCUyME9QVEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMkFydGh1clolMkZvcHQtMzUwbS1kdW1teS1zYyUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzKSUwQSUwQWxhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxJTVEKSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcyUwQXJvdW5kKGxvc3MuaXRlbSgpJTJDJTIwMik=",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(){c=a("p"),b=n("Example of single-label classification:"),_=p(),v(m.$$.fragment)},l(i){c=r(i,"P",{});var h=l(c);b=s(h,"Example of single-label classification:"),h.forEach(t),_=u(i),w(m.$$.fragment,i)},m(i,h){f(i,c,h),e(c,b),f(i,_,h),M(m,i,h),T=!0},p:Tt,i(i){T||(k(m.$$.fragment,i),T=!0)},o(i){$(m.$$.fragment,i),T=!1},d(i){i&&t(c),i&&t(_),P(m,i)}}}function Uu(O){let c,b,_,m,T;return m=new bt({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyME9QVEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJBcnRodXJaJTJGb3B0LTM1MG0tZHVtbXktc2MlMjIpJTBBbW9kZWwlMjAlM0QlMjBPUFRGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJBcnRodXJaJTJGb3B0LTM1MG0tZHVtbXktc2MlMjIlMkMlMjBwcm9ibGVtX3R5cGUlM0QlMjJtdWx0aV9sYWJlbF9jbGFzc2lmaWNhdGlvbiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEFwcmVkaWN0ZWRfY2xhc3NfaWRzJTIwJTNEJTIwdG9yY2guYXJhbmdlKDAlMkMlMjBsb2dpdHMuc2hhcGUlNUItMSU1RCklNUJ0b3JjaC5zaWdtb2lkKGxvZ2l0cykuc3F1ZWV6ZShkaW0lM0QwKSUyMCUzRSUyMDAuNSU1RCUwQSUwQSUyMyUyMFRvJTIwdHJhaW4lMjBhJTIwbW9kZWwlMjBvbiUyMCU2MG51bV9sYWJlbHMlNjAlMjBjbGFzc2VzJTJDJTIweW91JTIwY2FuJTIwcGFzcyUyMCU2MG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTYwJTIwdG8lMjAlNjAuZnJvbV9wcmV0cmFpbmVkKC4uLiklNjAlMEFudW1fbGFiZWxzJTIwJTNEJTIwbGVuKG1vZGVsLmNvbmZpZy5pZDJsYWJlbCklMEFtb2RlbCUyMCUzRCUyME9QVEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMkFydGh1clolMkZvcHQtMzUwbS1kdW1teS1zYyUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTJDJTIwcHJvYmxlbV90eXBlJTNEJTIybXVsdGlfbGFiZWxfY2xhc3NpZmljYXRpb24lMjIlMEEpJTBBJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2guc3VtKCUwQSUyMCUyMCUyMCUyMHRvcmNoLm5uLmZ1bmN0aW9uYWwub25lX2hvdChwcmVkaWN0ZWRfY2xhc3NfaWRzJTVCTm9uZSUyQyUyMCUzQSU1RC5jbG9uZSgpJTJDJTIwbnVtX2NsYXNzZXMlM0RudW1fbGFiZWxzKSUyQyUyMGRpbSUzRDElMEEpLnRvKHRvcmNoLmZsb2F0KSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",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(){c=a("p"),b=n("Example of multi-label classification:"),_=p(),v(m.$$.fragment)},l(i){c=r(i,"P",{});var h=l(c);b=s(h,"Example of multi-label classification:"),h.forEach(t),_=u(i),w(m.$$.fragment,i)},m(i,h){f(i,c,h),e(c,b),f(i,_,h),M(m,i,h),T=!0},p:Tt,i(i){T||(k(m.$$.fragment,i),T=!0)},o(i){$(m.$$.fragment,i),T=!1},d(i){i&&t(c),i&&t(_),P(m,i)}}}function Iu(O){let c,b,_,m,T;return{c(){c=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),m=n("Module"),T=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(i){c=r(i,"P",{});var h=l(c);b=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r(h,"CODE",{});var C=l(_);m=s(C,"Module"),C.forEach(t),T=s(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(t)},m(i,h){f(i,c,h),e(c,b),e(c,_),e(_,m),e(c,T)},d(i){i&&t(c)}}}function Wu(O){let c,b,_,m,T;return m=new bt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBPUFRGb3JRdWVzdGlvbkFuc3dlcmluZyUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdG9yY2gubWFudWFsX3NlZWQoNCklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRm9wdC0zNTBtJTIyKSUwQSUwQSUyMyUyMG5vdGUlM0ElMjB3ZSUyMGFyZSUyMGxvYWRpbmclMjBhJTIwT1BURm9yUXVlc3Rpb25BbnN3ZXJpbmclMjBmcm9tJTIwdGhlJTIwaHViJTIwaGVyZSUyQyUwQSUyMyUyMHNvJTIwdGhlJTIwaGVhZCUyMHdpbGwlMjBiZSUyMHJhbmRvbWx5JTIwaW5pdGlhbGl6ZWQlMkMlMjBoZW5jZSUyMHRoZSUyMHByZWRpY3Rpb25zJTIwd2lsbCUyMGJlJTIwcmFuZG9tJTBBbW9kZWwlMjAlM0QlMjBPUFRGb3JRdWVzdGlvbkFuc3dlcmluZy5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZvcHQtMzUwbSUyMiklMEElMEFxdWVzdGlvbiUyQyUyMHRleHQlMjAlM0QlMjAlMjJXaG8lMjB3YXMlMjBKaW0lMjBIZW5zb24lM0YlMjIlMkMlMjAlMjJKaW0lMjBIZW5zb24lMjB3YXMlMjBhJTIwbmljZSUyMHB1cHBldCUyMiUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihxdWVzdGlvbiUyQyUyMHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBYW5zd2VyX3N0YXJ0X2luZGV4JTIwJTNEJTIwb3V0cHV0cy5zdGFydF9sb2dpdHMuYXJnbWF4KCklMEFhbnN3ZXJfZW5kX2luZGV4JTIwJTNEJTIwb3V0cHV0cy5lbmRfbG9naXRzLmFyZ21heCgpJTBBJTBBYW5zd2VyX29mZnNldCUyMCUzRCUyMGxlbih0b2tlbml6ZXIocXVlc3Rpb24pJTVCMCU1RCklMEElMEFwcmVkaWN0X2Fuc3dlcl90b2tlbnMlMjAlM0QlMjBpbnB1dHMuaW5wdXRfaWRzJTVCJTBBJTIwJTIwJTIwJTIwMCUyQyUyMGFuc3dlcl9vZmZzZXQlMjAlMkIlMjBhbnN3ZXJfc3RhcnRfaW5kZXglMjAlM0ElMjBhbnN3ZXJfb2Zmc2V0JTIwJTJCJTIwYW5zd2VyX2VuZF9pbmRleCUyMCUyQiUyMDElMEElNUQlMEFwcmVkaWN0ZWQlMjAlM0QlMjB0b2tlbml6ZXIuZGVjb2RlKHByZWRpY3RfYW5zd2VyX3Rva2VucyklMEFwcmVkaWN0ZWQ=",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>answer_offset = <span class="hljs-built_in">len</span>(tokenizer(question)[<span class="hljs-number">0</span>])

<span class="hljs-meta">&gt;&gt;&gt; </span>predict_answer_tokens = inputs.input_ids[
<span class="hljs-meta">... </span>    <span class="hljs-number">0</span>, answer_offset + answer_start_index : answer_offset + answer_end_index + <span class="hljs-number">1</span>
<span class="hljs-meta">... </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; a nice puppet&#x27;</span>`}}),{c(){c=a("p"),b=n("Example:"),_=p(),v(m.$$.fragment)},l(i){c=r(i,"P",{});var h=l(c);b=s(h,"Example:"),h.forEach(t),_=u(i),w(m.$$.fragment,i)},m(i,h){f(i,c,h),e(c,b),f(i,_,h),M(m,i,h),T=!0},p:Tt,i(i){T||(k(m.$$.fragment,i),T=!0)},o(i){$(m.$$.fragment,i),T=!1},d(i){i&&t(c),i&&t(_),P(m,i)}}}function Zu(O){let c,b,_,m,T;return m=new bt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGbGF4T1BUTW9kZWwlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRm9wdC0zNTBtJTIyKSUwQW1vZGVsJTIwJTNEJTIwRmxheE9QVE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRm9wdC0zNTBtJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJqYXglMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGU=",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(){c=a("p"),b=n("Example:"),_=p(),v(m.$$.fragment)},l(i){c=r(i,"P",{});var h=l(c);b=s(h,"Example:"),h.forEach(t),_=u(i),w(m.$$.fragment,i)},m(i,h){f(i,c,h),e(c,b),f(i,_,h),M(m,i,h),T=!0},p:Tt,i(i){T||(k(m.$$.fragment,i),T=!0)},o(i){$(m.$$.fragment,i),T=!1},d(i){i&&t(c),i&&t(_),P(m,i)}}}function qu(O){let c,b,_,m,T;return m=new bt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGbGF4T1BURm9yQ2F1c2FsTE0lMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRm9wdC0zNTBtJTIyKSUwQW1vZGVsJTIwJTNEJTIwRmxheE9QVEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRm9wdC0zNTBtJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJucCUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBJTIzJTIwcmV0cmlldmUlMjBsb2d0cyUyMGZvciUyMG5leHQlMjB0b2tlbiUwQW5leHRfdG9rZW5fbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHMlNUIlM0ElMkMlMjAtMSU1RA==",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(){c=a("p"),b=n("Example:"),_=p(),v(m.$$.fragment)},l(i){c=r(i,"P",{});var h=l(c);b=s(h,"Example:"),h.forEach(t),_=u(i),w(m.$$.fragment,i)},m(i,h){f(i,c,h),e(c,b),f(i,_,h),M(m,i,h),T=!0},p:Tt,i(i){T||(k(m.$$.fragment,i),T=!0)},o(i){$(m.$$.fragment,i),T=!1},d(i){i&&t(c),i&&t(_),P(m,i)}}}function Au(O){let c,b,_,m,T,i,h,C,Ne,je,I,K,te,F,Ge,S,Ve,Ce,A,Le,oe,ne,Re,ze,L,Se,xe,R,ye,Qe,me,z,W,Je,B,se,Xe,Q,He,Ye,Z,ae,re,ve,De,le,Ue,J,X,ie,de,Ke,H,q,et,x,tt,ot,y,E,yt,fe,ce,ge,j,we,vt,nt,wt,rt,N,pe,lt,Me,ee,U,ke,st,$e,Pe,Mt,Or,Fo,Er,Oo,jr,Cr,zr,Xn,Eo,xr,Jr,Ur,it,Hn,Ir,Wr,jo,Zr,qr,Co,Ar,Br,Nr,dt,Yn,Gr,Vr,zo,Lr,Rr,xo,Sr,Qr,Xr,Nt,Dn,Hr,Yr,Jo,Dr,Kr,Ma,Uo,ka,Gt,Os,Kn,el,tl,ct,es,ol,nl,Io,sl,al,Wo,rl,ll,$a,Zo,Pa,Vt,pt,ts,il,dl,qo,cl,pl,Ao,ul,hl,ml,os,Bo,fl,gl,Fa,ns,_l,Oa,ss,No,Tl,Go,bl,yl,Ea,kt,Lt,Es,Vo,vl,js,wl,ja,Fe,Lo,Ml,$t,kl,as,$l,Pl,Ro,Fl,Ol,El,Pt,jl,rs,Cl,zl,ls,xl,Jl,Ul,Rt,Ca,Ft,St,Cs,So,Il,zs,Wl,za,Oe,Qo,Zl,Xo,ql,is,Al,Bl,Nl,Ho,Gl,Yo,Vl,Ll,Rl,Ie,Do,Sl,Ot,Ql,ds,Xl,Hl,xs,Yl,Dl,Kl,Qt,ei,Xt,xa,Et,Ht,Js,Ko,ti,Us,oi,Ja,jt,en,ni,Yt,tn,si,Dt,Ua,Ct,Kt,Is,on,ai,Ws,ri,Ia,ue,nn,li,sn,ii,cs,di,ci,pi,an,ui,rn,hi,mi,fi,eo,gi,We,ln,_i,zt,Ti,ps,bi,yi,Zs,vi,wi,Mi,to,ki,oo,Wa,xt,no,qs,dn,$i,As,Pi,Za,Y,cn,Fi,Bs,Oi,Ei,pn,ji,us,Ci,zi,xi,un,Ji,hn,Ui,Ii,Wi,so,Zi,ao,mn,qi,ro,qa,Jt,lo,Ns,fn,Ai,Gs,Bi,Aa,G,gn,Ni,Vs,Gi,Vi,hs,ms,Li,Ri,Si,Ee,Qi,Ls,Xi,Hi,Rs,Yi,Di,Ss,Ki,ed,Qs,td,od,nd,_n,sd,fs,ad,rd,ld,Tn,id,bn,dd,cd,pd,_e,yn,ud,Ut,hd,gs,md,fd,Xs,gd,_d,Td,io,bd,co,yd,po,Ba,It,uo,Hs,vn,vd,Ys,wd,Na,he,wn,Md,Wt,kd,Ds,$d,Pd,Ks,Fd,Od,Ed,Mn,jd,_s,Cd,zd,xd,kn,Jd,$n,Ud,Id,Wd,Ze,Pn,Zd,Zt,qd,Ts,Ad,Bd,ea,Nd,Gd,Vd,ho,Ld,mo,Ga,qt,fo,ta,Fn,Rd,oa,Sd,Va,At,On,Qd,go,En,Xd,_o,La,Bt,To,na,jn,Hd,sa,Yd,Ra,V,Cn,Dd,aa,Kd,ec,zn,tc,bs,oc,nc,sc,xn,ac,Jn,rc,lc,ic,ra,dc,cc,at,la,Un,pc,uc,ia,In,hc,mc,da,Wn,fc,gc,ca,Zn,_c,Tc,bo,qn,bc,yo,Sa;return i=new Be({}),F=new Be({}),we=new Be({}),Me=new Mc({props:{pipeline:"text-generation"}}),Uo=new Mc({props:{pipeline:"text-classification"}}),Zo=new Mc({props:{pipeline:"question-answering"}}),Vo=new Be({}),Lo=new D({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.`,name:"attention_dropout"},{anchor:"transformers.OPTConfig.layerdrop",description:`<strong>layerdrop</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
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:"layerdrop"},{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"}}),Rt=new _t({props:{anchor:"transformers.OPTConfig.example",$$slots:{default:[ku]},$$scope:{ctx:O}}}),So=new Be({}),Qo=new D({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#L752"}}),Do=new D({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#L768",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>
`}}),Qt=new Fs({props:{$$slots:{default:[$u]},$$scope:{ctx:O}}}),Xt=new _t({props:{anchor:"transformers.OPTModel.forward.example",$$slots:{default:[Pu]},$$scope:{ctx:O}}}),Ko=new Be({}),en=new D({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#L818"}}),tn=new D({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#L849",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>
`}}),Dt=new _t({props:{anchor:"transformers.OPTForCausalLM.forward.example",$$slots:{default:[Fu]},$$scope:{ctx:O}}}),on=new Be({}),nn=new D({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#L763"}}),eo=new Fs({props:{$$slots:{default:[Ou]},$$scope:{ctx:O}}}),ln=new D({props:{name:"call",anchor:"transformers.TFOPTModel.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"past_key_values",val:": Optional[Tuple[Tuple[Union[np.ndarray, tf.Tensor]]]] = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"use_cache",val:": Optional[bool] = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": 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#L777",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>
`}}),to=new Fs({props:{$$slots:{default:[Eu]},$$scope:{ctx:O}}}),oo=new _t({props:{anchor:"transformers.TFOPTModel.call.example",$$slots:{default:[ju]},$$scope:{ctx:O}}}),dn=new Be({}),cn=new D({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#L849"}}),so=new Fs({props:{$$slots:{default:[Cu]},$$scope:{ctx:O}}}),mn=new D({props:{name:"call",anchor:"transformers.TFOPTForCausalLM.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"past_key_values",val:": Optional[Tuple[Tuple[Union[np.ndarray, tf.Tensor]]]] = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"position_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"labels",val:": np.ndarray | tf.Tensor | None = None"},{name:"use_cache",val:": Optional[bool] = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": 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#L874",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>
`}}),ro=new _t({props:{anchor:"transformers.TFOPTForCausalLM.call.example",$$slots:{default:[zu]},$$scope:{ctx:O}}}),fn=new Be({}),gn=new D({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#L1025"}}),yn=new D({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#L1035",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>
`}}),io=new Fs({props:{$$slots:{default:[xu]},$$scope:{ctx:O}}}),co=new _t({props:{anchor:"transformers.OPTForSequenceClassification.forward.example",$$slots:{default:[Ju]},$$scope:{ctx:O}}}),po=new _t({props:{anchor:"transformers.OPTForSequenceClassification.forward.example-2",$$slots:{default:[Uu]},$$scope:{ctx:O}}}),vn=new Be({}),wn=new D({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#L1147"}}),Pn=new D({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#L1156",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>
`}}),ho=new Fs({props:{$$slots:{default:[Iu]},$$scope:{ctx:O}}}),mo=new _t({props:{anchor:"transformers.OPTForQuestionAnswering.forward.example",$$slots:{default:[Wu]},$$scope:{ctx:O}}}),Fn=new Be({}),On=new D({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#L690"}}),En=new D({props:{name:"__call__",anchor:"transformers.FlaxOPTModel.__call__",parameters:[{name:"input_ids",val:": Array"},{name:"attention_mask",val:": typing.Optional[jax.Array] = None"},{name:"position_ids",val:": typing.Optional[jax.Array] = 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#L583",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>
`}}),_o=new _t({props:{anchor:"transformers.FlaxOPTModel.__call__.example",$$slots:{default:[Zu]},$$scope:{ctx:O}}}),jn=new Be({}),Cn=new D({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#L763"}}),qn=new D({props:{name:"__call__",anchor:"transformers.FlaxOPTForCausalLM.__call__",parameters:[{name:"input_ids",val:": Array"},{name:"attention_mask",val:": typing.Optional[jax.Array] = None"},{name:"position_ids",val:": typing.Optional[jax.Array] = 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#L583",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>
`}}),yo=new _t({props:{anchor:"transformers.FlaxOPTForCausalLM.__call__.example",$$slots:{default:[qu]},$$scope:{ctx:O}}}),{c(){c=a("meta"),b=p(),_=a("h1"),m=a("a"),T=a("span"),v(i.$$.fragment),h=p(),C=a("span"),Ne=n("OPT"),je=p(),I=a("h2"),K=a("a"),te=a("span"),v(F.$$.fragment),Ge=p(),S=a("span"),Ve=n("Overview"),Ce=p(),A=a("p"),Le=n("The OPT model was proposed in "),oe=a("a"),ne=n("Open Pre-trained Transformer Language Models"),Re=n(` by Meta AI.
OPT is a series of open-sourced large causal language models which perform similar in performance to GPT3.`),ze=p(),L=a("p"),Se=n("The abstract from the paper is the following:"),xe=p(),R=a("p"),ye=a("em"),Qe=n("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."),me=p(),z=a("p"),W=n("Tips:"),Je=p(),B=a("ul"),se=a("li"),Xe=n("OPT has the same architecture as "),Q=a("code"),He=n("BartDecoder"),Ye=n("."),Z=p(),ae=a("li"),re=n("Contrary to GPT2, OPT adds the EOS token "),ve=a("code"),De=n("</s>"),le=n(" to the beginning of every prompt."),Ue=p(),J=a("p"),X=n("This model was contributed by "),ie=a("a"),de=n("Arthur Zucker"),Ke=n(", "),H=a("a"),q=n("Younes Belkada"),et=n(", and "),x=a("a"),tt=n("Patrick Von Platen"),ot=n(`.
The original code can be found `),y=a("a"),E=n("here"),yt=n("."),fe=p(),ce=a("h2"),ge=a("a"),j=a("span"),v(we.$$.fragment),vt=p(),nt=a("span"),wt=n("Resources"),rt=p(),N=a("p"),pe=n(`A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with OPT. If you\u2019re
interested in submitting a resource to be included here, please feel free to open a Pull Request and we will review it.
The resource should ideally demonstrate something new instead of duplicating an existing resource.`),lt=p(),v(Me.$$.fragment),ee=p(),U=a("ul"),ke=a("li"),st=n("A notebook on "),$e=a("a"),Pe=n("fine-tuning OPT with PEFT, bitsandbytes, and Transformers"),Mt=n(". \u{1F30E}"),Or=p(),Fo=a("li"),Er=n("A blog post on "),Oo=a("a"),jr=n("decoding strategies with OPT"),Cr=n("."),zr=p(),Xn=a("li"),Eo=a("a"),xr=n("Causal language modeling"),Jr=n(" chapter of the \u{1F917} Hugging Face Course."),Ur=p(),it=a("li"),Hn=a("a"),Ir=n("OPTForCausalLM"),Wr=n(" is supported by this "),jo=a("a"),Zr=n("causal language modeling example script"),qr=n(" and "),Co=a("a"),Ar=n("notebook"),Br=n("."),Nr=p(),dt=a("li"),Yn=a("a"),Gr=n("TFOPTForCausalLM"),Vr=n(" is supported by this "),zo=a("a"),Lr=n("causal language modeling example script"),Rr=n(" and "),xo=a("a"),Sr=n("notebook"),Qr=n("."),Xr=p(),Nt=a("li"),Dn=a("a"),Hr=n("FlaxOPTForCausalLM"),Yr=n(" is supported by this "),Jo=a("a"),Dr=n("causal language modeling example script"),Kr=n("."),Ma=p(),v(Uo.$$.fragment),ka=p(),Gt=a("ul"),Os=a("li"),Kn=a("a"),el=n("Text classification task guide"),tl=p(),ct=a("li"),es=a("a"),ol=n("OPTForSequenceClassification"),nl=n(" is supported by this "),Io=a("a"),sl=n("example script"),al=n(" and "),Wo=a("a"),rl=n("notebook"),ll=n("."),$a=p(),v(Zo.$$.fragment),Pa=p(),Vt=a("ul"),pt=a("li"),ts=a("a"),il=n("OPTForQuestionAnswering"),dl=n(" is supported by this "),qo=a("a"),cl=n("question answering example script"),pl=n(" and "),Ao=a("a"),ul=n("notebook"),hl=n("."),ml=p(),os=a("li"),Bo=a("a"),fl=n("Question answering"),gl=n(` chapter
of the \u{1F917} Hugging Face Course.`),Fa=p(),ns=a("p"),_l=n("\u26A1\uFE0F Inference"),Oa=p(),ss=a("ul"),No=a("li"),Tl=n("A blog post on "),Go=a("a"),bl=n("How \u{1F917} Accelerate runs very large models thanks to PyTorch"),yl=n(" with OPT."),Ea=p(),kt=a("h2"),Lt=a("a"),Es=a("span"),v(Vo.$$.fragment),vl=p(),js=a("span"),wl=n("OPTConfig"),ja=p(),Fe=a("div"),v(Lo.$$.fragment),Ml=p(),$t=a("p"),kl=n("This is the configuration class to store the configuration of a "),as=a("a"),$l=n("OPTModel"),Pl=n(`. 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
`),Ro=a("a"),Fl=n("facebook/opt-350m"),Ol=n(" architecture."),El=p(),Pt=a("p"),jl=n("Configuration objects inherit from "),rs=a("a"),Cl=n("PretrainedConfig"),zl=n(` and can be used to control the model outputs. Read the
documentation from `),ls=a("a"),xl=n("PretrainedConfig"),Jl=n(" for more information."),Ul=p(),v(Rt.$$.fragment),Ca=p(),Ft=a("h2"),St=a("a"),Cs=a("span"),v(So.$$.fragment),Il=p(),zs=a("span"),Wl=n("OPTModel"),za=p(),Oe=a("div"),v(Qo.$$.fragment),Zl=p(),Xo=a("p"),ql=n(`The bare OPT Model outputting raw hidden-states without any specific head on top.
This model inherits from `),is=a("a"),Al=n("PreTrainedModel"),Bl=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Nl=p(),Ho=a("p"),Gl=n("This model is also a PyTorch "),Yo=a("a"),Vl=n("torch.nn.Module"),Ll=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Rl=p(),Ie=a("div"),v(Do.$$.fragment),Sl=p(),Ot=a("p"),Ql=n("The "),ds=a("a"),Xl=n("OPTModel"),Hl=n(" forward method, overrides the "),xs=a("code"),Yl=n("__call__"),Dl=n(" special method."),Kl=p(),v(Qt.$$.fragment),ei=p(),v(Xt.$$.fragment),xa=p(),Et=a("h2"),Ht=a("a"),Js=a("span"),v(Ko.$$.fragment),ti=p(),Us=a("span"),oi=n("OPTForCausalLM"),Ja=p(),jt=a("div"),v(en.$$.fragment),ni=p(),Yt=a("div"),v(tn.$$.fragment),si=p(),v(Dt.$$.fragment),Ua=p(),Ct=a("h2"),Kt=a("a"),Is=a("span"),v(on.$$.fragment),ai=p(),Ws=a("span"),ri=n("TFOPTModel"),Ia=p(),ue=a("div"),v(nn.$$.fragment),li=p(),sn=a("p"),ii=n(`The bare TF OPT Model outputting raw hidden-states without any specific head on top.
This model inherits from `),cs=a("a"),di=n("TFPreTrainedModel"),ci=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),pi=p(),an=a("p"),ui=n("This model is also a "),rn=a("a"),hi=n("tf.keras.Model"),mi=n(` 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.`),fi=p(),v(eo.$$.fragment),gi=p(),We=a("div"),v(ln.$$.fragment),_i=p(),zt=a("p"),Ti=n("The "),ps=a("a"),bi=n("TFOPTModel"),yi=n(" forward method, overrides the "),Zs=a("code"),vi=n("__call__"),wi=n(" special method."),Mi=p(),v(to.$$.fragment),ki=p(),v(oo.$$.fragment),Wa=p(),xt=a("h2"),no=a("a"),qs=a("span"),v(dn.$$.fragment),$i=p(),As=a("span"),Pi=n("TFOPTForCausalLM"),Za=p(),Y=a("div"),v(cn.$$.fragment),Fi=p(),Bs=a("p"),Oi=n("The OPT Model transformer with a language modeling head on top."),Ei=p(),pn=a("p"),ji=n("This model inherits from "),us=a("a"),Ci=n("TFPreTrainedModel"),zi=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),xi=p(),un=a("p"),Ji=n("This model is also a "),hn=a("a"),Ui=n("tf.keras.Model"),Ii=n(` 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.`),Wi=p(),v(so.$$.fragment),Zi=p(),ao=a("div"),v(mn.$$.fragment),qi=p(),v(ro.$$.fragment),qa=p(),Jt=a("h2"),lo=a("a"),Ns=a("span"),v(fn.$$.fragment),Ai=p(),Gs=a("span"),Bi=n("OPTForSequenceClassification"),Aa=p(),G=a("div"),v(gn.$$.fragment),Ni=p(),Vs=a("p"),Gi=n("The OPT Model transformer with a sequence classification head on top (linear layer)."),Vi=p(),hs=a("p"),ms=a("a"),Li=n("OPTForSequenceClassification"),Ri=n(` uses the last token in order to do the classification, as other causal models
(e.g. GPT-2) do.`),Si=p(),Ee=a("p"),Qi=n(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Ls=a("code"),Xi=n("pad_token_id"),Hi=n(` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Rs=a("code"),Yi=n("pad_token_id"),Di=n(` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Ss=a("code"),Ki=n("inputs_embeds"),ed=n(" are passed instead of "),Qs=a("code"),td=n("input_ids"),od=n(`, it does the same (take the last value in
each row of the batch).`),nd=p(),_n=a("p"),sd=n("This model inherits from "),fs=a("a"),ad=n("PreTrainedModel"),rd=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),ld=p(),Tn=a("p"),id=n("This model is also a PyTorch "),bn=a("a"),dd=n("torch.nn.Module"),cd=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),pd=p(),_e=a("div"),v(yn.$$.fragment),ud=p(),Ut=a("p"),hd=n("The "),gs=a("a"),md=n("OPTForSequenceClassification"),fd=n(" forward method, overrides the "),Xs=a("code"),gd=n("__call__"),_d=n(" special method."),Td=p(),v(io.$$.fragment),bd=p(),v(co.$$.fragment),yd=p(),v(po.$$.fragment),Ba=p(),It=a("h2"),uo=a("a"),Hs=a("span"),v(vn.$$.fragment),vd=p(),Ys=a("span"),wd=n("OPTForQuestionAnswering"),Na=p(),he=a("div"),v(wn.$$.fragment),Md=p(),Wt=a("p"),kd=n(`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 `),Ds=a("code"),$d=n("span start logits"),Pd=n(" and "),Ks=a("code"),Fd=n("span end logits"),Od=n(")."),Ed=p(),Mn=a("p"),jd=n("This model inherits from "),_s=a("a"),Cd=n("PreTrainedModel"),zd=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),xd=p(),kn=a("p"),Jd=n("This model is also a PyTorch "),$n=a("a"),Ud=n("torch.nn.Module"),Id=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Wd=p(),Ze=a("div"),v(Pn.$$.fragment),Zd=p(),Zt=a("p"),qd=n("The "),Ts=a("a"),Ad=n("OPTForQuestionAnswering"),Bd=n(" forward method, overrides the "),ea=a("code"),Nd=n("__call__"),Gd=n(" special method."),Vd=p(),v(ho.$$.fragment),Ld=p(),v(mo.$$.fragment),Ga=p(),qt=a("h2"),fo=a("a"),ta=a("span"),v(Fn.$$.fragment),Rd=p(),oa=a("span"),Sd=n("FlaxOPTModel"),Va=p(),At=a("div"),v(On.$$.fragment),Qd=p(),go=a("div"),v(En.$$.fragment),Xd=p(),v(_o.$$.fragment),La=p(),Bt=a("h2"),To=a("a"),na=a("span"),v(jn.$$.fragment),Hd=p(),sa=a("span"),Yd=n("FlaxOPTForCausalLM"),Ra=p(),V=a("div"),v(Cn.$$.fragment),Dd=p(),aa=a("p"),Kd=n(`OPT Model with a language modeling head on top (linear layer with weights tied to the input embeddings) e.g for
autoregressive tasks.`),ec=p(),zn=a("p"),tc=n("This model inherits from "),bs=a("a"),oc=n("FlaxPreTrainedModel"),nc=n(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),sc=p(),xn=a("p"),ac=n(`This model is also a Flax Linen
`),Jn=a("a"),rc=n("flax.nn.Module"),lc=n(` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),ic=p(),ra=a("p"),dc=n("Finally, this model supports inherent JAX features such as:"),cc=p(),at=a("ul"),la=a("li"),Un=a("a"),pc=n("Just-In-Time (JIT) compilation"),uc=p(),ia=a("li"),In=a("a"),hc=n("Automatic Differentiation"),mc=p(),da=a("li"),Wn=a("a"),fc=n("Vectorization"),gc=p(),ca=a("li"),Zn=a("a"),_c=n("Parallelization"),Tc=p(),bo=a("div"),v(qn.$$.fragment),bc=p(),v(yo.$$.fragment),this.h()},l(o){const g=wu('[data-svelte="svelte-1phssyn"]',document.head);c=r(g,"META",{name:!0,content:!0}),g.forEach(t),b=u(o),_=r(o,"H1",{class:!0});var An=l(_);m=r(An,"A",{id:!0,class:!0,href:!0});var pa=l(m);T=r(pa,"SPAN",{});var ua=l(T);w(i.$$.fragment,ua),ua.forEach(t),pa.forEach(t),h=u(An),C=r(An,"SPAN",{});var ha=l(C);Ne=s(ha,"OPT"),ha.forEach(t),An.forEach(t),je=u(o),I=r(o,"H2",{class:!0});var Bn=l(I);K=r(Bn,"A",{id:!0,class:!0,href:!0});var ma=l(K);te=r(ma,"SPAN",{});var fa=l(te);w(F.$$.fragment,fa),fa.forEach(t),ma.forEach(t),Ge=u(Bn),S=r(Bn,"SPAN",{});var ga=l(S);Ve=s(ga,"Overview"),ga.forEach(t),Bn.forEach(t),Ce=u(o),A=r(o,"P",{});var Nn=l(A);Le=s(Nn,"The OPT model was proposed in "),oe=r(Nn,"A",{href:!0,rel:!0});var _a=l(oe);ne=s(_a,"Open Pre-trained Transformer Language Models"),_a.forEach(t),Re=s(Nn,` by Meta AI.
OPT is a series of open-sourced large causal language models which perform similar in performance to GPT3.`),Nn.forEach(t),ze=u(o),L=r(o,"P",{});var Ta=l(L);Se=s(Ta,"The abstract from the paper is the following:"),Ta.forEach(t),xe=u(o),R=r(o,"P",{});var ba=l(R);ye=r(ba,"EM",{});var ya=l(ye);Qe=s(ya,"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."),ya.forEach(t),ba.forEach(t),me=u(o),z=r(o,"P",{});var va=l(z);W=s(va,"Tips:"),va.forEach(t),Je=u(o),B=r(o,"UL",{});var Gn=l(B);se=r(Gn,"LI",{});var Vn=l(se);Xe=s(Vn,"OPT has the same architecture as "),Q=r(Vn,"CODE",{});var kc=l(Q);He=s(kc,"BartDecoder"),kc.forEach(t),Ye=s(Vn,"."),Vn.forEach(t),Z=u(Gn),ae=r(Gn,"LI",{});var Qa=l(ae);re=s(Qa,"Contrary to GPT2, OPT adds the EOS token "),ve=r(Qa,"CODE",{});var $c=l(ve);De=s($c,"</s>"),$c.forEach(t),le=s(Qa," to the beginning of every prompt."),Qa.forEach(t),Gn.forEach(t),Ue=u(o),J=r(o,"P",{});var ut=l(J);X=s(ut,"This model was contributed by "),ie=r(ut,"A",{href:!0,rel:!0});var Pc=l(ie);de=s(Pc,"Arthur Zucker"),Pc.forEach(t),Ke=s(ut,", "),H=r(ut,"A",{href:!0,rel:!0});var Fc=l(H);q=s(Fc,"Younes Belkada"),Fc.forEach(t),et=s(ut,", and "),x=r(ut,"A",{href:!0,rel:!0});var Oc=l(x);tt=s(Oc,"Patrick Von Platen"),Oc.forEach(t),ot=s(ut,`.
The original code can be found `),y=r(ut,"A",{href:!0,rel:!0});var Ec=l(y);E=s(Ec,"here"),Ec.forEach(t),yt=s(ut,"."),ut.forEach(t),fe=u(o),ce=r(o,"H2",{class:!0});var Xa=l(ce);ge=r(Xa,"A",{id:!0,class:!0,href:!0});var jc=l(ge);j=r(jc,"SPAN",{});var Cc=l(j);w(we.$$.fragment,Cc),Cc.forEach(t),jc.forEach(t),vt=u(Xa),nt=r(Xa,"SPAN",{});var zc=l(nt);wt=s(zc,"Resources"),zc.forEach(t),Xa.forEach(t),rt=u(o),N=r(o,"P",{});var xc=l(N);pe=s(xc,`A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with OPT. If you\u2019re
interested in submitting a resource to be included here, please feel free to open a Pull Request and we will review it.
The resource should ideally demonstrate something new instead of duplicating an existing resource.`),xc.forEach(t),lt=u(o),w(Me.$$.fragment,o),ee=u(o),U=r(o,"UL",{});var qe=l(U);ke=r(qe,"LI",{});var Ha=l(ke);st=s(Ha,"A notebook on "),$e=r(Ha,"A",{href:!0,rel:!0});var Jc=l($e);Pe=s(Jc,"fine-tuning OPT with PEFT, bitsandbytes, and Transformers"),Jc.forEach(t),Mt=s(Ha,". \u{1F30E}"),Ha.forEach(t),Or=u(qe),Fo=r(qe,"LI",{});var Ya=l(Fo);Er=s(Ya,"A blog post on "),Oo=r(Ya,"A",{href:!0,rel:!0});var Uc=l(Oo);jr=s(Uc,"decoding strategies with OPT"),Uc.forEach(t),Cr=s(Ya,"."),Ya.forEach(t),zr=u(qe),Xn=r(qe,"LI",{});var yc=l(Xn);Eo=r(yc,"A",{href:!0,rel:!0});var Ic=l(Eo);xr=s(Ic,"Causal language modeling"),Ic.forEach(t),Jr=s(yc," chapter of the \u{1F917} Hugging Face Course."),yc.forEach(t),Ur=u(qe),it=r(qe,"LI",{});var Ln=l(it);Hn=r(Ln,"A",{href:!0});var Wc=l(Hn);Ir=s(Wc,"OPTForCausalLM"),Wc.forEach(t),Wr=s(Ln," is supported by this "),jo=r(Ln,"A",{href:!0,rel:!0});var Zc=l(jo);Zr=s(Zc,"causal language modeling example script"),Zc.forEach(t),qr=s(Ln," and "),Co=r(Ln,"A",{href:!0,rel:!0});var qc=l(Co);Ar=s(qc,"notebook"),qc.forEach(t),Br=s(Ln,"."),Ln.forEach(t),Nr=u(qe),dt=r(qe,"LI",{});var Rn=l(dt);Yn=r(Rn,"A",{href:!0});var Ac=l(Yn);Gr=s(Ac,"TFOPTForCausalLM"),Ac.forEach(t),Vr=s(Rn," is supported by this "),zo=r(Rn,"A",{href:!0,rel:!0});var Bc=l(zo);Lr=s(Bc,"causal language modeling example script"),Bc.forEach(t),Rr=s(Rn," and "),xo=r(Rn,"A",{href:!0,rel:!0});var Nc=l(xo);Sr=s(Nc,"notebook"),Nc.forEach(t),Qr=s(Rn,"."),Rn.forEach(t),Xr=u(qe),Nt=r(qe,"LI",{});var wa=l(Nt);Dn=r(wa,"A",{href:!0});var Gc=l(Dn);Hr=s(Gc,"FlaxOPTForCausalLM"),Gc.forEach(t),Yr=s(wa," is supported by this "),Jo=r(wa,"A",{href:!0,rel:!0});var Vc=l(Jo);Dr=s(Vc,"causal language modeling example script"),Vc.forEach(t),Kr=s(wa,"."),wa.forEach(t),qe.forEach(t),Ma=u(o),w(Uo.$$.fragment,o),ka=u(o),Gt=r(o,"UL",{});var Da=l(Gt);Os=r(Da,"LI",{});var Lc=l(Os);Kn=r(Lc,"A",{href:!0});var Rc=l(Kn);el=s(Rc,"Text classification task guide"),Rc.forEach(t),Lc.forEach(t),tl=u(Da),ct=r(Da,"LI",{});var Sn=l(ct);es=r(Sn,"A",{href:!0});var Sc=l(es);ol=s(Sc,"OPTForSequenceClassification"),Sc.forEach(t),nl=s(Sn," is supported by this "),Io=r(Sn,"A",{href:!0,rel:!0});var Qc=l(Io);sl=s(Qc,"example script"),Qc.forEach(t),al=s(Sn," and "),Wo=r(Sn,"A",{href:!0,rel:!0});var Xc=l(Wo);rl=s(Xc,"notebook"),Xc.forEach(t),ll=s(Sn,"."),Sn.forEach(t),Da.forEach(t),$a=u(o),w(Zo.$$.fragment,o),Pa=u(o),Vt=r(o,"UL",{});var Ka=l(Vt);pt=r(Ka,"LI",{});var Qn=l(pt);ts=r(Qn,"A",{href:!0});var Hc=l(ts);il=s(Hc,"OPTForQuestionAnswering"),Hc.forEach(t),dl=s(Qn," is supported by this "),qo=r(Qn,"A",{href:!0,rel:!0});var Yc=l(qo);cl=s(Yc,"question answering example script"),Yc.forEach(t),pl=s(Qn," and "),Ao=r(Qn,"A",{href:!0,rel:!0});var Dc=l(Ao);ul=s(Dc,"notebook"),Dc.forEach(t),hl=s(Qn,"."),Qn.forEach(t),ml=u(Ka),os=r(Ka,"LI",{});var vc=l(os);Bo=r(vc,"A",{href:!0,rel:!0});var Kc=l(Bo);fl=s(Kc,"Question answering"),Kc.forEach(t),gl=s(vc,` chapter
of the \u{1F917} Hugging Face Course.`),vc.forEach(t),Ka.forEach(t),Fa=u(o),ns=r(o,"P",{});var ep=l(ns);_l=s(ep,"\u26A1\uFE0F Inference"),ep.forEach(t),Oa=u(o),ss=r(o,"UL",{});var tp=l(ss);No=r(tp,"LI",{});var er=l(No);Tl=s(er,"A blog post on "),Go=r(er,"A",{href:!0,rel:!0});var op=l(Go);bl=s(op,"How \u{1F917} Accelerate runs very large models thanks to PyTorch"),op.forEach(t),yl=s(er," with OPT."),er.forEach(t),tp.forEach(t),Ea=u(o),kt=r(o,"H2",{class:!0});var tr=l(kt);Lt=r(tr,"A",{id:!0,class:!0,href:!0});var np=l(Lt);Es=r(np,"SPAN",{});var sp=l(Es);w(Vo.$$.fragment,sp),sp.forEach(t),np.forEach(t),vl=u(tr),js=r(tr,"SPAN",{});var ap=l(js);wl=s(ap,"OPTConfig"),ap.forEach(t),tr.forEach(t),ja=u(o),Fe=r(o,"DIV",{class:!0});var vo=l(Fe);w(Lo.$$.fragment,vo),Ml=u(vo),$t=r(vo,"P",{});var ys=l($t);kl=s(ys,"This is the configuration class to store the configuration of a "),as=r(ys,"A",{href:!0});var rp=l(as);$l=s(rp,"OPTModel"),rp.forEach(t),Pl=s(ys,`. 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
`),Ro=r(ys,"A",{href:!0,rel:!0});var lp=l(Ro);Fl=s(lp,"facebook/opt-350m"),lp.forEach(t),Ol=s(ys," architecture."),ys.forEach(t),El=u(vo),Pt=r(vo,"P",{});var vs=l(Pt);jl=s(vs,"Configuration objects inherit from "),rs=r(vs,"A",{href:!0});var ip=l(rs);Cl=s(ip,"PretrainedConfig"),ip.forEach(t),zl=s(vs,` and can be used to control the model outputs. Read the
documentation from `),ls=r(vs,"A",{href:!0});var dp=l(ls);xl=s(dp,"PretrainedConfig"),dp.forEach(t),Jl=s(vs," for more information."),vs.forEach(t),Ul=u(vo),w(Rt.$$.fragment,vo),vo.forEach(t),Ca=u(o),Ft=r(o,"H2",{class:!0});var or=l(Ft);St=r(or,"A",{id:!0,class:!0,href:!0});var cp=l(St);Cs=r(cp,"SPAN",{});var pp=l(Cs);w(So.$$.fragment,pp),pp.forEach(t),cp.forEach(t),Il=u(or),zs=r(or,"SPAN",{});var up=l(zs);Wl=s(up,"OPTModel"),up.forEach(t),or.forEach(t),za=u(o),Oe=r(o,"DIV",{class:!0});var wo=l(Oe);w(Qo.$$.fragment,wo),Zl=u(wo),Xo=r(wo,"P",{});var nr=l(Xo);ql=s(nr,`The bare OPT Model outputting raw hidden-states without any specific head on top.
This model inherits from `),is=r(nr,"A",{href:!0});var hp=l(is);Al=s(hp,"PreTrainedModel"),hp.forEach(t),Bl=s(nr,`. 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.)`),nr.forEach(t),Nl=u(wo),Ho=r(wo,"P",{});var sr=l(Ho);Gl=s(sr,"This model is also a PyTorch "),Yo=r(sr,"A",{href:!0,rel:!0});var mp=l(Yo);Vl=s(mp,"torch.nn.Module"),mp.forEach(t),Ll=s(sr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),sr.forEach(t),Rl=u(wo),Ie=r(wo,"DIV",{class:!0});var Mo=l(Ie);w(Do.$$.fragment,Mo),Sl=u(Mo),Ot=r(Mo,"P",{});var ws=l(Ot);Ql=s(ws,"The "),ds=r(ws,"A",{href:!0});var fp=l(ds);Xl=s(fp,"OPTModel"),fp.forEach(t),Hl=s(ws," forward method, overrides the "),xs=r(ws,"CODE",{});var gp=l(xs);Yl=s(gp,"__call__"),gp.forEach(t),Dl=s(ws," special method."),ws.forEach(t),Kl=u(Mo),w(Qt.$$.fragment,Mo),ei=u(Mo),w(Xt.$$.fragment,Mo),Mo.forEach(t),wo.forEach(t),xa=u(o),Et=r(o,"H2",{class:!0});var ar=l(Et);Ht=r(ar,"A",{id:!0,class:!0,href:!0});var _p=l(Ht);Js=r(_p,"SPAN",{});var Tp=l(Js);w(Ko.$$.fragment,Tp),Tp.forEach(t),_p.forEach(t),ti=u(ar),Us=r(ar,"SPAN",{});var bp=l(Us);oi=s(bp,"OPTForCausalLM"),bp.forEach(t),ar.forEach(t),Ja=u(o),jt=r(o,"DIV",{class:!0});var rr=l(jt);w(en.$$.fragment,rr),ni=u(rr),Yt=r(rr,"DIV",{class:!0});var lr=l(Yt);w(tn.$$.fragment,lr),si=u(lr),w(Dt.$$.fragment,lr),lr.forEach(t),rr.forEach(t),Ua=u(o),Ct=r(o,"H2",{class:!0});var ir=l(Ct);Kt=r(ir,"A",{id:!0,class:!0,href:!0});var yp=l(Kt);Is=r(yp,"SPAN",{});var vp=l(Is);w(on.$$.fragment,vp),vp.forEach(t),yp.forEach(t),ai=u(ir),Ws=r(ir,"SPAN",{});var wp=l(Ws);ri=s(wp,"TFOPTModel"),wp.forEach(t),ir.forEach(t),Ia=u(o),ue=r(o,"DIV",{class:!0});var ht=l(ue);w(nn.$$.fragment,ht),li=u(ht),sn=r(ht,"P",{});var dr=l(sn);ii=s(dr,`The bare TF OPT Model outputting raw hidden-states without any specific head on top.
This model inherits from `),cs=r(dr,"A",{href:!0});var Mp=l(cs);di=s(Mp,"TFPreTrainedModel"),Mp.forEach(t),ci=s(dr,`. 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.)`),dr.forEach(t),pi=u(ht),an=r(ht,"P",{});var cr=l(an);ui=s(cr,"This model is also a "),rn=r(cr,"A",{href:!0,rel:!0});var kp=l(rn);hi=s(kp,"tf.keras.Model"),kp.forEach(t),mi=s(cr,` 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.`),cr.forEach(t),fi=u(ht),w(eo.$$.fragment,ht),gi=u(ht),We=r(ht,"DIV",{class:!0});var ko=l(We);w(ln.$$.fragment,ko),_i=u(ko),zt=r(ko,"P",{});var Ms=l(zt);Ti=s(Ms,"The "),ps=r(Ms,"A",{href:!0});var $p=l(ps);bi=s($p,"TFOPTModel"),$p.forEach(t),yi=s(Ms," forward method, overrides the "),Zs=r(Ms,"CODE",{});var Pp=l(Zs);vi=s(Pp,"__call__"),Pp.forEach(t),wi=s(Ms," special method."),Ms.forEach(t),Mi=u(ko),w(to.$$.fragment,ko),ki=u(ko),w(oo.$$.fragment,ko),ko.forEach(t),ht.forEach(t),Wa=u(o),xt=r(o,"H2",{class:!0});var pr=l(xt);no=r(pr,"A",{id:!0,class:!0,href:!0});var Fp=l(no);qs=r(Fp,"SPAN",{});var Op=l(qs);w(dn.$$.fragment,Op),Op.forEach(t),Fp.forEach(t),$i=u(pr),As=r(pr,"SPAN",{});var Ep=l(As);Pi=s(Ep,"TFOPTForCausalLM"),Ep.forEach(t),pr.forEach(t),Za=u(o),Y=r(o,"DIV",{class:!0});var Ae=l(Y);w(cn.$$.fragment,Ae),Fi=u(Ae),Bs=r(Ae,"P",{});var jp=l(Bs);Oi=s(jp,"The OPT Model transformer with a language modeling head on top."),jp.forEach(t),Ei=u(Ae),pn=r(Ae,"P",{});var ur=l(pn);ji=s(ur,"This model inherits from "),us=r(ur,"A",{href:!0});var Cp=l(us);Ci=s(Cp,"TFPreTrainedModel"),Cp.forEach(t),zi=s(ur,`. 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.)`),ur.forEach(t),xi=u(Ae),un=r(Ae,"P",{});var hr=l(un);Ji=s(hr,"This model is also a "),hn=r(hr,"A",{href:!0,rel:!0});var zp=l(hn);Ui=s(zp,"tf.keras.Model"),zp.forEach(t),Ii=s(hr,` 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.`),hr.forEach(t),Wi=u(Ae),w(so.$$.fragment,Ae),Zi=u(Ae),ao=r(Ae,"DIV",{class:!0});var mr=l(ao);w(mn.$$.fragment,mr),qi=u(mr),w(ro.$$.fragment,mr),mr.forEach(t),Ae.forEach(t),qa=u(o),Jt=r(o,"H2",{class:!0});var fr=l(Jt);lo=r(fr,"A",{id:!0,class:!0,href:!0});var xp=l(lo);Ns=r(xp,"SPAN",{});var Jp=l(Ns);w(fn.$$.fragment,Jp),Jp.forEach(t),xp.forEach(t),Ai=u(fr),Gs=r(fr,"SPAN",{});var Up=l(Gs);Bi=s(Up,"OPTForSequenceClassification"),Up.forEach(t),fr.forEach(t),Aa=u(o),G=r(o,"DIV",{class:!0});var Te=l(G);w(gn.$$.fragment,Te),Ni=u(Te),Vs=r(Te,"P",{});var Ip=l(Vs);Gi=s(Ip,"The OPT Model transformer with a sequence classification head on top (linear layer)."),Ip.forEach(t),Vi=u(Te),hs=r(Te,"P",{});var wc=l(hs);ms=r(wc,"A",{href:!0});var Wp=l(ms);Li=s(Wp,"OPTForSequenceClassification"),Wp.forEach(t),Ri=s(wc,` uses the last token in order to do the classification, as other causal models
(e.g. GPT-2) do.`),wc.forEach(t),Si=u(Te),Ee=r(Te,"P",{});var mt=l(Ee);Qi=s(mt,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Ls=r(mt,"CODE",{});var Zp=l(Ls);Xi=s(Zp,"pad_token_id"),Zp.forEach(t),Hi=s(mt,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Rs=r(mt,"CODE",{});var qp=l(Rs);Yi=s(qp,"pad_token_id"),qp.forEach(t),Di=s(mt,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Ss=r(mt,"CODE",{});var Ap=l(Ss);Ki=s(Ap,"inputs_embeds"),Ap.forEach(t),ed=s(mt," are passed instead of "),Qs=r(mt,"CODE",{});var Bp=l(Qs);td=s(Bp,"input_ids"),Bp.forEach(t),od=s(mt,`, it does the same (take the last value in
each row of the batch).`),mt.forEach(t),nd=u(Te),_n=r(Te,"P",{});var gr=l(_n);sd=s(gr,"This model inherits from "),fs=r(gr,"A",{href:!0});var Np=l(fs);ad=s(Np,"PreTrainedModel"),Np.forEach(t),rd=s(gr,`. 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.)`),gr.forEach(t),ld=u(Te),Tn=r(Te,"P",{});var _r=l(Tn);id=s(_r,"This model is also a PyTorch "),bn=r(_r,"A",{href:!0,rel:!0});var Gp=l(bn);dd=s(Gp,"torch.nn.Module"),Gp.forEach(t),cd=s(_r,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),_r.forEach(t),pd=u(Te),_e=r(Te,"DIV",{class:!0});var ft=l(_e);w(yn.$$.fragment,ft),ud=u(ft),Ut=r(ft,"P",{});var ks=l(Ut);hd=s(ks,"The "),gs=r(ks,"A",{href:!0});var Vp=l(gs);md=s(Vp,"OPTForSequenceClassification"),Vp.forEach(t),fd=s(ks," forward method, overrides the "),Xs=r(ks,"CODE",{});var Lp=l(Xs);gd=s(Lp,"__call__"),Lp.forEach(t),_d=s(ks," special method."),ks.forEach(t),Td=u(ft),w(io.$$.fragment,ft),bd=u(ft),w(co.$$.fragment,ft),yd=u(ft),w(po.$$.fragment,ft),ft.forEach(t),Te.forEach(t),Ba=u(o),It=r(o,"H2",{class:!0});var Tr=l(It);uo=r(Tr,"A",{id:!0,class:!0,href:!0});var Rp=l(uo);Hs=r(Rp,"SPAN",{});var Sp=l(Hs);w(vn.$$.fragment,Sp),Sp.forEach(t),Rp.forEach(t),vd=u(Tr),Ys=r(Tr,"SPAN",{});var Qp=l(Ys);wd=s(Qp,"OPTForQuestionAnswering"),Qp.forEach(t),Tr.forEach(t),Na=u(o),he=r(o,"DIV",{class:!0});var gt=l(he);w(wn.$$.fragment,gt),Md=u(gt),Wt=r(gt,"P",{});var $s=l(Wt);kd=s($s,`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 `),Ds=r($s,"CODE",{});var Xp=l(Ds);$d=s(Xp,"span start logits"),Xp.forEach(t),Pd=s($s," and "),Ks=r($s,"CODE",{});var Hp=l(Ks);Fd=s(Hp,"span end logits"),Hp.forEach(t),Od=s($s,")."),$s.forEach(t),Ed=u(gt),Mn=r(gt,"P",{});var br=l(Mn);jd=s(br,"This model inherits from "),_s=r(br,"A",{href:!0});var Yp=l(_s);Cd=s(Yp,"PreTrainedModel"),Yp.forEach(t),zd=s(br,`. 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.)`),br.forEach(t),xd=u(gt),kn=r(gt,"P",{});var yr=l(kn);Jd=s(yr,"This model is also a PyTorch "),$n=r(yr,"A",{href:!0,rel:!0});var Dp=l($n);Ud=s(Dp,"torch.nn.Module"),Dp.forEach(t),Id=s(yr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),yr.forEach(t),Wd=u(gt),Ze=r(gt,"DIV",{class:!0});var $o=l(Ze);w(Pn.$$.fragment,$o),Zd=u($o),Zt=r($o,"P",{});var Ps=l(Zt);qd=s(Ps,"The "),Ts=r(Ps,"A",{href:!0});var Kp=l(Ts);Ad=s(Kp,"OPTForQuestionAnswering"),Kp.forEach(t),Bd=s(Ps," forward method, overrides the "),ea=r(Ps,"CODE",{});var eu=l(ea);Nd=s(eu,"__call__"),eu.forEach(t),Gd=s(Ps," special method."),Ps.forEach(t),Vd=u($o),w(ho.$$.fragment,$o),Ld=u($o),w(mo.$$.fragment,$o),$o.forEach(t),gt.forEach(t),Ga=u(o),qt=r(o,"H2",{class:!0});var vr=l(qt);fo=r(vr,"A",{id:!0,class:!0,href:!0});var tu=l(fo);ta=r(tu,"SPAN",{});var ou=l(ta);w(Fn.$$.fragment,ou),ou.forEach(t),tu.forEach(t),Rd=u(vr),oa=r(vr,"SPAN",{});var nu=l(oa);Sd=s(nu,"FlaxOPTModel"),nu.forEach(t),vr.forEach(t),Va=u(o),At=r(o,"DIV",{class:!0});var wr=l(At);w(On.$$.fragment,wr),Qd=u(wr),go=r(wr,"DIV",{class:!0});var Mr=l(go);w(En.$$.fragment,Mr),Xd=u(Mr),w(_o.$$.fragment,Mr),Mr.forEach(t),wr.forEach(t),La=u(o),Bt=r(o,"H2",{class:!0});var kr=l(Bt);To=r(kr,"A",{id:!0,class:!0,href:!0});var su=l(To);na=r(su,"SPAN",{});var au=l(na);w(jn.$$.fragment,au),au.forEach(t),su.forEach(t),Hd=u(kr),sa=r(kr,"SPAN",{});var ru=l(sa);Yd=s(ru,"FlaxOPTForCausalLM"),ru.forEach(t),kr.forEach(t),Ra=u(o),V=r(o,"DIV",{class:!0});var be=l(V);w(Cn.$$.fragment,be),Dd=u(be),aa=r(be,"P",{});var lu=l(aa);Kd=s(lu,`OPT Model with a language modeling head on top (linear layer with weights tied to the input embeddings) e.g for
autoregressive tasks.`),lu.forEach(t),ec=u(be),zn=r(be,"P",{});var $r=l(zn);tc=s($r,"This model inherits from "),bs=r($r,"A",{href:!0});var iu=l(bs);oc=s(iu,"FlaxPreTrainedModel"),iu.forEach(t),nc=s($r,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),$r.forEach(t),sc=u(be),xn=r(be,"P",{});var Pr=l(xn);ac=s(Pr,`This model is also a Flax Linen
`),Jn=r(Pr,"A",{href:!0,rel:!0});var du=l(Jn);rc=s(du,"flax.nn.Module"),du.forEach(t),lc=s(Pr,` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),Pr.forEach(t),ic=u(be),ra=r(be,"P",{});var cu=l(ra);dc=s(cu,"Finally, this model supports inherent JAX features such as:"),cu.forEach(t),cc=u(be),at=r(be,"UL",{});var Po=l(at);la=r(Po,"LI",{});var pu=l(la);Un=r(pu,"A",{href:!0,rel:!0});var uu=l(Un);pc=s(uu,"Just-In-Time (JIT) compilation"),uu.forEach(t),pu.forEach(t),uc=u(Po),ia=r(Po,"LI",{});var hu=l(ia);In=r(hu,"A",{href:!0,rel:!0});var mu=l(In);hc=s(mu,"Automatic Differentiation"),mu.forEach(t),hu.forEach(t),mc=u(Po),da=r(Po,"LI",{});var fu=l(da);Wn=r(fu,"A",{href:!0,rel:!0});var gu=l(Wn);fc=s(gu,"Vectorization"),gu.forEach(t),fu.forEach(t),gc=u(Po),ca=r(Po,"LI",{});var _u=l(ca);Zn=r(_u,"A",{href:!0,rel:!0});var Tu=l(Zn);_c=s(Tu,"Parallelization"),Tu.forEach(t),_u.forEach(t),Po.forEach(t),Tc=u(be),bo=r(be,"DIV",{class:!0});var Fr=l(bo);w(qn.$$.fragment,Fr),bc=u(Fr),w(yo.$$.fragment,Fr),Fr.forEach(t),be.forEach(t),this.h()},h(){d(c,"name","hf:doc:metadata"),d(c,"content",JSON.stringify(Bu)),d(m,"id","opt"),d(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"),d(m,"href","#opt"),d(_,"class","relative group"),d(K,"id","overview"),d(K,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(K,"href","#overview"),d(I,"class","relative group"),d(oe,"href","https://arxiv.org/pdf/2205.01068"),d(oe,"rel","nofollow"),d(ie,"href","https://huggingface.co/ArthurZ"),d(ie,"rel","nofollow"),d(H,"href","https://huggingface.co/ybelkada"),d(H,"rel","nofollow"),d(x,"href","https://huggingface.co/patrickvonplaten"),d(x,"rel","nofollow"),d(y,"href","https://github.com/facebookresearch/metaseq"),d(y,"rel","nofollow"),d(ge,"id","resources"),d(ge,"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"),d(ge,"href","#resources"),d(ce,"class","relative group"),d($e,"href","https://colab.research.google.com/drive/1jCkpikz0J2o20FBQmYmAGdiKmJGOMo-o?usp=sharing"),d($e,"rel","nofollow"),d(Oo,"href","https://huggingface.co/blog/introducing-csearch#62-example-two---opt"),d(Oo,"rel","nofollow"),d(Eo,"href","https://huggingface.co/course/en/chapter7/6?fw=pt#training-a-causal-language-model-from-scratch"),d(Eo,"rel","nofollow"),d(Hn,"href","/docs/transformers/main/en/model_doc/opt#transformers.OPTForCausalLM"),d(jo,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/language-modeling#gpt-2gpt-and-causal-language-modeling"),d(jo,"rel","nofollow"),d(Co,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb"),d(Co,"rel","nofollow"),d(Yn,"href","/docs/transformers/main/en/model_doc/opt#transformers.TFOPTForCausalLM"),d(zo,"href","https://github.com/huggingface/transformers/tree/main/examples/tensorflow/language-modeling#run_clmpy"),d(zo,"rel","nofollow"),d(xo,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb"),d(xo,"rel","nofollow"),d(Dn,"href","/docs/transformers/main/en/model_doc/opt#transformers.FlaxOPTForCausalLM"),d(Jo,"href","https://github.com/huggingface/transformers/tree/main/examples/flax/language-modeling#causal-language-modeling"),d(Jo,"rel","nofollow"),d(Kn,"href","sequence_classification.md"),d(es,"href","/docs/transformers/main/en/model_doc/opt#transformers.OPTForSequenceClassification"),d(Io,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification"),d(Io,"rel","nofollow"),d(Wo,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification.ipynb"),d(Wo,"rel","nofollow"),d(ts,"href","/docs/transformers/main/en/model_doc/opt#transformers.OPTForQuestionAnswering"),d(qo,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering"),d(qo,"rel","nofollow"),d(Ao,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering.ipynb"),d(Ao,"rel","nofollow"),d(Bo,"href","https://huggingface.co/course/chapter7/7?fw=pt"),d(Bo,"rel","nofollow"),d(Go,"href","https://huggingface.co/blog/accelerate-large-models"),d(Go,"rel","nofollow"),d(Lt,"id","transformers.OPTConfig"),d(Lt,"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"),d(Lt,"href","#transformers.OPTConfig"),d(kt,"class","relative group"),d(as,"href","/docs/transformers/main/en/model_doc/opt#transformers.OPTModel"),d(Ro,"href","https://huggingface.co/facebook/opt-350m"),d(Ro,"rel","nofollow"),d(rs,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),d(ls,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),d(Fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(St,"id","transformers.OPTModel"),d(St,"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"),d(St,"href","#transformers.OPTModel"),d(Ft,"class","relative group"),d(is,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),d(Yo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(Yo,"rel","nofollow"),d(ds,"href","/docs/transformers/main/en/model_doc/opt#transformers.OPTModel"),d(Ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ht,"id","transformers.OPTForCausalLM"),d(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"),d(Ht,"href","#transformers.OPTForCausalLM"),d(Et,"class","relative group"),d(Yt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(jt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Kt,"id","transformers.TFOPTModel"),d(Kt,"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"),d(Kt,"href","#transformers.TFOPTModel"),d(Ct,"class","relative group"),d(cs,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),d(rn,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),d(rn,"rel","nofollow"),d(ps,"href","/docs/transformers/main/en/model_doc/opt#transformers.TFOPTModel"),d(We,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(no,"id","transformers.TFOPTForCausalLM"),d(no,"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"),d(no,"href","#transformers.TFOPTForCausalLM"),d(xt,"class","relative group"),d(us,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),d(hn,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),d(hn,"rel","nofollow"),d(ao,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(lo,"id","transformers.OPTForSequenceClassification"),d(lo,"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"),d(lo,"href","#transformers.OPTForSequenceClassification"),d(Jt,"class","relative group"),d(ms,"href","/docs/transformers/main/en/model_doc/opt#transformers.OPTForSequenceClassification"),d(fs,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),d(bn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(bn,"rel","nofollow"),d(gs,"href","/docs/transformers/main/en/model_doc/opt#transformers.OPTForSequenceClassification"),d(_e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(uo,"id","transformers.OPTForQuestionAnswering"),d(uo,"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"),d(uo,"href","#transformers.OPTForQuestionAnswering"),d(It,"class","relative group"),d(_s,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),d($n,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d($n,"rel","nofollow"),d(Ts,"href","/docs/transformers/main/en/model_doc/opt#transformers.OPTForQuestionAnswering"),d(Ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(he,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(fo,"id","transformers.FlaxOPTModel"),d(fo,"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"),d(fo,"href","#transformers.FlaxOPTModel"),d(qt,"class","relative group"),d(go,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(At,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(To,"id","transformers.FlaxOPTForCausalLM"),d(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"),d(To,"href","#transformers.FlaxOPTForCausalLM"),d(Bt,"class","relative group"),d(bs,"href","/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel"),d(Jn,"href","https://flax.readthedocs.io/en/latest/_autosummary/flax.nn.module.html"),d(Jn,"rel","nofollow"),d(Un,"href","https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit"),d(Un,"rel","nofollow"),d(In,"href","https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation"),d(In,"rel","nofollow"),d(Wn,"href","https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap"),d(Wn,"rel","nofollow"),d(Zn,"href","https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap"),d(Zn,"rel","nofollow"),d(bo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(V,"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,g){e(document.head,c),f(o,b,g),f(o,_,g),e(_,m),e(m,T),M(i,T,null),e(_,h),e(_,C),e(C,Ne),f(o,je,g),f(o,I,g),e(I,K),e(K,te),M(F,te,null),e(I,Ge),e(I,S),e(S,Ve),f(o,Ce,g),f(o,A,g),e(A,Le),e(A,oe),e(oe,ne),e(A,Re),f(o,ze,g),f(o,L,g),e(L,Se),f(o,xe,g),f(o,R,g),e(R,ye),e(ye,Qe),f(o,me,g),f(o,z,g),e(z,W),f(o,Je,g),f(o,B,g),e(B,se),e(se,Xe),e(se,Q),e(Q,He),e(se,Ye),e(B,Z),e(B,ae),e(ae,re),e(ae,ve),e(ve,De),e(ae,le),f(o,Ue,g),f(o,J,g),e(J,X),e(J,ie),e(ie,de),e(J,Ke),e(J,H),e(H,q),e(J,et),e(J,x),e(x,tt),e(J,ot),e(J,y),e(y,E),e(J,yt),f(o,fe,g),f(o,ce,g),e(ce,ge),e(ge,j),M(we,j,null),e(ce,vt),e(ce,nt),e(nt,wt),f(o,rt,g),f(o,N,g),e(N,pe),f(o,lt,g),M(Me,o,g),f(o,ee,g),f(o,U,g),e(U,ke),e(ke,st),e(ke,$e),e($e,Pe),e(ke,Mt),e(U,Or),e(U,Fo),e(Fo,Er),e(Fo,Oo),e(Oo,jr),e(Fo,Cr),e(U,zr),e(U,Xn),e(Xn,Eo),e(Eo,xr),e(Xn,Jr),e(U,Ur),e(U,it),e(it,Hn),e(Hn,Ir),e(it,Wr),e(it,jo),e(jo,Zr),e(it,qr),e(it,Co),e(Co,Ar),e(it,Br),e(U,Nr),e(U,dt),e(dt,Yn),e(Yn,Gr),e(dt,Vr),e(dt,zo),e(zo,Lr),e(dt,Rr),e(dt,xo),e(xo,Sr),e(dt,Qr),e(U,Xr),e(U,Nt),e(Nt,Dn),e(Dn,Hr),e(Nt,Yr),e(Nt,Jo),e(Jo,Dr),e(Nt,Kr),f(o,Ma,g),M(Uo,o,g),f(o,ka,g),f(o,Gt,g),e(Gt,Os),e(Os,Kn),e(Kn,el),e(Gt,tl),e(Gt,ct),e(ct,es),e(es,ol),e(ct,nl),e(ct,Io),e(Io,sl),e(ct,al),e(ct,Wo),e(Wo,rl),e(ct,ll),f(o,$a,g),M(Zo,o,g),f(o,Pa,g),f(o,Vt,g),e(Vt,pt),e(pt,ts),e(ts,il),e(pt,dl),e(pt,qo),e(qo,cl),e(pt,pl),e(pt,Ao),e(Ao,ul),e(pt,hl),e(Vt,ml),e(Vt,os),e(os,Bo),e(Bo,fl),e(os,gl),f(o,Fa,g),f(o,ns,g),e(ns,_l),f(o,Oa,g),f(o,ss,g),e(ss,No),e(No,Tl),e(No,Go),e(Go,bl),e(No,yl),f(o,Ea,g),f(o,kt,g),e(kt,Lt),e(Lt,Es),M(Vo,Es,null),e(kt,vl),e(kt,js),e(js,wl),f(o,ja,g),f(o,Fe,g),M(Lo,Fe,null),e(Fe,Ml),e(Fe,$t),e($t,kl),e($t,as),e(as,$l),e($t,Pl),e($t,Ro),e(Ro,Fl),e($t,Ol),e(Fe,El),e(Fe,Pt),e(Pt,jl),e(Pt,rs),e(rs,Cl),e(Pt,zl),e(Pt,ls),e(ls,xl),e(Pt,Jl),e(Fe,Ul),M(Rt,Fe,null),f(o,Ca,g),f(o,Ft,g),e(Ft,St),e(St,Cs),M(So,Cs,null),e(Ft,Il),e(Ft,zs),e(zs,Wl),f(o,za,g),f(o,Oe,g),M(Qo,Oe,null),e(Oe,Zl),e(Oe,Xo),e(Xo,ql),e(Xo,is),e(is,Al),e(Xo,Bl),e(Oe,Nl),e(Oe,Ho),e(Ho,Gl),e(Ho,Yo),e(Yo,Vl),e(Ho,Ll),e(Oe,Rl),e(Oe,Ie),M(Do,Ie,null),e(Ie,Sl),e(Ie,Ot),e(Ot,Ql),e(Ot,ds),e(ds,Xl),e(Ot,Hl),e(Ot,xs),e(xs,Yl),e(Ot,Dl),e(Ie,Kl),M(Qt,Ie,null),e(Ie,ei),M(Xt,Ie,null),f(o,xa,g),f(o,Et,g),e(Et,Ht),e(Ht,Js),M(Ko,Js,null),e(Et,ti),e(Et,Us),e(Us,oi),f(o,Ja,g),f(o,jt,g),M(en,jt,null),e(jt,ni),e(jt,Yt),M(tn,Yt,null),e(Yt,si),M(Dt,Yt,null),f(o,Ua,g),f(o,Ct,g),e(Ct,Kt),e(Kt,Is),M(on,Is,null),e(Ct,ai),e(Ct,Ws),e(Ws,ri),f(o,Ia,g),f(o,ue,g),M(nn,ue,null),e(ue,li),e(ue,sn),e(sn,ii),e(sn,cs),e(cs,di),e(sn,ci),e(ue,pi),e(ue,an),e(an,ui),e(an,rn),e(rn,hi),e(an,mi),e(ue,fi),M(eo,ue,null),e(ue,gi),e(ue,We),M(ln,We,null),e(We,_i),e(We,zt),e(zt,Ti),e(zt,ps),e(ps,bi),e(zt,yi),e(zt,Zs),e(Zs,vi),e(zt,wi),e(We,Mi),M(to,We,null),e(We,ki),M(oo,We,null),f(o,Wa,g),f(o,xt,g),e(xt,no),e(no,qs),M(dn,qs,null),e(xt,$i),e(xt,As),e(As,Pi),f(o,Za,g),f(o,Y,g),M(cn,Y,null),e(Y,Fi),e(Y,Bs),e(Bs,Oi),e(Y,Ei),e(Y,pn),e(pn,ji),e(pn,us),e(us,Ci),e(pn,zi),e(Y,xi),e(Y,un),e(un,Ji),e(un,hn),e(hn,Ui),e(un,Ii),e(Y,Wi),M(so,Y,null),e(Y,Zi),e(Y,ao),M(mn,ao,null),e(ao,qi),M(ro,ao,null),f(o,qa,g),f(o,Jt,g),e(Jt,lo),e(lo,Ns),M(fn,Ns,null),e(Jt,Ai),e(Jt,Gs),e(Gs,Bi),f(o,Aa,g),f(o,G,g),M(gn,G,null),e(G,Ni),e(G,Vs),e(Vs,Gi),e(G,Vi),e(G,hs),e(hs,ms),e(ms,Li),e(hs,Ri),e(G,Si),e(G,Ee),e(Ee,Qi),e(Ee,Ls),e(Ls,Xi),e(Ee,Hi),e(Ee,Rs),e(Rs,Yi),e(Ee,Di),e(Ee,Ss),e(Ss,Ki),e(Ee,ed),e(Ee,Qs),e(Qs,td),e(Ee,od),e(G,nd),e(G,_n),e(_n,sd),e(_n,fs),e(fs,ad),e(_n,rd),e(G,ld),e(G,Tn),e(Tn,id),e(Tn,bn),e(bn,dd),e(Tn,cd),e(G,pd),e(G,_e),M(yn,_e,null),e(_e,ud),e(_e,Ut),e(Ut,hd),e(Ut,gs),e(gs,md),e(Ut,fd),e(Ut,Xs),e(Xs,gd),e(Ut,_d),e(_e,Td),M(io,_e,null),e(_e,bd),M(co,_e,null),e(_e,yd),M(po,_e,null),f(o,Ba,g),f(o,It,g),e(It,uo),e(uo,Hs),M(vn,Hs,null),e(It,vd),e(It,Ys),e(Ys,wd),f(o,Na,g),f(o,he,g),M(wn,he,null),e(he,Md),e(he,Wt),e(Wt,kd),e(Wt,Ds),e(Ds,$d),e(Wt,Pd),e(Wt,Ks),e(Ks,Fd),e(Wt,Od),e(he,Ed),e(he,Mn),e(Mn,jd),e(Mn,_s),e(_s,Cd),e(Mn,zd),e(he,xd),e(he,kn),e(kn,Jd),e(kn,$n),e($n,Ud),e(kn,Id),e(he,Wd),e(he,Ze),M(Pn,Ze,null),e(Ze,Zd),e(Ze,Zt),e(Zt,qd),e(Zt,Ts),e(Ts,Ad),e(Zt,Bd),e(Zt,ea),e(ea,Nd),e(Zt,Gd),e(Ze,Vd),M(ho,Ze,null),e(Ze,Ld),M(mo,Ze,null),f(o,Ga,g),f(o,qt,g),e(qt,fo),e(fo,ta),M(Fn,ta,null),e(qt,Rd),e(qt,oa),e(oa,Sd),f(o,Va,g),f(o,At,g),M(On,At,null),e(At,Qd),e(At,go),M(En,go,null),e(go,Xd),M(_o,go,null),f(o,La,g),f(o,Bt,g),e(Bt,To),e(To,na),M(jn,na,null),e(Bt,Hd),e(Bt,sa),e(sa,Yd),f(o,Ra,g),f(o,V,g),M(Cn,V,null),e(V,Dd),e(V,aa),e(aa,Kd),e(V,ec),e(V,zn),e(zn,tc),e(zn,bs),e(bs,oc),e(zn,nc),e(V,sc),e(V,xn),e(xn,ac),e(xn,Jn),e(Jn,rc),e(xn,lc),e(V,ic),e(V,ra),e(ra,dc),e(V,cc),e(V,at),e(at,la),e(la,Un),e(Un,pc),e(at,uc),e(at,ia),e(ia,In),e(In,hc),e(at,mc),e(at,da),e(da,Wn),e(Wn,fc),e(at,gc),e(at,ca),e(ca,Zn),e(Zn,_c),e(V,Tc),e(V,bo),M(qn,bo,null),e(bo,bc),M(yo,bo,null),Sa=!0},p(o,[g]){const An={};g&2&&(An.$$scope={dirty:g,ctx:o}),Rt.$set(An);const pa={};g&2&&(pa.$$scope={dirty:g,ctx:o}),Qt.$set(pa);const ua={};g&2&&(ua.$$scope={dirty:g,ctx:o}),Xt.$set(ua);const ha={};g&2&&(ha.$$scope={dirty:g,ctx:o}),Dt.$set(ha);const Bn={};g&2&&(Bn.$$scope={dirty:g,ctx:o}),eo.$set(Bn);const ma={};g&2&&(ma.$$scope={dirty:g,ctx:o}),to.$set(ma);const fa={};g&2&&(fa.$$scope={dirty:g,ctx:o}),oo.$set(fa);const ga={};g&2&&(ga.$$scope={dirty:g,ctx:o}),so.$set(ga);const Nn={};g&2&&(Nn.$$scope={dirty:g,ctx:o}),ro.$set(Nn);const _a={};g&2&&(_a.$$scope={dirty:g,ctx:o}),io.$set(_a);const Ta={};g&2&&(Ta.$$scope={dirty:g,ctx:o}),co.$set(Ta);const ba={};g&2&&(ba.$$scope={dirty:g,ctx:o}),po.$set(ba);const ya={};g&2&&(ya.$$scope={dirty:g,ctx:o}),ho.$set(ya);const va={};g&2&&(va.$$scope={dirty:g,ctx:o}),mo.$set(va);const Gn={};g&2&&(Gn.$$scope={dirty:g,ctx:o}),_o.$set(Gn);const Vn={};g&2&&(Vn.$$scope={dirty:g,ctx:o}),yo.$set(Vn)},i(o){Sa||(k(i.$$.fragment,o),k(F.$$.fragment,o),k(we.$$.fragment,o),k(Me.$$.fragment,o),k(Uo.$$.fragment,o),k(Zo.$$.fragment,o),k(Vo.$$.fragment,o),k(Lo.$$.fragment,o),k(Rt.$$.fragment,o),k(So.$$.fragment,o),k(Qo.$$.fragment,o),k(Do.$$.fragment,o),k(Qt.$$.fragment,o),k(Xt.$$.fragment,o),k(Ko.$$.fragment,o),k(en.$$.fragment,o),k(tn.$$.fragment,o),k(Dt.$$.fragment,o),k(on.$$.fragment,o),k(nn.$$.fragment,o),k(eo.$$.fragment,o),k(ln.$$.fragment,o),k(to.$$.fragment,o),k(oo.$$.fragment,o),k(dn.$$.fragment,o),k(cn.$$.fragment,o),k(so.$$.fragment,o),k(mn.$$.fragment,o),k(ro.$$.fragment,o),k(fn.$$.fragment,o),k(gn.$$.fragment,o),k(yn.$$.fragment,o),k(io.$$.fragment,o),k(co.$$.fragment,o),k(po.$$.fragment,o),k(vn.$$.fragment,o),k(wn.$$.fragment,o),k(Pn.$$.fragment,o),k(ho.$$.fragment,o),k(mo.$$.fragment,o),k(Fn.$$.fragment,o),k(On.$$.fragment,o),k(En.$$.fragment,o),k(_o.$$.fragment,o),k(jn.$$.fragment,o),k(Cn.$$.fragment,o),k(qn.$$.fragment,o),k(yo.$$.fragment,o),Sa=!0)},o(o){$(i.$$.fragment,o),$(F.$$.fragment,o),$(we.$$.fragment,o),$(Me.$$.fragment,o),$(Uo.$$.fragment,o),$(Zo.$$.fragment,o),$(Vo.$$.fragment,o),$(Lo.$$.fragment,o),$(Rt.$$.fragment,o),$(So.$$.fragment,o),$(Qo.$$.fragment,o),$(Do.$$.fragment,o),$(Qt.$$.fragment,o),$(Xt.$$.fragment,o),$(Ko.$$.fragment,o),$(en.$$.fragment,o),$(tn.$$.fragment,o),$(Dt.$$.fragment,o),$(on.$$.fragment,o),$(nn.$$.fragment,o),$(eo.$$.fragment,o),$(ln.$$.fragment,o),$(to.$$.fragment,o),$(oo.$$.fragment,o),$(dn.$$.fragment,o),$(cn.$$.fragment,o),$(so.$$.fragment,o),$(mn.$$.fragment,o),$(ro.$$.fragment,o),$(fn.$$.fragment,o),$(gn.$$.fragment,o),$(yn.$$.fragment,o),$(io.$$.fragment,o),$(co.$$.fragment,o),$(po.$$.fragment,o),$(vn.$$.fragment,o),$(wn.$$.fragment,o),$(Pn.$$.fragment,o),$(ho.$$.fragment,o),$(mo.$$.fragment,o),$(Fn.$$.fragment,o),$(On.$$.fragment,o),$(En.$$.fragment,o),$(_o.$$.fragment,o),$(jn.$$.fragment,o),$(Cn.$$.fragment,o),$(qn.$$.fragment,o),$(yo.$$.fragment,o),Sa=!1},d(o){t(c),o&&t(b),o&&t(_),P(i),o&&t(je),o&&t(I),P(F),o&&t(Ce),o&&t(A),o&&t(ze),o&&t(L),o&&t(xe),o&&t(R),o&&t(me),o&&t(z),o&&t(Je),o&&t(B),o&&t(Ue),o&&t(J),o&&t(fe),o&&t(ce),P(we),o&&t(rt),o&&t(N),o&&t(lt),P(Me,o),o&&t(ee),o&&t(U),o&&t(Ma),P(Uo,o),o&&t(ka),o&&t(Gt),o&&t($a),P(Zo,o),o&&t(Pa),o&&t(Vt),o&&t(Fa),o&&t(ns),o&&t(Oa),o&&t(ss),o&&t(Ea),o&&t(kt),P(Vo),o&&t(ja),o&&t(Fe),P(Lo),P(Rt),o&&t(Ca),o&&t(Ft),P(So),o&&t(za),o&&t(Oe),P(Qo),P(Do),P(Qt),P(Xt),o&&t(xa),o&&t(Et),P(Ko),o&&t(Ja),o&&t(jt),P(en),P(tn),P(Dt),o&&t(Ua),o&&t(Ct),P(on),o&&t(Ia),o&&t(ue),P(nn),P(eo),P(ln),P(to),P(oo),o&&t(Wa),o&&t(xt),P(dn),o&&t(Za),o&&t(Y),P(cn),P(so),P(mn),P(ro),o&&t(qa),o&&t(Jt),P(fn),o&&t(Aa),o&&t(G),P(gn),P(yn),P(io),P(co),P(po),o&&t(Ba),o&&t(It),P(vn),o&&t(Na),o&&t(he),P(wn),P(Pn),P(ho),P(mo),o&&t(Ga),o&&t(qt),P(Fn),o&&t(Va),o&&t(At),P(On),P(En),P(_o),o&&t(La),o&&t(Bt),P(jn),o&&t(Ra),o&&t(V),P(Cn),P(qn),P(yo)}}}const Bu={local:"opt",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{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 Nu(O){return Mu(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Hu extends bu{constructor(c){super();yu(this,c,Nu,Au,vu,{})}}export{Hu as default,Bu as metadata};
