import{S as Mu,i as Cu,s as qu,e as a,k as p,w as y,t as n,M as ju,c as r,d as t,m as u,a as i,x as w,h as s,b as d,G as e,g as m,y as k,q as P,o as $,B as O,v as Au,L as mt}from"../../chunks/vendor-hf-doc-builder.js";import{T as Cs}from"../../chunks/Tip-hf-doc-builder.js";import{D as ee}from"../../chunks/Docstring-hf-doc-builder.js";import{C as gt}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Ie}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ft}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as Cc}from"../../chunks/PipelineTag-hf-doc-builder.js";function Lu(x){let c,v,_,f,T;return f=new gt({props:{code:`from transformers import OPTConfig, OPTModel

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the facebook/opt-large style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = OPTModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){c=a("p"),v=n("Example:"),_=p(),y(f.$$.fragment)},l(l){c=r(l,"P",{});var h=i(c);v=s(h,"Example:"),h.forEach(t),_=u(l),w(f.$$.fragment,l)},m(l,h){m(l,c,h),e(c,v),m(l,_,h),k(f,l,h),T=!0},p:mt,i(l){T||(P(f.$$.fragment,l),T=!0)},o(l){$(f.$$.fragment,l),T=!1},d(l){l&&t(c),l&&t(_),O(f,l)}}}function Iu(x){let c,v,_,f,T;return{c(){c=a("p"),v=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),f=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(l){c=r(l,"P",{});var h=i(c);v=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r(h,"CODE",{});var M=i(_);f=s(M,"Module"),M.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(l,h){m(l,c,h),e(c,v),e(c,_),e(_,f),e(c,T)},d(l){l&&t(c)}}}function Nu(x){let c,v,_,f,T;return f=new gt({props:{code:`from transformers import AutoTokenizer, OPTModel
import torch

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

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

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

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

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

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

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

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Generate</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>generate_ids = model.generate(inputs.input_ids, max_length=<span class="hljs-number">30</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(generate_ids, skip_special_tokens=<span class="hljs-literal">True</span>, clean_up_tokenization_spaces=<span class="hljs-literal">False</span>)[<span class="hljs-number">0</span>]
<span class="hljs-string">&quot;Hey, are you consciours? Can you talk to me?\\nI&#x27;m not consciours, but I can talk to you.&quot;</span>`}}),{c(){c=a("p"),v=n("Example:"),_=p(),y(f.$$.fragment)},l(l){c=r(l,"P",{});var h=i(c);v=s(h,"Example:"),h.forEach(t),_=u(l),w(f.$$.fragment,l)},m(l,h){m(l,c,h),e(c,v),m(l,_,h),k(f,l,h),T=!0},p:mt,i(l){T||(P(f.$$.fragment,l),T=!0)},o(l){$(f.$$.fragment,l),T=!1},d(l){l&&t(c),l&&t(_),O(f,l)}}}function Du(x){let c,v,_,f,T,l,h,M,Ne,Fe,j,te,ae,F,Se,R,De,xe,D,We,re,ie,He,ze,K,Qe,Ee,V,ve,Ue,fe,C,A,Me,W,le,Be,Z,Ke,Ve,L,I,de,be,Ge,ce,ye,Re,J,we,pe,Ze,oe,N,Je,H,q,Ye;return{c(){c=a("p"),v=n("TensorFlow models and layers in "),_=a("code"),f=n("transformers"),T=n(" accept two formats as input:"),l=p(),h=a("ul"),M=a("li"),Ne=n("having all inputs as keyword arguments (like PyTorch models), or"),Fe=p(),j=a("li"),te=n("having all inputs as a list, tuple or dict in the first positional argument."),ae=p(),F=a("p"),Se=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 `),R=a("code"),De=n("model.fit()"),xe=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),D=a("code"),We=n("model.fit()"),re=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),ie=a("code"),He=n("fit()"),ze=n(" and "),K=a("code"),Qe=n("predict()"),Ee=n(`, such as when creating your own layers or models with
the Keras `),V=a("code"),ve=n("Functional"),Ue=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),fe=p(),C=a("ul"),A=a("li"),Me=n("a single Tensor with "),W=a("code"),le=n("input_ids"),Be=n(" only and nothing else: "),Z=a("code"),Ke=n("model(input_ids)"),Ve=p(),L=a("li"),I=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),de=a("code"),be=n("model([input_ids, attention_mask])"),Ge=n(" or "),ce=a("code"),ye=n("model([input_ids, attention_mask, token_type_ids])"),Re=p(),J=a("li"),we=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),pe=a("code"),Ze=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),oe=p(),N=a("p"),Je=n(`Note that when creating models and layers with
`),H=a("a"),q=n("subclassing"),Ye=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(b){c=r(b,"P",{});var z=i(c);v=s(z,"TensorFlow models and layers in "),_=r(z,"CODE",{});var _t=i(_);f=s(_t,"transformers"),_t.forEach(t),T=s(z," accept two formats as input:"),z.forEach(t),l=u(b),h=r(b,"UL",{});var Y=i(h);M=r(Y,"LI",{});var Tt=i(M);Ne=s(Tt,"having all inputs as keyword arguments (like PyTorch models), or"),Tt.forEach(t),Fe=u(Y),j=r(Y,"LI",{});var vt=i(j);te=s(vt,"having all inputs as a list, tuple or dict in the first positional argument."),vt.forEach(t),Y.forEach(t),ae=u(b),F=r(b,"P",{});var E=i(F);Se=s(E,`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models
and layers. Because of this support, when using methods like `),R=r(E,"CODE",{});var bt=i(R);De=s(bt,"model.fit()"),bt.forEach(t),xe=s(E,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),D=r(E,"CODE",{});var yt=i(D);We=s(yt,"model.fit()"),yt.forEach(t),re=s(E,` supports! If, however, you want to use the second
format outside of Keras methods like `),ie=r(E,"CODE",{});var ke=i(ie);He=s(ke,"fit()"),ke.forEach(t),ze=s(E," and "),K=r(E,"CODE",{});var wt=i(K);Qe=s(wt,"predict()"),wt.forEach(t),Ee=s(E,`, such as when creating your own layers or models with
the Keras `),V=r(E,"CODE",{});var kt=i(V);ve=s(kt,"Functional"),kt.forEach(t),Ue=s(E,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),E.forEach(t),fe=u(b),C=r(b,"UL",{});var G=i(C);A=r(G,"LI",{});var S=i(A);Me=s(S,"a single Tensor with "),W=r(S,"CODE",{});var me=i(W);le=s(me,"input_ids"),me.forEach(t),Be=s(S," only and nothing else: "),Z=r(S,"CODE",{});var Xe=i(Z);Ke=s(Xe,"model(input_ids)"),Xe.forEach(t),S.forEach(t),Ve=u(G),L=r(G,"LI",{});var Q=i(L);I=s(Q,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),de=r(Q,"CODE",{});var Pt=i(de);be=s(Pt,"model([input_ids, attention_mask])"),Pt.forEach(t),Ge=s(Q," or "),ce=r(Q,"CODE",{});var et=i(ce);ye=s(et,"model([input_ids, attention_mask, token_type_ids])"),et.forEach(t),Q.forEach(t),Re=u(G),J=r(G,"LI",{});var tt=i(J);we=s(tt,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),pe=r(tt,"CODE",{});var nt=i(pe);Ze=s(nt,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),nt.forEach(t),tt.forEach(t),G.forEach(t),oe=u(b),N=r(b,"P",{});var ne=i(N);Je=s(ne,`Note that when creating models and layers with
`),H=r(ne,"A",{href:!0,rel:!0});var $t=i(H);q=s($t,"subclassing"),$t.forEach(t),Ye=s(ne,` 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!`),ne.forEach(t),this.h()},h(){d(H,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),d(H,"rel","nofollow")},m(b,z){m(b,c,z),e(c,v),e(c,_),e(_,f),e(c,T),m(b,l,z),m(b,h,z),e(h,M),e(M,Ne),e(h,Fe),e(h,j),e(j,te),m(b,ae,z),m(b,F,z),e(F,Se),e(F,R),e(R,De),e(F,xe),e(F,D),e(D,We),e(F,re),e(F,ie),e(ie,He),e(F,ze),e(F,K),e(K,Qe),e(F,Ee),e(F,V),e(V,ve),e(F,Ue),m(b,fe,z),m(b,C,z),e(C,A),e(A,Me),e(A,W),e(W,le),e(A,Be),e(A,Z),e(Z,Ke),e(C,Ve),e(C,L),e(L,I),e(L,de),e(de,be),e(L,Ge),e(L,ce),e(ce,ye),e(C,Re),e(C,J),e(J,we),e(J,pe),e(pe,Ze),m(b,oe,z),m(b,N,z),e(N,Je),e(N,H),e(H,q),e(N,Ye)},d(b){b&&t(c),b&&t(l),b&&t(h),b&&t(ae),b&&t(F),b&&t(fe),b&&t(C),b&&t(oe),b&&t(N)}}}function Wu(x){let c,v,_,f,T;return{c(){c=a("p"),v=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),f=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(l){c=r(l,"P",{});var h=i(c);v=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r(h,"CODE",{});var M=i(_);f=s(M,"Module"),M.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(l,h){m(l,c,h),e(c,v),e(c,_),e(_,f),e(c,T)},d(l){l&&t(c)}}}function Hu(x){let c,v,_,f,T;return f=new gt({props:{code:`from transformers import AutoTokenizer, TFOPTModel
import tensorflow as tf

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

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

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

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

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

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){c=a("p"),v=n("Example:"),_=p(),y(f.$$.fragment)},l(l){c=r(l,"P",{});var h=i(c);v=s(h,"Example:"),h.forEach(t),_=u(l),w(f.$$.fragment,l)},m(l,h){m(l,c,h),e(c,v),m(l,_,h),k(f,l,h),T=!0},p:mt,i(l){T||(P(f.$$.fragment,l),T=!0)},o(l){$(f.$$.fragment,l),T=!1},d(l){l&&t(c),l&&t(_),O(f,l)}}}function Bu(x){let c,v,_,f,T;return{c(){c=a("p"),v=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),f=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(l){c=r(l,"P",{});var h=i(c);v=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r(h,"CODE",{});var M=i(_);f=s(M,"Module"),M.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(l,h){m(l,c,h),e(c,v),e(c,_),e(_,f),e(c,T)},d(l){l&&t(c)}}}function Ku(x){let c,v,_,f,T;return f=new gt({props:{code:`import torch
from transformers import AutoTokenizer, OPTForSequenceClassification

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.<span class="hljs-built_in">sum</span>(
<span class="hljs-meta">... </span>    torch.nn.functional.one_hot(predicted_class_ids[<span class="hljs-literal">None</span>, :].clone(), num_classes=num_labels), dim=<span class="hljs-number">1</span>
<span class="hljs-meta">... </span>).to(torch.<span class="hljs-built_in">float</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){c=a("p"),v=n("Example of multi-label classification:"),_=p(),y(f.$$.fragment)},l(l){c=r(l,"P",{});var h=i(c);v=s(h,"Example of multi-label classification:"),h.forEach(t),_=u(l),w(f.$$.fragment,l)},m(l,h){m(l,c,h),e(c,v),m(l,_,h),k(f,l,h),T=!0},p:mt,i(l){T||(P(f.$$.fragment,l),T=!0)},o(l){$(f.$$.fragment,l),T=!1},d(l){l&&t(c),l&&t(_),O(f,l)}}}function Gu(x){let c,v,_,f,T;return{c(){c=a("p"),v=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a("code"),f=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(l){c=r(l,"P",{});var h=i(c);v=s(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r(h,"CODE",{});var M=i(_);f=s(M,"Module"),M.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(l,h){m(l,c,h),e(c,v),e(c,_),e(_,f),e(c,T)},d(l){l&&t(c)}}}function Ru(x){let c,v,_,f,T;return f=new gt({props:{code:`from transformers import AutoTokenizer, OPTForQuestionAnswering
import torch

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

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

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

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

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

answer_offset = len(tokenizer(question)[0])

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

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

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>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"),v=n("Example:"),_=p(),y(f.$$.fragment)},l(l){c=r(l,"P",{});var h=i(c);v=s(h,"Example:"),h.forEach(t),_=u(l),w(f.$$.fragment,l)},m(l,h){m(l,c,h),e(c,v),m(l,_,h),k(f,l,h),T=!0},p:mt,i(l){T||(P(f.$$.fragment,l),T=!0)},o(l){$(f.$$.fragment,l),T=!1},d(l){l&&t(c),l&&t(_),O(f,l)}}}function Zu(x){let c,v,_,f,T;return f=new gt({props:{code:`from transformers import AutoTokenizer, FlaxOPTModel

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

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

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

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

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

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

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

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># retrieve logts for next token</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>next_token_logits = outputs.logits[:, -<span class="hljs-number">1</span>]`}}),{c(){c=a("p"),v=n("Example:"),_=p(),y(f.$$.fragment)},l(l){c=r(l,"P",{});var h=i(c);v=s(h,"Example:"),h.forEach(t),_=u(l),w(f.$$.fragment,l)},m(l,h){m(l,c,h),e(c,v),m(l,_,h),k(f,l,h),T=!0},p:mt,i(l){T||(P(f.$$.fragment,l),T=!0)},o(l){$(f.$$.fragment,l),T=!1},d(l){l&&t(c),l&&t(_),O(f,l)}}}function Yu(x){let c,v,_,f,T,l,h,M,Ne,Fe,j,te,ae,F,Se,R,De,xe,D,We,re,ie,He,ze,K,Qe,Ee,V,ve,Ue,fe,C,A,Me,W,le,Be,Z,Ke,Ve,L,I,de,be,Ge,ce,ye,Re,J,we,pe,Ze,oe,N,Je,H,q,Ye,b,z,_t,Y,Tt,vt,E,bt,yt,ke,wt,kt,G,S,me,Xe,Q,Pt,et,tt,nt,ne,$t,xa,zo,za,se,Eo,jr,Mo,Ar,Lr,Ir,Co,Nr,qo,Sr,Dr,Wr,es,jo,Hr,Qr,Ur,st,ts,Br,Kr,Ao,Vr,Gr,Lo,Rr,Zr,Jr,at,os,Yr,Xr,Io,ei,ti,No,oi,ni,si,Ut,ns,ai,ri,So,ii,li,Ea,Do,Ma,Bt,qs,ss,di,ci,rt,as,pi,ui,Wo,hi,fi,Ho,mi,gi,Ca,Qo,qa,Kt,it,rs,_i,Ti,Uo,vi,bi,Bo,yi,wi,ki,is,Ko,Pi,$i,ja,ls,Oi,Aa,ds,Vo,Fi,Go,xi,zi,La,Ot,Vt,js,Ro,Ei,As,Mi,Ia,Pe,Zo,Ci,Ft,qi,cs,ji,Ai,Jo,Li,Ii,Ni,xt,Si,ps,Di,Wi,us,Hi,Qi,Ui,Gt,Na,zt,Rt,Ls,Yo,Bi,Is,Ki,Sa,$e,Xo,Vi,en,Gi,hs,Ri,Zi,Ji,tn,Yi,on,Xi,el,tl,Ce,nn,ol,Et,nl,fs,sl,al,Ns,rl,il,ll,Zt,dl,Jt,Da,Mt,Yt,Ss,sn,cl,Ds,pl,Wa,Ct,an,ul,Xt,rn,hl,eo,Ha,qt,to,Ws,ln,fl,Hs,ml,Qa,ue,dn,gl,cn,_l,ms,Tl,vl,bl,pn,yl,un,wl,kl,Pl,oo,$l,qe,hn,Ol,jt,Fl,gs,xl,zl,Qs,El,Ml,Cl,no,ql,so,Ua,At,ao,Us,fn,jl,Bs,Al,Ba,X,mn,Ll,Ks,Il,Nl,gn,Sl,_s,Dl,Wl,Hl,_n,Ql,Tn,Ul,Bl,Kl,ro,Vl,io,vn,Gl,lo,Ka,Lt,co,Vs,bn,Rl,Gs,Zl,Va,U,yn,Jl,Rs,Yl,Xl,Ts,vs,ed,td,od,Oe,nd,Zs,sd,ad,Js,rd,id,Ys,ld,dd,Xs,cd,pd,ud,wn,hd,bs,fd,md,gd,kn,_d,Pn,Td,vd,bd,ge,$n,yd,It,wd,ys,kd,Pd,ea,$d,Od,Fd,po,xd,uo,zd,ho,Ga,Nt,fo,ta,On,Ed,oa,Md,Ra,he,Fn,Cd,St,qd,na,jd,Ad,sa,Ld,Id,Nd,xn,Sd,ws,Dd,Wd,Hd,zn,Qd,En,Ud,Bd,Kd,je,Mn,Vd,Dt,Gd,ks,Rd,Zd,aa,Jd,Yd,Xd,mo,ec,go,Za,Wt,_o,ra,Cn,tc,ia,oc,Ja,Ht,qn,nc,To,jn,sc,vo,Ya,Qt,bo,la,An,ac,da,rc,Xa,B,Ln,ic,ca,lc,dc,In,cc,Ps,pc,uc,hc,Nn,fc,Sn,mc,gc,_c,pa,Tc,vc,ot,ua,Dn,bc,yc,ha,Wn,wc,kc,fa,Hn,Pc,$c,ma,Qn,Oc,Fc,yo,Un,xc,wo,er;return l=new Ie({}),F=new Ie({}),Q=new Ie({}),zo=new Cc({props:{pipeline:"text-generation"}}),Do=new Cc({props:{pipeline:"text-classification"}}),Qo=new Cc({props:{pipeline:"question-answering"}}),Ro=new Ie({}),Zo=new ee({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/v4.29.0/en/model_doc/opt#transformers.OPTModel">OPTModel</a>`,name:"vocab_size"},{anchor:"transformers.OPTConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.OPTConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of decoder layers.`,name:"num_hidden_layers"},{anchor:"transformers.OPTConfig.ffn_dim",description:`<strong>ffn_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (often named feed-forward) layer in decoder.`,name:"ffn_dim"},{anchor:"transformers.OPTConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer decoder.`,name:"num_attention_heads"},{anchor:"transformers.OPTConfig.activation_function",description:`<strong>activation_function</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;relu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;silu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"activation_function"},{anchor:"transformers.OPTConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.OPTConfig.do_layer_norm_before",description:`<strong>do_layer_norm_before</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to perform layer normalization before the attention block.`,name:"do_layer_norm_before"},{anchor:"transformers.OPTConfig.word_embed_proj_dim",description:`<strong>word_embed_proj_dim</strong> (<code>int</code>, <em>optional</em>) &#x2014;
<code>word_embed_proj_dim</code> can be set to down-project word embeddings, <em>e.g.</em> <code>opt-350m</code>. Defaults to
<code>hidden_size</code>.`,name:"word_embed_proj_dim"},{anchor:"transformers.OPTConfig.dropout",description:`<strong>dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"dropout"},{anchor:"transformers.OPTConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.
layerdrop &#x2014; (<code>float</code>, <em>optional</em>, defaults to 0.0):
The LayerDrop probability. See the [LayerDrop paper](see <a href="https://arxiv.org/abs/1909.11556" rel="nofollow">https://arxiv.org/abs/1909.11556</a>) for more
details.`,name:"attention_dropout"},{anchor:"transformers.OPTConfig.init_std",description:`<strong>init_std</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"init_std"},{anchor:"transformers.OPTConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models).`,name:"use_cache"},{anchor:"transformers.OPTConfig.enable_bias",description:`<strong>enable_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not if the linear layers in the attention blocks should use the bias term.`,name:"enable_bias"},{anchor:"transformers.OPTConfig.layer_norm_elementwise_affine",description:`<strong>layer_norm_elementwise_affine</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not if the layer norms should have learnable parameters.`,name:"layer_norm_elementwise_affine"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/opt/configuration_opt.py#L32"}}),Gt=new ft({props:{anchor:"transformers.OPTConfig.example",$$slots:{default:[Lu]},$$scope:{ctx:x}}}),Yo=new Ie({}),Xo=new ee({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/v4.29.0/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/v4.29.0/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/v4.29.0/src/transformers/models/opt/modeling_opt.py#L746"}}),nn=new ee({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/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.`,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/v4.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/opt/modeling_opt.py#L762",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/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/v4.29.0/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/v4.29.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast"
>transformers.modeling_outputs.BaseModelOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Zt=new Cs({props:{$$slots:{default:[Iu]},$$scope:{ctx:x}}}),Jt=new ft({props:{anchor:"transformers.OPTModel.forward.example",$$slots:{default:[Nu]},$$scope:{ctx:x}}}),sn=new Ie({}),an=new ee({props:{name:"class transformers.OPTForCausalLM",anchor:"transformers.OPTForCausalLM",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/opt/modeling_opt.py#L812"}}),rn=new ee({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/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/v4.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/opt/modeling_opt.py#L843",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/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/v4.29.0/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/v4.29.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),eo=new ft({props:{anchor:"transformers.OPTForCausalLM.forward.example",$$slots:{default:[Su]},$$scope:{ctx:x}}}),ln=new Ie({}),dn=new ee({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/v4.29.0/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/v4.29.0/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/v4.29.0/src/transformers/models/opt/modeling_tf_opt.py#L783"}}),oo=new Cs({props:{$$slots:{default:[Du]},$$scope:{ctx:x}}}),hn=new ee({props:{name:"call",anchor:"transformers.TFOPTModel.call",parameters:[{name:"input_ids",val:": typing.Union[typing.List[tensorflow.python.framework.ops.Tensor], typing.List[numpy.ndarray], typing.List[keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, keras.engine.keras_tensor.KerasTensor, NoneType] = None"},{name:"attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"past_key_values",val:": typing.Union[typing.Tuple[typing.Tuple[typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor]]], NoneType] = None"},{name:"inputs_embeds",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"training",val:": typing.Optional[bool] = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFOPTModel.call.input_ids",description:`<strong>input_ids</strong> (<code>tf.Tensor</code> of shape <code>({0})</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/v4.29.0/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/v4.29.0/src/transformers/models/opt/modeling_tf_opt.py#L797",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/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/v4.29.0/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/v4.29.0/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPast"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPast</a> or <code>tuple(tf.Tensor)</code></p>
`}}),no=new Cs({props:{$$slots:{default:[Wu]},$$scope:{ctx:x}}}),so=new ft({props:{anchor:"transformers.TFOPTModel.call.example",$$slots:{default:[Hu]},$$scope:{ctx:x}}}),fn=new Ie({}),mn=new ee({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/v4.29.0/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/v4.29.0/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/v4.29.0/src/transformers/models/opt/modeling_tf_opt.py#L869"}}),ro=new Cs({props:{$$slots:{default:[Qu]},$$scope:{ctx:x}}}),vn=new ee({props:{name:"call",anchor:"transformers.TFOPTForCausalLM.call",parameters:[{name:"input_ids",val:": typing.Union[typing.List[tensorflow.python.framework.ops.Tensor], typing.List[numpy.ndarray], typing.List[keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, keras.engine.keras_tensor.KerasTensor, NoneType] = None"},{name:"past_key_values",val:": typing.Union[typing.Tuple[typing.Tuple[typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor]]], NoneType] = None"},{name:"attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"position_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"inputs_embeds",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"labels",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"training",val:": typing.Optional[bool] = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFOPTForCausalLM.call.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you
provide it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/v4.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/opt/modeling_tf_opt.py#L894",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/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/v4.29.0/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/v4.29.0/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/v4.29.0/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/v4.29.0/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/v4.29.0/en/main_classes/output#transformers.modeling_tf_outputs.TFCausalLMOutputWithPast"
>transformers.modeling_tf_outputs.TFCausalLMOutputWithPast</a> or <code>tuple(tf.Tensor)</code></p>
`}}),lo=new ft({props:{anchor:"transformers.TFOPTForCausalLM.call.example",$$slots:{default:[Uu]},$$scope:{ctx:x}}}),bn=new Ie({}),yn=new ee({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/v4.29.0/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/v4.29.0/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/v4.29.0/src/transformers/models/opt/modeling_opt.py#L1019"}}),$n=new ee({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/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.`,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/v4.29.0/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/v4.29.0/src/transformers/models/opt/modeling_opt.py#L1031",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/v4.29.0/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>
`}}),po=new Cs({props:{$$slots:{default:[Bu]},$$scope:{ctx:x}}}),uo=new ft({props:{anchor:"transformers.OPTForSequenceClassification.forward.example",$$slots:{default:[Ku]},$$scope:{ctx:x}}}),ho=new ft({props:{anchor:"transformers.OPTForSequenceClassification.forward.example-2",$$slots:{default:[Vu]},$$scope:{ctx:x}}}),On=new Ie({}),Fn=new ee({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/v4.29.0/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/v4.29.0/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/v4.29.0/src/transformers/models/opt/modeling_opt.py#L1141"}}),Mn=new ee({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/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.`,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/v4.29.0/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/v4.29.0/src/transformers/models/opt/modeling_opt.py#L1152",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/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/v4.29.0/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/v4.29.0/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),mo=new Cs({props:{$$slots:{default:[Gu]},$$scope:{ctx:x}}}),go=new ft({props:{anchor:"transformers.OPTForQuestionAnswering.forward.example",$$slots:{default:[Ru]},$$scope:{ctx:x}}}),Cn=new Ie({}),qn=new ee({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/v4.29.0/src/transformers/models/opt/modeling_flax_opt.py#L690"}}),jn=new ee({props:{name:"__call__",anchor:"transformers.FlaxOPTModel.__call__",parameters:[{name:"input_ids",val:": ndarray"},{name:"attention_mask",val:": typing.Optional[jax._src.numpy.ndarray.ndarray] = None"},{name:"position_ids",val:": typing.Optional[jax._src.numpy.ndarray.ndarray] = None"},{name:"params",val:": dict = None"},{name:"past_key_values",val:": dict = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"dropout_rng",val:": PRNGKey = None"},{name:"deterministic",val:": bool = True"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/opt/modeling_flax_opt.py#L583",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/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/v4.29.0/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/v4.29.0/en/main_classes/output#transformers.modeling_flax_outputs.FlaxBaseModelOutput"
>transformers.modeling_flax_outputs.FlaxBaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),vo=new ft({props:{anchor:"transformers.FlaxOPTModel.__call__.example",$$slots:{default:[Zu]},$$scope:{ctx:x}}}),An=new Ie({}),Ln=new ee({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/v4.29.0/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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/opt/modeling_flax_opt.py#L763"}}),Un=new ee({props:{name:"__call__",anchor:"transformers.FlaxOPTForCausalLM.__call__",parameters:[{name:"input_ids",val:": ndarray"},{name:"attention_mask",val:": typing.Optional[jax._src.numpy.ndarray.ndarray] = None"},{name:"position_ids",val:": typing.Optional[jax._src.numpy.ndarray.ndarray] = None"},{name:"params",val:": dict = None"},{name:"past_key_values",val:": dict = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"dropout_rng",val:": PRNGKey = None"},{name:"deterministic",val:": bool = True"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/opt/modeling_flax_opt.py#L583",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/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/v4.29.0/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/v4.29.0/en/main_classes/output#transformers.modeling_flax_outputs.FlaxBaseModelOutput"
>transformers.modeling_flax_outputs.FlaxBaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),wo=new ft({props:{anchor:"transformers.FlaxOPTForCausalLM.__call__.example",$$slots:{default:[Ju]},$$scope:{ctx:x}}}),{c(){c=a("meta"),v=p(),_=a("h1"),f=a("a"),T=a("span"),y(l.$$.fragment),h=p(),M=a("span"),Ne=n("OPT"),Fe=p(),j=a("h2"),te=a("a"),ae=a("span"),y(F.$$.fragment),Se=p(),R=a("span"),De=n("Overview"),xe=p(),D=a("p"),We=n("The OPT model was proposed in "),re=a("a"),ie=n("Open Pre-trained Transformer Language Models"),He=n(` by Meta AI.
OPT is a series of open-sourced large causal language models which perform similar in performance to GPT3.`),ze=p(),K=a("p"),Qe=n("The abstract from the paper is the following:"),Ee=p(),V=a("p"),ve=a("em"),Ue=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."),fe=p(),C=a("p"),A=n("Tips:"),Me=p(),W=a("ul"),le=a("li"),Be=n("OPT has the same architecture as "),Z=a("code"),Ke=n("BartDecoder"),Ve=n("."),L=p(),I=a("li"),de=n("Contrary to GPT2, OPT adds the EOS token "),be=a("code"),Ge=n("</s>"),ce=n(" to the beginning of every prompt. "),ye=a("strong"),Re=n("Note"),J=n(": Make sure to pass "),we=a("code"),pe=n("use_fast=False"),Ze=n(" when loading OPT\u2019s tokenizer with "),oe=a("a"),N=n("AutoTokenizer"),Je=n(" to get the correct tokenizer."),H=p(),q=a("p"),Ye=n("This model was contributed by "),b=a("a"),z=n("Arthur Zucker"),_t=n(", "),Y=a("a"),Tt=n("Younes Belkada"),vt=n(", and "),E=a("a"),bt=n("Patrick Von Platen"),yt=n(`.
The original code can be found `),ke=a("a"),wt=n("here"),kt=n("."),G=p(),S=a("h2"),me=a("a"),Xe=a("span"),y(Q.$$.fragment),Pt=p(),et=a("span"),tt=n("Resources"),nt=p(),ne=a("p"),$t=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.`),xa=p(),y(zo.$$.fragment),za=p(),se=a("ul"),Eo=a("li"),jr=n("A notebook on "),Mo=a("a"),Ar=n("fine-tuning OPT with PEFT, bitsandbytes, and Transformers"),Lr=n(". \u{1F30E}"),Ir=p(),Co=a("li"),Nr=n("A blog post on "),qo=a("a"),Sr=n("decoding strategies with OPT"),Dr=n("."),Wr=p(),es=a("li"),jo=a("a"),Hr=n("Causal language modeling"),Qr=n(" chapter of the \u{1F917} Hugging Face Course."),Ur=p(),st=a("li"),ts=a("a"),Br=n("OPTForCausalLM"),Kr=n(" is supported by this "),Ao=a("a"),Vr=n("causal language modeling example script"),Gr=n(" and "),Lo=a("a"),Rr=n("notebook"),Zr=n("."),Jr=p(),at=a("li"),os=a("a"),Yr=n("TFOPTForCausalLM"),Xr=n(" is supported by this "),Io=a("a"),ei=n("causal language modeling example script"),ti=n(" and "),No=a("a"),oi=n("notebook"),ni=n("."),si=p(),Ut=a("li"),ns=a("a"),ai=n("FlaxOPTForCausalLM"),ri=n(" is supported by this "),So=a("a"),ii=n("causal language modeling example script"),li=n("."),Ea=p(),y(Do.$$.fragment),Ma=p(),Bt=a("ul"),qs=a("li"),ss=a("a"),di=n("Text classification task guide"),ci=p(),rt=a("li"),as=a("a"),pi=n("OPTForSequenceClassification"),ui=n(" is supported by this "),Wo=a("a"),hi=n("example script"),fi=n(" and "),Ho=a("a"),mi=n("notebook"),gi=n("."),Ca=p(),y(Qo.$$.fragment),qa=p(),Kt=a("ul"),it=a("li"),rs=a("a"),_i=n("OPTForQuestionAnswering"),Ti=n(" is supported by this "),Uo=a("a"),vi=n("question answering example script"),bi=n(" and "),Bo=a("a"),yi=n("notebook"),wi=n("."),ki=p(),is=a("li"),Ko=a("a"),Pi=n("Question answering"),$i=n(` chapter
of the \u{1F917} Hugging Face Course.`),ja=p(),ls=a("p"),Oi=n("\u26A1\uFE0F Inference"),Aa=p(),ds=a("ul"),Vo=a("li"),Fi=n("A blog post on "),Go=a("a"),xi=n("How \u{1F917} Accelerate runs very large models thanks to PyTorch"),zi=n(" with OPT."),La=p(),Ot=a("h2"),Vt=a("a"),js=a("span"),y(Ro.$$.fragment),Ei=p(),As=a("span"),Mi=n("OPTConfig"),Ia=p(),Pe=a("div"),y(Zo.$$.fragment),Ci=p(),Ft=a("p"),qi=n("This is the configuration class to store the configuration of a "),cs=a("a"),ji=n("OPTModel"),Ai=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
`),Jo=a("a"),Li=n("facebook/opt-350m"),Ii=n(" architecture."),Ni=p(),xt=a("p"),Si=n("Configuration objects inherit from "),ps=a("a"),Di=n("PretrainedConfig"),Wi=n(` and can be used to control the model outputs. Read the
documentation from `),us=a("a"),Hi=n("PretrainedConfig"),Qi=n(" for more information."),Ui=p(),y(Gt.$$.fragment),Na=p(),zt=a("h2"),Rt=a("a"),Ls=a("span"),y(Yo.$$.fragment),Bi=p(),Is=a("span"),Ki=n("OPTModel"),Sa=p(),$e=a("div"),y(Xo.$$.fragment),Vi=p(),en=a("p"),Gi=n(`The bare OPT Model outputting raw hidden-states without any specific head on top.
This model inherits from `),hs=a("a"),Ri=n("PreTrainedModel"),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.)`),Ji=p(),tn=a("p"),Yi=n("This model is also a PyTorch "),on=a("a"),Xi=n("torch.nn.Module"),el=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),tl=p(),Ce=a("div"),y(nn.$$.fragment),ol=p(),Et=a("p"),nl=n("The "),fs=a("a"),sl=n("OPTModel"),al=n(" forward method, overrides the "),Ns=a("code"),rl=n("__call__"),il=n(" special method."),ll=p(),y(Zt.$$.fragment),dl=p(),y(Jt.$$.fragment),Da=p(),Mt=a("h2"),Yt=a("a"),Ss=a("span"),y(sn.$$.fragment),cl=p(),Ds=a("span"),pl=n("OPTForCausalLM"),Wa=p(),Ct=a("div"),y(an.$$.fragment),ul=p(),Xt=a("div"),y(rn.$$.fragment),hl=p(),y(eo.$$.fragment),Ha=p(),qt=a("h2"),to=a("a"),Ws=a("span"),y(ln.$$.fragment),fl=p(),Hs=a("span"),ml=n("TFOPTModel"),Qa=p(),ue=a("div"),y(dn.$$.fragment),gl=p(),cn=a("p"),_l=n(`The bare TF OPT Model outputting raw hidden-states without any specific head on top.
This model inherits from `),ms=a("a"),Tl=n("TFPreTrainedModel"),vl=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.)`),bl=p(),pn=a("p"),yl=n("This model is also a "),un=a("a"),wl=n("tf.keras.Model"),kl=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.`),Pl=p(),y(oo.$$.fragment),$l=p(),qe=a("div"),y(hn.$$.fragment),Ol=p(),jt=a("p"),Fl=n("The "),gs=a("a"),xl=n("TFOPTModel"),zl=n(" forward method, overrides the "),Qs=a("code"),El=n("__call__"),Ml=n(" special method."),Cl=p(),y(no.$$.fragment),ql=p(),y(so.$$.fragment),Ua=p(),At=a("h2"),ao=a("a"),Us=a("span"),y(fn.$$.fragment),jl=p(),Bs=a("span"),Al=n("TFOPTForCausalLM"),Ba=p(),X=a("div"),y(mn.$$.fragment),Ll=p(),Ks=a("p"),Il=n("The OPT Model transformer with a language modeling head on top."),Nl=p(),gn=a("p"),Sl=n("This model inherits from "),_s=a("a"),Dl=n("TFPreTrainedModel"),Wl=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.)`),Hl=p(),_n=a("p"),Ql=n("This model is also a "),Tn=a("a"),Ul=n("tf.keras.Model"),Bl=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.`),Kl=p(),y(ro.$$.fragment),Vl=p(),io=a("div"),y(vn.$$.fragment),Gl=p(),y(lo.$$.fragment),Ka=p(),Lt=a("h2"),co=a("a"),Vs=a("span"),y(bn.$$.fragment),Rl=p(),Gs=a("span"),Zl=n("OPTForSequenceClassification"),Va=p(),U=a("div"),y(yn.$$.fragment),Jl=p(),Rs=a("p"),Yl=n("The OPT Model transformer with a sequence classification head on top (linear layer)."),Xl=p(),Ts=a("p"),vs=a("a"),ed=n("OPTForSequenceClassification"),td=n(` uses the last token in order to do the classification, as other causal models
(e.g. GPT-2) do.`),od=p(),Oe=a("p"),nd=n(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Zs=a("code"),sd=n("pad_token_id"),ad=n(` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Js=a("code"),rd=n("pad_token_id"),id=n(` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Ys=a("code"),ld=n("inputs_embeds"),dd=n(" are passed instead of "),Xs=a("code"),cd=n("input_ids"),pd=n(`, it does the same (take the last value in
each row of the batch).`),ud=p(),wn=a("p"),hd=n("This model inherits from "),bs=a("a"),fd=n("PreTrainedModel"),md=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.)`),gd=p(),kn=a("p"),_d=n("This model is also a PyTorch "),Pn=a("a"),Td=n("torch.nn.Module"),vd=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),bd=p(),ge=a("div"),y($n.$$.fragment),yd=p(),It=a("p"),wd=n("The "),ys=a("a"),kd=n("OPTForSequenceClassification"),Pd=n(" forward method, overrides the "),ea=a("code"),$d=n("__call__"),Od=n(" special method."),Fd=p(),y(po.$$.fragment),xd=p(),y(uo.$$.fragment),zd=p(),y(ho.$$.fragment),Ga=p(),Nt=a("h2"),fo=a("a"),ta=a("span"),y(On.$$.fragment),Ed=p(),oa=a("span"),Md=n("OPTForQuestionAnswering"),Ra=p(),he=a("div"),y(Fn.$$.fragment),Cd=p(),St=a("p"),qd=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 `),na=a("code"),jd=n("span start logits"),Ad=n(" and "),sa=a("code"),Ld=n("span end logits"),Id=n(")."),Nd=p(),xn=a("p"),Sd=n("This model inherits from "),ws=a("a"),Dd=n("PreTrainedModel"),Wd=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.)`),Hd=p(),zn=a("p"),Qd=n("This model is also a PyTorch "),En=a("a"),Ud=n("torch.nn.Module"),Bd=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Kd=p(),je=a("div"),y(Mn.$$.fragment),Vd=p(),Dt=a("p"),Gd=n("The "),ks=a("a"),Rd=n("OPTForQuestionAnswering"),Zd=n(" forward method, overrides the "),aa=a("code"),Jd=n("__call__"),Yd=n(" special method."),Xd=p(),y(mo.$$.fragment),ec=p(),y(go.$$.fragment),Za=p(),Wt=a("h2"),_o=a("a"),ra=a("span"),y(Cn.$$.fragment),tc=p(),ia=a("span"),oc=n("FlaxOPTModel"),Ja=p(),Ht=a("div"),y(qn.$$.fragment),nc=p(),To=a("div"),y(jn.$$.fragment),sc=p(),y(vo.$$.fragment),Ya=p(),Qt=a("h2"),bo=a("a"),la=a("span"),y(An.$$.fragment),ac=p(),da=a("span"),rc=n("FlaxOPTForCausalLM"),Xa=p(),B=a("div"),y(Ln.$$.fragment),ic=p(),ca=a("p"),lc=n(`OPT Model with a language modeling head on top (linear layer with weights tied to the input embeddings) e.g for
autoregressive tasks.`),dc=p(),In=a("p"),cc=n("This model inherits from "),Ps=a("a"),pc=n("FlaxPreTrainedModel"),uc=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.)`),hc=p(),Nn=a("p"),fc=n(`This model is also a Flax Linen
`),Sn=a("a"),mc=n("flax.nn.Module"),gc=n(` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),_c=p(),pa=a("p"),Tc=n("Finally, this model supports inherent JAX features such as:"),vc=p(),ot=a("ul"),ua=a("li"),Dn=a("a"),bc=n("Just-In-Time (JIT) compilation"),yc=p(),ha=a("li"),Wn=a("a"),wc=n("Automatic Differentiation"),kc=p(),fa=a("li"),Hn=a("a"),Pc=n("Vectorization"),$c=p(),ma=a("li"),Qn=a("a"),Oc=n("Parallelization"),Fc=p(),yo=a("div"),y(Un.$$.fragment),xc=p(),y(wo.$$.fragment),this.h()},l(o){const g=ju('[data-svelte="svelte-1phssyn"]',document.head);c=r(g,"META",{name:!0,content:!0}),g.forEach(t),v=u(o),_=r(o,"H1",{class:!0});var Bn=i(_);f=r(Bn,"A",{id:!0,class:!0,href:!0});var ga=i(f);T=r(ga,"SPAN",{});var _a=i(T);w(l.$$.fragment,_a),_a.forEach(t),ga.forEach(t),h=u(Bn),M=r(Bn,"SPAN",{});var Ta=i(M);Ne=s(Ta,"OPT"),Ta.forEach(t),Bn.forEach(t),Fe=u(o),j=r(o,"H2",{class:!0});var Kn=i(j);te=r(Kn,"A",{id:!0,class:!0,href:!0});var va=i(te);ae=r(va,"SPAN",{});var ba=i(ae);w(F.$$.fragment,ba),ba.forEach(t),va.forEach(t),Se=u(Kn),R=r(Kn,"SPAN",{});var ya=i(R);De=s(ya,"Overview"),ya.forEach(t),Kn.forEach(t),xe=u(o),D=r(o,"P",{});var Vn=i(D);We=s(Vn,"The OPT model was proposed in "),re=r(Vn,"A",{href:!0,rel:!0});var wa=i(re);ie=s(wa,"Open Pre-trained Transformer Language Models"),wa.forEach(t),He=s(Vn,` by Meta AI.
OPT is a series of open-sourced large causal language models which perform similar in performance to GPT3.`),Vn.forEach(t),ze=u(o),K=r(o,"P",{});var ka=i(K);Qe=s(ka,"The abstract from the paper is the following:"),ka.forEach(t),Ee=u(o),V=r(o,"P",{});var Pa=i(V);ve=r(Pa,"EM",{});var $a=i(ve);Ue=s($a,"Large language models, which are often trained for hundreds of thousands of compute days, have shown remarkable capabilities for zero- and few-shot learning. Given their computational cost, these models are difficult to replicate without significant capital. For the few that are available through APIs, no access is granted to the full model weights, making them difficult to study. We present Open Pre-trained Transformers (OPT), a suite of decoder-only pre-trained transformers ranging from 125M to 175B parameters, which we aim to fully and responsibly share with interested researchers. We show that OPT-175B is comparable to GPT-3, while requiring only 1/7th the carbon footprint to develop. We are also releasing our logbook detailing the infrastructure challenges we faced, along with code for experimenting with all of the released models."),$a.forEach(t),Pa.forEach(t),fe=u(o),C=r(o,"P",{});var Oa=i(C);A=s(Oa,"Tips:"),Oa.forEach(t),Me=u(o),W=r(o,"UL",{});var Gn=i(W);le=r(Gn,"LI",{});var Rn=i(le);Be=s(Rn,"OPT has the same architecture as "),Z=r(Rn,"CODE",{});var qc=i(Z);Ke=s(qc,"BartDecoder"),qc.forEach(t),Ve=s(Rn,"."),Rn.forEach(t),L=u(Gn),I=r(Gn,"LI",{});var lt=i(I);de=s(lt,"Contrary to GPT2, OPT adds the EOS token "),be=r(lt,"CODE",{});var jc=i(be);Ge=s(jc,"</s>"),jc.forEach(t),ce=s(lt," to the beginning of every prompt. "),ye=r(lt,"STRONG",{});var Ac=i(ye);Re=s(Ac,"Note"),Ac.forEach(t),J=s(lt,": Make sure to pass "),we=r(lt,"CODE",{});var Lc=i(we);pe=s(Lc,"use_fast=False"),Lc.forEach(t),Ze=s(lt," when loading OPT\u2019s tokenizer with "),oe=r(lt,"A",{href:!0});var Ic=i(oe);N=s(Ic,"AutoTokenizer"),Ic.forEach(t),Je=s(lt," to get the correct tokenizer."),lt.forEach(t),Gn.forEach(t),H=u(o),q=r(o,"P",{});var dt=i(q);Ye=s(dt,"This model was contributed by "),b=r(dt,"A",{href:!0,rel:!0});var Nc=i(b);z=s(Nc,"Arthur Zucker"),Nc.forEach(t),_t=s(dt,", "),Y=r(dt,"A",{href:!0,rel:!0});var Sc=i(Y);Tt=s(Sc,"Younes Belkada"),Sc.forEach(t),vt=s(dt,", and "),E=r(dt,"A",{href:!0,rel:!0});var Dc=i(E);bt=s(Dc,"Patrick Von Platen"),Dc.forEach(t),yt=s(dt,`.
The original code can be found `),ke=r(dt,"A",{href:!0,rel:!0});var Wc=i(ke);wt=s(Wc,"here"),Wc.forEach(t),kt=s(dt,"."),dt.forEach(t),G=u(o),S=r(o,"H2",{class:!0});var tr=i(S);me=r(tr,"A",{id:!0,class:!0,href:!0});var Hc=i(me);Xe=r(Hc,"SPAN",{});var Qc=i(Xe);w(Q.$$.fragment,Qc),Qc.forEach(t),Hc.forEach(t),Pt=u(tr),et=r(tr,"SPAN",{});var Uc=i(et);tt=s(Uc,"Resources"),Uc.forEach(t),tr.forEach(t),nt=u(o),ne=r(o,"P",{});var Bc=i(ne);$t=s(Bc,`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.`),Bc.forEach(t),xa=u(o),w(zo.$$.fragment,o),za=u(o),se=r(o,"UL",{});var Ae=i(se);Eo=r(Ae,"LI",{});var or=i(Eo);jr=s(or,"A notebook on "),Mo=r(or,"A",{href:!0,rel:!0});var Kc=i(Mo);Ar=s(Kc,"fine-tuning OPT with PEFT, bitsandbytes, and Transformers"),Kc.forEach(t),Lr=s(or,". \u{1F30E}"),or.forEach(t),Ir=u(Ae),Co=r(Ae,"LI",{});var nr=i(Co);Nr=s(nr,"A blog post on "),qo=r(nr,"A",{href:!0,rel:!0});var Vc=i(qo);Sr=s(Vc,"decoding strategies with OPT"),Vc.forEach(t),Dr=s(nr,"."),nr.forEach(t),Wr=u(Ae),es=r(Ae,"LI",{});var zc=i(es);jo=r(zc,"A",{href:!0,rel:!0});var Gc=i(jo);Hr=s(Gc,"Causal language modeling"),Gc.forEach(t),Qr=s(zc," chapter of the \u{1F917} Hugging Face Course."),zc.forEach(t),Ur=u(Ae),st=r(Ae,"LI",{});var Zn=i(st);ts=r(Zn,"A",{href:!0});var Rc=i(ts);Br=s(Rc,"OPTForCausalLM"),Rc.forEach(t),Kr=s(Zn," is supported by this "),Ao=r(Zn,"A",{href:!0,rel:!0});var Zc=i(Ao);Vr=s(Zc,"causal language modeling example script"),Zc.forEach(t),Gr=s(Zn," and "),Lo=r(Zn,"A",{href:!0,rel:!0});var Jc=i(Lo);Rr=s(Jc,"notebook"),Jc.forEach(t),Zr=s(Zn,"."),Zn.forEach(t),Jr=u(Ae),at=r(Ae,"LI",{});var Jn=i(at);os=r(Jn,"A",{href:!0});var Yc=i(os);Yr=s(Yc,"TFOPTForCausalLM"),Yc.forEach(t),Xr=s(Jn," is supported by this "),Io=r(Jn,"A",{href:!0,rel:!0});var Xc=i(Io);ei=s(Xc,"causal language modeling example script"),Xc.forEach(t),ti=s(Jn," and "),No=r(Jn,"A",{href:!0,rel:!0});var ep=i(No);oi=s(ep,"notebook"),ep.forEach(t),ni=s(Jn,"."),Jn.forEach(t),si=u(Ae),Ut=r(Ae,"LI",{});var Fa=i(Ut);ns=r(Fa,"A",{href:!0});var tp=i(ns);ai=s(tp,"FlaxOPTForCausalLM"),tp.forEach(t),ri=s(Fa," is supported by this "),So=r(Fa,"A",{href:!0,rel:!0});var op=i(So);ii=s(op,"causal language modeling example script"),op.forEach(t),li=s(Fa,"."),Fa.forEach(t),Ae.forEach(t),Ea=u(o),w(Do.$$.fragment,o),Ma=u(o),Bt=r(o,"UL",{});var sr=i(Bt);qs=r(sr,"LI",{});var np=i(qs);ss=r(np,"A",{href:!0});var sp=i(ss);di=s(sp,"Text classification task guide"),sp.forEach(t),np.forEach(t),ci=u(sr),rt=r(sr,"LI",{});var Yn=i(rt);as=r(Yn,"A",{href:!0});var ap=i(as);pi=s(ap,"OPTForSequenceClassification"),ap.forEach(t),ui=s(Yn," is supported by this "),Wo=r(Yn,"A",{href:!0,rel:!0});var rp=i(Wo);hi=s(rp,"example script"),rp.forEach(t),fi=s(Yn," and "),Ho=r(Yn,"A",{href:!0,rel:!0});var ip=i(Ho);mi=s(ip,"notebook"),ip.forEach(t),gi=s(Yn,"."),Yn.forEach(t),sr.forEach(t),Ca=u(o),w(Qo.$$.fragment,o),qa=u(o),Kt=r(o,"UL",{});var ar=i(Kt);it=r(ar,"LI",{});var Xn=i(it);rs=r(Xn,"A",{href:!0});var lp=i(rs);_i=s(lp,"OPTForQuestionAnswering"),lp.forEach(t),Ti=s(Xn," is supported by this "),Uo=r(Xn,"A",{href:!0,rel:!0});var dp=i(Uo);vi=s(dp,"question answering example script"),dp.forEach(t),bi=s(Xn," and "),Bo=r(Xn,"A",{href:!0,rel:!0});var cp=i(Bo);yi=s(cp,"notebook"),cp.forEach(t),wi=s(Xn,"."),Xn.forEach(t),ki=u(ar),is=r(ar,"LI",{});var Ec=i(is);Ko=r(Ec,"A",{href:!0,rel:!0});var pp=i(Ko);Pi=s(pp,"Question answering"),pp.forEach(t),$i=s(Ec,` chapter
of the \u{1F917} Hugging Face Course.`),Ec.forEach(t),ar.forEach(t),ja=u(o),ls=r(o,"P",{});var up=i(ls);Oi=s(up,"\u26A1\uFE0F Inference"),up.forEach(t),Aa=u(o),ds=r(o,"UL",{});var hp=i(ds);Vo=r(hp,"LI",{});var rr=i(Vo);Fi=s(rr,"A blog post on "),Go=r(rr,"A",{href:!0,rel:!0});var fp=i(Go);xi=s(fp,"How \u{1F917} Accelerate runs very large models thanks to PyTorch"),fp.forEach(t),zi=s(rr," with OPT."),rr.forEach(t),hp.forEach(t),La=u(o),Ot=r(o,"H2",{class:!0});var ir=i(Ot);Vt=r(ir,"A",{id:!0,class:!0,href:!0});var mp=i(Vt);js=r(mp,"SPAN",{});var gp=i(js);w(Ro.$$.fragment,gp),gp.forEach(t),mp.forEach(t),Ei=u(ir),As=r(ir,"SPAN",{});var _p=i(As);Mi=s(_p,"OPTConfig"),_p.forEach(t),ir.forEach(t),Ia=u(o),Pe=r(o,"DIV",{class:!0});var ko=i(Pe);w(Zo.$$.fragment,ko),Ci=u(ko),Ft=r(ko,"P",{});var $s=i(Ft);qi=s($s,"This is the configuration class to store the configuration of a "),cs=r($s,"A",{href:!0});var Tp=i(cs);ji=s(Tp,"OPTModel"),Tp.forEach(t),Ai=s($s,`. 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
`),Jo=r($s,"A",{href:!0,rel:!0});var vp=i(Jo);Li=s(vp,"facebook/opt-350m"),vp.forEach(t),Ii=s($s," architecture."),$s.forEach(t),Ni=u(ko),xt=r(ko,"P",{});var Os=i(xt);Si=s(Os,"Configuration objects inherit from "),ps=r(Os,"A",{href:!0});var bp=i(ps);Di=s(bp,"PretrainedConfig"),bp.forEach(t),Wi=s(Os,` and can be used to control the model outputs. Read the
documentation from `),us=r(Os,"A",{href:!0});var yp=i(us);Hi=s(yp,"PretrainedConfig"),yp.forEach(t),Qi=s(Os," for more information."),Os.forEach(t),Ui=u(ko),w(Gt.$$.fragment,ko),ko.forEach(t),Na=u(o),zt=r(o,"H2",{class:!0});var lr=i(zt);Rt=r(lr,"A",{id:!0,class:!0,href:!0});var wp=i(Rt);Ls=r(wp,"SPAN",{});var kp=i(Ls);w(Yo.$$.fragment,kp),kp.forEach(t),wp.forEach(t),Bi=u(lr),Is=r(lr,"SPAN",{});var Pp=i(Is);Ki=s(Pp,"OPTModel"),Pp.forEach(t),lr.forEach(t),Sa=u(o),$e=r(o,"DIV",{class:!0});var Po=i($e);w(Xo.$$.fragment,Po),Vi=u(Po),en=r(Po,"P",{});var dr=i(en);Gi=s(dr,`The bare OPT Model outputting raw hidden-states without any specific head on top.
This model inherits from `),hs=r(dr,"A",{href:!0});var $p=i(hs);Ri=s($p,"PreTrainedModel"),$p.forEach(t),Zi=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),Ji=u(Po),tn=r(Po,"P",{});var cr=i(tn);Yi=s(cr,"This model is also a PyTorch "),on=r(cr,"A",{href:!0,rel:!0});var Op=i(on);Xi=s(Op,"torch.nn.Module"),Op.forEach(t),el=s(cr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),cr.forEach(t),tl=u(Po),Ce=r(Po,"DIV",{class:!0});var $o=i(Ce);w(nn.$$.fragment,$o),ol=u($o),Et=r($o,"P",{});var Fs=i(Et);nl=s(Fs,"The "),fs=r(Fs,"A",{href:!0});var Fp=i(fs);sl=s(Fp,"OPTModel"),Fp.forEach(t),al=s(Fs," forward method, overrides the "),Ns=r(Fs,"CODE",{});var xp=i(Ns);rl=s(xp,"__call__"),xp.forEach(t),il=s(Fs," special method."),Fs.forEach(t),ll=u($o),w(Zt.$$.fragment,$o),dl=u($o),w(Jt.$$.fragment,$o),$o.forEach(t),Po.forEach(t),Da=u(o),Mt=r(o,"H2",{class:!0});var pr=i(Mt);Yt=r(pr,"A",{id:!0,class:!0,href:!0});var zp=i(Yt);Ss=r(zp,"SPAN",{});var Ep=i(Ss);w(sn.$$.fragment,Ep),Ep.forEach(t),zp.forEach(t),cl=u(pr),Ds=r(pr,"SPAN",{});var Mp=i(Ds);pl=s(Mp,"OPTForCausalLM"),Mp.forEach(t),pr.forEach(t),Wa=u(o),Ct=r(o,"DIV",{class:!0});var ur=i(Ct);w(an.$$.fragment,ur),ul=u(ur),Xt=r(ur,"DIV",{class:!0});var hr=i(Xt);w(rn.$$.fragment,hr),hl=u(hr),w(eo.$$.fragment,hr),hr.forEach(t),ur.forEach(t),Ha=u(o),qt=r(o,"H2",{class:!0});var fr=i(qt);to=r(fr,"A",{id:!0,class:!0,href:!0});var Cp=i(to);Ws=r(Cp,"SPAN",{});var qp=i(Ws);w(ln.$$.fragment,qp),qp.forEach(t),Cp.forEach(t),fl=u(fr),Hs=r(fr,"SPAN",{});var jp=i(Hs);ml=s(jp,"TFOPTModel"),jp.forEach(t),fr.forEach(t),Qa=u(o),ue=r(o,"DIV",{class:!0});var ct=i(ue);w(dn.$$.fragment,ct),gl=u(ct),cn=r(ct,"P",{});var mr=i(cn);_l=s(mr,`The bare TF OPT Model outputting raw hidden-states without any specific head on top.
This model inherits from `),ms=r(mr,"A",{href:!0});var Ap=i(ms);Tl=s(Ap,"TFPreTrainedModel"),Ap.forEach(t),vl=s(mr,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),mr.forEach(t),bl=u(ct),pn=r(ct,"P",{});var gr=i(pn);yl=s(gr,"This model is also a "),un=r(gr,"A",{href:!0,rel:!0});var Lp=i(un);wl=s(Lp,"tf.keras.Model"),Lp.forEach(t),kl=s(gr,` 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.`),gr.forEach(t),Pl=u(ct),w(oo.$$.fragment,ct),$l=u(ct),qe=r(ct,"DIV",{class:!0});var Oo=i(qe);w(hn.$$.fragment,Oo),Ol=u(Oo),jt=r(Oo,"P",{});var xs=i(jt);Fl=s(xs,"The "),gs=r(xs,"A",{href:!0});var Ip=i(gs);xl=s(Ip,"TFOPTModel"),Ip.forEach(t),zl=s(xs," forward method, overrides the "),Qs=r(xs,"CODE",{});var Np=i(Qs);El=s(Np,"__call__"),Np.forEach(t),Ml=s(xs," special method."),xs.forEach(t),Cl=u(Oo),w(no.$$.fragment,Oo),ql=u(Oo),w(so.$$.fragment,Oo),Oo.forEach(t),ct.forEach(t),Ua=u(o),At=r(o,"H2",{class:!0});var _r=i(At);ao=r(_r,"A",{id:!0,class:!0,href:!0});var Sp=i(ao);Us=r(Sp,"SPAN",{});var Dp=i(Us);w(fn.$$.fragment,Dp),Dp.forEach(t),Sp.forEach(t),jl=u(_r),Bs=r(_r,"SPAN",{});var Wp=i(Bs);Al=s(Wp,"TFOPTForCausalLM"),Wp.forEach(t),_r.forEach(t),Ba=u(o),X=r(o,"DIV",{class:!0});var Le=i(X);w(mn.$$.fragment,Le),Ll=u(Le),Ks=r(Le,"P",{});var Hp=i(Ks);Il=s(Hp,"The OPT Model transformer with a language modeling head on top."),Hp.forEach(t),Nl=u(Le),gn=r(Le,"P",{});var Tr=i(gn);Sl=s(Tr,"This model inherits from "),_s=r(Tr,"A",{href:!0});var Qp=i(_s);Dl=s(Qp,"TFPreTrainedModel"),Qp.forEach(t),Wl=s(Tr,`. 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.)`),Tr.forEach(t),Hl=u(Le),_n=r(Le,"P",{});var vr=i(_n);Ql=s(vr,"This model is also a "),Tn=r(vr,"A",{href:!0,rel:!0});var Up=i(Tn);Ul=s(Up,"tf.keras.Model"),Up.forEach(t),Bl=s(vr,` 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.`),vr.forEach(t),Kl=u(Le),w(ro.$$.fragment,Le),Vl=u(Le),io=r(Le,"DIV",{class:!0});var br=i(io);w(vn.$$.fragment,br),Gl=u(br),w(lo.$$.fragment,br),br.forEach(t),Le.forEach(t),Ka=u(o),Lt=r(o,"H2",{class:!0});var yr=i(Lt);co=r(yr,"A",{id:!0,class:!0,href:!0});var Bp=i(co);Vs=r(Bp,"SPAN",{});var Kp=i(Vs);w(bn.$$.fragment,Kp),Kp.forEach(t),Bp.forEach(t),Rl=u(yr),Gs=r(yr,"SPAN",{});var Vp=i(Gs);Zl=s(Vp,"OPTForSequenceClassification"),Vp.forEach(t),yr.forEach(t),Va=u(o),U=r(o,"DIV",{class:!0});var _e=i(U);w(yn.$$.fragment,_e),Jl=u(_e),Rs=r(_e,"P",{});var Gp=i(Rs);Yl=s(Gp,"The OPT Model transformer with a sequence classification head on top (linear layer)."),Gp.forEach(t),Xl=u(_e),Ts=r(_e,"P",{});var Mc=i(Ts);vs=r(Mc,"A",{href:!0});var Rp=i(vs);ed=s(Rp,"OPTForSequenceClassification"),Rp.forEach(t),td=s(Mc,` uses the last token in order to do the classification, as other causal models
(e.g. GPT-2) do.`),Mc.forEach(t),od=u(_e),Oe=r(_e,"P",{});var pt=i(Oe);nd=s(pt,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Zs=r(pt,"CODE",{});var Zp=i(Zs);sd=s(Zp,"pad_token_id"),Zp.forEach(t),ad=s(pt,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Js=r(pt,"CODE",{});var Jp=i(Js);rd=s(Jp,"pad_token_id"),Jp.forEach(t),id=s(pt,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Ys=r(pt,"CODE",{});var Yp=i(Ys);ld=s(Yp,"inputs_embeds"),Yp.forEach(t),dd=s(pt," are passed instead of "),Xs=r(pt,"CODE",{});var Xp=i(Xs);cd=s(Xp,"input_ids"),Xp.forEach(t),pd=s(pt,`, it does the same (take the last value in
each row of the batch).`),pt.forEach(t),ud=u(_e),wn=r(_e,"P",{});var wr=i(wn);hd=s(wr,"This model inherits from "),bs=r(wr,"A",{href:!0});var eu=i(bs);fd=s(eu,"PreTrainedModel"),eu.forEach(t),md=s(wr,`. 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.)`),wr.forEach(t),gd=u(_e),kn=r(_e,"P",{});var kr=i(kn);_d=s(kr,"This model is also a PyTorch "),Pn=r(kr,"A",{href:!0,rel:!0});var tu=i(Pn);Td=s(tu,"torch.nn.Module"),tu.forEach(t),vd=s(kr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),kr.forEach(t),bd=u(_e),ge=r(_e,"DIV",{class:!0});var ut=i(ge);w($n.$$.fragment,ut),yd=u(ut),It=r(ut,"P",{});var zs=i(It);wd=s(zs,"The "),ys=r(zs,"A",{href:!0});var ou=i(ys);kd=s(ou,"OPTForSequenceClassification"),ou.forEach(t),Pd=s(zs," forward method, overrides the "),ea=r(zs,"CODE",{});var nu=i(ea);$d=s(nu,"__call__"),nu.forEach(t),Od=s(zs," special method."),zs.forEach(t),Fd=u(ut),w(po.$$.fragment,ut),xd=u(ut),w(uo.$$.fragment,ut),zd=u(ut),w(ho.$$.fragment,ut),ut.forEach(t),_e.forEach(t),Ga=u(o),Nt=r(o,"H2",{class:!0});var Pr=i(Nt);fo=r(Pr,"A",{id:!0,class:!0,href:!0});var su=i(fo);ta=r(su,"SPAN",{});var au=i(ta);w(On.$$.fragment,au),au.forEach(t),su.forEach(t),Ed=u(Pr),oa=r(Pr,"SPAN",{});var ru=i(oa);Md=s(ru,"OPTForQuestionAnswering"),ru.forEach(t),Pr.forEach(t),Ra=u(o),he=r(o,"DIV",{class:!0});var ht=i(he);w(Fn.$$.fragment,ht),Cd=u(ht),St=r(ht,"P",{});var Es=i(St);qd=s(Es,`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 `),na=r(Es,"CODE",{});var iu=i(na);jd=s(iu,"span start logits"),iu.forEach(t),Ad=s(Es," and "),sa=r(Es,"CODE",{});var lu=i(sa);Ld=s(lu,"span end logits"),lu.forEach(t),Id=s(Es,")."),Es.forEach(t),Nd=u(ht),xn=r(ht,"P",{});var $r=i(xn);Sd=s($r,"This model inherits from "),ws=r($r,"A",{href:!0});var du=i(ws);Dd=s(du,"PreTrainedModel"),du.forEach(t),Wd=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),Hd=u(ht),zn=r(ht,"P",{});var Or=i(zn);Qd=s(Or,"This model is also a PyTorch "),En=r(Or,"A",{href:!0,rel:!0});var cu=i(En);Ud=s(cu,"torch.nn.Module"),cu.forEach(t),Bd=s(Or,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Or.forEach(t),Kd=u(ht),je=r(ht,"DIV",{class:!0});var Fo=i(je);w(Mn.$$.fragment,Fo),Vd=u(Fo),Dt=r(Fo,"P",{});var Ms=i(Dt);Gd=s(Ms,"The "),ks=r(Ms,"A",{href:!0});var pu=i(ks);Rd=s(pu,"OPTForQuestionAnswering"),pu.forEach(t),Zd=s(Ms," forward method, overrides the "),aa=r(Ms,"CODE",{});var uu=i(aa);Jd=s(uu,"__call__"),uu.forEach(t),Yd=s(Ms," special method."),Ms.forEach(t),Xd=u(Fo),w(mo.$$.fragment,Fo),ec=u(Fo),w(go.$$.fragment,Fo),Fo.forEach(t),ht.forEach(t),Za=u(o),Wt=r(o,"H2",{class:!0});var Fr=i(Wt);_o=r(Fr,"A",{id:!0,class:!0,href:!0});var hu=i(_o);ra=r(hu,"SPAN",{});var fu=i(ra);w(Cn.$$.fragment,fu),fu.forEach(t),hu.forEach(t),tc=u(Fr),ia=r(Fr,"SPAN",{});var mu=i(ia);oc=s(mu,"FlaxOPTModel"),mu.forEach(t),Fr.forEach(t),Ja=u(o),Ht=r(o,"DIV",{class:!0});var xr=i(Ht);w(qn.$$.fragment,xr),nc=u(xr),To=r(xr,"DIV",{class:!0});var zr=i(To);w(jn.$$.fragment,zr),sc=u(zr),w(vo.$$.fragment,zr),zr.forEach(t),xr.forEach(t),Ya=u(o),Qt=r(o,"H2",{class:!0});var Er=i(Qt);bo=r(Er,"A",{id:!0,class:!0,href:!0});var gu=i(bo);la=r(gu,"SPAN",{});var _u=i(la);w(An.$$.fragment,_u),_u.forEach(t),gu.forEach(t),ac=u(Er),da=r(Er,"SPAN",{});var Tu=i(da);rc=s(Tu,"FlaxOPTForCausalLM"),Tu.forEach(t),Er.forEach(t),Xa=u(o),B=r(o,"DIV",{class:!0});var Te=i(B);w(Ln.$$.fragment,Te),ic=u(Te),ca=r(Te,"P",{});var vu=i(ca);lc=s(vu,`OPT Model with a language modeling head on top (linear layer with weights tied to the input embeddings) e.g for
autoregressive tasks.`),vu.forEach(t),dc=u(Te),In=r(Te,"P",{});var Mr=i(In);cc=s(Mr,"This model inherits from "),Ps=r(Mr,"A",{href:!0});var bu=i(Ps);pc=s(bu,"FlaxPreTrainedModel"),bu.forEach(t),uc=s(Mr,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Mr.forEach(t),hc=u(Te),Nn=r(Te,"P",{});var Cr=i(Nn);fc=s(Cr,`This model is also a Flax Linen
`),Sn=r(Cr,"A",{href:!0,rel:!0});var yu=i(Sn);mc=s(yu,"flax.nn.Module"),yu.forEach(t),gc=s(Cr,` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),Cr.forEach(t),_c=u(Te),pa=r(Te,"P",{});var wu=i(pa);Tc=s(wu,"Finally, this model supports inherent JAX features such as:"),wu.forEach(t),vc=u(Te),ot=r(Te,"UL",{});var xo=i(ot);ua=r(xo,"LI",{});var ku=i(ua);Dn=r(ku,"A",{href:!0,rel:!0});var Pu=i(Dn);bc=s(Pu,"Just-In-Time (JIT) compilation"),Pu.forEach(t),ku.forEach(t),yc=u(xo),ha=r(xo,"LI",{});var $u=i(ha);Wn=r($u,"A",{href:!0,rel:!0});var Ou=i(Wn);wc=s(Ou,"Automatic Differentiation"),Ou.forEach(t),$u.forEach(t),kc=u(xo),fa=r(xo,"LI",{});var Fu=i(fa);Hn=r(Fu,"A",{href:!0,rel:!0});var xu=i(Hn);Pc=s(xu,"Vectorization"),xu.forEach(t),Fu.forEach(t),$c=u(xo),ma=r(xo,"LI",{});var zu=i(ma);Qn=r(zu,"A",{href:!0,rel:!0});var Eu=i(Qn);Oc=s(Eu,"Parallelization"),Eu.forEach(t),zu.forEach(t),xo.forEach(t),Fc=u(Te),yo=r(Te,"DIV",{class:!0});var qr=i(yo);w(Un.$$.fragment,qr),xc=u(qr),w(wo.$$.fragment,qr),qr.forEach(t),Te.forEach(t),this.h()},h(){d(c,"name","hf:doc:metadata"),d(c,"content",JSON.stringify(Xu)),d(f,"id","opt"),d(f,"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(f,"href","#opt"),d(_,"class","relative group"),d(te,"id","overview"),d(te,"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(te,"href","#overview"),d(j,"class","relative group"),d(re,"href","https://arxiv.org/pdf/2205.01068"),d(re,"rel","nofollow"),d(oe,"href","/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoTokenizer"),d(b,"href","https://huggingface.co/ArthurZ"),d(b,"rel","nofollow"),d(Y,"href","https://huggingface.co/ybelkada"),d(Y,"rel","nofollow"),d(E,"href","https://huggingface.co/patrickvonplaten"),d(E,"rel","nofollow"),d(ke,"href","https://github.com/facebookresearch/metaseq"),d(ke,"rel","nofollow"),d(me,"id","resources"),d(me,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(me,"href","#resources"),d(S,"class","relative group"),d(Mo,"href","https://colab.research.google.com/drive/1jCkpikz0J2o20FBQmYmAGdiKmJGOMo-o?usp=sharing"),d(Mo,"rel","nofollow"),d(qo,"href","https://huggingface.co/blog/introducing-csearch#62-example-two---opt"),d(qo,"rel","nofollow"),d(jo,"href","https://huggingface.co/course/en/chapter7/6?fw=pt#training-a-causal-language-model-from-scratch"),d(jo,"rel","nofollow"),d(ts,"href","/docs/transformers/v4.29.0/en/model_doc/opt#transformers.OPTForCausalLM"),d(Ao,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/language-modeling#gpt-2gpt-and-causal-language-modeling"),d(Ao,"rel","nofollow"),d(Lo,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb"),d(Lo,"rel","nofollow"),d(os,"href","/docs/transformers/v4.29.0/en/model_doc/opt#transformers.TFOPTForCausalLM"),d(Io,"href","https://github.com/huggingface/transformers/tree/main/examples/tensorflow/language-modeling#run_clmpy"),d(Io,"rel","nofollow"),d(No,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb"),d(No,"rel","nofollow"),d(ns,"href","/docs/transformers/v4.29.0/en/model_doc/opt#transformers.FlaxOPTForCausalLM"),d(So,"href","https://github.com/huggingface/transformers/tree/main/examples/flax/language-modeling#causal-language-modeling"),d(So,"rel","nofollow"),d(ss,"href","sequence_classification.mdx"),d(as,"href","/docs/transformers/v4.29.0/en/model_doc/opt#transformers.OPTForSequenceClassification"),d(Wo,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification"),d(Wo,"rel","nofollow"),d(Ho,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification.ipynb"),d(Ho,"rel","nofollow"),d(rs,"href","/docs/transformers/v4.29.0/en/model_doc/opt#transformers.OPTForQuestionAnswering"),d(Uo,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering"),d(Uo,"rel","nofollow"),d(Bo,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering.ipynb"),d(Bo,"rel","nofollow"),d(Ko,"href","https://huggingface.co/course/chapter7/7?fw=pt"),d(Ko,"rel","nofollow"),d(Go,"href","https://huggingface.co/blog/accelerate-large-models"),d(Go,"rel","nofollow"),d(Vt,"id","transformers.OPTConfig"),d(Vt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Vt,"href","#transformers.OPTConfig"),d(Ot,"class","relative group"),d(cs,"href","/docs/transformers/v4.29.0/en/model_doc/opt#transformers.OPTModel"),d(Jo,"href","https://huggingface.co/facebook/opt-350m"),d(Jo,"rel","nofollow"),d(ps,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(us,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),d(Pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Rt,"id","transformers.OPTModel"),d(Rt,"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(Rt,"href","#transformers.OPTModel"),d(zt,"class","relative group"),d(hs,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),d(on,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(on,"rel","nofollow"),d(fs,"href","/docs/transformers/v4.29.0/en/model_doc/opt#transformers.OPTModel"),d(Ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(Yt,"id","transformers.OPTForCausalLM"),d(Yt,"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(Yt,"href","#transformers.OPTForCausalLM"),d(Mt,"class","relative group"),d(Xt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ct,"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.TFOPTModel"),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.TFOPTModel"),d(qt,"class","relative group"),d(ms,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.TFPreTrainedModel"),d(un,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),d(un,"rel","nofollow"),d(gs,"href","/docs/transformers/v4.29.0/en/model_doc/opt#transformers.TFOPTModel"),d(qe,"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(ao,"id","transformers.TFOPTForCausalLM"),d(ao,"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(ao,"href","#transformers.TFOPTForCausalLM"),d(At,"class","relative group"),d(_s,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.TFPreTrainedModel"),d(Tn,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),d(Tn,"rel","nofollow"),d(io,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(co,"id","transformers.OPTForSequenceClassification"),d(co,"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(co,"href","#transformers.OPTForSequenceClassification"),d(Lt,"class","relative group"),d(vs,"href","/docs/transformers/v4.29.0/en/model_doc/opt#transformers.OPTForSequenceClassification"),d(bs,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),d(Pn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(Pn,"rel","nofollow"),d(ys,"href","/docs/transformers/v4.29.0/en/model_doc/opt#transformers.OPTForSequenceClassification"),d(ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(U,"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.OPTForQuestionAnswering"),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.OPTForQuestionAnswering"),d(Nt,"class","relative group"),d(ws,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),d(En,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(En,"rel","nofollow"),d(ks,"href","/docs/transformers/v4.29.0/en/model_doc/opt#transformers.OPTForQuestionAnswering"),d(je,"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(_o,"id","transformers.FlaxOPTModel"),d(_o,"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(_o,"href","#transformers.FlaxOPTModel"),d(Wt,"class","relative group"),d(To,"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,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(bo,"id","transformers.FlaxOPTForCausalLM"),d(bo,"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(bo,"href","#transformers.FlaxOPTForCausalLM"),d(Qt,"class","relative group"),d(Ps,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.FlaxPreTrainedModel"),d(Sn,"href","https://flax.readthedocs.io/en/latest/_autosummary/flax.nn.module.html"),d(Sn,"rel","nofollow"),d(Dn,"href","https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit"),d(Dn,"rel","nofollow"),d(Wn,"href","https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation"),d(Wn,"rel","nofollow"),d(Hn,"href","https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap"),d(Hn,"rel","nofollow"),d(Qn,"href","https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap"),d(Qn,"rel","nofollow"),d(yo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(B,"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),m(o,v,g),m(o,_,g),e(_,f),e(f,T),k(l,T,null),e(_,h),e(_,M),e(M,Ne),m(o,Fe,g),m(o,j,g),e(j,te),e(te,ae),k(F,ae,null),e(j,Se),e(j,R),e(R,De),m(o,xe,g),m(o,D,g),e(D,We),e(D,re),e(re,ie),e(D,He),m(o,ze,g),m(o,K,g),e(K,Qe),m(o,Ee,g),m(o,V,g),e(V,ve),e(ve,Ue),m(o,fe,g),m(o,C,g),e(C,A),m(o,Me,g),m(o,W,g),e(W,le),e(le,Be),e(le,Z),e(Z,Ke),e(le,Ve),e(W,L),e(W,I),e(I,de),e(I,be),e(be,Ge),e(I,ce),e(I,ye),e(ye,Re),e(I,J),e(I,we),e(we,pe),e(I,Ze),e(I,oe),e(oe,N),e(I,Je),m(o,H,g),m(o,q,g),e(q,Ye),e(q,b),e(b,z),e(q,_t),e(q,Y),e(Y,Tt),e(q,vt),e(q,E),e(E,bt),e(q,yt),e(q,ke),e(ke,wt),e(q,kt),m(o,G,g),m(o,S,g),e(S,me),e(me,Xe),k(Q,Xe,null),e(S,Pt),e(S,et),e(et,tt),m(o,nt,g),m(o,ne,g),e(ne,$t),m(o,xa,g),k(zo,o,g),m(o,za,g),m(o,se,g),e(se,Eo),e(Eo,jr),e(Eo,Mo),e(Mo,Ar),e(Eo,Lr),e(se,Ir),e(se,Co),e(Co,Nr),e(Co,qo),e(qo,Sr),e(Co,Dr),e(se,Wr),e(se,es),e(es,jo),e(jo,Hr),e(es,Qr),e(se,Ur),e(se,st),e(st,ts),e(ts,Br),e(st,Kr),e(st,Ao),e(Ao,Vr),e(st,Gr),e(st,Lo),e(Lo,Rr),e(st,Zr),e(se,Jr),e(se,at),e(at,os),e(os,Yr),e(at,Xr),e(at,Io),e(Io,ei),e(at,ti),e(at,No),e(No,oi),e(at,ni),e(se,si),e(se,Ut),e(Ut,ns),e(ns,ai),e(Ut,ri),e(Ut,So),e(So,ii),e(Ut,li),m(o,Ea,g),k(Do,o,g),m(o,Ma,g),m(o,Bt,g),e(Bt,qs),e(qs,ss),e(ss,di),e(Bt,ci),e(Bt,rt),e(rt,as),e(as,pi),e(rt,ui),e(rt,Wo),e(Wo,hi),e(rt,fi),e(rt,Ho),e(Ho,mi),e(rt,gi),m(o,Ca,g),k(Qo,o,g),m(o,qa,g),m(o,Kt,g),e(Kt,it),e(it,rs),e(rs,_i),e(it,Ti),e(it,Uo),e(Uo,vi),e(it,bi),e(it,Bo),e(Bo,yi),e(it,wi),e(Kt,ki),e(Kt,is),e(is,Ko),e(Ko,Pi),e(is,$i),m(o,ja,g),m(o,ls,g),e(ls,Oi),m(o,Aa,g),m(o,ds,g),e(ds,Vo),e(Vo,Fi),e(Vo,Go),e(Go,xi),e(Vo,zi),m(o,La,g),m(o,Ot,g),e(Ot,Vt),e(Vt,js),k(Ro,js,null),e(Ot,Ei),e(Ot,As),e(As,Mi),m(o,Ia,g),m(o,Pe,g),k(Zo,Pe,null),e(Pe,Ci),e(Pe,Ft),e(Ft,qi),e(Ft,cs),e(cs,ji),e(Ft,Ai),e(Ft,Jo),e(Jo,Li),e(Ft,Ii),e(Pe,Ni),e(Pe,xt),e(xt,Si),e(xt,ps),e(ps,Di),e(xt,Wi),e(xt,us),e(us,Hi),e(xt,Qi),e(Pe,Ui),k(Gt,Pe,null),m(o,Na,g),m(o,zt,g),e(zt,Rt),e(Rt,Ls),k(Yo,Ls,null),e(zt,Bi),e(zt,Is),e(Is,Ki),m(o,Sa,g),m(o,$e,g),k(Xo,$e,null),e($e,Vi),e($e,en),e(en,Gi),e(en,hs),e(hs,Ri),e(en,Zi),e($e,Ji),e($e,tn),e(tn,Yi),e(tn,on),e(on,Xi),e(tn,el),e($e,tl),e($e,Ce),k(nn,Ce,null),e(Ce,ol),e(Ce,Et),e(Et,nl),e(Et,fs),e(fs,sl),e(Et,al),e(Et,Ns),e(Ns,rl),e(Et,il),e(Ce,ll),k(Zt,Ce,null),e(Ce,dl),k(Jt,Ce,null),m(o,Da,g),m(o,Mt,g),e(Mt,Yt),e(Yt,Ss),k(sn,Ss,null),e(Mt,cl),e(Mt,Ds),e(Ds,pl),m(o,Wa,g),m(o,Ct,g),k(an,Ct,null),e(Ct,ul),e(Ct,Xt),k(rn,Xt,null),e(Xt,hl),k(eo,Xt,null),m(o,Ha,g),m(o,qt,g),e(qt,to),e(to,Ws),k(ln,Ws,null),e(qt,fl),e(qt,Hs),e(Hs,ml),m(o,Qa,g),m(o,ue,g),k(dn,ue,null),e(ue,gl),e(ue,cn),e(cn,_l),e(cn,ms),e(ms,Tl),e(cn,vl),e(ue,bl),e(ue,pn),e(pn,yl),e(pn,un),e(un,wl),e(pn,kl),e(ue,Pl),k(oo,ue,null),e(ue,$l),e(ue,qe),k(hn,qe,null),e(qe,Ol),e(qe,jt),e(jt,Fl),e(jt,gs),e(gs,xl),e(jt,zl),e(jt,Qs),e(Qs,El),e(jt,Ml),e(qe,Cl),k(no,qe,null),e(qe,ql),k(so,qe,null),m(o,Ua,g),m(o,At,g),e(At,ao),e(ao,Us),k(fn,Us,null),e(At,jl),e(At,Bs),e(Bs,Al),m(o,Ba,g),m(o,X,g),k(mn,X,null),e(X,Ll),e(X,Ks),e(Ks,Il),e(X,Nl),e(X,gn),e(gn,Sl),e(gn,_s),e(_s,Dl),e(gn,Wl),e(X,Hl),e(X,_n),e(_n,Ql),e(_n,Tn),e(Tn,Ul),e(_n,Bl),e(X,Kl),k(ro,X,null),e(X,Vl),e(X,io),k(vn,io,null),e(io,Gl),k(lo,io,null),m(o,Ka,g),m(o,Lt,g),e(Lt,co),e(co,Vs),k(bn,Vs,null),e(Lt,Rl),e(Lt,Gs),e(Gs,Zl),m(o,Va,g),m(o,U,g),k(yn,U,null),e(U,Jl),e(U,Rs),e(Rs,Yl),e(U,Xl),e(U,Ts),e(Ts,vs),e(vs,ed),e(Ts,td),e(U,od),e(U,Oe),e(Oe,nd),e(Oe,Zs),e(Zs,sd),e(Oe,ad),e(Oe,Js),e(Js,rd),e(Oe,id),e(Oe,Ys),e(Ys,ld),e(Oe,dd),e(Oe,Xs),e(Xs,cd),e(Oe,pd),e(U,ud),e(U,wn),e(wn,hd),e(wn,bs),e(bs,fd),e(wn,md),e(U,gd),e(U,kn),e(kn,_d),e(kn,Pn),e(Pn,Td),e(kn,vd),e(U,bd),e(U,ge),k($n,ge,null),e(ge,yd),e(ge,It),e(It,wd),e(It,ys),e(ys,kd),e(It,Pd),e(It,ea),e(ea,$d),e(It,Od),e(ge,Fd),k(po,ge,null),e(ge,xd),k(uo,ge,null),e(ge,zd),k(ho,ge,null),m(o,Ga,g),m(o,Nt,g),e(Nt,fo),e(fo,ta),k(On,ta,null),e(Nt,Ed),e(Nt,oa),e(oa,Md),m(o,Ra,g),m(o,he,g),k(Fn,he,null),e(he,Cd),e(he,St),e(St,qd),e(St,na),e(na,jd),e(St,Ad),e(St,sa),e(sa,Ld),e(St,Id),e(he,Nd),e(he,xn),e(xn,Sd),e(xn,ws),e(ws,Dd),e(xn,Wd),e(he,Hd),e(he,zn),e(zn,Qd),e(zn,En),e(En,Ud),e(zn,Bd),e(he,Kd),e(he,je),k(Mn,je,null),e(je,Vd),e(je,Dt),e(Dt,Gd),e(Dt,ks),e(ks,Rd),e(Dt,Zd),e(Dt,aa),e(aa,Jd),e(Dt,Yd),e(je,Xd),k(mo,je,null),e(je,ec),k(go,je,null),m(o,Za,g),m(o,Wt,g),e(Wt,_o),e(_o,ra),k(Cn,ra,null),e(Wt,tc),e(Wt,ia),e(ia,oc),m(o,Ja,g),m(o,Ht,g),k(qn,Ht,null),e(Ht,nc),e(Ht,To),k(jn,To,null),e(To,sc),k(vo,To,null),m(o,Ya,g),m(o,Qt,g),e(Qt,bo),e(bo,la),k(An,la,null),e(Qt,ac),e(Qt,da),e(da,rc),m(o,Xa,g),m(o,B,g),k(Ln,B,null),e(B,ic),e(B,ca),e(ca,lc),e(B,dc),e(B,In),e(In,cc),e(In,Ps),e(Ps,pc),e(In,uc),e(B,hc),e(B,Nn),e(Nn,fc),e(Nn,Sn),e(Sn,mc),e(Nn,gc),e(B,_c),e(B,pa),e(pa,Tc),e(B,vc),e(B,ot),e(ot,ua),e(ua,Dn),e(Dn,bc),e(ot,yc),e(ot,ha),e(ha,Wn),e(Wn,wc),e(ot,kc),e(ot,fa),e(fa,Hn),e(Hn,Pc),e(ot,$c),e(ot,ma),e(ma,Qn),e(Qn,Oc),e(B,Fc),e(B,yo),k(Un,yo,null),e(yo,xc),k(wo,yo,null),er=!0},p(o,[g]){const Bn={};g&2&&(Bn.$$scope={dirty:g,ctx:o}),Gt.$set(Bn);const ga={};g&2&&(ga.$$scope={dirty:g,ctx:o}),Zt.$set(ga);const _a={};g&2&&(_a.$$scope={dirty:g,ctx:o}),Jt.$set(_a);const Ta={};g&2&&(Ta.$$scope={dirty:g,ctx:o}),eo.$set(Ta);const Kn={};g&2&&(Kn.$$scope={dirty:g,ctx:o}),oo.$set(Kn);const va={};g&2&&(va.$$scope={dirty:g,ctx:o}),no.$set(va);const ba={};g&2&&(ba.$$scope={dirty:g,ctx:o}),so.$set(ba);const ya={};g&2&&(ya.$$scope={dirty:g,ctx:o}),ro.$set(ya);const Vn={};g&2&&(Vn.$$scope={dirty:g,ctx:o}),lo.$set(Vn);const wa={};g&2&&(wa.$$scope={dirty:g,ctx:o}),po.$set(wa);const ka={};g&2&&(ka.$$scope={dirty:g,ctx:o}),uo.$set(ka);const Pa={};g&2&&(Pa.$$scope={dirty:g,ctx:o}),ho.$set(Pa);const $a={};g&2&&($a.$$scope={dirty:g,ctx:o}),mo.$set($a);const Oa={};g&2&&(Oa.$$scope={dirty:g,ctx:o}),go.$set(Oa);const Gn={};g&2&&(Gn.$$scope={dirty:g,ctx:o}),vo.$set(Gn);const Rn={};g&2&&(Rn.$$scope={dirty:g,ctx:o}),wo.$set(Rn)},i(o){er||(P(l.$$.fragment,o),P(F.$$.fragment,o),P(Q.$$.fragment,o),P(zo.$$.fragment,o),P(Do.$$.fragment,o),P(Qo.$$.fragment,o),P(Ro.$$.fragment,o),P(Zo.$$.fragment,o),P(Gt.$$.fragment,o),P(Yo.$$.fragment,o),P(Xo.$$.fragment,o),P(nn.$$.fragment,o),P(Zt.$$.fragment,o),P(Jt.$$.fragment,o),P(sn.$$.fragment,o),P(an.$$.fragment,o),P(rn.$$.fragment,o),P(eo.$$.fragment,o),P(ln.$$.fragment,o),P(dn.$$.fragment,o),P(oo.$$.fragment,o),P(hn.$$.fragment,o),P(no.$$.fragment,o),P(so.$$.fragment,o),P(fn.$$.fragment,o),P(mn.$$.fragment,o),P(ro.$$.fragment,o),P(vn.$$.fragment,o),P(lo.$$.fragment,o),P(bn.$$.fragment,o),P(yn.$$.fragment,o),P($n.$$.fragment,o),P(po.$$.fragment,o),P(uo.$$.fragment,o),P(ho.$$.fragment,o),P(On.$$.fragment,o),P(Fn.$$.fragment,o),P(Mn.$$.fragment,o),P(mo.$$.fragment,o),P(go.$$.fragment,o),P(Cn.$$.fragment,o),P(qn.$$.fragment,o),P(jn.$$.fragment,o),P(vo.$$.fragment,o),P(An.$$.fragment,o),P(Ln.$$.fragment,o),P(Un.$$.fragment,o),P(wo.$$.fragment,o),er=!0)},o(o){$(l.$$.fragment,o),$(F.$$.fragment,o),$(Q.$$.fragment,o),$(zo.$$.fragment,o),$(Do.$$.fragment,o),$(Qo.$$.fragment,o),$(Ro.$$.fragment,o),$(Zo.$$.fragment,o),$(Gt.$$.fragment,o),$(Yo.$$.fragment,o),$(Xo.$$.fragment,o),$(nn.$$.fragment,o),$(Zt.$$.fragment,o),$(Jt.$$.fragment,o),$(sn.$$.fragment,o),$(an.$$.fragment,o),$(rn.$$.fragment,o),$(eo.$$.fragment,o),$(ln.$$.fragment,o),$(dn.$$.fragment,o),$(oo.$$.fragment,o),$(hn.$$.fragment,o),$(no.$$.fragment,o),$(so.$$.fragment,o),$(fn.$$.fragment,o),$(mn.$$.fragment,o),$(ro.$$.fragment,o),$(vn.$$.fragment,o),$(lo.$$.fragment,o),$(bn.$$.fragment,o),$(yn.$$.fragment,o),$($n.$$.fragment,o),$(po.$$.fragment,o),$(uo.$$.fragment,o),$(ho.$$.fragment,o),$(On.$$.fragment,o),$(Fn.$$.fragment,o),$(Mn.$$.fragment,o),$(mo.$$.fragment,o),$(go.$$.fragment,o),$(Cn.$$.fragment,o),$(qn.$$.fragment,o),$(jn.$$.fragment,o),$(vo.$$.fragment,o),$(An.$$.fragment,o),$(Ln.$$.fragment,o),$(Un.$$.fragment,o),$(wo.$$.fragment,o),er=!1},d(o){t(c),o&&t(v),o&&t(_),O(l),o&&t(Fe),o&&t(j),O(F),o&&t(xe),o&&t(D),o&&t(ze),o&&t(K),o&&t(Ee),o&&t(V),o&&t(fe),o&&t(C),o&&t(Me),o&&t(W),o&&t(H),o&&t(q),o&&t(G),o&&t(S),O(Q),o&&t(nt),o&&t(ne),o&&t(xa),O(zo,o),o&&t(za),o&&t(se),o&&t(Ea),O(Do,o),o&&t(Ma),o&&t(Bt),o&&t(Ca),O(Qo,o),o&&t(qa),o&&t(Kt),o&&t(ja),o&&t(ls),o&&t(Aa),o&&t(ds),o&&t(La),o&&t(Ot),O(Ro),o&&t(Ia),o&&t(Pe),O(Zo),O(Gt),o&&t(Na),o&&t(zt),O(Yo),o&&t(Sa),o&&t($e),O(Xo),O(nn),O(Zt),O(Jt),o&&t(Da),o&&t(Mt),O(sn),o&&t(Wa),o&&t(Ct),O(an),O(rn),O(eo),o&&t(Ha),o&&t(qt),O(ln),o&&t(Qa),o&&t(ue),O(dn),O(oo),O(hn),O(no),O(so),o&&t(Ua),o&&t(At),O(fn),o&&t(Ba),o&&t(X),O(mn),O(ro),O(vn),O(lo),o&&t(Ka),o&&t(Lt),O(bn),o&&t(Va),o&&t(U),O(yn),O($n),O(po),O(uo),O(ho),o&&t(Ga),o&&t(Nt),O(On),o&&t(Ra),o&&t(he),O(Fn),O(Mn),O(mo),O(go),o&&t(Za),o&&t(Wt),O(Cn),o&&t(Ja),o&&t(Ht),O(qn),O(jn),O(vo),o&&t(Ya),o&&t(Qt),O(An),o&&t(Xa),o&&t(B),O(Ln),O(Un),O(wo)}}}const Xu={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 eh(x){return Au(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class lh extends Mu{constructor(c){super();Cu(this,c,eh,Yu,qu,{})}}export{lh as default,Xu as metadata};
