import{S as Rk,i as Kk,s as Vk,e as a,k as p,w as v,t as n,M as Jk,c as r,d as t,m as h,a as i,x as k,h as s,b as m,G as e,g,y as w,q as $,o as P,B as M,v as Xk,L as ue}from"../../chunks/vendor-hf-doc-builder.js";import{T as ot}from"../../chunks/Tip-hf-doc-builder.js";import{D as O}from"../../chunks/Docstring-hf-doc-builder.js";import{C as me}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Me}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as he}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as Yk}from"../../chunks/PipelineTag-hf-doc-builder.js";function Qk(x){let d,b,f,u,_;return u=new me({props:{code:`from transformers import GPT2Config, GPT2Model

# Initializing a GPT2 configuration
configuration = GPT2Config()

# Initializing a model (with random weights) from the configuration
model = GPT2Model(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> GPT2Config, GPT2Model

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a GPT2 configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = GPT2Config()

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){d=a("p"),b=n("Example:"),f=p(),v(u.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"Example:"),c.forEach(t),f=h(l),k(u.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(u,l,c),_=!0},p:ue,i(l){_||($(u.$$.fragment,l),_=!0)},o(l){P(u.$$.fragment,l),_=!1},d(l){l&&t(d),l&&t(f),M(u,l)}}}function Zk(x){let d,b,f,u,_;return u=new me({props:{code:`from transformers import GPT2Tokenizer
tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
tokenizer("Hello world")['input_ids']
tokenizer(" Hello world")['input_ids']`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="language-python"><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPT2Tokenizer</span>
<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="language-python">tokenizer = GPT2Tokenizer.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)</span>
<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="language-python">tokenizer(<span class="hljs-string">&quot;Hello world&quot;</span>)[<span class="hljs-string">&#x27;input_ids&#x27;</span>]</span>
[15496, 995]
<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="language-python">tokenizer(<span class="hljs-string">&quot; Hello world&quot;</span>)[<span class="hljs-string">&#x27;input_ids&#x27;</span>]</span>
[18435, 995]`}}),{c(){d=a("p"),b=n("be encoded differently whether it is at the beginning of the sentence (without space) or not:"),f=p(),v(u.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"be encoded differently whether it is at the beginning of the sentence (without space) or not:"),c.forEach(t),f=h(l),k(u.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(u,l,c),_=!0},p:ue,i(l){_||($(u.$$.fragment,l),_=!0)},o(l){P(u.$$.fragment,l),_=!1},d(l){l&&t(d),l&&t(f),M(u,l)}}}function ew(x){let d,b,f,u,_;return{c(){d=a("p"),b=n("When used with "),f=a("code"),u=n("is_split_into_words=True"),_=n(", this tokenizer will add a space before each word (even the first one).")},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"When used with "),f=r(c,"CODE",{});var z=i(f);u=s(z,"is_split_into_words=True"),z.forEach(t),_=s(c,", this tokenizer will add a space before each word (even the first one)."),c.forEach(t)},m(l,c){g(l,d,c),e(d,b),e(d,f),e(f,u),e(d,_)},d(l){l&&t(d)}}}function tw(x){let d,b,f,u,_;return u=new me({props:{code:`from transformers import GPT2TokenizerFast
tokenizer = GPT2TokenizerFast.from_pretrained("gpt2")
tokenizer("Hello world")['input_ids']
tokenizer(" Hello world")['input_ids']`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="language-python"><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPT2TokenizerFast</span>
<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="language-python">tokenizer = GPT2TokenizerFast.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)</span>
<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="language-python">tokenizer(<span class="hljs-string">&quot;Hello world&quot;</span>)[<span class="hljs-string">&#x27;input_ids&#x27;</span>]</span>
[15496, 995]
<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="language-python">tokenizer(<span class="hljs-string">&quot; Hello world&quot;</span>)[<span class="hljs-string">&#x27;input_ids&#x27;</span>]</span>
[18435, 995]`}}),{c(){d=a("p"),b=n("be encoded differently whether it is at the beginning of the sentence (without space) or not:"),f=p(),v(u.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"be encoded differently whether it is at the beginning of the sentence (without space) or not:"),c.forEach(t),f=h(l),k(u.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(u,l,c),_=!0},p:ue,i(l){_||($(u.$$.fragment,l),_=!0)},o(l){P(u.$$.fragment,l),_=!1},d(l){l&&t(d),l&&t(f),M(u,l)}}}function ow(x){let d,b,f,u,_,l,c,z;return{c(){d=a("p"),b=n("When used with "),f=a("code"),u=n("is_split_into_words=True"),_=n(", this tokenizer needs to be instantiated with "),l=a("code"),c=n("add_prefix_space=True"),z=n(".")},l(ae){d=r(ae,"P",{});var K=i(d);b=s(K,"When used with "),f=r(K,"CODE",{});var H=i(f);u=s(H,"is_split_into_words=True"),H.forEach(t),_=s(K,", this tokenizer needs to be instantiated with "),l=r(K,"CODE",{});var J=i(l);c=s(J,"add_prefix_space=True"),J.forEach(t),z=s(K,"."),K.forEach(t)},m(ae,K){g(ae,d,K),e(d,b),e(d,f),e(f,u),e(d,_),e(d,l),e(l,c),e(d,z)},d(ae){ae&&t(d)}}}function nw(x){let d,b,f,u,_;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),u=n("Module"),_=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){d=r(l,"P",{});var c=i(d);b=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(c,"CODE",{});var z=i(f);u=s(z,"Module"),z.forEach(t),_=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(l,c){g(l,d,c),e(d,b),e(d,f),e(f,u),e(d,_)},d(l){l&&t(d)}}}function sw(x){let d,b,f,u,_;return u=new me({props:{code:`from transformers import AutoTokenizer, GPT2Model
import torch

tokenizer = AutoTokenizer.from_pretrained("gpt2")
model = GPT2Model.from_pretrained("gpt2")

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, GPT2Model
<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;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPT2Model.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){d=a("p"),b=n("Example:"),f=p(),v(u.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"Example:"),c.forEach(t),f=h(l),k(u.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(u,l,c),_=!0},p:ue,i(l){_||($(u.$$.fragment,l),_=!0)},o(l){P(u.$$.fragment,l),_=!1},d(l){l&&t(d),l&&t(f),M(u,l)}}}function aw(x){let d,b,f,u,_;return u=new me({props:{code:`# Here is an example of a device map on a machine with 4 GPUs using gpt2-xl, which has a total of 48 attention modules:
model = GPT2LMHeadModel.from_pretrained("gpt2-xl")
device_map = {
    0: [0, 1, 2, 3, 4, 5, 6, 7, 8],
    1: [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21],
    2: [22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34],
    3: [35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47],
}
model.parallelize(device_map)`,highlighted:`<span class="hljs-comment"># Here is an example of a device map on a machine with 4 GPUs using gpt2-xl, which has a total of 48 attention modules:</span>
model = GPT2LMHeadModel.from_pretrained(<span class="hljs-string">&quot;gpt2-xl&quot;</span>)
device_map = {
    <span class="hljs-number">0</span>: [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>, <span class="hljs-number">8</span>],
    <span class="hljs-number">1</span>: [<span class="hljs-number">9</span>, <span class="hljs-number">10</span>, <span class="hljs-number">11</span>, <span class="hljs-number">12</span>, <span class="hljs-number">13</span>, <span class="hljs-number">14</span>, <span class="hljs-number">15</span>, <span class="hljs-number">16</span>, <span class="hljs-number">17</span>, <span class="hljs-number">18</span>, <span class="hljs-number">19</span>, <span class="hljs-number">20</span>, <span class="hljs-number">21</span>],
    <span class="hljs-number">2</span>: [<span class="hljs-number">22</span>, <span class="hljs-number">23</span>, <span class="hljs-number">24</span>, <span class="hljs-number">25</span>, <span class="hljs-number">26</span>, <span class="hljs-number">27</span>, <span class="hljs-number">28</span>, <span class="hljs-number">29</span>, <span class="hljs-number">30</span>, <span class="hljs-number">31</span>, <span class="hljs-number">32</span>, <span class="hljs-number">33</span>, <span class="hljs-number">34</span>],
    <span class="hljs-number">3</span>: [<span class="hljs-number">35</span>, <span class="hljs-number">36</span>, <span class="hljs-number">37</span>, <span class="hljs-number">38</span>, <span class="hljs-number">39</span>, <span class="hljs-number">40</span>, <span class="hljs-number">41</span>, <span class="hljs-number">42</span>, <span class="hljs-number">43</span>, <span class="hljs-number">44</span>, <span class="hljs-number">45</span>, <span class="hljs-number">46</span>, <span class="hljs-number">47</span>],
}
model.parallelize(device_map)`}}),{c(){d=a("p"),b=n("Example:"),f=p(),v(u.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"Example:"),c.forEach(t),f=h(l),k(u.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(u,l,c),_=!0},p:ue,i(l){_||($(u.$$.fragment,l),_=!0)},o(l){P(u.$$.fragment,l),_=!1},d(l){l&&t(d),l&&t(f),M(u,l)}}}function rw(x){let d,b,f,u,_;return u=new me({props:{code:`# On a 4 GPU machine with gpt2-large:
model = GPT2LMHeadModel.from_pretrained("gpt2-large")
device_map = {
    0: [0, 1, 2, 3, 4, 5, 6, 7],
    1: [8, 9, 10, 11, 12, 13, 14, 15],
    2: [16, 17, 18, 19, 20, 21, 22, 23],
    3: [24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35],
}
model.parallelize(device_map)  # Splits the model across several devices
model.deparallelize()  # Put the model back on cpu and cleans memory by calling torch.cuda.empty_cache()`,highlighted:`<span class="hljs-comment"># On a 4 GPU machine with gpt2-large:</span>
model = GPT2LMHeadModel.from_pretrained(<span class="hljs-string">&quot;gpt2-large&quot;</span>)
device_map = {
    <span class="hljs-number">0</span>: [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>],
    <span class="hljs-number">1</span>: [<span class="hljs-number">8</span>, <span class="hljs-number">9</span>, <span class="hljs-number">10</span>, <span class="hljs-number">11</span>, <span class="hljs-number">12</span>, <span class="hljs-number">13</span>, <span class="hljs-number">14</span>, <span class="hljs-number">15</span>],
    <span class="hljs-number">2</span>: [<span class="hljs-number">16</span>, <span class="hljs-number">17</span>, <span class="hljs-number">18</span>, <span class="hljs-number">19</span>, <span class="hljs-number">20</span>, <span class="hljs-number">21</span>, <span class="hljs-number">22</span>, <span class="hljs-number">23</span>],
    <span class="hljs-number">3</span>: [<span class="hljs-number">24</span>, <span class="hljs-number">25</span>, <span class="hljs-number">26</span>, <span class="hljs-number">27</span>, <span class="hljs-number">28</span>, <span class="hljs-number">29</span>, <span class="hljs-number">30</span>, <span class="hljs-number">31</span>, <span class="hljs-number">32</span>, <span class="hljs-number">33</span>, <span class="hljs-number">34</span>, <span class="hljs-number">35</span>],
}
model.parallelize(device_map)  <span class="hljs-comment"># Splits the model across several devices</span>
model.deparallelize()  <span class="hljs-comment"># Put the model back on cpu and cleans memory by calling torch.cuda.empty_cache()</span>`}}),{c(){d=a("p"),b=n("Example:"),f=p(),v(u.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"Example:"),c.forEach(t),f=h(l),k(u.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(u,l,c),_=!0},p:ue,i(l){_||($(u.$$.fragment,l),_=!0)},o(l){P(u.$$.fragment,l),_=!1},d(l){l&&t(d),l&&t(f),M(u,l)}}}function iw(x){let d,b,f,u,_;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),u=n("Module"),_=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){d=r(l,"P",{});var c=i(d);b=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(c,"CODE",{});var z=i(f);u=s(z,"Module"),z.forEach(t),_=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(l,c){g(l,d,c),e(d,b),e(d,f),e(f,u),e(d,_)},d(l){l&&t(d)}}}function lw(x){let d,b,f,u,_;return u=new me({props:{code:`import torch
from transformers import AutoTokenizer, GPT2LMHeadModel

tokenizer = AutoTokenizer.from_pretrained("gpt2")
model = GPT2LMHeadModel.from_pretrained("gpt2")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs, labels=inputs["input_ids"])
loss = outputs.loss
logits = outputs.logits`,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, GPT2LMHeadModel

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPT2LMHeadModel.from_pretrained(<span class="hljs-string">&quot;gpt2&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, labels=inputs[<span class="hljs-string">&quot;input_ids&quot;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){d=a("p"),b=n("Example:"),f=p(),v(u.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"Example:"),c.forEach(t),f=h(l),k(u.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(u,l,c),_=!0},p:ue,i(l){_||($(u.$$.fragment,l),_=!0)},o(l){P(u.$$.fragment,l),_=!1},d(l){l&&t(d),l&&t(f),M(u,l)}}}function dw(x){let d,b,f,u,_;return u=new me({props:{code:`# Here is an example of a device map on a machine with 4 GPUs using gpt2-xl, which has a total of 48 attention modules:
model = GPT2LMHeadModel.from_pretrained("gpt2-xl")
device_map = {
    0: [0, 1, 2, 3, 4, 5, 6, 7, 8],
    1: [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21],
    2: [22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34],
    3: [35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47],
}
model.parallelize(device_map)`,highlighted:`<span class="hljs-comment"># Here is an example of a device map on a machine with 4 GPUs using gpt2-xl, which has a total of 48 attention modules:</span>
model = GPT2LMHeadModel.from_pretrained(<span class="hljs-string">&quot;gpt2-xl&quot;</span>)
device_map = {
    <span class="hljs-number">0</span>: [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>, <span class="hljs-number">8</span>],
    <span class="hljs-number">1</span>: [<span class="hljs-number">9</span>, <span class="hljs-number">10</span>, <span class="hljs-number">11</span>, <span class="hljs-number">12</span>, <span class="hljs-number">13</span>, <span class="hljs-number">14</span>, <span class="hljs-number">15</span>, <span class="hljs-number">16</span>, <span class="hljs-number">17</span>, <span class="hljs-number">18</span>, <span class="hljs-number">19</span>, <span class="hljs-number">20</span>, <span class="hljs-number">21</span>],
    <span class="hljs-number">2</span>: [<span class="hljs-number">22</span>, <span class="hljs-number">23</span>, <span class="hljs-number">24</span>, <span class="hljs-number">25</span>, <span class="hljs-number">26</span>, <span class="hljs-number">27</span>, <span class="hljs-number">28</span>, <span class="hljs-number">29</span>, <span class="hljs-number">30</span>, <span class="hljs-number">31</span>, <span class="hljs-number">32</span>, <span class="hljs-number">33</span>, <span class="hljs-number">34</span>],
    <span class="hljs-number">3</span>: [<span class="hljs-number">35</span>, <span class="hljs-number">36</span>, <span class="hljs-number">37</span>, <span class="hljs-number">38</span>, <span class="hljs-number">39</span>, <span class="hljs-number">40</span>, <span class="hljs-number">41</span>, <span class="hljs-number">42</span>, <span class="hljs-number">43</span>, <span class="hljs-number">44</span>, <span class="hljs-number">45</span>, <span class="hljs-number">46</span>, <span class="hljs-number">47</span>],
}
model.parallelize(device_map)`}}),{c(){d=a("p"),b=n("Example:"),f=p(),v(u.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"Example:"),c.forEach(t),f=h(l),k(u.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(u,l,c),_=!0},p:ue,i(l){_||($(u.$$.fragment,l),_=!0)},o(l){P(u.$$.fragment,l),_=!1},d(l){l&&t(d),l&&t(f),M(u,l)}}}function cw(x){let d,b,f,u,_;return u=new me({props:{code:`# On a 4 GPU machine with gpt2-large:
model = GPT2LMHeadModel.from_pretrained("gpt2-large")
device_map = {
    0: [0, 1, 2, 3, 4, 5, 6, 7],
    1: [8, 9, 10, 11, 12, 13, 14, 15],
    2: [16, 17, 18, 19, 20, 21, 22, 23],
    3: [24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35],
}
model.parallelize(device_map)  # Splits the model across several devices
model.deparallelize()  # Put the model back on cpu and cleans memory by calling torch.cuda.empty_cache()`,highlighted:`<span class="hljs-comment"># On a 4 GPU machine with gpt2-large:</span>
model = GPT2LMHeadModel.from_pretrained(<span class="hljs-string">&quot;gpt2-large&quot;</span>)
device_map = {
    <span class="hljs-number">0</span>: [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>],
    <span class="hljs-number">1</span>: [<span class="hljs-number">8</span>, <span class="hljs-number">9</span>, <span class="hljs-number">10</span>, <span class="hljs-number">11</span>, <span class="hljs-number">12</span>, <span class="hljs-number">13</span>, <span class="hljs-number">14</span>, <span class="hljs-number">15</span>],
    <span class="hljs-number">2</span>: [<span class="hljs-number">16</span>, <span class="hljs-number">17</span>, <span class="hljs-number">18</span>, <span class="hljs-number">19</span>, <span class="hljs-number">20</span>, <span class="hljs-number">21</span>, <span class="hljs-number">22</span>, <span class="hljs-number">23</span>],
    <span class="hljs-number">3</span>: [<span class="hljs-number">24</span>, <span class="hljs-number">25</span>, <span class="hljs-number">26</span>, <span class="hljs-number">27</span>, <span class="hljs-number">28</span>, <span class="hljs-number">29</span>, <span class="hljs-number">30</span>, <span class="hljs-number">31</span>, <span class="hljs-number">32</span>, <span class="hljs-number">33</span>, <span class="hljs-number">34</span>, <span class="hljs-number">35</span>],
}
model.parallelize(device_map)  <span class="hljs-comment"># Splits the model across several devices</span>
model.deparallelize()  <span class="hljs-comment"># Put the model back on cpu and cleans memory by calling torch.cuda.empty_cache()</span>`}}),{c(){d=a("p"),b=n("Example:"),f=p(),v(u.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"Example:"),c.forEach(t),f=h(l),k(u.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(u,l,c),_=!0},p:ue,i(l){_||($(u.$$.fragment,l),_=!0)},o(l){P(u.$$.fragment,l),_=!1},d(l){l&&t(d),l&&t(f),M(u,l)}}}function pw(x){let d,b,f,u,_;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),u=n("Module"),_=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){d=r(l,"P",{});var c=i(d);b=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(c,"CODE",{});var z=i(f);u=s(z,"Module"),z.forEach(t),_=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(l,c){g(l,d,c),e(d,b),e(d,f),e(f,u),e(d,_)},d(l){l&&t(d)}}}function hw(x){let d,b,f,u,_;return u=new me({props:{code:`import torch
from transformers import AutoTokenizer, GPT2DoubleHeadsModel

tokenizer = AutoTokenizer.from_pretrained("gpt2")
model = GPT2DoubleHeadsModel.from_pretrained("gpt2")

# Add a [CLS] to the vocabulary (we should train it also!)
num_added_tokens = tokenizer.add_special_tokens({"cls_token": "[CLS]"})
# Update the model embeddings with the new vocabulary size
embedding_layer = model.resize_token_embeddings(len(tokenizer))

choices = ["Hello, my dog is cute [CLS]", "Hello, my cat is cute [CLS]"]
encoded_choices = [tokenizer.encode(s) for s in choices]
cls_token_location = [tokens.index(tokenizer.cls_token_id) for tokens in encoded_choices]

input_ids = torch.tensor(encoded_choices).unsqueeze(0)  # Batch size: 1, number of choices: 2
mc_token_ids = torch.tensor([cls_token_location])  # Batch size: 1

outputs = model(input_ids, mc_token_ids=mc_token_ids)
lm_logits = outputs.logits
mc_logits = outputs.mc_logits`,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, GPT2DoubleHeadsModel

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPT2DoubleHeadsModel.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Add a [CLS] to the vocabulary (we should train it also!)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_added_tokens = tokenizer.add_special_tokens({<span class="hljs-string">&quot;cls_token&quot;</span>: <span class="hljs-string">&quot;[CLS]&quot;</span>})
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Update the model embeddings with the new vocabulary size</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>embedding_layer = model.resize_token_embeddings(<span class="hljs-built_in">len</span>(tokenizer))

<span class="hljs-meta">&gt;&gt;&gt; </span>choices = [<span class="hljs-string">&quot;Hello, my dog is cute [CLS]&quot;</span>, <span class="hljs-string">&quot;Hello, my cat is cute [CLS]&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>encoded_choices = [tokenizer.encode(s) <span class="hljs-keyword">for</span> s <span class="hljs-keyword">in</span> choices]
<span class="hljs-meta">&gt;&gt;&gt; </span>cls_token_location = [tokens.index(tokenizer.cls_token_id) <span class="hljs-keyword">for</span> tokens <span class="hljs-keyword">in</span> encoded_choices]

<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = torch.tensor(encoded_choices).unsqueeze(<span class="hljs-number">0</span>)  <span class="hljs-comment"># Batch size: 1, number of choices: 2</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>mc_token_ids = torch.tensor([cls_token_location])  <span class="hljs-comment"># Batch size: 1</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids, mc_token_ids=mc_token_ids)
<span class="hljs-meta">&gt;&gt;&gt; </span>lm_logits = outputs.logits
<span class="hljs-meta">&gt;&gt;&gt; </span>mc_logits = outputs.mc_logits`}}),{c(){d=a("p"),b=n("Example:"),f=p(),v(u.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"Example:"),c.forEach(t),f=h(l),k(u.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(u,l,c),_=!0},p:ue,i(l){_||($(u.$$.fragment,l),_=!0)},o(l){P(u.$$.fragment,l),_=!1},d(l){l&&t(d),l&&t(f),M(u,l)}}}function uw(x){let d,b,f,u,_;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),u=n("Module"),_=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){d=r(l,"P",{});var c=i(d);b=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(c,"CODE",{});var z=i(f);u=s(z,"Module"),z.forEach(t),_=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(l,c){g(l,d,c),e(d,b),e(d,f),e(f,u),e(d,_)},d(l){l&&t(d)}}}function mw(x){let d,b,f,u,_;return u=new me({props:{code:`import torch
from transformers import AutoTokenizer, GPT2ForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("microsoft/DialogRPT-updown")
model = GPT2ForSequenceClassification.from_pretrained("microsoft/DialogRPT-updown")

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

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

predicted_class_id = logits.argmax().item()

# 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 = GPT2ForSequenceClassification.from_pretrained("microsoft/DialogRPT-updown", num_labels=num_labels)

labels = torch.tensor([1])
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, GPT2ForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;microsoft/DialogRPT-updown&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPT2ForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;microsoft/DialogRPT-updown&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><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 = GPT2ForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;microsoft/DialogRPT-updown&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`}}),{c(){d=a("p"),b=n("Example of single-label classification:"),f=p(),v(u.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"Example of single-label classification:"),c.forEach(t),f=h(l),k(u.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(u,l,c),_=!0},p:ue,i(l){_||($(u.$$.fragment,l),_=!0)},o(l){P(u.$$.fragment,l),_=!1},d(l){l&&t(d),l&&t(f),M(u,l)}}}function fw(x){let d,b,f,u,_;return u=new me({props:{code:`import torch
from transformers import AutoTokenizer, GPT2ForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("microsoft/DialogRPT-updown")
model = GPT2ForSequenceClassification.from_pretrained("microsoft/DialogRPT-updown", 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 = GPT2ForSequenceClassification.from_pretrained(
    "microsoft/DialogRPT-updown", 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, GPT2ForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;microsoft/DialogRPT-updown&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPT2ForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;microsoft/DialogRPT-updown&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 = GPT2ForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;microsoft/DialogRPT-updown&quot;</span>, num_labels=num_labels, problem_type=<span class="hljs-string">&quot;multi_label_classification&quot;</span>
<span class="hljs-meta">... </span>)

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

tokenizer = AutoTokenizer.from_pretrained("brad1141/gpt2-finetuned-comp2")
model = GPT2ForTokenClassification.from_pretrained("brad1141/gpt2-finetuned-comp2")

inputs = tokenizer(
    "HuggingFace is a company based in Paris and New York", add_special_tokens=False, return_tensors="pt"
)

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

predicted_token_class_ids = logits.argmax(-1)

# Note that tokens are classified rather then input words which means that
# there might be more predicted token classes than words.
# Multiple token classes might account for the same word
predicted_tokens_classes = [model.config.id2label[t.item()] for t in predicted_token_class_ids[0]]
predicted_tokens_classes

labels = predicted_token_class_ids
loss = model(**inputs, labels=labels).loss
round(loss.item(), 2)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, GPT2ForTokenClassification
<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;brad1141/gpt2-finetuned-comp2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPT2ForTokenClassification.from_pretrained(<span class="hljs-string">&quot;brad1141/gpt2-finetuned-comp2&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;HuggingFace is a company based in Paris and New York&quot;</span>, add_special_tokens=<span class="hljs-literal">False</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>
<span class="hljs-meta">... </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_token_class_ids = logits.argmax(-<span class="hljs-number">1</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Note that tokens are classified rather then input words which means that</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># there might be more predicted token classes than words.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Multiple token classes might account for the same word</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_tokens_classes = [model.config.id2label[t.item()] <span class="hljs-keyword">for</span> t <span class="hljs-keyword">in</span> predicted_token_class_ids[<span class="hljs-number">0</span>]]
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_tokens_classes
[<span class="hljs-string">&#x27;Lead&#x27;</span>, <span class="hljs-string">&#x27;Lead&#x27;</span>, <span class="hljs-string">&#x27;Lead&#x27;</span>, <span class="hljs-string">&#x27;Position&#x27;</span>, <span class="hljs-string">&#x27;Lead&#x27;</span>, <span class="hljs-string">&#x27;Lead&#x27;</span>, <span class="hljs-string">&#x27;Lead&#x27;</span>, <span class="hljs-string">&#x27;Lead&#x27;</span>, <span class="hljs-string">&#x27;Lead&#x27;</span>, <span class="hljs-string">&#x27;Lead&#x27;</span>, <span class="hljs-string">&#x27;Lead&#x27;</span>, <span class="hljs-string">&#x27;Lead&#x27;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = predicted_token_class_ids
<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">0.25</span>`}}),{c(){d=a("p"),b=n("Example:"),f=p(),v(u.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"Example:"),c.forEach(t),f=h(l),k(u.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(u,l,c),_=!0},p:ue,i(l){_||($(u.$$.fragment,l),_=!0)},o(l){P(u.$$.fragment,l),_=!1},d(l){l&&t(d),l&&t(f),M(u,l)}}}function Tw(x){let d,b,f,u,_,l,c,z,ae,K,H,J,re,G,xe,V,Ge,ke,S,ze,de,X,Fe,we,B,Ee,$e,R,fe,je,le,j,C,Pe,N,ge,qe,Y,ce,Ce,q,Ae,Q,De,D,Z,_e,Le,W,Te,ee,Oe,ie,A,He,L,Ne,Ie;return{c(){d=a("p"),b=n("TensorFlow models and layers in "),f=a("code"),u=n("transformers"),_=n(" accept two formats as input:"),l=p(),c=a("ul"),z=a("li"),ae=n("having all inputs as keyword arguments (like PyTorch models), or"),K=p(),H=a("li"),J=n("having all inputs as a list, tuple or dict in the first positional argument."),re=p(),G=a("p"),xe=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 `),V=a("code"),Ge=n("model.fit()"),ke=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=a("code"),ze=n("model.fit()"),de=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),X=a("code"),Fe=n("fit()"),we=n(" and "),B=a("code"),Ee=n("predict()"),$e=n(`, such as when creating your own layers or models with
the Keras `),R=a("code"),fe=n("Functional"),je=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),le=p(),j=a("ul"),C=a("li"),Pe=n("a single Tensor with "),N=a("code"),ge=n("input_ids"),qe=n(" only and nothing else: "),Y=a("code"),ce=n("model(input_ids)"),Ce=p(),q=a("li"),Ae=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Q=a("code"),De=n("model([input_ids, attention_mask])"),D=n(" or "),Z=a("code"),_e=n("model([input_ids, attention_mask, token_type_ids])"),Le=p(),W=a("li"),Te=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),ee=a("code"),Oe=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ie=p(),A=a("p"),He=n(`Note that when creating models and layers with
`),L=a("a"),Ne=n("subclassing"),Ie=n(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(y){d=r(y,"P",{});var F=i(d);b=s(F,"TensorFlow models and layers in "),f=r(F,"CODE",{});var at=i(f);u=s(at,"transformers"),at.forEach(t),_=s(F," accept two formats as input:"),F.forEach(t),l=h(y),c=r(y,"UL",{});var ne=i(c);z=r(ne,"LI",{});var rt=i(z);ae=s(rt,"having all inputs as keyword arguments (like PyTorch models), or"),rt.forEach(t),K=h(ne),H=r(ne,"LI",{});var it=i(H);J=s(it,"having all inputs as a list, tuple or dict in the first positional argument."),it.forEach(t),ne.forEach(t),re=h(y),G=r(y,"P",{});var E=i(G);xe=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 `),V=r(E,"CODE",{});var lt=i(V);Ge=s(lt,"model.fit()"),lt.forEach(t),ke=s(E,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=r(E,"CODE",{});var dt=i(S);ze=s(dt,"model.fit()"),dt.forEach(t),de=s(E,` supports! If, however, you want to use the second
format outside of Keras methods like `),X=r(E,"CODE",{});var Je=i(X);Fe=s(Je,"fit()"),Je.forEach(t),we=s(E," and "),B=r(E,"CODE",{});var ct=i(B);Ee=s(ct,"predict()"),ct.forEach(t),$e=s(E,`, such as when creating your own layers or models with
the Keras `),R=r(E,"CODE",{});var pt=i(R);fe=s(pt,"Functional"),pt.forEach(t),je=s(E,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),E.forEach(t),le=h(y),j=r(y,"UL",{});var U=i(j);C=r(U,"LI",{});var I=i(C);Pe=s(I,"a single Tensor with "),N=r(I,"CODE",{});var ht=i(N);ge=s(ht,"input_ids"),ht.forEach(t),qe=s(I," only and nothing else: "),Y=r(I,"CODE",{});var Xe=i(Y);ce=s(Xe,"model(input_ids)"),Xe.forEach(t),I.forEach(t),Ce=h(U),q=r(U,"LI",{});var te=i(q);Ae=s(te,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Q=r(te,"CODE",{});var ut=i(Q);De=s(ut,"model([input_ids, attention_mask])"),ut.forEach(t),D=s(te," or "),Z=r(te,"CODE",{});var Ye=i(Z);_e=s(Ye,"model([input_ids, attention_mask, token_type_ids])"),Ye.forEach(t),te.forEach(t),Le=h(U),W=r(U,"LI",{});var Se=i(W);Te=s(Se,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),ee=r(Se,"CODE",{});var mt=i(ee);Oe=s(mt,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),mt.forEach(t),Se.forEach(t),U.forEach(t),ie=h(y),A=r(y,"P",{});var oe=i(A);He=s(oe,`Note that when creating models and layers with
`),L=r(oe,"A",{href:!0,rel:!0});var ft=i(L);Ne=s(ft,"subclassing"),ft.forEach(t),Ie=s(oe,` 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!`),oe.forEach(t),this.h()},h(){m(L,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),m(L,"rel","nofollow")},m(y,F){g(y,d,F),e(d,b),e(d,f),e(f,u),e(d,_),g(y,l,F),g(y,c,F),e(c,z),e(z,ae),e(c,K),e(c,H),e(H,J),g(y,re,F),g(y,G,F),e(G,xe),e(G,V),e(V,Ge),e(G,ke),e(G,S),e(S,ze),e(G,de),e(G,X),e(X,Fe),e(G,we),e(G,B),e(B,Ee),e(G,$e),e(G,R),e(R,fe),e(G,je),g(y,le,F),g(y,j,F),e(j,C),e(C,Pe),e(C,N),e(N,ge),e(C,qe),e(C,Y),e(Y,ce),e(j,Ce),e(j,q),e(q,Ae),e(q,Q),e(Q,De),e(q,D),e(q,Z),e(Z,_e),e(j,Le),e(j,W),e(W,Te),e(W,ee),e(ee,Oe),g(y,ie,F),g(y,A,F),e(A,He),e(A,L),e(L,Ne),e(A,Ie)},d(y){y&&t(d),y&&t(l),y&&t(c),y&&t(re),y&&t(G),y&&t(le),y&&t(j),y&&t(ie),y&&t(A)}}}function bw(x){let d,b,f,u,_;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),u=n("Module"),_=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){d=r(l,"P",{});var c=i(d);b=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(c,"CODE",{});var z=i(f);u=s(z,"Module"),z.forEach(t),_=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(l,c){g(l,d,c),e(d,b),e(d,f),e(f,u),e(d,_)},d(l){l&&t(d)}}}function yw(x){let d,b,f,u,_;return u=new me({props:{code:`from transformers import AutoTokenizer, TFGPT2Model
import tensorflow as tf

tokenizer = AutoTokenizer.from_pretrained("gpt2")
model = TFGPT2Model.from_pretrained("gpt2")

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, TFGPT2Model
<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;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFGPT2Model.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){d=a("p"),b=n("Example:"),f=p(),v(u.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"Example:"),c.forEach(t),f=h(l),k(u.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(u,l,c),_=!0},p:ue,i(l){_||($(u.$$.fragment,l),_=!0)},o(l){P(u.$$.fragment,l),_=!1},d(l){l&&t(d),l&&t(f),M(u,l)}}}function vw(x){let d,b,f,u,_,l,c,z,ae,K,H,J,re,G,xe,V,Ge,ke,S,ze,de,X,Fe,we,B,Ee,$e,R,fe,je,le,j,C,Pe,N,ge,qe,Y,ce,Ce,q,Ae,Q,De,D,Z,_e,Le,W,Te,ee,Oe,ie,A,He,L,Ne,Ie;return{c(){d=a("p"),b=n("TensorFlow models and layers in "),f=a("code"),u=n("transformers"),_=n(" accept two formats as input:"),l=p(),c=a("ul"),z=a("li"),ae=n("having all inputs as keyword arguments (like PyTorch models), or"),K=p(),H=a("li"),J=n("having all inputs as a list, tuple or dict in the first positional argument."),re=p(),G=a("p"),xe=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 `),V=a("code"),Ge=n("model.fit()"),ke=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=a("code"),ze=n("model.fit()"),de=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),X=a("code"),Fe=n("fit()"),we=n(" and "),B=a("code"),Ee=n("predict()"),$e=n(`, such as when creating your own layers or models with
the Keras `),R=a("code"),fe=n("Functional"),je=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),le=p(),j=a("ul"),C=a("li"),Pe=n("a single Tensor with "),N=a("code"),ge=n("input_ids"),qe=n(" only and nothing else: "),Y=a("code"),ce=n("model(input_ids)"),Ce=p(),q=a("li"),Ae=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Q=a("code"),De=n("model([input_ids, attention_mask])"),D=n(" or "),Z=a("code"),_e=n("model([input_ids, attention_mask, token_type_ids])"),Le=p(),W=a("li"),Te=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),ee=a("code"),Oe=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ie=p(),A=a("p"),He=n(`Note that when creating models and layers with
`),L=a("a"),Ne=n("subclassing"),Ie=n(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(y){d=r(y,"P",{});var F=i(d);b=s(F,"TensorFlow models and layers in "),f=r(F,"CODE",{});var at=i(f);u=s(at,"transformers"),at.forEach(t),_=s(F," accept two formats as input:"),F.forEach(t),l=h(y),c=r(y,"UL",{});var ne=i(c);z=r(ne,"LI",{});var rt=i(z);ae=s(rt,"having all inputs as keyword arguments (like PyTorch models), or"),rt.forEach(t),K=h(ne),H=r(ne,"LI",{});var it=i(H);J=s(it,"having all inputs as a list, tuple or dict in the first positional argument."),it.forEach(t),ne.forEach(t),re=h(y),G=r(y,"P",{});var E=i(G);xe=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 `),V=r(E,"CODE",{});var lt=i(V);Ge=s(lt,"model.fit()"),lt.forEach(t),ke=s(E,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=r(E,"CODE",{});var dt=i(S);ze=s(dt,"model.fit()"),dt.forEach(t),de=s(E,` supports! If, however, you want to use the second
format outside of Keras methods like `),X=r(E,"CODE",{});var Je=i(X);Fe=s(Je,"fit()"),Je.forEach(t),we=s(E," and "),B=r(E,"CODE",{});var ct=i(B);Ee=s(ct,"predict()"),ct.forEach(t),$e=s(E,`, such as when creating your own layers or models with
the Keras `),R=r(E,"CODE",{});var pt=i(R);fe=s(pt,"Functional"),pt.forEach(t),je=s(E,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),E.forEach(t),le=h(y),j=r(y,"UL",{});var U=i(j);C=r(U,"LI",{});var I=i(C);Pe=s(I,"a single Tensor with "),N=r(I,"CODE",{});var ht=i(N);ge=s(ht,"input_ids"),ht.forEach(t),qe=s(I," only and nothing else: "),Y=r(I,"CODE",{});var Xe=i(Y);ce=s(Xe,"model(input_ids)"),Xe.forEach(t),I.forEach(t),Ce=h(U),q=r(U,"LI",{});var te=i(q);Ae=s(te,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Q=r(te,"CODE",{});var ut=i(Q);De=s(ut,"model([input_ids, attention_mask])"),ut.forEach(t),D=s(te," or "),Z=r(te,"CODE",{});var Ye=i(Z);_e=s(Ye,"model([input_ids, attention_mask, token_type_ids])"),Ye.forEach(t),te.forEach(t),Le=h(U),W=r(U,"LI",{});var Se=i(W);Te=s(Se,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),ee=r(Se,"CODE",{});var mt=i(ee);Oe=s(mt,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),mt.forEach(t),Se.forEach(t),U.forEach(t),ie=h(y),A=r(y,"P",{});var oe=i(A);He=s(oe,`Note that when creating models and layers with
`),L=r(oe,"A",{href:!0,rel:!0});var ft=i(L);Ne=s(ft,"subclassing"),ft.forEach(t),Ie=s(oe,` 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!`),oe.forEach(t),this.h()},h(){m(L,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),m(L,"rel","nofollow")},m(y,F){g(y,d,F),e(d,b),e(d,f),e(f,u),e(d,_),g(y,l,F),g(y,c,F),e(c,z),e(z,ae),e(c,K),e(c,H),e(H,J),g(y,re,F),g(y,G,F),e(G,xe),e(G,V),e(V,Ge),e(G,ke),e(G,S),e(S,ze),e(G,de),e(G,X),e(X,Fe),e(G,we),e(G,B),e(B,Ee),e(G,$e),e(G,R),e(R,fe),e(G,je),g(y,le,F),g(y,j,F),e(j,C),e(C,Pe),e(C,N),e(N,ge),e(C,qe),e(C,Y),e(Y,ce),e(j,Ce),e(j,q),e(q,Ae),e(q,Q),e(Q,De),e(q,D),e(q,Z),e(Z,_e),e(j,Le),e(j,W),e(W,Te),e(W,ee),e(ee,Oe),g(y,ie,F),g(y,A,F),e(A,He),e(A,L),e(L,Ne),e(A,Ie)},d(y){y&&t(d),y&&t(l),y&&t(c),y&&t(re),y&&t(G),y&&t(le),y&&t(j),y&&t(ie),y&&t(A)}}}function kw(x){let d,b,f,u,_;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),u=n("Module"),_=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){d=r(l,"P",{});var c=i(d);b=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(c,"CODE",{});var z=i(f);u=s(z,"Module"),z.forEach(t),_=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(l,c){g(l,d,c),e(d,b),e(d,f),e(f,u),e(d,_)},d(l){l&&t(d)}}}function ww(x){let d,b,f,u,_;return u=new me({props:{code:`from transformers import AutoTokenizer, TFGPT2LMHeadModel
import tensorflow as tf

tokenizer = AutoTokenizer.from_pretrained("gpt2")
model = TFGPT2LMHeadModel.from_pretrained("gpt2")

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, TFGPT2LMHeadModel
<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;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFGPT2LMHeadModel.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){d=a("p"),b=n("Example:"),f=p(),v(u.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"Example:"),c.forEach(t),f=h(l),k(u.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(u,l,c),_=!0},p:ue,i(l){_||($(u.$$.fragment,l),_=!0)},o(l){P(u.$$.fragment,l),_=!1},d(l){l&&t(d),l&&t(f),M(u,l)}}}function $w(x){let d,b,f,u,_,l,c,z,ae,K,H,J,re,G,xe,V,Ge,ke,S,ze,de,X,Fe,we,B,Ee,$e,R,fe,je,le,j,C,Pe,N,ge,qe,Y,ce,Ce,q,Ae,Q,De,D,Z,_e,Le,W,Te,ee,Oe,ie,A,He,L,Ne,Ie;return{c(){d=a("p"),b=n("TensorFlow models and layers in "),f=a("code"),u=n("transformers"),_=n(" accept two formats as input:"),l=p(),c=a("ul"),z=a("li"),ae=n("having all inputs as keyword arguments (like PyTorch models), or"),K=p(),H=a("li"),J=n("having all inputs as a list, tuple or dict in the first positional argument."),re=p(),G=a("p"),xe=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 `),V=a("code"),Ge=n("model.fit()"),ke=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=a("code"),ze=n("model.fit()"),de=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),X=a("code"),Fe=n("fit()"),we=n(" and "),B=a("code"),Ee=n("predict()"),$e=n(`, such as when creating your own layers or models with
the Keras `),R=a("code"),fe=n("Functional"),je=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),le=p(),j=a("ul"),C=a("li"),Pe=n("a single Tensor with "),N=a("code"),ge=n("input_ids"),qe=n(" only and nothing else: "),Y=a("code"),ce=n("model(input_ids)"),Ce=p(),q=a("li"),Ae=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Q=a("code"),De=n("model([input_ids, attention_mask])"),D=n(" or "),Z=a("code"),_e=n("model([input_ids, attention_mask, token_type_ids])"),Le=p(),W=a("li"),Te=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),ee=a("code"),Oe=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ie=p(),A=a("p"),He=n(`Note that when creating models and layers with
`),L=a("a"),Ne=n("subclassing"),Ie=n(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(y){d=r(y,"P",{});var F=i(d);b=s(F,"TensorFlow models and layers in "),f=r(F,"CODE",{});var at=i(f);u=s(at,"transformers"),at.forEach(t),_=s(F," accept two formats as input:"),F.forEach(t),l=h(y),c=r(y,"UL",{});var ne=i(c);z=r(ne,"LI",{});var rt=i(z);ae=s(rt,"having all inputs as keyword arguments (like PyTorch models), or"),rt.forEach(t),K=h(ne),H=r(ne,"LI",{});var it=i(H);J=s(it,"having all inputs as a list, tuple or dict in the first positional argument."),it.forEach(t),ne.forEach(t),re=h(y),G=r(y,"P",{});var E=i(G);xe=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 `),V=r(E,"CODE",{});var lt=i(V);Ge=s(lt,"model.fit()"),lt.forEach(t),ke=s(E,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=r(E,"CODE",{});var dt=i(S);ze=s(dt,"model.fit()"),dt.forEach(t),de=s(E,` supports! If, however, you want to use the second
format outside of Keras methods like `),X=r(E,"CODE",{});var Je=i(X);Fe=s(Je,"fit()"),Je.forEach(t),we=s(E," and "),B=r(E,"CODE",{});var ct=i(B);Ee=s(ct,"predict()"),ct.forEach(t),$e=s(E,`, such as when creating your own layers or models with
the Keras `),R=r(E,"CODE",{});var pt=i(R);fe=s(pt,"Functional"),pt.forEach(t),je=s(E,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),E.forEach(t),le=h(y),j=r(y,"UL",{});var U=i(j);C=r(U,"LI",{});var I=i(C);Pe=s(I,"a single Tensor with "),N=r(I,"CODE",{});var ht=i(N);ge=s(ht,"input_ids"),ht.forEach(t),qe=s(I," only and nothing else: "),Y=r(I,"CODE",{});var Xe=i(Y);ce=s(Xe,"model(input_ids)"),Xe.forEach(t),I.forEach(t),Ce=h(U),q=r(U,"LI",{});var te=i(q);Ae=s(te,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Q=r(te,"CODE",{});var ut=i(Q);De=s(ut,"model([input_ids, attention_mask])"),ut.forEach(t),D=s(te," or "),Z=r(te,"CODE",{});var Ye=i(Z);_e=s(Ye,"model([input_ids, attention_mask, token_type_ids])"),Ye.forEach(t),te.forEach(t),Le=h(U),W=r(U,"LI",{});var Se=i(W);Te=s(Se,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),ee=r(Se,"CODE",{});var mt=i(ee);Oe=s(mt,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),mt.forEach(t),Se.forEach(t),U.forEach(t),ie=h(y),A=r(y,"P",{});var oe=i(A);He=s(oe,`Note that when creating models and layers with
`),L=r(oe,"A",{href:!0,rel:!0});var ft=i(L);Ne=s(ft,"subclassing"),ft.forEach(t),Ie=s(oe,` 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!`),oe.forEach(t),this.h()},h(){m(L,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),m(L,"rel","nofollow")},m(y,F){g(y,d,F),e(d,b),e(d,f),e(f,u),e(d,_),g(y,l,F),g(y,c,F),e(c,z),e(z,ae),e(c,K),e(c,H),e(H,J),g(y,re,F),g(y,G,F),e(G,xe),e(G,V),e(V,Ge),e(G,ke),e(G,S),e(S,ze),e(G,de),e(G,X),e(X,Fe),e(G,we),e(G,B),e(B,Ee),e(G,$e),e(G,R),e(R,fe),e(G,je),g(y,le,F),g(y,j,F),e(j,C),e(C,Pe),e(C,N),e(N,ge),e(C,qe),e(C,Y),e(Y,ce),e(j,Ce),e(j,q),e(q,Ae),e(q,Q),e(Q,De),e(q,D),e(q,Z),e(Z,_e),e(j,Le),e(j,W),e(W,Te),e(W,ee),e(ee,Oe),g(y,ie,F),g(y,A,F),e(A,He),e(A,L),e(L,Ne),e(A,Ie)},d(y){y&&t(d),y&&t(l),y&&t(c),y&&t(re),y&&t(G),y&&t(le),y&&t(j),y&&t(ie),y&&t(A)}}}function Pw(x){let d,b,f,u,_;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),u=n("Module"),_=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){d=r(l,"P",{});var c=i(d);b=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(c,"CODE",{});var z=i(f);u=s(z,"Module"),z.forEach(t),_=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(l,c){g(l,d,c),e(d,b),e(d,f),e(f,u),e(d,_)},d(l){l&&t(d)}}}function Mw(x){let d,b,f,u,_;return u=new me({props:{code:`import tensorflow as tf
from transformers import AutoTokenizer, TFGPT2DoubleHeadsModel

tokenizer = AutoTokenizer.from_pretrained("gpt2")
model = TFGPT2DoubleHeadsModel.from_pretrained("gpt2")

# Add a [CLS] to the vocabulary (we should train it also!)
num_added_tokens = tokenizer.add_special_tokens({"cls_token": "[CLS]"})

embedding_layer = model.resize_token_embeddings(
    len(tokenizer)
)  # Update the model embeddings with the new vocabulary size

choices = ["Hello, my dog is cute [CLS]", "Hello, my cat is cute [CLS]"]
encoded_choices = [tokenizer.encode(s) for s in choices]
cls_token_location = [tokens.index(tokenizer.cls_token_id) for tokens in encoded_choices]

input_ids = tf.constant(encoded_choices)[None, :]  # Batch size: 1, number of choices: 2
mc_token_ids = tf.constant([cls_token_location])  # Batch size: 1

outputs = model(input_ids, mc_token_ids=mc_token_ids)
lm_prediction_scores, mc_prediction_scores = outputs[:2]`,highlighted:`<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><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFGPT2DoubleHeadsModel

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFGPT2DoubleHeadsModel.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Add a [CLS] to the vocabulary (we should train it also!)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_added_tokens = tokenizer.add_special_tokens({<span class="hljs-string">&quot;cls_token&quot;</span>: <span class="hljs-string">&quot;[CLS]&quot;</span>})

<span class="hljs-meta">&gt;&gt;&gt; </span>embedding_layer = model.resize_token_embeddings(
<span class="hljs-meta">... </span>    <span class="hljs-built_in">len</span>(tokenizer)
<span class="hljs-meta">... </span>)  <span class="hljs-comment"># Update the model embeddings with the new vocabulary size</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>choices = [<span class="hljs-string">&quot;Hello, my dog is cute [CLS]&quot;</span>, <span class="hljs-string">&quot;Hello, my cat is cute [CLS]&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>encoded_choices = [tokenizer.encode(s) <span class="hljs-keyword">for</span> s <span class="hljs-keyword">in</span> choices]
<span class="hljs-meta">&gt;&gt;&gt; </span>cls_token_location = [tokens.index(tokenizer.cls_token_id) <span class="hljs-keyword">for</span> tokens <span class="hljs-keyword">in</span> encoded_choices]

<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = tf.constant(encoded_choices)[<span class="hljs-literal">None</span>, :]  <span class="hljs-comment"># Batch size: 1, number of choices: 2</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>mc_token_ids = tf.constant([cls_token_location])  <span class="hljs-comment"># Batch size: 1</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids, mc_token_ids=mc_token_ids)
<span class="hljs-meta">&gt;&gt;&gt; </span>lm_prediction_scores, mc_prediction_scores = outputs[:<span class="hljs-number">2</span>]`}}),{c(){d=a("p"),b=n("Examples:"),f=p(),v(u.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"Examples:"),c.forEach(t),f=h(l),k(u.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(u,l,c),_=!0},p:ue,i(l){_||($(u.$$.fragment,l),_=!0)},o(l){P(u.$$.fragment,l),_=!1},d(l){l&&t(d),l&&t(f),M(u,l)}}}function xw(x){let d,b,f,u,_,l,c,z,ae,K,H,J,re,G,xe,V,Ge,ke,S,ze,de,X,Fe,we,B,Ee,$e,R,fe,je,le,j,C,Pe,N,ge,qe,Y,ce,Ce,q,Ae,Q,De,D,Z,_e,Le,W,Te,ee,Oe,ie,A,He,L,Ne,Ie;return{c(){d=a("p"),b=n("TensorFlow models and layers in "),f=a("code"),u=n("transformers"),_=n(" accept two formats as input:"),l=p(),c=a("ul"),z=a("li"),ae=n("having all inputs as keyword arguments (like PyTorch models), or"),K=p(),H=a("li"),J=n("having all inputs as a list, tuple or dict in the first positional argument."),re=p(),G=a("p"),xe=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 `),V=a("code"),Ge=n("model.fit()"),ke=n(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=a("code"),ze=n("model.fit()"),de=n(` supports! If, however, you want to use the second
format outside of Keras methods like `),X=a("code"),Fe=n("fit()"),we=n(" and "),B=a("code"),Ee=n("predict()"),$e=n(`, such as when creating your own layers or models with
the Keras `),R=a("code"),fe=n("Functional"),je=n(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),le=p(),j=a("ul"),C=a("li"),Pe=n("a single Tensor with "),N=a("code"),ge=n("input_ids"),qe=n(" only and nothing else: "),Y=a("code"),ce=n("model(input_ids)"),Ce=p(),q=a("li"),Ae=n(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Q=a("code"),De=n("model([input_ids, attention_mask])"),D=n(" or "),Z=a("code"),_e=n("model([input_ids, attention_mask, token_type_ids])"),Le=p(),W=a("li"),Te=n(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),ee=a("code"),Oe=n('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),ie=p(),A=a("p"),He=n(`Note that when creating models and layers with
`),L=a("a"),Ne=n("subclassing"),Ie=n(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(y){d=r(y,"P",{});var F=i(d);b=s(F,"TensorFlow models and layers in "),f=r(F,"CODE",{});var at=i(f);u=s(at,"transformers"),at.forEach(t),_=s(F," accept two formats as input:"),F.forEach(t),l=h(y),c=r(y,"UL",{});var ne=i(c);z=r(ne,"LI",{});var rt=i(z);ae=s(rt,"having all inputs as keyword arguments (like PyTorch models), or"),rt.forEach(t),K=h(ne),H=r(ne,"LI",{});var it=i(H);J=s(it,"having all inputs as a list, tuple or dict in the first positional argument."),it.forEach(t),ne.forEach(t),re=h(y),G=r(y,"P",{});var E=i(G);xe=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 `),V=r(E,"CODE",{});var lt=i(V);Ge=s(lt,"model.fit()"),lt.forEach(t),ke=s(E,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),S=r(E,"CODE",{});var dt=i(S);ze=s(dt,"model.fit()"),dt.forEach(t),de=s(E,` supports! If, however, you want to use the second
format outside of Keras methods like `),X=r(E,"CODE",{});var Je=i(X);Fe=s(Je,"fit()"),Je.forEach(t),we=s(E," and "),B=r(E,"CODE",{});var ct=i(B);Ee=s(ct,"predict()"),ct.forEach(t),$e=s(E,`, such as when creating your own layers or models with
the Keras `),R=r(E,"CODE",{});var pt=i(R);fe=s(pt,"Functional"),pt.forEach(t),je=s(E,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),E.forEach(t),le=h(y),j=r(y,"UL",{});var U=i(j);C=r(U,"LI",{});var I=i(C);Pe=s(I,"a single Tensor with "),N=r(I,"CODE",{});var ht=i(N);ge=s(ht,"input_ids"),ht.forEach(t),qe=s(I," only and nothing else: "),Y=r(I,"CODE",{});var Xe=i(Y);ce=s(Xe,"model(input_ids)"),Xe.forEach(t),I.forEach(t),Ce=h(U),q=r(U,"LI",{});var te=i(q);Ae=s(te,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Q=r(te,"CODE",{});var ut=i(Q);De=s(ut,"model([input_ids, attention_mask])"),ut.forEach(t),D=s(te," or "),Z=r(te,"CODE",{});var Ye=i(Z);_e=s(Ye,"model([input_ids, attention_mask, token_type_ids])"),Ye.forEach(t),te.forEach(t),Le=h(U),W=r(U,"LI",{});var Se=i(W);Te=s(Se,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),ee=r(Se,"CODE",{});var mt=i(ee);Oe=s(mt,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),mt.forEach(t),Se.forEach(t),U.forEach(t),ie=h(y),A=r(y,"P",{});var oe=i(A);He=s(oe,`Note that when creating models and layers with
`),L=r(oe,"A",{href:!0,rel:!0});var ft=i(L);Ne=s(ft,"subclassing"),ft.forEach(t),Ie=s(oe,` 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!`),oe.forEach(t),this.h()},h(){m(L,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),m(L,"rel","nofollow")},m(y,F){g(y,d,F),e(d,b),e(d,f),e(f,u),e(d,_),g(y,l,F),g(y,c,F),e(c,z),e(z,ae),e(c,K),e(c,H),e(H,J),g(y,re,F),g(y,G,F),e(G,xe),e(G,V),e(V,Ge),e(G,ke),e(G,S),e(S,ze),e(G,de),e(G,X),e(X,Fe),e(G,we),e(G,B),e(B,Ee),e(G,$e),e(G,R),e(R,fe),e(G,je),g(y,le,F),g(y,j,F),e(j,C),e(C,Pe),e(C,N),e(N,ge),e(C,qe),e(C,Y),e(Y,ce),e(j,Ce),e(j,q),e(q,Ae),e(q,Q),e(Q,De),e(q,D),e(q,Z),e(Z,_e),e(j,Le),e(j,W),e(W,Te),e(W,ee),e(ee,Oe),g(y,ie,F),g(y,A,F),e(A,He),e(A,L),e(L,Ne),e(A,Ie)},d(y){y&&t(d),y&&t(l),y&&t(c),y&&t(re),y&&t(G),y&&t(le),y&&t(j),y&&t(ie),y&&t(A)}}}function Gw(x){let d,b,f,u,_;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),u=n("Module"),_=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){d=r(l,"P",{});var c=i(d);b=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(c,"CODE",{});var z=i(f);u=s(z,"Module"),z.forEach(t),_=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(l,c){g(l,d,c),e(d,b),e(d,f),e(f,u),e(d,_)},d(l){l&&t(d)}}}function zw(x){let d,b,f,u,_;return u=new me({props:{code:`from transformers import AutoTokenizer, TFGPT2ForSequenceClassification
import tensorflow as tf

tokenizer = AutoTokenizer.from_pretrained("microsoft/DialogRPT-updown")
model = TFGPT2ForSequenceClassification.from_pretrained("microsoft/DialogRPT-updown")

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

logits = model(**inputs).logits

predicted_class_id = int(tf.math.argmax(logits, axis=-1)[0])`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFGPT2ForSequenceClassification
<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;microsoft/DialogRPT-updown&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFGPT2ForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;microsoft/DialogRPT-updown&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>logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_id = <span class="hljs-built_in">int</span>(tf.math.argmax(logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>])`}}),{c(){d=a("p"),b=n("Example:"),f=p(),v(u.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"Example:"),c.forEach(t),f=h(l),k(u.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(u,l,c),_=!0},p:ue,i(l){_||($(u.$$.fragment,l),_=!0)},o(l){P(u.$$.fragment,l),_=!1},d(l){l&&t(d),l&&t(f),M(u,l)}}}function Fw(x){let d,b;return d=new me({props:{code:'# To train a model on `num_labels` classes, you can pass `num_labels=num_labels` to `.from_pretrained(...)`\nnum_labels = len(model.config.id2label)\nmodel = TFGPT2ForSequenceClassification.from_pretrained("microsoft/DialogRPT-updown", num_labels=num_labels)\n\nlabels = tf.constant(1)\nloss = model(**inputs, labels=labels).loss',highlighted:'<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>\n<span class="hljs-meta">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)\n<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFGPT2ForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;microsoft/DialogRPT-updown&quot;</span>, num_labels=num_labels)\n\n<span class="hljs-meta">&gt;&gt;&gt; </span>labels = tf.constant(<span class="hljs-number">1</span>)\n<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss'}}),{c(){v(d.$$.fragment)},l(f){k(d.$$.fragment,f)},m(f,u){w(d,f,u),b=!0},p:ue,i(f){b||($(d.$$.fragment,f),b=!0)},o(f){P(d.$$.fragment,f),b=!1},d(f){M(d,f)}}}function Ew(x){let d,b,f,u,_;return u=new me({props:{code:`from transformers import TFGPT2Tokenizer

tf_tokenizer = TFGPT2Tokenizer.from_pretrained("gpt2")`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFGPT2Tokenizer

tf_tokenizer = TFGPT2Tokenizer.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)`}}),{c(){d=a("p"),b=n("Examples:"),f=p(),v(u.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"Examples:"),c.forEach(t),f=h(l),k(u.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(u,l,c),_=!0},p:ue,i(l){_||($(u.$$.fragment,l),_=!0)},o(l){P(u.$$.fragment,l),_=!1},d(l){l&&t(d),l&&t(f),M(u,l)}}}function jw(x){let d,b,f,u,_;return u=new me({props:{code:`from transformers import AutoTokenizer, TFGPT2Tokenizer

tokenizer = AutoTokenizer.from_pretrained("gpt2")
tf_tokenizer = TFGPT2Tokenizer.from_tokenizer(tokenizer)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFGPT2Tokenizer

tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
tf_tokenizer = TFGPT2Tokenizer.from_tokenizer(tokenizer)`}}),{c(){d=a("p"),b=n("Examples:"),f=p(),v(u.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"Examples:"),c.forEach(t),f=h(l),k(u.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(u,l,c),_=!0},p:ue,i(l){_||($(u.$$.fragment,l),_=!0)},o(l){P(u.$$.fragment,l),_=!1},d(l){l&&t(d),l&&t(f),M(u,l)}}}function qw(x){let d,b,f,u,_;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),u=n("Module"),_=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){d=r(l,"P",{});var c=i(d);b=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(c,"CODE",{});var z=i(f);u=s(z,"Module"),z.forEach(t),_=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(l,c){g(l,d,c),e(d,b),e(d,f),e(f,u),e(d,_)},d(l){l&&t(d)}}}function Cw(x){let d,b,f,u,_;return u=new me({props:{code:`from transformers import AutoTokenizer, FlaxGPT2Model

tokenizer = AutoTokenizer.from_pretrained("gpt2")
model = FlaxGPT2Model.from_pretrained("gpt2")

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, FlaxGPT2Model

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxGPT2Model.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){d=a("p"),b=n("Example:"),f=p(),v(u.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"Example:"),c.forEach(t),f=h(l),k(u.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(u,l,c),_=!0},p:ue,i(l){_||($(u.$$.fragment,l),_=!0)},o(l){P(u.$$.fragment,l),_=!1},d(l){l&&t(d),l&&t(f),M(u,l)}}}function Aw(x){let d,b,f,u,_;return{c(){d=a("p"),b=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a("code"),u=n("Module"),_=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){d=r(l,"P",{});var c=i(d);b=s(c,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=r(c,"CODE",{});var z=i(f);u=s(z,"Module"),z.forEach(t),_=s(c,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),c.forEach(t)},m(l,c){g(l,d,c),e(d,b),e(d,f),e(f,u),e(d,_)},d(l){l&&t(d)}}}function Dw(x){let d,b,f,u,_;return u=new me({props:{code:`from transformers import AutoTokenizer, FlaxGPT2LMHeadModel

tokenizer = AutoTokenizer.from_pretrained("gpt2")
model = FlaxGPT2LMHeadModel.from_pretrained("gpt2")

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, FlaxGPT2LMHeadModel

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FlaxGPT2LMHeadModel.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># retrieve logts for next token</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>next_token_logits = outputs.logits[:, -<span class="hljs-number">1</span>]`}}),{c(){d=a("p"),b=n("Example:"),f=p(),v(u.$$.fragment)},l(l){d=r(l,"P",{});var c=i(d);b=s(c,"Example:"),c.forEach(t),f=h(l),k(u.$$.fragment,l)},m(l,c){g(l,d,c),e(d,b),g(l,f,c),w(u,l,c),_=!0},p:ue,i(l){_||($(u.$$.fragment,l),_=!0)},o(l){P(u.$$.fragment,l),_=!1},d(l){l&&t(d),l&&t(f),M(u,l)}}}function Lw(x){let d,b,f,u,_,l,c,z,ae,K,H,J,re,G,xe,V,Ge,ke,S,ze,de,X,Fe,we,B,Ee,$e,R,fe,je,le,j,C,Pe,N,ge,qe,Y,ce,Ce,q,Ae,Q,De,D,Z,_e,Le,W,Te,ee,Oe,ie,A,He,L,Ne,Ie,y,F,at,ne,rt,it,E,lt,dt,Je,ct,pt,U,I,ht,Xe,te,ut,Ye,Se,mt,oe,ft,Qp,lc,co,ms,Zp,eh,Ii,th,oh,dc,Xt,nh,fs,sh,ah,gs,rh,ih,cc,po,Ko,Si,_s,lh,Wi,dh,pc,Sr,ch,hc,Ts,uc,se,bs,ph,ys,hh,uh,mh,vs,fh,ks,gh,_h,Th,ws,bh,$s,yh,vh,kh,Ps,wh,Ms,$h,Ph,Mh,xs,xh,Gs,Gh,zh,Fh,zs,Eh,Fs,jh,qh,Ch,Es,Ah,js,Dh,Lh,Oh,Wr,qs,Hh,Nh,Ih,zt,Ur,Sh,Wh,Cs,Uh,Bh,As,Rh,Kh,Ds,Vh,Jh,Xh,Yt,Br,Yh,Qh,Ls,Zh,eu,Os,tu,ou,nu,Qt,Rr,su,au,Hs,ru,iu,Ns,lu,du,mc,ho,Vo,Ui,Is,cu,Bi,pu,fc,Mt,Ss,hu,Bt,uu,Kr,mu,fu,Vr,gu,_u,Ws,Tu,bu,yu,uo,vu,Jr,ku,wu,Xr,$u,Pu,Mu,Jo,gc,mo,Xo,Ri,Us,xu,Ki,Gu,_c,be,Bs,zu,Vi,Fu,Eu,Ji,ju,qu,Yo,Cu,Rs,Au,Xi,Du,Lu,Ou,Qo,Hu,Ks,Nu,Yr,Iu,Su,Wu,Qr,Vs,Tc,fo,Zo,Yi,Js,Uu,Qi,Bu,bc,We,Xs,Ru,Ys,Ku,Zi,Vu,Ju,Xu,el,Yu,Qu,en,Zu,Qs,em,tl,tm,om,nm,tn,sm,Zs,am,Zr,rm,im,yc,go,on,ol,ea,lm,nl,dm,vc,_o,ta,cm,sl,pm,kc,To,oa,hm,al,um,wc,bo,nn,rl,na,mm,il,fm,$c,Ue,sa,gm,ll,_m,Tm,aa,bm,ei,ym,vm,km,ra,wm,ia,$m,Pm,Mm,Ft,la,xm,yo,Gm,ti,zm,Fm,dl,Em,jm,qm,sn,Cm,an,Am,Et,da,Dm,cl,Lm,Om,pl,Hm,Nm,rn,Im,Zt,ca,Sm,hl,Wm,Um,ln,Pc,vo,dn,ul,pa,Bm,ml,Rm,Mc,Be,ha,Km,fl,Vm,Jm,ua,Xm,oi,Ym,Qm,Zm,ma,ef,fa,tf,of,nf,jt,ga,sf,ko,af,ni,rf,lf,gl,df,cf,pf,cn,hf,pn,uf,qt,_a,mf,_l,ff,gf,Tl,_f,Tf,hn,bf,eo,Ta,yf,bl,vf,kf,un,xc,wo,mn,yl,ba,wf,vl,$f,Gc,gt,ya,Pf,kl,Mf,xf,va,Gf,si,zf,Ff,Ef,ka,jf,wa,qf,Cf,Af,Ct,$a,Df,$o,Lf,ai,Of,Hf,wl,Nf,If,Sf,fn,Wf,gn,zc,Po,_n,$l,Pa,Uf,Pl,Bf,Fc,Re,Ma,Rf,Ml,Kf,Vf,ri,ii,Jf,Xf,Yf,xt,Qf,xl,Zf,eg,Gl,tg,og,zl,ng,sg,Fl,ag,rg,ig,xa,lg,li,dg,cg,pg,Ga,hg,za,ug,mg,fg,Tt,Fa,gg,Mo,_g,di,Tg,bg,El,yg,vg,kg,Tn,wg,bn,$g,yn,Ec,xo,vn,jl,Ea,Pg,ql,Mg,jc,_t,ja,xg,Cl,Gg,zg,qa,Fg,ci,Eg,jg,qg,Ca,Cg,Aa,Ag,Dg,Lg,At,Da,Og,Go,Hg,pi,Ng,Ig,Al,Sg,Wg,Ug,kn,Bg,wn,qc,zo,$n,Dl,La,Rg,Ll,Kg,Cc,Qe,Oa,Vg,Ol,Jg,Xg,Ha,Yg,hi,Qg,Zg,e_,Na,t_,Ia,o_,n_,s_,Pn,a_,Dt,Sa,r_,Fo,i_,ui,l_,d_,Hl,c_,p_,h_,Mn,u_,xn,Ac,Eo,Gn,Nl,Wa,m_,Il,f_,Dc,Ze,Ua,g_,Sl,__,T_,Ba,b_,mi,y_,v_,k_,Ra,w_,Ka,$_,P_,M_,zn,x_,Lt,Va,G_,jo,z_,fi,F_,E_,Wl,j_,q_,C_,Fn,A_,En,Lc,qo,jn,Ul,Ja,D_,Bl,L_,Oc,et,Xa,O_,Rl,H_,N_,Ya,I_,gi,S_,W_,U_,Qa,B_,Za,R_,K_,V_,qn,J_,Ot,er,X_,Co,Y_,_i,Q_,Z_,Kl,eT,tT,oT,Cn,nT,An,Hc,Ao,Dn,Vl,tr,sT,Jl,aT,Nc,ye,or,rT,Xl,iT,lT,Ti,bi,dT,cT,pT,Gt,hT,Yl,uT,mT,Ql,fT,gT,Zl,_T,TT,ed,bT,yT,vT,nr,kT,yi,wT,$T,PT,sr,MT,ar,xT,GT,zT,Ln,FT,bt,rr,ET,Do,jT,vi,qT,CT,td,AT,DT,LT,On,OT,Hn,HT,Nn,Ic,Lo,In,od,ir,NT,nd,IT,Sc,Oo,lr,ST,sd,WT,Wc,Ho,Sn,ad,dr,UT,rd,BT,Uc,tt,cr,RT,No,KT,id,VT,JT,ld,XT,YT,QT,pr,ZT,dd,e2,t2,o2,Wn,hr,n2,cd,s2,a2,to,ur,r2,pd,i2,l2,Un,d2,oo,mr,c2,hd,p2,h2,Bn,Bc,Io,Rn,ud,fr,u2,md,m2,Rc,Ke,gr,f2,fd,g2,_2,_r,T2,ki,b2,y2,v2,Tr,k2,br,w2,$2,P2,gd,M2,x2,Rt,_d,yr,G2,z2,Td,vr,F2,E2,bd,kr,j2,q2,yd,wr,C2,A2,Ht,$r,D2,So,L2,vd,O2,H2,kd,N2,I2,S2,Kn,W2,Vn,Kc,Wo,Jn,wd,Pr,U2,$d,B2,Vc,Ve,Mr,R2,Pd,K2,V2,xr,J2,wi,X2,Y2,Q2,Gr,Z2,zr,eb,tb,ob,Md,nb,sb,Kt,xd,Fr,ab,rb,Gd,Er,ib,lb,zd,jr,db,cb,Fd,qr,pb,hb,Nt,Cr,ub,Uo,mb,Ed,fb,gb,jd,_b,Tb,bb,Xn,yb,Yn,Jc;return l=new Me({}),G=new Me({}),_s=new Me({}),Ts=new Yk({props:{pipeline:"text-generation"}}),Is=new Me({}),Ss=new O({props:{name:"class transformers.GPT2Config",anchor:"transformers.GPT2Config",parameters:[{name:"vocab_size",val:" = 50257"},{name:"n_positions",val:" = 1024"},{name:"n_embd",val:" = 768"},{name:"n_layer",val:" = 12"},{name:"n_head",val:" = 12"},{name:"n_inner",val:" = None"},{name:"activation_function",val:" = 'gelu_new'"},{name:"resid_pdrop",val:" = 0.1"},{name:"embd_pdrop",val:" = 0.1"},{name:"attn_pdrop",val:" = 0.1"},{name:"layer_norm_epsilon",val:" = 1e-05"},{name:"initializer_range",val:" = 0.02"},{name:"summary_type",val:" = 'cls_index'"},{name:"summary_use_proj",val:" = True"},{name:"summary_activation",val:" = None"},{name:"summary_proj_to_labels",val:" = True"},{name:"summary_first_dropout",val:" = 0.1"},{name:"scale_attn_weights",val:" = True"},{name:"use_cache",val:" = True"},{name:"bos_token_id",val:" = 50256"},{name:"eos_token_id",val:" = 50256"},{name:"scale_attn_by_inverse_layer_idx",val:" = False"},{name:"reorder_and_upcast_attn",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.GPT2Config.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 50257) &#x2014;
Vocabulary size of the GPT-2 model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Model">GPT2Model</a> or <a href="/docs/transformers/main/en/model_doc/gpt2#transformers.TFGPT2Model">TFGPT2Model</a>.`,name:"vocab_size"},{anchor:"transformers.GPT2Config.n_positions",description:`<strong>n_positions</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#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:"n_positions"},{anchor:"transformers.GPT2Config.n_embd",description:`<strong>n_embd</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the embeddings and hidden states.`,name:"n_embd"},{anchor:"transformers.GPT2Config.n_layer",description:`<strong>n_layer</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"n_layer"},{anchor:"transformers.GPT2Config.n_head",description:`<strong>n_head</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"n_head"},{anchor:"transformers.GPT2Config.n_inner",description:`<strong>n_inner</strong> (<code>int</code>, <em>optional</em>, defaults to None) &#x2014;
Dimensionality of the inner feed-forward layers. <code>None</code> will set it to 4 times n_embd`,name:"n_inner"},{anchor:"transformers.GPT2Config.activation_function",description:`<strong>activation_function</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
Activation function, to be selected in the list <code>[&quot;relu&quot;, &quot;silu&quot;, &quot;gelu&quot;, &quot;tanh&quot;, &quot;gelu_new&quot;]</code>.`,name:"activation_function"},{anchor:"transformers.GPT2Config.resid_pdrop",description:`<strong>resid_pdrop</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:"resid_pdrop"},{anchor:"transformers.GPT2Config.embd_pdrop",description:`<strong>embd_pdrop</strong> (<code>int</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the embeddings.`,name:"embd_pdrop"},{anchor:"transformers.GPT2Config.attn_pdrop",description:`<strong>attn_pdrop</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention.`,name:"attn_pdrop"},{anchor:"transformers.GPT2Config.layer_norm_epsilon",description:`<strong>layer_norm_epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The epsilon to use in the layer normalization layers.`,name:"layer_norm_epsilon"},{anchor:"transformers.GPT2Config.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.GPT2Config.summary_type",description:`<strong>summary_type</strong> (<code>string</code>, <em>optional</em>, defaults to <code>&quot;cls_index&quot;</code>) &#x2014;
Argument used when doing sequence summary, used in the models <a href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2DoubleHeadsModel">GPT2DoubleHeadsModel</a> and
<a href="/docs/transformers/main/en/model_doc/gpt2#transformers.TFGPT2DoubleHeadsModel">TFGPT2DoubleHeadsModel</a>.</p>
<p>Has to be one of the following options:</p>
<ul>
<li><code>&quot;last&quot;</code>: Take the last token hidden state (like XLNet).</li>
<li><code>&quot;first&quot;</code>: Take the first token hidden state (like BERT).</li>
<li><code>&quot;mean&quot;</code>: Take the mean of all tokens hidden states.</li>
<li><code>&quot;cls_index&quot;</code>: Supply a Tensor of classification token position (like GPT/GPT-2).</li>
<li><code>&quot;attn&quot;</code>: Not implemented now, use multi-head attention.</li>
</ul>`,name:"summary_type"},{anchor:"transformers.GPT2Config.summary_use_proj",description:`<strong>summary_use_proj</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Argument used when doing sequence summary, used in the models <a href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2DoubleHeadsModel">GPT2DoubleHeadsModel</a> and
<a href="/docs/transformers/main/en/model_doc/gpt2#transformers.TFGPT2DoubleHeadsModel">TFGPT2DoubleHeadsModel</a>.</p>
<p>Whether or not to add a projection after the vector extraction.`,name:"summary_use_proj"},{anchor:"transformers.GPT2Config.summary_activation",description:`<strong>summary_activation</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Argument used when doing sequence summary. Used in for the multiple choice head in
<a href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2DoubleHeadsModel">GPT2DoubleHeadsModel</a>.</p>
<p>Pass <code>&quot;tanh&quot;</code> for a tanh activation to the output, any other value will result in no activation.`,name:"summary_activation"},{anchor:"transformers.GPT2Config.summary_proj_to_labels",description:`<strong>summary_proj_to_labels</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Argument used when doing sequence summary, used in the models <a href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2DoubleHeadsModel">GPT2DoubleHeadsModel</a> and
<a href="/docs/transformers/main/en/model_doc/gpt2#transformers.TFGPT2DoubleHeadsModel">TFGPT2DoubleHeadsModel</a>.</p>
<p>Whether the projection outputs should have <code>config.num_labels</code> or <code>config.hidden_size</code> classes.`,name:"summary_proj_to_labels"},{anchor:"transformers.GPT2Config.summary_first_dropout",description:`<strong>summary_first_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
Argument used when doing sequence summary, used in the models <a href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2DoubleHeadsModel">GPT2DoubleHeadsModel</a> and
<a href="/docs/transformers/main/en/model_doc/gpt2#transformers.TFGPT2DoubleHeadsModel">TFGPT2DoubleHeadsModel</a>.</p>
<p>The dropout ratio to be used after the projection and activation.`,name:"summary_first_dropout"},{anchor:"transformers.GPT2Config.scale_attn_weights",description:`<strong>scale_attn_weights</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Scale attention weights by dividing by sqrt(hidden_size)..`,name:"scale_attn_weights"},{anchor:"transformers.GPT2Config.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.GPT2Config.scale_attn_by_inverse_layer_idx",description:`<strong>scale_attn_by_inverse_layer_idx</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to additionally scale attention weights by <code>1 / layer_idx + 1</code>.`,name:"scale_attn_by_inverse_layer_idx"},{anchor:"transformers.GPT2Config.reorder_and_upcast_attn",description:`<strong>reorder_and_upcast_attn</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to scale keys (K) prior to computing attention (dot-product) and upcast attention
dot-product/softmax to float() when training with mixed precision.`,name:"reorder_and_upcast_attn"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/configuration_gpt2.py#L38"}}),Jo=new he({props:{anchor:"transformers.GPT2Config.example",$$slots:{default:[Qk]},$$scope:{ctx:x}}}),Us=new Me({}),Bs=new O({props:{name:"class transformers.GPT2Tokenizer",anchor:"transformers.GPT2Tokenizer",parameters:[{name:"vocab_file",val:""},{name:"merges_file",val:""},{name:"errors",val:" = 'replace'"},{name:"unk_token",val:" = '<|endoftext|>'"},{name:"bos_token",val:" = '<|endoftext|>'"},{name:"eos_token",val:" = '<|endoftext|>'"},{name:"pad_token",val:" = None"},{name:"add_prefix_space",val:" = False"},{name:"add_bos_token",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.GPT2Tokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.GPT2Tokenizer.merges_file",description:`<strong>merges_file</strong> (<code>str</code>) &#x2014;
Path to the merges file.`,name:"merges_file"},{anchor:"transformers.GPT2Tokenizer.errors",description:`<strong>errors</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;replace&quot;</code>) &#x2014;
Paradigm to follow when decoding bytes to UTF-8. See
<a href="https://docs.python.org/3/library/stdtypes.html#bytes.decode" rel="nofollow">bytes.decode</a> for more information.`,name:"errors"},{anchor:"transformers.GPT2Tokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&lt;|endoftext|&gt;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"},{anchor:"transformers.GPT2Tokenizer.bos_token",description:`<strong>bos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&lt;|endoftext|&gt;</code>) &#x2014;
The beginning of sequence token.`,name:"bos_token"},{anchor:"transformers.GPT2Tokenizer.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&lt;|endoftext|&gt;</code>) &#x2014;
The end of sequence token.`,name:"eos_token"},{anchor:"transformers.GPT2Tokenizer.add_prefix_space",description:`<strong>add_prefix_space</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to add an initial space to the input. This allows to treat the leading word just as any
other word. (GPT2 tokenizer detect beginning of words by the preceding space).`,name:"add_prefix_space"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/tokenization_gpt2.py#L104"}}),Yo=new he({props:{anchor:"transformers.GPT2Tokenizer.example",$$slots:{default:[Zk]},$$scope:{ctx:x}}}),Qo=new ot({props:{$$slots:{default:[ew]},$$scope:{ctx:x}}}),Vs=new O({props:{name:"save_vocabulary",anchor:"transformers.GPT2Tokenizer.save_vocabulary",parameters:[{name:"save_directory",val:": str"},{name:"filename_prefix",val:": typing.Optional[str] = None"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/tokenization_gpt2.py#L320"}}),Js=new Me({}),Xs=new O({props:{name:"class transformers.GPT2TokenizerFast",anchor:"transformers.GPT2TokenizerFast",parameters:[{name:"vocab_file",val:" = None"},{name:"merges_file",val:" = None"},{name:"tokenizer_file",val:" = None"},{name:"unk_token",val:" = '<|endoftext|>'"},{name:"bos_token",val:" = '<|endoftext|>'"},{name:"eos_token",val:" = '<|endoftext|>'"},{name:"add_prefix_space",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.GPT2TokenizerFast.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.GPT2TokenizerFast.merges_file",description:`<strong>merges_file</strong> (<code>str</code>) &#x2014;
Path to the merges file.`,name:"merges_file"},{anchor:"transformers.GPT2TokenizerFast.errors",description:`<strong>errors</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;replace&quot;</code>) &#x2014;
Paradigm to follow when decoding bytes to UTF-8. See
<a href="https://docs.python.org/3/library/stdtypes.html#bytes.decode" rel="nofollow">bytes.decode</a> for more information.`,name:"errors"},{anchor:"transformers.GPT2TokenizerFast.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&lt;|endoftext|&gt;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"},{anchor:"transformers.GPT2TokenizerFast.bos_token",description:`<strong>bos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&lt;|endoftext|&gt;</code>) &#x2014;
The beginning of sequence token.`,name:"bos_token"},{anchor:"transformers.GPT2TokenizerFast.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&lt;|endoftext|&gt;</code>) &#x2014;
The end of sequence token.`,name:"eos_token"},{anchor:"transformers.GPT2TokenizerFast.add_prefix_space",description:`<strong>add_prefix_space</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to add an initial space to the input. This allows to treat the leading word just as any
other word. (GPT2 tokenizer detect beginning of words by the preceding space).`,name:"add_prefix_space"},{anchor:"transformers.GPT2TokenizerFast.trim_offsets",description:`<strong>trim_offsets</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the post-processing step should trim offsets to avoid including whitespaces.`,name:"trim_offsets"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/tokenization_gpt2_fast.py#L70"}}),en=new he({props:{anchor:"transformers.GPT2TokenizerFast.example",$$slots:{default:[tw]},$$scope:{ctx:x}}}),tn=new ot({props:{$$slots:{default:[ow]},$$scope:{ctx:x}}}),ea=new Me({}),ta=new O({props:{name:"class transformers.models.gpt2.modeling_gpt2.GPT2DoubleHeadsModelOutput",anchor:"transformers.models.gpt2.modeling_gpt2.GPT2DoubleHeadsModelOutput",parameters:[{name:"loss",val:": typing.Optional[torch.FloatTensor] = None"},{name:"mc_loss",val:": typing.Optional[torch.FloatTensor] = None"},{name:"logits",val:": FloatTensor = None"},{name:"mc_logits",val:": FloatTensor = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"}],parametersDescription:[{anchor:"transformers.models.gpt2.modeling_gpt2.GPT2DoubleHeadsModelOutput.loss",description:`<strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) &#x2014;
Language modeling loss.`,name:"loss"},{anchor:"transformers.models.gpt2.modeling_gpt2.GPT2DoubleHeadsModelOutput.mc_loss",description:`<strong>mc_loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>mc_labels</code> is provided) &#x2014;
Multiple choice classification loss.`,name:"mc_loss"},{anchor:"transformers.models.gpt2.modeling_gpt2.GPT2DoubleHeadsModelOutput.logits",description:`<strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices, sequence_length, config.vocab_size)</code>) &#x2014;
Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).`,name:"logits"},{anchor:"transformers.models.gpt2.modeling_gpt2.GPT2DoubleHeadsModelOutput.mc_logits",description:`<strong>mc_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices)</code>) &#x2014;
Prediction scores of the multiple choice classification head (scores for each choice before SoftMax).`,name:"mc_logits"},{anchor:"transformers.models.gpt2.modeling_gpt2.GPT2DoubleHeadsModelOutput.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[torch.Tensor]]</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) &#x2014;
Tuple of length <code>config.n_layers</code>, containing tuples of 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 attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.`,name:"past_key_values"},{anchor:"transformers.models.gpt2.modeling_gpt2.GPT2DoubleHeadsModelOutput.hidden_states",description:`<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>) &#x2014;
Tuple of <code>torch.FloatTensor</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.`,name:"hidden_states"},{anchor:"transformers.models.gpt2.modeling_gpt2.GPT2DoubleHeadsModelOutput.attentions",description:`<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>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>GPT2Attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads.`,name:"attentions"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_gpt2.py#L486"}}),oa=new O({props:{name:"class transformers.models.gpt2.modeling_tf_gpt2.TFGPT2DoubleHeadsModelOutput",anchor:"transformers.models.gpt2.modeling_tf_gpt2.TFGPT2DoubleHeadsModelOutput",parameters:[{name:"logits",val:": Tensor = None"},{name:"mc_logits",val:": Tensor = None"},{name:"past_key_values",val:": typing.Optional[typing.List[tensorflow.python.framework.ops.Tensor]] = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[tensorflow.python.framework.ops.Tensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[tensorflow.python.framework.ops.Tensor]] = None"}],parametersDescription:[{anchor:"transformers.models.gpt2.modeling_tf_gpt2.TFGPT2DoubleHeadsModelOutput.logits",description:`<strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_choices, sequence_length, config.vocab_size)</code>) &#x2014;
Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).`,name:"logits"},{anchor:"transformers.models.gpt2.modeling_tf_gpt2.TFGPT2DoubleHeadsModelOutput.mc_logits",description:`<strong>mc_logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_choices)</code>) &#x2014;
Prediction scores of the multiple choice classification head (scores for each choice before SoftMax).`,name:"mc_logits"},{anchor:"transformers.models.gpt2.modeling_tf_gpt2.TFGPT2DoubleHeadsModelOutput.past_key_values",description:`<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>) &#x2014;
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.`,name:"past_key_values"},{anchor:"transformers.models.gpt2.modeling_tf_gpt2.TFGPT2DoubleHeadsModelOutput.hidden_states",description:`<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>) &#x2014;
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.`,name:"hidden_states"},{anchor:"transformers.models.gpt2.modeling_tf_gpt2.TFGPT2DoubleHeadsModelOutput.attentions",description:`<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>) &#x2014;
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.`,name:"attentions"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_tf_gpt2.py#L571"}}),na=new Me({}),sa=new O({props:{name:"class transformers.GPT2Model",anchor:"transformers.GPT2Model",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GPT2Model.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config">GPT2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_gpt2.py#L666"}}),la=new O({props:{name:"forward",anchor:"transformers.GPT2Model.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.Tensor]]] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_attention_mask",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.GPT2Model.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else
<code>past_key_values[0][0].shape[-2]</code> (<code>sequence_length</code> of input past key value states). Indices of input
sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only <code>input_ids</code> that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.GPT2Model.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[torch.Tensor]]</code> of length <code>config.n_layers</code>) &#x2014;
Contains precomputed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The <code>input_ids</code> which have
their past given to this model should not be passed as <code>input_ids</code> as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.GPT2Model.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</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>If <code>past_key_values</code> is used, <code>attention_mask</code> needs to contain the masking strategy that was used for
<code>past_key_values</code>. In other words, the <code>attention_mask</code> always has to have the length:
<code>len(past_key_values) + len(input_ids)</code></p>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.GPT2Model.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.GPT2Model.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPT2Model.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-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.GPT2Model.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.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>inputs_embeds</code> have to be input (see
<code>past_key_values</code>).`,name:"inputs_embeds"},{anchor:"transformers.GPT2Model.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.GPT2Model.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.GPT2Model.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.GPT2Model.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_gpt2.py#L735",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config"
>GPT2Config</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>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> and <code>config.add_cross_attention=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 of the decoder\u2019s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),sn=new ot({props:{$$slots:{default:[nw]},$$scope:{ctx:x}}}),an=new he({props:{anchor:"transformers.GPT2Model.forward.example",$$slots:{default:[sw]},$$scope:{ctx:x}}}),da=new O({props:{name:"parallelize",anchor:"transformers.GPT2Model.parallelize",parameters:[{name:"device_map",val:" = None"}],parametersDescription:[{anchor:"transformers.GPT2Model.parallelize.device_map",description:`<strong>device_map</strong> (<code>Dict[int, list]</code>, optional, defaults to None) &#x2014;
A dictionary that maps attention modules to devices. Note that the embedding module and LMHead are always
automatically mapped to the first device (for esoteric reasons). That means that the first device should
have fewer attention modules mapped to it than other devices. For reference, the gpt2 models have the
following number of attention modules:</p>
<ul>
<li>gpt2: 12</li>
<li>gpt2-medium: 24</li>
<li>gpt2-large: 36</li>
<li>gpt2-xl: 48</li>
</ul>`,name:"device_map"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_gpt2.py#L689"}}),rn=new he({props:{anchor:"transformers.GPT2Model.parallelize.example",$$slots:{default:[aw]},$$scope:{ctx:x}}}),ca=new O({props:{name:"deparallelize",anchor:"transformers.GPT2Model.deparallelize",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_gpt2.py#L709"}}),ln=new he({props:{anchor:"transformers.GPT2Model.deparallelize.example",$$slots:{default:[rw]},$$scope:{ctx:x}}}),pa=new Me({}),ha=new O({props:{name:"class transformers.GPT2LMHeadModel",anchor:"transformers.GPT2LMHeadModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GPT2LMHeadModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config">GPT2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_gpt2.py#L943"}}),ga=new O({props:{name:"forward",anchor:"transformers.GPT2LMHeadModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.Tensor]]] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_attention_mask",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.GPT2LMHeadModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else
<code>past_key_values[0][0].shape[-2]</code> (<code>sequence_length</code> of input past key value states). Indices of input
sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only <code>input_ids</code> that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.GPT2LMHeadModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[torch.Tensor]]</code> of length <code>config.n_layers</code>) &#x2014;
Contains precomputed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The <code>input_ids</code> which have
their past given to this model should not be passed as <code>input_ids</code> as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.GPT2LMHeadModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</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>If <code>past_key_values</code> is used, <code>attention_mask</code> needs to contain the masking strategy that was used for
<code>past_key_values</code>. In other words, the <code>attention_mask</code> always has to have the length:
<code>len(past_key_values) + len(input_ids)</code></p>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.GPT2LMHeadModel.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.GPT2LMHeadModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPT2LMHeadModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-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.GPT2LMHeadModel.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.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>inputs_embeds</code> have to be input (see
<code>past_key_values</code>).`,name:"inputs_embeds"},{anchor:"transformers.GPT2LMHeadModel.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.GPT2LMHeadModel.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.GPT2LMHeadModel.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.GPT2LMHeadModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPT2LMHeadModel.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for language modeling. Note that the labels <strong>are shifted</strong> inside the model, i.e. you can set
<code>labels = input_ids</code> Indices are selected in <code>[-100, 0, ..., config.vocab_size]</code> All labels set to <code>-100</code>
are ignored (masked), the loss is only computed for labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_gpt2.py#L1012",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config"
>GPT2Config</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>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>
<li>
<p><strong>cross_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>Cross attentions weights after the attention softmax, used to compute the weighted average in the
cross-attention heads.</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>torch.FloatTensor</code> tuples of length <code>config.n_layers</code>, with each tuple containing the cached key,
value states of the self-attention and the cross-attention layers if model is used in encoder-decoder
setting. Only relevant if <code>config.is_decoder = True</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>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),cn=new ot({props:{$$slots:{default:[iw]},$$scope:{ctx:x}}}),pn=new he({props:{anchor:"transformers.GPT2LMHeadModel.forward.example",$$slots:{default:[lw]},$$scope:{ctx:x}}}),_a=new O({props:{name:"parallelize",anchor:"transformers.GPT2LMHeadModel.parallelize",parameters:[{name:"device_map",val:" = None"}],parametersDescription:[{anchor:"transformers.GPT2LMHeadModel.parallelize.device_map",description:`<strong>device_map</strong> (<code>Dict[int, list]</code>, optional, defaults to None) &#x2014;
A dictionary that maps attention modules to devices. Note that the embedding module and LMHead are always
automatically mapped to the first device (for esoteric reasons). That means that the first device should
have fewer attention modules mapped to it than other devices. For reference, the gpt2 models have the
following number of attention modules:</p>
<ul>
<li>gpt2: 12</li>
<li>gpt2-medium: 24</li>
<li>gpt2-large: 36</li>
<li>gpt2-xl: 48</li>
</ul>`,name:"device_map"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_gpt2.py#L958"}}),hn=new he({props:{anchor:"transformers.GPT2LMHeadModel.parallelize.example",$$slots:{default:[dw]},$$scope:{ctx:x}}}),Ta=new O({props:{name:"deparallelize",anchor:"transformers.GPT2LMHeadModel.deparallelize",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_gpt2.py#L970"}}),un=new he({props:{anchor:"transformers.GPT2LMHeadModel.deparallelize.example",$$slots:{default:[cw]},$$scope:{ctx:x}}}),ba=new Me({}),ya=new O({props:{name:"class transformers.GPT2DoubleHeadsModel",anchor:"transformers.GPT2DoubleHeadsModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GPT2DoubleHeadsModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config">GPT2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_gpt2.py#L1111"}}),$a=new O({props:{name:"forward",anchor:"transformers.GPT2DoubleHeadsModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.Tensor]]] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"mc_token_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"mc_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"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.GPT2DoubleHeadsModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else
<code>past_key_values[0][0].shape[-2]</code> (<code>sequence_length</code> of input past key value states). Indices of input
sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only <code>input_ids</code> that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.GPT2DoubleHeadsModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[torch.Tensor]]</code> of length <code>config.n_layers</code>) &#x2014;
Contains precomputed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The <code>input_ids</code> which have
their past given to this model should not be passed as <code>input_ids</code> as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.GPT2DoubleHeadsModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</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>If <code>past_key_values</code> is used, <code>attention_mask</code> needs to contain the masking strategy that was used for
<code>past_key_values</code>. In other words, the <code>attention_mask</code> always has to have the length:
<code>len(past_key_values) + len(input_ids)</code></p>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.GPT2DoubleHeadsModel.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.GPT2DoubleHeadsModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPT2DoubleHeadsModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-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.GPT2DoubleHeadsModel.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.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>inputs_embeds</code> have to be input (see
<code>past_key_values</code>).`,name:"inputs_embeds"},{anchor:"transformers.GPT2DoubleHeadsModel.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.GPT2DoubleHeadsModel.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.GPT2DoubleHeadsModel.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.GPT2DoubleHeadsModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPT2DoubleHeadsModel.forward.mc_token_ids",description:`<strong>mc_token_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_choices)</code>, <em>optional</em>, default to index of the last token of the input) &#x2014;
Index of the classification token in each input sequence. Selected in the range <code>[0, input_ids.size(-1) - 1]</code>.`,name:"mc_token_ids"},{anchor:"transformers.GPT2DoubleHeadsModel.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for language modeling. Note that the labels <strong>are shifted</strong> inside the model, i.e. you can set
<code>labels = input_ids</code>. Indices are selected in <code>[-100, 0, ..., config.vocab_size - 1]</code>. All labels set to
<code>-100</code> are ignored (masked), the loss is only computed for labels in <code>[0, ..., config.vocab_size - 1]</code>`,name:"labels"},{anchor:"transformers.GPT2DoubleHeadsModel.forward.mc_labels",description:`<strong>mc_labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size)</code>, <em>optional</em>) &#x2014;
Labels for computing the multiple choice classification loss. Indices should be in <code>[0, ..., num_choices]</code>
where <em>num_choices</em> is the size of the second dimension of the input tensors. (see <em>input_ids</em> above)`,name:"mc_labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_gpt2.py#L1185",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/model_doc/gpt2#transformers.models.gpt2.modeling_gpt2.GPT2DoubleHeadsModelOutput"
>transformers.models.gpt2.modeling_gpt2.GPT2DoubleHeadsModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config"
>GPT2Config</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.</p>
</li>
<li>
<p><strong>mc_loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>mc_labels</code> is provided) \u2014 Multiple choice classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices, 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>mc_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices)</code>) \u2014 Prediction scores of the multiple choice classification head (scores for each choice before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>Tuple[Tuple[torch.Tensor]]</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of length <code>config.n_layers</code>, containing tuples of 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 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 + 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(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>GPT2Attentions weights after the attention softmax, used to compute the weighted average in the
self-attention heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/gpt2#transformers.models.gpt2.modeling_gpt2.GPT2DoubleHeadsModelOutput"
>transformers.models.gpt2.modeling_gpt2.GPT2DoubleHeadsModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),fn=new ot({props:{$$slots:{default:[pw]},$$scope:{ctx:x}}}),gn=new he({props:{anchor:"transformers.GPT2DoubleHeadsModel.forward.example",$$slots:{default:[hw]},$$scope:{ctx:x}}}),Pa=new Me({}),Ma=new O({props:{name:"class transformers.GPT2ForSequenceClassification",anchor:"transformers.GPT2ForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GPT2ForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config">GPT2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_gpt2.py#L1325"}}),Fa=new O({props:{name:"forward",anchor:"transformers.GPT2ForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.Tensor]]] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[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.GPT2ForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else
<code>past_key_values[0][0].shape[-2]</code> (<code>sequence_length</code> of input past key value states). Indices of input
sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only <code>input_ids</code> that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.GPT2ForSequenceClassification.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[torch.Tensor]]</code> of length <code>config.n_layers</code>) &#x2014;
Contains precomputed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The <code>input_ids</code> which have
their past given to this model should not be passed as <code>input_ids</code> as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.GPT2ForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</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>If <code>past_key_values</code> is used, <code>attention_mask</code> needs to contain the masking strategy that was used for
<code>past_key_values</code>. In other words, the <code>attention_mask</code> always has to have the length:
<code>len(past_key_values) + len(input_ids)</code></p>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.GPT2ForSequenceClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.GPT2ForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPT2ForSequenceClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-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.GPT2ForSequenceClassification.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.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>inputs_embeds</code> have to be input (see
<code>past_key_values</code>).`,name:"inputs_embeds"},{anchor:"transformers.GPT2ForSequenceClassification.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.GPT2ForSequenceClassification.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.GPT2ForSequenceClassification.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.GPT2ForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPT2ForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_gpt2.py#L1341",returnDescription:`
<p>A <code>transformers.modeling_outputs.SequenceClassifierOutputWithPast</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config"
>GPT2Config</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>
`}}),Tn=new ot({props:{$$slots:{default:[uw]},$$scope:{ctx:x}}}),bn=new he({props:{anchor:"transformers.GPT2ForSequenceClassification.forward.example",$$slots:{default:[mw]},$$scope:{ctx:x}}}),yn=new he({props:{anchor:"transformers.GPT2ForSequenceClassification.forward.example-2",$$slots:{default:[fw]},$$scope:{ctx:x}}}),Ea=new Me({}),ja=new O({props:{name:"class transformers.GPT2ForTokenClassification",anchor:"transformers.GPT2ForTokenClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GPT2ForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config">GPT2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_gpt2.py#L1450"}}),Da=new O({props:{name:"forward",anchor:"transformers.GPT2ForTokenClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.Tensor]]] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[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.GPT2ForTokenClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else
<code>past_key_values[0][0].shape[-2]</code> (<code>sequence_length</code> of input past key value states). Indices of input
sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only <code>input_ids</code> that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.GPT2ForTokenClassification.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[torch.Tensor]]</code> of length <code>config.n_layers</code>) &#x2014;
Contains precomputed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The <code>input_ids</code> which have
their past given to this model should not be passed as <code>input_ids</code> as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.GPT2ForTokenClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</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>If <code>past_key_values</code> is used, <code>attention_mask</code> needs to contain the masking strategy that was used for
<code>past_key_values</code>. In other words, the <code>attention_mask</code> always has to have the length:
<code>len(past_key_values) + len(input_ids)</code></p>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.GPT2ForTokenClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.GPT2ForTokenClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.GPT2ForTokenClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-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.GPT2ForTokenClassification.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.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>inputs_embeds</code> have to be input (see
<code>past_key_values</code>).`,name:"inputs_embeds"},{anchor:"transformers.GPT2ForTokenClassification.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.GPT2ForTokenClassification.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.GPT2ForTokenClassification.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.GPT2ForTokenClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.GPT2ForTokenClassification.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 sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_gpt2.py#L1472",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config"
>GPT2Config</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 loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) \u2014 Classification scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),kn=new ot({props:{$$slots:{default:[gw]},$$scope:{ctx:x}}}),wn=new he({props:{anchor:"transformers.GPT2ForTokenClassification.forward.example",$$slots:{default:[_w]},$$scope:{ctx:x}}}),La=new Me({}),Oa=new O({props:{name:"class transformers.TFGPT2Model",anchor:"transformers.TFGPT2Model",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFGPT2Model.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config">GPT2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_tf_gpt2.py#L720"}}),Pn=new ot({props:{$$slots:{default:[Tw]},$$scope:{ctx:x}}}),Sa=new O({props:{name:"call",anchor:"transformers.TFGPT2Model.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:"token_type_ids",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:"encoder_hidden_states",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"encoder_attention_mask",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"}],parametersDescription:[{anchor:"transformers.TFGPT2Model.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else <code>past_key_values[0].shape[-2]</code>
(<code>sequence_length</code> of input past key value states). Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only input IDs that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFGPT2Model.call.past_key_values",description:`<strong>past_key_values</strong> (<code>List[tf.Tensor]</code> of length <code>config.n_layers</code>) &#x2014;
Contains pre-computed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The token ids which have
their past given to this model should not be passed as input ids as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.TFGPT2Model.call.attention_mask",description:`<strong>attention_mask</strong> (<code>tf.Tensor</code> or <code>Numpy array</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>If <code>past_key_values</code> is used, <code>attention_mask</code> needs to contain the masking strategy that was used for
<code>past_key_values</code>. In other words, the <code>attention_mask</code> always has to have the length:
<code>len(past_key_values) + len(input_ids)</code></p>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFGPT2Model.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFGPT2Model.call.position_ids",description:`<strong>position_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFGPT2Model.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-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.TFGPT2Model.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</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.TFGPT2Model.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.TFGPT2Model.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.TFGPT2Model.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFGPT2Model.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"},{anchor:"transformers.TFGPT2Model.call.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong>  (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Sequence of hidden-states at the output of the last layer of the encoder. Used in the cross-attention if
the model is configured as a decoder.`,name:"encoder_hidden_states"},{anchor:"transformers.TFGPT2Model.call.encoder_attention_mask",description:`<strong>encoder_attention_mask</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on the padding token indices of the encoder input. This mask is used in
the cross-attention if the model is configured as a decoder. 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>`,name:"encoder_attention_mask"},{anchor:"transformers.TFGPT2Model.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</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.TFGPT2Model.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</code>). Set to <code>False</code> during training, <code>True</code> during generation`,name:"use_cache"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_tf_gpt2.py#L725",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPastAndCrossAttentions"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPastAndCrossAttentions</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config"
>GPT2Config</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.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>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>
<li>
<p><strong>cross_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 of the decoder\u2019s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPastAndCrossAttentions"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPastAndCrossAttentions</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Mn=new ot({props:{$$slots:{default:[bw]},$$scope:{ctx:x}}}),xn=new he({props:{anchor:"transformers.TFGPT2Model.call.example",$$slots:{default:[yw]},$$scope:{ctx:x}}}),Wa=new Me({}),Ua=new O({props:{name:"class transformers.TFGPT2LMHeadModel",anchor:"transformers.TFGPT2LMHeadModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFGPT2LMHeadModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config">GPT2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_tf_gpt2.py#L817"}}),zn=new ot({props:{$$slots:{default:[vw]},$$scope:{ctx:x}}}),Va=new O({props:{name:"call",anchor:"transformers.TFGPT2LMHeadModel.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:"token_type_ids",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:"encoder_hidden_states",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"encoder_attention_mask",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:"labels",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"training",val:": typing.Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFGPT2LMHeadModel.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else <code>past_key_values[0].shape[-2]</code>
(<code>sequence_length</code> of input past key value states). Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only input IDs that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFGPT2LMHeadModel.call.past_key_values",description:`<strong>past_key_values</strong> (<code>List[tf.Tensor]</code> of length <code>config.n_layers</code>) &#x2014;
Contains pre-computed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The token ids which have
their past given to this model should not be passed as input ids as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.TFGPT2LMHeadModel.call.attention_mask",description:`<strong>attention_mask</strong> (<code>tf.Tensor</code> or <code>Numpy array</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>If <code>past_key_values</code> is used, <code>attention_mask</code> needs to contain the masking strategy that was used for
<code>past_key_values</code>. In other words, the <code>attention_mask</code> always has to have the length:
<code>len(past_key_values) + len(input_ids)</code></p>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFGPT2LMHeadModel.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFGPT2LMHeadModel.call.position_ids",description:`<strong>position_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFGPT2LMHeadModel.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-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.TFGPT2LMHeadModel.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</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.TFGPT2LMHeadModel.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.TFGPT2LMHeadModel.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.TFGPT2LMHeadModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFGPT2LMHeadModel.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"},{anchor:"transformers.TFGPT2LMHeadModel.call.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong>  (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Sequence of hidden-states at the output of the last layer of the encoder. Used in the cross-attention if
the model is configured as a decoder.`,name:"encoder_hidden_states"},{anchor:"transformers.TFGPT2LMHeadModel.call.encoder_attention_mask",description:`<strong>encoder_attention_mask</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on the padding token indices of the encoder input. This mask is used in
the cross-attention if the model is configured as a decoder. 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>`,name:"encoder_attention_mask"},{anchor:"transformers.TFGPT2LMHeadModel.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</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.TFGPT2LMHeadModel.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</code>). Set to <code>False</code> during training, <code>True</code> during generation`,name:"use_cache"},{anchor:"transformers.TFGPT2LMHeadModel.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the cross entropy classification loss. Indices should be in <code>[0, ..., config.vocab_size - 1]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_tf_gpt2.py#L853",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFCausalLMOutputWithCrossAttentions"
>transformers.modeling_tf_outputs.TFCausalLMOutputWithCrossAttentions</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config"
>GPT2Config</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>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>
<li>
<p><strong>cross_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 of the decoder\u2019s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</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>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_tf_outputs.TFCausalLMOutputWithCrossAttentions"
>transformers.modeling_tf_outputs.TFCausalLMOutputWithCrossAttentions</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Fn=new ot({props:{$$slots:{default:[kw]},$$scope:{ctx:x}}}),En=new he({props:{anchor:"transformers.TFGPT2LMHeadModel.call.example",$$slots:{default:[ww]},$$scope:{ctx:x}}}),Ja=new Me({}),Xa=new O({props:{name:"class transformers.TFGPT2DoubleHeadsModel",anchor:"transformers.TFGPT2DoubleHeadsModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFGPT2DoubleHeadsModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config">GPT2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_tf_gpt2.py#L967"}}),qn=new ot({props:{$$slots:{default:[$w]},$$scope:{ctx:x}}}),er=new O({props:{name:"call",anchor:"transformers.TFGPT2DoubleHeadsModel.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:"token_type_ids",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:"mc_token_ids",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"}],parametersDescription:[{anchor:"transformers.TFGPT2DoubleHeadsModel.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else <code>past_key_values[0].shape[-2]</code>
(<code>sequence_length</code> of input past key value states). Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only input IDs that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFGPT2DoubleHeadsModel.call.past_key_values",description:`<strong>past_key_values</strong> (<code>List[tf.Tensor]</code> of length <code>config.n_layers</code>) &#x2014;
Contains pre-computed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The token ids which have
their past given to this model should not be passed as input ids as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.TFGPT2DoubleHeadsModel.call.attention_mask",description:`<strong>attention_mask</strong> (<code>tf.Tensor</code> or <code>Numpy array</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>If <code>past_key_values</code> is used, <code>attention_mask</code> needs to contain the masking strategy that was used for
<code>past_key_values</code>. In other words, the <code>attention_mask</code> always has to have the length:
<code>len(past_key_values) + len(input_ids)</code></p>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFGPT2DoubleHeadsModel.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFGPT2DoubleHeadsModel.call.position_ids",description:`<strong>position_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFGPT2DoubleHeadsModel.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-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.TFGPT2DoubleHeadsModel.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</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.TFGPT2DoubleHeadsModel.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.TFGPT2DoubleHeadsModel.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.TFGPT2DoubleHeadsModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFGPT2DoubleHeadsModel.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"},{anchor:"transformers.TFGPT2DoubleHeadsModel.call.mc_token_ids",description:`<strong>mc_token_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, num_choices)</code>, <em>optional</em>, default to index of the last token of the input) &#x2014;
Index of the classification token in each input sequence. Selected in the range <code>[0, input_ids.size(-1) - 1]</code>.`,name:"mc_token_ids"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_tf_gpt2.py#L976",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/model_doc/gpt2#transformers.models.gpt2.modeling_tf_gpt2.TFGPT2DoubleHeadsModelOutput"
>transformers.models.gpt2.modeling_tf_gpt2.TFGPT2DoubleHeadsModelOutput</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config"
>GPT2Config</a>) and inputs.</p>
<ul>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_choices, 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>mc_logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_choices)</code>) \u2014 Prediction scores of the multiple choice classification head (scores for each choice before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>List[tf.Tensor]</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 List of <code>tf.Tensor</code> of length <code>config.n_layers</code>, with each tensor of shape <code>(2, batch_size, num_heads, sequence_length, embed_size_per_head)</code>).</p>
<p>Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/gpt2#transformers.models.gpt2.modeling_tf_gpt2.TFGPT2DoubleHeadsModelOutput"
>transformers.models.gpt2.modeling_tf_gpt2.TFGPT2DoubleHeadsModelOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Cn=new ot({props:{$$slots:{default:[Pw]},$$scope:{ctx:x}}}),An=new he({props:{anchor:"transformers.TFGPT2DoubleHeadsModel.call.example",$$slots:{default:[Mw]},$$scope:{ctx:x}}}),tr=new Me({}),or=new O({props:{name:"class transformers.TFGPT2ForSequenceClassification",anchor:"transformers.TFGPT2ForSequenceClassification",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFGPT2ForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config">GPT2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_tf_gpt2.py#L1115"}}),Ln=new ot({props:{$$slots:{default:[xw]},$$scope:{ctx:x}}}),rr=new O({props:{name:"call",anchor:"transformers.TFGPT2ForSequenceClassification.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:"token_type_ids",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:"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:"labels",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"training",val:": typing.Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFGPT2ForSequenceClassification.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else <code>past_key_values[0].shape[-2]</code>
(<code>sequence_length</code> of input past key value states). Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only input IDs that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFGPT2ForSequenceClassification.call.past_key_values",description:`<strong>past_key_values</strong> (<code>List[tf.Tensor]</code> of length <code>config.n_layers</code>) &#x2014;
Contains pre-computed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The token ids which have
their past given to this model should not be passed as input ids as they have already been computed.`,name:"past_key_values"},{anchor:"transformers.TFGPT2ForSequenceClassification.call.attention_mask",description:`<strong>attention_mask</strong> (<code>tf.Tensor</code> or <code>Numpy array</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>If <code>past_key_values</code> is used, <code>attention_mask</code> needs to contain the masking strategy that was used for
<code>past_key_values</code>. In other words, the <code>attention_mask</code> always has to have the length:
<code>len(past_key_values) + len(input_ids)</code></p>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFGPT2ForSequenceClassification.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFGPT2ForSequenceClassification.call.position_ids",description:`<strong>position_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.TFGPT2ForSequenceClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-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.TFGPT2ForSequenceClassification.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</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.TFGPT2ForSequenceClassification.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.TFGPT2ForSequenceClassification.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.TFGPT2ForSequenceClassification.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFGPT2ForSequenceClassification.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"},{anchor:"transformers.TFGPT2ForSequenceClassification.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the cross entropy classification loss. Indices should be in <code>[0, ..., config.vocab_size - 1]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_tf_gpt2.py#L1127",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/model_doc/gpt2#transformers.modeling_tf_outputs.TFSequenceClassifierOutputWithPast"
>transformers.modeling_tf_outputs.TFSequenceClassifierOutputWithPast</a> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config"
>GPT2Config</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, )</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>tf.Tensor</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>List[tf.Tensor]</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 List of <code>tf.Tensor</code> of length <code>config.n_layers</code>, with each tensor of shape <code>(2, batch_size, num_heads, sequence_length, embed_size_per_head)</code>).</p>
<p>Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/model_doc/gpt2#transformers.modeling_tf_outputs.TFSequenceClassifierOutputWithPast"
>transformers.modeling_tf_outputs.TFSequenceClassifierOutputWithPast</a> or <code>tuple(tf.Tensor)</code></p>
`}}),On=new ot({props:{$$slots:{default:[Gw]},$$scope:{ctx:x}}}),Hn=new he({props:{anchor:"transformers.TFGPT2ForSequenceClassification.call.example",$$slots:{default:[zw]},$$scope:{ctx:x}}}),Nn=new he({props:{anchor:"transformers.TFGPT2ForSequenceClassification.call.example-2",$$slots:{default:[Fw]},$$scope:{ctx:x}}}),ir=new Me({}),lr=new O({props:{name:"class transformers.modeling_tf_outputs.TFSequenceClassifierOutputWithPast",anchor:"transformers.modeling_tf_outputs.TFSequenceClassifierOutputWithPast",parameters:[{name:"loss",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"logits",val:": Tensor = None"},{name:"past_key_values",val:": typing.Optional[typing.List[tensorflow.python.framework.ops.Tensor]] = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[tensorflow.python.framework.ops.Tensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[tensorflow.python.framework.ops.Tensor]] = None"}],parametersDescription:[{anchor:"transformers.modeling_tf_outputs.TFSequenceClassifierOutputWithPast.loss",description:`<strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, )</code>, <em>optional</em>, returned when <code>labels</code> is provided) &#x2014;
Classification (or regression if config.num_labels==1) loss.`,name:"loss"},{anchor:"transformers.modeling_tf_outputs.TFSequenceClassifierOutputWithPast.logits",description:`<strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, config.num_labels)</code>) &#x2014;
Classification (or regression if config.num_labels==1) scores (before SoftMax).`,name:"logits"},{anchor:"transformers.modeling_tf_outputs.TFSequenceClassifierOutputWithPast.past_key_values",description:`<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>) &#x2014;
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.`,name:"past_key_values"},{anchor:"transformers.modeling_tf_outputs.TFSequenceClassifierOutputWithPast.hidden_states",description:`<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>) &#x2014;
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.`,name:"hidden_states"},{anchor:"transformers.modeling_tf_outputs.TFSequenceClassifierOutputWithPast.attentions",description:`<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>) &#x2014;
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.`,name:"attentions"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/modeling_tf_outputs.py#L898"}}),dr=new Me({}),cr=new O({props:{name:"class transformers.TFGPT2Tokenizer",anchor:"transformers.TFGPT2Tokenizer",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFGPT2Tokenizer.vocab",description:"<strong>vocab</strong> (Dict[str, int]) &#x2014; Vocabulary dict for Byte Pair Tokenizer",name:"vocab"},{anchor:"transformers.TFGPT2Tokenizer.merges",description:"<strong>merges</strong> (List[str]) &#x2014; Merges list for Byte Pair Tokenizer",name:"merges"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/tokenization_gpt2_tf.py#L12"}}),hr=new O({props:{name:"from_config",anchor:"transformers.TFGPT2Tokenizer.from_config",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.TFGPT2Tokenizer.from_config.config",description:"<strong>config</strong> (Dict) &#x2014; Dictionary with keys such as stated in <code>get_config</code>.",name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/tokenization_gpt2_tf.py#L74"}}),ur=new O({props:{name:"from_pretrained",anchor:"transformers.TFGPT2Tokenizer.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:": typing.Union[str, os.PathLike]"},{name:"*init_inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFGPT2Tokenizer.from_pretrained.pretrained_model_name_or_path",description:"<strong>pretrained_model_name_or_path</strong> (Union[str, os.PathLike]) &#x2014; Path to pretrained model",name:"pretrained_model_name_or_path"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/tokenization_gpt2_tf.py#L56"}}),Un=new he({props:{anchor:"transformers.TFGPT2Tokenizer.from_pretrained.example",$$slots:{default:[Ew]},$$scope:{ctx:x}}}),mr=new O({props:{name:"from_tokenizer",anchor:"transformers.TFGPT2Tokenizer.from_tokenizer",parameters:[{name:"tokenizer",val:": GPT2Tokenizer"},{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFGPT2Tokenizer.from_tokenizer.tokenizer",description:"<strong>tokenizer</strong> (GPT2Tokenizer) &#x2014;",name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/tokenization_gpt2_tf.py#L36"}}),Bn=new he({props:{anchor:"transformers.TFGPT2Tokenizer.from_tokenizer.example",$$slots:{default:[jw]},$$scope:{ctx:x}}}),fr=new Me({}),gr=new O({props:{name:"class transformers.FlaxGPT2Model",anchor:"transformers.FlaxGPT2Model",parameters:[{name:"config",val:": GPT2Config"},{name:"input_shape",val:": typing.Tuple = (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.FlaxGPT2Model.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config">GPT2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.FlaxGPT2Model.dtype",description:`<strong>dtype</strong> (<code>jax.numpy.dtype</code>, <em>optional</em>, defaults to <code>jax.numpy.float32</code>) &#x2014;
The data type of the computation. Can be one of <code>jax.numpy.float32</code>, <code>jax.numpy.float16</code> (on GPUs) and
<code>jax.numpy.bfloat16</code> (on TPUs).</p>
<p>This can be used to enable mixed-precision training or half-precision inference on GPUs or TPUs. If
specified all the computation will be performed with the given <code>dtype</code>.</p>
<p><strong>Note that this only specifies the dtype of the computation and does not influence the dtype of model
parameters.</strong></p>
<p>If you wish to change the dtype of the model parameters, see <a href="/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_flax_gpt2.py#L666"}}),$r=new O({props:{name:"__call__",anchor:"transformers.FlaxGPT2Model.__call__",parameters:[{name:"input_ids",val:""},{name:"attention_mask",val:" = None"},{name:"position_ids",val:" = None"},{name:"encoder_hidden_states",val:": typing.Optional[jax._src.numpy.ndarray.ndarray] = None"},{name:"encoder_attention_mask",val:": typing.Optional[jax._src.numpy.ndarray.ndarray] = None"},{name:"params",val:": dict = None"},{name:"past_key_values",val:": dict = None"},{name:"dropout_rng",val:": PRNGKey = None"},{name:"train",val:": bool = False"},{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.FlaxGPT2Model.__call__.input_ids",description:`<strong>input_ids</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code>. Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FlaxGPT2Model.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>numpy.ndarray</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.FlaxGPT2Model.__call__.position_ids",description:`<strong>position_ids</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.`,name:"position_ids"},{anchor:"transformers.FlaxGPT2Model.__call__.past_key_values",description:`<strong>past_key_values</strong> (<code>Dict[str, np.ndarray]</code>, <em>optional</em>, returned by <code>init_cache</code> or when passing previous <code>past_key_values</code>) &#x2014;
Dictionary of pre-computed hidden-states (key and values in the attention blocks) that can be used for fast
auto-regressive decoding. Pre-computed key and value hidden-states are of shape <em>[batch_size, max_length]</em>.`,name:"past_key_values"},{anchor:"transformers.FlaxGPT2Model.__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.FlaxGPT2Model.__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.FlaxGPT2Model.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_flax_gpt2.py#L457",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPastAndCrossAttentions"
>transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPastAndCrossAttentions</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config"
>GPT2Config</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>
<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(jnp.ndarray))</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(jnp.ndarray)</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(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>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> and <code>config.add_cross_attention=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 of the decoder\u2019s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPastAndCrossAttentions"
>transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPastAndCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Kn=new ot({props:{$$slots:{default:[qw]},$$scope:{ctx:x}}}),Vn=new he({props:{anchor:"transformers.FlaxGPT2Model.__call__.example",$$slots:{default:[Cw]},$$scope:{ctx:x}}}),Pr=new Me({}),Mr=new O({props:{name:"class transformers.FlaxGPT2LMHeadModel",anchor:"transformers.FlaxGPT2LMHeadModel",parameters:[{name:"config",val:": GPT2Config"},{name:"input_shape",val:": typing.Tuple = (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.FlaxGPT2LMHeadModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config">GPT2Config</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.FlaxGPT2LMHeadModel.dtype",description:`<strong>dtype</strong> (<code>jax.numpy.dtype</code>, <em>optional</em>, defaults to <code>jax.numpy.float32</code>) &#x2014;
The data type of the computation. Can be one of <code>jax.numpy.float32</code>, <code>jax.numpy.float16</code> (on GPUs) and
<code>jax.numpy.bfloat16</code> (on TPUs).</p>
<p>This can be used to enable mixed-precision training or half-precision inference on GPUs or TPUs. If
specified all the computation will be performed with the given <code>dtype</code>.</p>
<p><strong>Note that this only specifies the dtype of the computation and does not influence the dtype of model
parameters.</strong></p>
<p>If you wish to change the dtype of the model parameters, see <a href="/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel.to_fp16">to_fp16()</a> and
<a href="/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel.to_bf16">to_bf16()</a>.`,name:"dtype"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_flax_gpt2.py#L743"}}),Cr=new O({props:{name:"__call__",anchor:"transformers.FlaxGPT2LMHeadModel.__call__",parameters:[{name:"input_ids",val:""},{name:"attention_mask",val:" = None"},{name:"position_ids",val:" = None"},{name:"encoder_hidden_states",val:": typing.Optional[jax._src.numpy.ndarray.ndarray] = None"},{name:"encoder_attention_mask",val:": typing.Optional[jax._src.numpy.ndarray.ndarray] = None"},{name:"params",val:": dict = None"},{name:"past_key_values",val:": dict = None"},{name:"dropout_rng",val:": PRNGKey = None"},{name:"train",val:": bool = False"},{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.FlaxGPT2LMHeadModel.__call__.input_ids",description:`<strong>input_ids</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code>. Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FlaxGPT2LMHeadModel.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>numpy.ndarray</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.FlaxGPT2LMHeadModel.__call__.position_ids",description:`<strong>position_ids</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.`,name:"position_ids"},{anchor:"transformers.FlaxGPT2LMHeadModel.__call__.past_key_values",description:`<strong>past_key_values</strong> (<code>Dict[str, np.ndarray]</code>, <em>optional</em>, returned by <code>init_cache</code> or when passing previous <code>past_key_values</code>) &#x2014;
Dictionary of pre-computed hidden-states (key and values in the attention blocks) that can be used for fast
auto-regressive decoding. Pre-computed key and value hidden-states are of shape <em>[batch_size, max_length]</em>.`,name:"past_key_values"},{anchor:"transformers.FlaxGPT2LMHeadModel.__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.FlaxGPT2LMHeadModel.__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.FlaxGPT2LMHeadModel.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt2/modeling_flax_gpt2.py#L457",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_flax_outputs.FlaxCausalLMOutputWithCrossAttentions"
>transformers.modeling_flax_outputs.FlaxCausalLMOutputWithCrossAttentions</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Config"
>GPT2Config</a>) and inputs.</p>
<ul>
<li>
<p><strong>logits</strong> (<code>jnp.ndarray</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>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>
<li>
<p><strong>cross_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>Cross attentions weights after the attention softmax, used to compute the weighted average in the
cross-attention heads.</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(jnp.ndarray))</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>jnp.ndarray</code> tuples of length <code>config.n_layers</code>, with each tuple containing the cached key, value
states of the self-attention and the cross-attention layers if model is used in encoder-decoder setting.
Only relevant if <code>config.is_decoder = True</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>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_flax_outputs.FlaxCausalLMOutputWithCrossAttentions"
>transformers.modeling_flax_outputs.FlaxCausalLMOutputWithCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Xn=new ot({props:{$$slots:{default:[Aw]},$$scope:{ctx:x}}}),Yn=new he({props:{anchor:"transformers.FlaxGPT2LMHeadModel.__call__.example",$$slots:{default:[Dw]},$$scope:{ctx:x}}}),{c(){d=a("meta"),b=p(),f=a("h1"),u=a("a"),_=a("span"),v(l.$$.fragment),c=p(),z=a("span"),ae=n("OpenAI GPT2"),K=p(),H=a("h2"),J=a("a"),re=a("span"),v(G.$$.fragment),xe=p(),V=a("span"),Ge=n("Overview"),ke=p(),S=a("p"),ze=n("OpenAI GPT-2 model was proposed in "),de=a("a"),X=n("Language Models are Unsupervised Multitask Learners"),Fe=n(` by Alec
Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei and Ilya Sutskever. It\u2019s a causal (unidirectional)
transformer pretrained using language modeling on a very large corpus of ~40 GB of text data.`),we=p(),B=a("p"),Ee=n("The abstract from the paper is the following:"),$e=p(),R=a("p"),fe=a("em"),je=n(`GPT-2 is a large transformer-based language model with 1.5 billion parameters, trained on a dataset[1] of 8 million
web pages. GPT-2 is trained with a simple objective: predict the next word, given all of the previous words within some
text. The diversity of the dataset causes this simple goal to contain naturally occurring demonstrations of many tasks
across diverse domains. GPT-2 is a direct scale-up of GPT, with more than 10X the parameters and trained on more than
10X the amount of data.`),le=p(),j=a("p"),C=n("Tips:"),Pe=p(),N=a("ul"),ge=a("li"),qe=n(`GPT-2 is a model with absolute position embeddings so it\u2019s usually advised to pad the inputs on the right rather than
the left.`),Y=p(),ce=a("li"),Ce=n(`GPT-2 was trained with a causal language modeling (CLM) objective and is therefore powerful at predicting the next
token in a sequence. Leveraging this feature allows GPT-2 to generate syntactically coherent text as it can be
observed in the `),q=a("em"),Ae=n("run_generation.py"),Q=n(" example script."),De=p(),D=a("li"),Z=n("The model can take the "),_e=a("em"),Le=n("past_key_values"),W=n(" (for PyTorch) or "),Te=a("em"),ee=n("past"),Oe=n(` (for TF) as input, which is the previously computed
key/value attention pairs. Using this (`),ie=a("em"),A=n("past_key_values"),He=n(" or "),L=a("em"),Ne=n("past"),Ie=n(`) value prevents the model from re-computing
pre-computed values in the context of text generation. For PyTorch, see `),y=a("em"),F=n("past_key_values"),at=n(` argument of the
`),ne=a("a"),rt=n("GPT2Model.forward()"),it=n(" method, or for TF the "),E=a("em"),lt=n("past"),dt=n(` argument of the
`),Je=a("a"),ct=n("TFGPT2Model.call()"),pt=n(" method for more information on its usage."),U=p(),I=a("li"),ht=n("Enabling the "),Xe=a("em"),te=n("scale_attn_by_inverse_layer_idx"),ut=n(" and "),Ye=a("em"),Se=n("reorder_and_upcast_attn"),mt=n(` flags will apply the training stability
improvements from `),oe=a("a"),ft=n("Mistral"),Qp=n(" (for PyTorch only)."),lc=p(),co=a("p"),ms=a("a"),Zp=n("Write With Transformer"),eh=n(` is a webapp created and hosted by
Hugging Face showcasing the generative capabilities of several models. GPT-2 is one of them and is available in five
different sizes: small, medium, large, xl and a distilled version of the small checkpoint: `),Ii=a("em"),th=n("distilgpt-2"),oh=n("."),dc=p(),Xt=a("p"),nh=n("This model was contributed by "),fs=a("a"),sh=n("thomwolf"),ah=n(". The original code can be found "),gs=a("a"),rh=n("here"),ih=n("."),cc=p(),po=a("h2"),Ko=a("a"),Si=a("span"),v(_s.$$.fragment),lh=p(),Wi=a("span"),dh=n("Resources"),pc=p(),Sr=a("p"),ch=n("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with GPT2. If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),hc=p(),v(Ts.$$.fragment),uc=p(),se=a("ul"),bs=a("li"),ph=n("A blog on how to "),ys=a("a"),hh=n("Finetune a non-English GPT-2 Model with Hugging Face"),uh=n("."),mh=p(),vs=a("li"),fh=n("A blog on "),ks=a("a"),gh=n("How to generate text: using different decoding methods for language generation with Transformers"),_h=n(" with GPT-2."),Th=p(),ws=a("li"),bh=n("A blog on "),$s=a("a"),yh=n("Training CodeParrot \u{1F99C} from Scratch"),vh=n(", a large GPT-2 model."),kh=p(),Ps=a("li"),wh=n("A blog on "),Ms=a("a"),$h=n("Faster Text Generation with TensorFlow and XLA"),Ph=n(" with GPT-2."),Mh=p(),xs=a("li"),xh=n("A blog on "),Gs=a("a"),Gh=n("How to train a Language Model with Megatron-LM"),zh=n(" with a GPT-2 model."),Fh=p(),zs=a("li"),Eh=n("A notebook on how to "),Fs=a("a"),jh=n("finetune GPT2 to generate lyrics in the style of your favorite artist"),qh=n(". \u{1F30E}"),Ch=p(),Es=a("li"),Ah=n("A notebook on how to "),js=a("a"),Dh=n("finetune GPT2 to generate tweets in the style of your favorite Twitter user"),Lh=n(". \u{1F30E}"),Oh=p(),Wr=a("li"),qs=a("a"),Hh=n("Causal language modeling"),Nh=n(" chapter of the \u{1F917} Hugging Face Course."),Ih=p(),zt=a("li"),Ur=a("a"),Sh=n("GPT2LMHeadModel"),Wh=n(" is supported by this "),Cs=a("a"),Uh=n("causal language modeling example script"),Bh=n(", "),As=a("a"),Rh=n("text generation example script"),Kh=n(", and "),Ds=a("a"),Vh=n("notebook"),Jh=n("."),Xh=p(),Yt=a("li"),Br=a("a"),Yh=n("TFGPT2LMHeadModel"),Qh=n(" is supported by this "),Ls=a("a"),Zh=n("causal language modeling example script"),eu=n(" and "),Os=a("a"),tu=n("notebook"),ou=n("."),nu=p(),Qt=a("li"),Rr=a("a"),su=n("FlaxGPT2LMHeadModel"),au=n(" is supported by this "),Hs=a("a"),ru=n("causal language modeling example script"),iu=n(" and "),Ns=a("a"),lu=n("notebook"),du=n("."),mc=p(),ho=a("h2"),Vo=a("a"),Ui=a("span"),v(Is.$$.fragment),cu=p(),Bi=a("span"),pu=n("GPT2Config"),fc=p(),Mt=a("div"),v(Ss.$$.fragment),hu=p(),Bt=a("p"),uu=n("This is the configuration class to store the configuration of a "),Kr=a("a"),mu=n("GPT2Model"),fu=n(" or a "),Vr=a("a"),gu=n("TFGPT2Model"),_u=n(`. It is used to
instantiate a GPT-2 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 GPT-2
`),Ws=a("a"),Tu=n("gpt2"),bu=n(" architecture."),yu=p(),uo=a("p"),vu=n("Configuration objects inherit from "),Jr=a("a"),ku=n("PretrainedConfig"),wu=n(` and can be used to control the model outputs. Read the
documentation from `),Xr=a("a"),$u=n("PretrainedConfig"),Pu=n(" for more information."),Mu=p(),v(Jo.$$.fragment),gc=p(),mo=a("h2"),Xo=a("a"),Ri=a("span"),v(Us.$$.fragment),xu=p(),Ki=a("span"),Gu=n("GPT2Tokenizer"),_c=p(),be=a("div"),v(Bs.$$.fragment),zu=p(),Vi=a("p"),Fu=n("Construct a GPT-2 tokenizer. Based on byte-level Byte-Pair-Encoding."),Eu=p(),Ji=a("p"),ju=n("This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will"),qu=p(),v(Yo.$$.fragment),Cu=p(),Rs=a("p"),Au=n("You can get around that behavior by passing "),Xi=a("code"),Du=n("add_prefix_space=True"),Lu=n(` when instantiating this tokenizer or when you
call it on some text, but since the model was not pretrained this way, it might yield a decrease in performance.`),Ou=p(),v(Qo.$$.fragment),Hu=p(),Ks=a("p"),Nu=n("This tokenizer inherits from "),Yr=a("a"),Iu=n("PreTrainedTokenizer"),Su=n(` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),Wu=p(),Qr=a("div"),v(Vs.$$.fragment),Tc=p(),fo=a("h2"),Zo=a("a"),Yi=a("span"),v(Js.$$.fragment),Uu=p(),Qi=a("span"),Bu=n("GPT2TokenizerFast"),bc=p(),We=a("div"),v(Xs.$$.fragment),Ru=p(),Ys=a("p"),Ku=n("Construct a \u201Cfast\u201D GPT-2 tokenizer (backed by HuggingFace\u2019s "),Zi=a("em"),Vu=n("tokenizers"),Ju=n(` library). Based on byte-level
Byte-Pair-Encoding.`),Xu=p(),el=a("p"),Yu=n("This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will"),Qu=p(),v(en.$$.fragment),Zu=p(),Qs=a("p"),em=n("You can get around that behavior by passing "),tl=a("code"),tm=n("add_prefix_space=True"),om=n(` when instantiating this tokenizer, but since
the model was not pretrained this way, it might yield a decrease in performance.`),nm=p(),v(tn.$$.fragment),sm=p(),Zs=a("p"),am=n("This tokenizer inherits from "),Zr=a("a"),rm=n("PreTrainedTokenizerFast"),im=n(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),yc=p(),go=a("h2"),on=a("a"),ol=a("span"),v(ea.$$.fragment),lm=p(),nl=a("span"),dm=n("GPT2 specific outputs"),vc=p(),_o=a("div"),v(ta.$$.fragment),cm=p(),sl=a("p"),pm=n("Base class for outputs of models predicting if two sentences are consecutive or not."),kc=p(),To=a("div"),v(oa.$$.fragment),hm=p(),al=a("p"),um=n("Base class for outputs of models predicting if two sentences are consecutive or not."),wc=p(),bo=a("h2"),nn=a("a"),rl=a("span"),v(na.$$.fragment),mm=p(),il=a("span"),fm=n("GPT2Model"),$c=p(),Ue=a("div"),v(sa.$$.fragment),gm=p(),ll=a("p"),_m=n("The bare GPT2 Model transformer outputting raw hidden-states without any specific head on top."),Tm=p(),aa=a("p"),bm=n("This model inherits from "),ei=a("a"),ym=n("PreTrainedModel"),vm=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.)`),km=p(),ra=a("p"),wm=n("This model is also a PyTorch "),ia=a("a"),$m=n("torch.nn.Module"),Pm=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Mm=p(),Ft=a("div"),v(la.$$.fragment),xm=p(),yo=a("p"),Gm=n("The "),ti=a("a"),zm=n("GPT2Model"),Fm=n(" forward method, overrides the "),dl=a("code"),Em=n("__call__"),jm=n(" special method."),qm=p(),v(sn.$$.fragment),Cm=p(),v(an.$$.fragment),Am=p(),Et=a("div"),v(da.$$.fragment),Dm=p(),cl=a("p"),Lm=n("This is an experimental feature and is a subject to change at a moment\u2019s notice."),Om=p(),pl=a("p"),Hm=n(`Uses a device map to distribute attention modules of the model across several devices. If no device map is given,
it will evenly distribute blocks across all devices.`),Nm=p(),v(rn.$$.fragment),Im=p(),Zt=a("div"),v(ca.$$.fragment),Sm=p(),hl=a("p"),Wm=n("Moves the model to cpu from a model parallel state."),Um=p(),v(ln.$$.fragment),Pc=p(),vo=a("h2"),dn=a("a"),ul=a("span"),v(pa.$$.fragment),Bm=p(),ml=a("span"),Rm=n("GPT2LMHeadModel"),Mc=p(),Be=a("div"),v(ha.$$.fragment),Km=p(),fl=a("p"),Vm=n(`The GPT2 Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),Jm=p(),ua=a("p"),Xm=n("This model inherits from "),oi=a("a"),Ym=n("PreTrainedModel"),Qm=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.)`),Zm=p(),ma=a("p"),ef=n("This model is also a PyTorch "),fa=a("a"),tf=n("torch.nn.Module"),of=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),nf=p(),jt=a("div"),v(ga.$$.fragment),sf=p(),ko=a("p"),af=n("The "),ni=a("a"),rf=n("GPT2LMHeadModel"),lf=n(" forward method, overrides the "),gl=a("code"),df=n("__call__"),cf=n(" special method."),pf=p(),v(cn.$$.fragment),hf=p(),v(pn.$$.fragment),uf=p(),qt=a("div"),v(_a.$$.fragment),mf=p(),_l=a("p"),ff=n("This is an experimental feature and is a subject to change at a moment\u2019s notice."),gf=p(),Tl=a("p"),_f=n(`Uses a device map to distribute attention modules of the model across several devices. If no device map is given,
it will evenly distribute blocks across all devices.`),Tf=p(),v(hn.$$.fragment),bf=p(),eo=a("div"),v(Ta.$$.fragment),yf=p(),bl=a("p"),vf=n("Moves the model to cpu from a model parallel state."),kf=p(),v(un.$$.fragment),xc=p(),wo=a("h2"),mn=a("a"),yl=a("span"),v(ba.$$.fragment),wf=p(),vl=a("span"),$f=n("GPT2DoubleHeadsModel"),Gc=p(),gt=a("div"),v(ya.$$.fragment),Pf=p(),kl=a("p"),Mf=n(`The GPT2 Model transformer with a language modeling and a multiple-choice classification head on top e.g. for
RocStories/SWAG tasks. The two heads are two linear layers. The language modeling head has its weights tied to the
input embeddings, the classification head takes as input the input of a specified classification token index in the
input sequence).`),xf=p(),va=a("p"),Gf=n("This model inherits from "),si=a("a"),zf=n("PreTrainedModel"),Ff=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.)`),Ef=p(),ka=a("p"),jf=n("This model is also a PyTorch "),wa=a("a"),qf=n("torch.nn.Module"),Cf=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Af=p(),Ct=a("div"),v($a.$$.fragment),Df=p(),$o=a("p"),Lf=n("The "),ai=a("a"),Of=n("GPT2DoubleHeadsModel"),Hf=n(" forward method, overrides the "),wl=a("code"),Nf=n("__call__"),If=n(" special method."),Sf=p(),v(fn.$$.fragment),Wf=p(),v(gn.$$.fragment),zc=p(),Po=a("h2"),_n=a("a"),$l=a("span"),v(Pa.$$.fragment),Uf=p(),Pl=a("span"),Bf=n("GPT2ForSequenceClassification"),Fc=p(),Re=a("div"),v(Ma.$$.fragment),Rf=p(),Ml=a("p"),Kf=n("The GPT2 Model transformer with a sequence classification head on top (linear layer)."),Vf=p(),ri=a("p"),ii=a("a"),Jf=n("GPT2ForSequenceClassification"),Xf=n(` uses the last token in order to do the classification, as other causal models
(e.g. GPT-1) do.`),Yf=p(),xt=a("p"),Qf=n(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),xl=a("code"),Zf=n("pad_token_id"),eg=n(` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Gl=a("code"),tg=n("pad_token_id"),og=n(` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),zl=a("code"),ng=n("inputs_embeds"),sg=n(" are passed instead of "),Fl=a("code"),ag=n("input_ids"),rg=n(`, it does the same (take the last value in
each row of the batch).`),ig=p(),xa=a("p"),lg=n("This model inherits from "),li=a("a"),dg=n("PreTrainedModel"),cg=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.)`),pg=p(),Ga=a("p"),hg=n("This model is also a PyTorch "),za=a("a"),ug=n("torch.nn.Module"),mg=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),fg=p(),Tt=a("div"),v(Fa.$$.fragment),gg=p(),Mo=a("p"),_g=n("The "),di=a("a"),Tg=n("GPT2ForSequenceClassification"),bg=n(" forward method, overrides the "),El=a("code"),yg=n("__call__"),vg=n(" special method."),kg=p(),v(Tn.$$.fragment),wg=p(),v(bn.$$.fragment),$g=p(),v(yn.$$.fragment),Ec=p(),xo=a("h2"),vn=a("a"),jl=a("span"),v(Ea.$$.fragment),Pg=p(),ql=a("span"),Mg=n("GPT2ForTokenClassification"),jc=p(),_t=a("div"),v(ja.$$.fragment),xg=p(),Cl=a("p"),Gg=n(`GPT2 Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g. for
Named-Entity-Recognition (NER) tasks.`),zg=p(),qa=a("p"),Fg=n("This model inherits from "),ci=a("a"),Eg=n("PreTrainedModel"),jg=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.)`),qg=p(),Ca=a("p"),Cg=n("This model is also a PyTorch "),Aa=a("a"),Ag=n("torch.nn.Module"),Dg=n(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Lg=p(),At=a("div"),v(Da.$$.fragment),Og=p(),Go=a("p"),Hg=n("The "),pi=a("a"),Ng=n("GPT2ForTokenClassification"),Ig=n(" forward method, overrides the "),Al=a("code"),Sg=n("__call__"),Wg=n(" special method."),Ug=p(),v(kn.$$.fragment),Bg=p(),v(wn.$$.fragment),qc=p(),zo=a("h2"),$n=a("a"),Dl=a("span"),v(La.$$.fragment),Rg=p(),Ll=a("span"),Kg=n("TFGPT2Model"),Cc=p(),Qe=a("div"),v(Oa.$$.fragment),Vg=p(),Ol=a("p"),Jg=n("The bare GPT2 Model transformer outputting raw hidden-states without any specific head on top."),Xg=p(),Ha=a("p"),Yg=n("This model inherits from "),hi=a("a"),Qg=n("TFPreTrainedModel"),Zg=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.)`),e_=p(),Na=a("p"),t_=n("This model is also a "),Ia=a("a"),o_=n("tf.keras.Model"),n_=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.`),s_=p(),v(Pn.$$.fragment),a_=p(),Dt=a("div"),v(Sa.$$.fragment),r_=p(),Fo=a("p"),i_=n("The "),ui=a("a"),l_=n("TFGPT2Model"),d_=n(" forward method, overrides the "),Hl=a("code"),c_=n("__call__"),p_=n(" special method."),h_=p(),v(Mn.$$.fragment),u_=p(),v(xn.$$.fragment),Ac=p(),Eo=a("h2"),Gn=a("a"),Nl=a("span"),v(Wa.$$.fragment),m_=p(),Il=a("span"),f_=n("TFGPT2LMHeadModel"),Dc=p(),Ze=a("div"),v(Ua.$$.fragment),g_=p(),Sl=a("p"),__=n(`The GPT2 Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),T_=p(),Ba=a("p"),b_=n("This model inherits from "),mi=a("a"),y_=n("TFPreTrainedModel"),v_=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.)`),k_=p(),Ra=a("p"),w_=n("This model is also a "),Ka=a("a"),$_=n("tf.keras.Model"),P_=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.`),M_=p(),v(zn.$$.fragment),x_=p(),Lt=a("div"),v(Va.$$.fragment),G_=p(),jo=a("p"),z_=n("The "),fi=a("a"),F_=n("TFGPT2LMHeadModel"),E_=n(" forward method, overrides the "),Wl=a("code"),j_=n("__call__"),q_=n(" special method."),C_=p(),v(Fn.$$.fragment),A_=p(),v(En.$$.fragment),Lc=p(),qo=a("h2"),jn=a("a"),Ul=a("span"),v(Ja.$$.fragment),D_=p(),Bl=a("span"),L_=n("TFGPT2DoubleHeadsModel"),Oc=p(),et=a("div"),v(Xa.$$.fragment),O_=p(),Rl=a("p"),H_=n(`The GPT2 Model transformer with a language modeling and a multiple-choice classification head on top e.g. for
RocStories/SWAG tasks. The two heads are two linear layers. The language modeling head has its weights tied to the
input embeddings, the classification head takes as input the input of a specified classification token index in the
input sequence).`),N_=p(),Ya=a("p"),I_=n("This model inherits from "),gi=a("a"),S_=n("TFPreTrainedModel"),W_=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.)`),U_=p(),Qa=a("p"),B_=n("This model is also a "),Za=a("a"),R_=n("tf.keras.Model"),K_=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.`),V_=p(),v(qn.$$.fragment),J_=p(),Ot=a("div"),v(er.$$.fragment),X_=p(),Co=a("p"),Y_=n("The "),_i=a("a"),Q_=n("TFGPT2DoubleHeadsModel"),Z_=n(" forward method, overrides the "),Kl=a("code"),eT=n("__call__"),tT=n(" special method."),oT=p(),v(Cn.$$.fragment),nT=p(),v(An.$$.fragment),Hc=p(),Ao=a("h2"),Dn=a("a"),Vl=a("span"),v(tr.$$.fragment),sT=p(),Jl=a("span"),aT=n("TFGPT2ForSequenceClassification"),Nc=p(),ye=a("div"),v(or.$$.fragment),rT=p(),Xl=a("p"),iT=n("The GPT2 Model transformer with a sequence classification head on top (linear layer)."),lT=p(),Ti=a("p"),bi=a("a"),dT=n("TFGPT2ForSequenceClassification"),cT=n(` uses the last token in order to do the classification, as other causal models
(e.g. GPT-1) do.`),pT=p(),Gt=a("p"),hT=n(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Yl=a("code"),uT=n("pad_token_id"),mT=n(` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Ql=a("code"),fT=n("pad_token_id"),gT=n(` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Zl=a("code"),_T=n("inputs_embeds"),TT=n(" are passed instead of "),ed=a("code"),bT=n("input_ids"),yT=n(`, it does the same (take the last value in
each row of the batch).`),vT=p(),nr=a("p"),kT=n("This model inherits from "),yi=a("a"),wT=n("TFPreTrainedModel"),$T=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.)`),PT=p(),sr=a("p"),MT=n("This model is also a "),ar=a("a"),xT=n("tf.keras.Model"),GT=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.`),zT=p(),v(Ln.$$.fragment),FT=p(),bt=a("div"),v(rr.$$.fragment),ET=p(),Do=a("p"),jT=n("The "),vi=a("a"),qT=n("TFGPT2ForSequenceClassification"),CT=n(" forward method, overrides the "),td=a("code"),AT=n("__call__"),DT=n(" special method."),LT=p(),v(On.$$.fragment),OT=p(),v(Hn.$$.fragment),HT=p(),v(Nn.$$.fragment),Ic=p(),Lo=a("h2"),In=a("a"),od=a("span"),v(ir.$$.fragment),NT=p(),nd=a("span"),IT=n("TFSequenceClassifierOutputWithPast"),Sc=p(),Oo=a("div"),v(lr.$$.fragment),ST=p(),sd=a("p"),WT=n("Base class for outputs of sentence classification models."),Wc=p(),Ho=a("h2"),Sn=a("a"),ad=a("span"),v(dr.$$.fragment),UT=p(),rd=a("span"),BT=n("TFGPT2Tokenizer"),Uc=p(),tt=a("div"),v(cr.$$.fragment),RT=p(),No=a("p"),KT=n(`This is an in-graph tokenizer for GPT2. It should be initialized similarly to other tokenizers, using the
`),id=a("code"),VT=n("from_pretrained()"),JT=n(" method. It can also be initialized with the "),ld=a("code"),XT=n("from_tokenizer()"),YT=n(` method, which imports settings
from an existing standard tokenizer object.`),QT=p(),pr=a("p"),ZT=n(`In-graph tokenizers, unlike other Hugging Face tokenizers, are actually Keras layers and are designed to be run
when the model is called, rather than during preprocessing. As a result, they have somewhat more limited options
than standard tokenizer classes. They are most useful when you want to create an end-to-end model that goes
straight from `),dd=a("code"),e2=n("tf.string"),t2=n(" inputs to outputs."),o2=p(),Wn=a("div"),v(hr.$$.fragment),n2=p(),cd=a("p"),s2=n("Creates TFGPT2Tokenizer from configurations"),a2=p(),to=a("div"),v(ur.$$.fragment),r2=p(),pd=a("p"),i2=n("Creates TFGPT2Tokenizer from pretrained GPT2Tokenizer"),l2=p(),v(Un.$$.fragment),d2=p(),oo=a("div"),v(mr.$$.fragment),c2=p(),hd=a("p"),p2=n("Creates TFGPT2Tokenizer from GPT2Tokenizer"),h2=p(),v(Bn.$$.fragment),Bc=p(),Io=a("h2"),Rn=a("a"),ud=a("span"),v(fr.$$.fragment),u2=p(),md=a("span"),m2=n("FlaxGPT2Model"),Rc=p(),Ke=a("div"),v(gr.$$.fragment),f2=p(),fd=a("p"),g2=n("The bare GPT2 Model transformer outputting raw hidden-states without any specific head on top."),_2=p(),_r=a("p"),T2=n("This model inherits from "),ki=a("a"),b2=n("FlaxPreTrainedModel"),y2=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.)`),v2=p(),Tr=a("p"),k2=n(`This model is also a Flax Linen
`),br=a("a"),w2=n("flax.nn.Module"),$2=n(` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),P2=p(),gd=a("p"),M2=n("Finally, this model supports inherent JAX features such as:"),x2=p(),Rt=a("ul"),_d=a("li"),yr=a("a"),G2=n("Just-In-Time (JIT) compilation"),z2=p(),Td=a("li"),vr=a("a"),F2=n("Automatic Differentiation"),E2=p(),bd=a("li"),kr=a("a"),j2=n("Vectorization"),q2=p(),yd=a("li"),wr=a("a"),C2=n("Parallelization"),A2=p(),Ht=a("div"),v($r.$$.fragment),D2=p(),So=a("p"),L2=n("The "),vd=a("code"),O2=n("FlaxGPT2PreTrainedModel"),H2=n(" forward method, overrides the "),kd=a("code"),N2=n("__call__"),I2=n(" special method."),S2=p(),v(Kn.$$.fragment),W2=p(),v(Vn.$$.fragment),Kc=p(),Wo=a("h2"),Jn=a("a"),wd=a("span"),v(Pr.$$.fragment),U2=p(),$d=a("span"),B2=n("FlaxGPT2LMHeadModel"),Vc=p(),Ve=a("div"),v(Mr.$$.fragment),R2=p(),Pd=a("p"),K2=n(`The GPT2 Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),V2=p(),xr=a("p"),J2=n("This model inherits from "),wi=a("a"),X2=n("FlaxPreTrainedModel"),Y2=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.)`),Q2=p(),Gr=a("p"),Z2=n(`This model is also a Flax Linen
`),zr=a("a"),eb=n("flax.nn.Module"),tb=n(` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),ob=p(),Md=a("p"),nb=n("Finally, this model supports inherent JAX features such as:"),sb=p(),Kt=a("ul"),xd=a("li"),Fr=a("a"),ab=n("Just-In-Time (JIT) compilation"),rb=p(),Gd=a("li"),Er=a("a"),ib=n("Automatic Differentiation"),lb=p(),zd=a("li"),jr=a("a"),db=n("Vectorization"),cb=p(),Fd=a("li"),qr=a("a"),pb=n("Parallelization"),hb=p(),Nt=a("div"),v(Cr.$$.fragment),ub=p(),Uo=a("p"),mb=n("The "),Ed=a("code"),fb=n("FlaxGPT2PreTrainedModel"),gb=n(" forward method, overrides the "),jd=a("code"),_b=n("__call__"),Tb=n(" special method."),bb=p(),v(Xn.$$.fragment),yb=p(),v(Yn.$$.fragment),this.h()},l(o){const T=Jk('[data-svelte="svelte-1phssyn"]',document.head);d=r(T,"META",{name:!0,content:!0}),T.forEach(t),b=h(o),f=r(o,"H1",{class:!0});var Ar=i(f);u=r(Ar,"A",{id:!0,class:!0,href:!0});var qd=i(u);_=r(qd,"SPAN",{});var Cd=i(_);k(l.$$.fragment,Cd),Cd.forEach(t),qd.forEach(t),c=h(Ar),z=r(Ar,"SPAN",{});var Ad=i(z);ae=s(Ad,"OpenAI GPT2"),Ad.forEach(t),Ar.forEach(t),K=h(o),H=r(o,"H2",{class:!0});var Dr=i(H);J=r(Dr,"A",{id:!0,class:!0,href:!0});var Dd=i(J);re=r(Dd,"SPAN",{});var Ld=i(re);k(G.$$.fragment,Ld),Ld.forEach(t),Dd.forEach(t),xe=h(Dr),V=r(Dr,"SPAN",{});var Od=i(V);Ge=s(Od,"Overview"),Od.forEach(t),Dr.forEach(t),ke=h(o),S=r(o,"P",{});var Lr=i(S);ze=s(Lr,"OpenAI GPT-2 model was proposed in "),de=r(Lr,"A",{href:!0,rel:!0});var Hd=i(de);X=s(Hd,"Language Models are Unsupervised Multitask Learners"),Hd.forEach(t),Fe=s(Lr,` by Alec
Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei and Ilya Sutskever. It\u2019s a causal (unidirectional)
transformer pretrained using language modeling on a very large corpus of ~40 GB of text data.`),Lr.forEach(t),we=h(o),B=r(o,"P",{});var Nd=i(B);Ee=s(Nd,"The abstract from the paper is the following:"),Nd.forEach(t),$e=h(o),R=r(o,"P",{});var Id=i(R);fe=r(Id,"EM",{});var Sd=i(fe);je=s(Sd,`GPT-2 is a large transformer-based language model with 1.5 billion parameters, trained on a dataset[1] of 8 million
web pages. GPT-2 is trained with a simple objective: predict the next word, given all of the previous words within some
text. The diversity of the dataset causes this simple goal to contain naturally occurring demonstrations of many tasks
across diverse domains. GPT-2 is a direct scale-up of GPT, with more than 10X the parameters and trained on more than
10X the amount of data.`),Sd.forEach(t),Id.forEach(t),le=h(o),j=r(o,"P",{});var Wd=i(j);C=s(Wd,"Tips:"),Wd.forEach(t),Pe=h(o),N=r(o,"UL",{});var Vt=i(N);ge=r(Vt,"LI",{});var Ud=i(ge);qe=s(Ud,`GPT-2 is a model with absolute position embeddings so it\u2019s usually advised to pad the inputs on the right rather than
the left.`),Ud.forEach(t),Y=h(Vt),ce=r(Vt,"LI",{});var Or=i(ce);Ce=s(Or,`GPT-2 was trained with a causal language modeling (CLM) objective and is therefore powerful at predicting the next
token in a sequence. Leveraging this feature allows GPT-2 to generate syntactically coherent text as it can be
observed in the `),q=r(Or,"EM",{});var Bd=i(q);Ae=s(Bd,"run_generation.py"),Bd.forEach(t),Q=s(Or," example script."),Or.forEach(t),De=h(Vt),D=r(Vt,"LI",{});var ve=i(D);Z=s(ve,"The model can take the "),_e=r(ve,"EM",{});var Rd=i(_e);Le=s(Rd,"past_key_values"),Rd.forEach(t),W=s(ve," (for PyTorch) or "),Te=r(ve,"EM",{});var Kd=i(Te);ee=s(Kd,"past"),Kd.forEach(t),Oe=s(ve,` (for TF) as input, which is the previously computed
key/value attention pairs. Using this (`),ie=r(ve,"EM",{});var Vd=i(ie);A=s(Vd,"past_key_values"),Vd.forEach(t),He=s(ve," or "),L=r(ve,"EM",{});var Jd=i(L);Ne=s(Jd,"past"),Jd.forEach(t),Ie=s(ve,`) value prevents the model from re-computing
pre-computed values in the context of text generation. For PyTorch, see `),y=r(ve,"EM",{});var Xd=i(y);F=s(Xd,"past_key_values"),Xd.forEach(t),at=s(ve,` argument of the
`),ne=r(ve,"A",{href:!0});var Yd=i(ne);rt=s(Yd,"GPT2Model.forward()"),Yd.forEach(t),it=s(ve," method, or for TF the "),E=r(ve,"EM",{});var Qd=i(E);lt=s(Qd,"past"),Qd.forEach(t),dt=s(ve,` argument of the
`),Je=r(ve,"A",{href:!0});var Zd=i(Je);ct=s(Zd,"TFGPT2Model.call()"),Zd.forEach(t),pt=s(ve," method for more information on its usage."),ve.forEach(t),U=h(Vt),I=r(Vt,"LI",{});var Jt=i(I);ht=s(Jt,"Enabling the "),Xe=r(Jt,"EM",{});var ec=i(Xe);te=s(ec,"scale_attn_by_inverse_layer_idx"),ec.forEach(t),ut=s(Jt," and "),Ye=r(Jt,"EM",{});var tc=i(Ye);Se=s(tc,"reorder_and_upcast_attn"),tc.forEach(t),mt=s(Jt,` flags will apply the training stability
improvements from `),oe=r(Jt,"A",{href:!0,rel:!0});var oc=i(oe);ft=s(oc,"Mistral"),oc.forEach(t),Qp=s(Jt," (for PyTorch only)."),Jt.forEach(t),Vt.forEach(t),lc=h(o),co=r(o,"P",{});var Qn=i(co);ms=r(Qn,"A",{href:!0,rel:!0});var nc=i(ms);Zp=s(nc,"Write With Transformer"),nc.forEach(t),eh=s(Qn,` is a webapp created and hosted by
Hugging Face showcasing the generative capabilities of several models. GPT-2 is one of them and is available in five
different sizes: small, medium, large, xl and a distilled version of the small checkpoint: `),Ii=r(Qn,"EM",{});var sc=i(Ii);th=s(sc,"distilgpt-2"),sc.forEach(t),oh=s(Qn,"."),Qn.forEach(t),dc=h(o),Xt=r(o,"P",{});var Bo=i(Xt);nh=s(Bo,"This model was contributed by "),fs=r(Bo,"A",{href:!0,rel:!0});var ac=i(fs);sh=s(ac,"thomwolf"),ac.forEach(t),ah=s(Bo,". The original code can be found "),gs=r(Bo,"A",{href:!0,rel:!0});var rc=i(gs);rh=s(rc,"here"),rc.forEach(t),ih=s(Bo,"."),Bo.forEach(t),cc=h(o),po=r(o,"H2",{class:!0});var Hr=i(po);Ko=r(Hr,"A",{id:!0,class:!0,href:!0});var ic=i(Ko);Si=r(ic,"SPAN",{});var $b=i(Si);k(_s.$$.fragment,$b),$b.forEach(t),ic.forEach(t),lh=h(Hr),Wi=r(Hr,"SPAN",{});var Pb=i(Wi);dh=s(Pb,"Resources"),Pb.forEach(t),Hr.forEach(t),pc=h(o),Sr=r(o,"P",{});var Mb=i(Sr);ch=s(Mb,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with GPT2. If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),Mb.forEach(t),hc=h(o),k(Ts.$$.fragment,o),uc=h(o),se=r(o,"UL",{});var pe=i(se);bs=r(pe,"LI",{});var Xc=i(bs);ph=s(Xc,"A blog on how to "),ys=r(Xc,"A",{href:!0,rel:!0});var xb=i(ys);hh=s(xb,"Finetune a non-English GPT-2 Model with Hugging Face"),xb.forEach(t),uh=s(Xc,"."),Xc.forEach(t),mh=h(pe),vs=r(pe,"LI",{});var Yc=i(vs);fh=s(Yc,"A blog on "),ks=r(Yc,"A",{href:!0,rel:!0});var Gb=i(ks);gh=s(Gb,"How to generate text: using different decoding methods for language generation with Transformers"),Gb.forEach(t),_h=s(Yc," with GPT-2."),Yc.forEach(t),Th=h(pe),ws=r(pe,"LI",{});var Qc=i(ws);bh=s(Qc,"A blog on "),$s=r(Qc,"A",{href:!0,rel:!0});var zb=i($s);yh=s(zb,"Training CodeParrot \u{1F99C} from Scratch"),zb.forEach(t),vh=s(Qc,", a large GPT-2 model."),Qc.forEach(t),kh=h(pe),Ps=r(pe,"LI",{});var Zc=i(Ps);wh=s(Zc,"A blog on "),Ms=r(Zc,"A",{href:!0,rel:!0});var Fb=i(Ms);$h=s(Fb,"Faster Text Generation with TensorFlow and XLA"),Fb.forEach(t),Ph=s(Zc," with GPT-2."),Zc.forEach(t),Mh=h(pe),xs=r(pe,"LI",{});var ep=i(xs);xh=s(ep,"A blog on "),Gs=r(ep,"A",{href:!0,rel:!0});var Eb=i(Gs);Gh=s(Eb,"How to train a Language Model with Megatron-LM"),Eb.forEach(t),zh=s(ep," with a GPT-2 model."),ep.forEach(t),Fh=h(pe),zs=r(pe,"LI",{});var tp=i(zs);Eh=s(tp,"A notebook on how to "),Fs=r(tp,"A",{href:!0,rel:!0});var jb=i(Fs);jh=s(jb,"finetune GPT2 to generate lyrics in the style of your favorite artist"),jb.forEach(t),qh=s(tp,". \u{1F30E}"),tp.forEach(t),Ch=h(pe),Es=r(pe,"LI",{});var op=i(Es);Ah=s(op,"A notebook on how to "),js=r(op,"A",{href:!0,rel:!0});var qb=i(js);Dh=s(qb,"finetune GPT2 to generate tweets in the style of your favorite Twitter user"),qb.forEach(t),Lh=s(op,". \u{1F30E}"),op.forEach(t),Oh=h(pe),Wr=r(pe,"LI",{});var vb=i(Wr);qs=r(vb,"A",{href:!0,rel:!0});var Cb=i(qs);Hh=s(Cb,"Causal language modeling"),Cb.forEach(t),Nh=s(vb," chapter of the \u{1F917} Hugging Face Course."),vb.forEach(t),Ih=h(pe),zt=r(pe,"LI",{});var Ro=i(zt);Ur=r(Ro,"A",{href:!0});var Ab=i(Ur);Sh=s(Ab,"GPT2LMHeadModel"),Ab.forEach(t),Wh=s(Ro," is supported by this "),Cs=r(Ro,"A",{href:!0,rel:!0});var Db=i(Cs);Uh=s(Db,"causal language modeling example script"),Db.forEach(t),Bh=s(Ro,", "),As=r(Ro,"A",{href:!0,rel:!0});var Lb=i(As);Rh=s(Lb,"text generation example script"),Lb.forEach(t),Kh=s(Ro,", and "),Ds=r(Ro,"A",{href:!0,rel:!0});var Ob=i(Ds);Vh=s(Ob,"notebook"),Ob.forEach(t),Jh=s(Ro,"."),Ro.forEach(t),Xh=h(pe),Yt=r(pe,"LI",{});var Nr=i(Yt);Br=r(Nr,"A",{href:!0});var Hb=i(Br);Yh=s(Hb,"TFGPT2LMHeadModel"),Hb.forEach(t),Qh=s(Nr," is supported by this "),Ls=r(Nr,"A",{href:!0,rel:!0});var Nb=i(Ls);Zh=s(Nb,"causal language modeling example script"),Nb.forEach(t),eu=s(Nr," and "),Os=r(Nr,"A",{href:!0,rel:!0});var Ib=i(Os);tu=s(Ib,"notebook"),Ib.forEach(t),ou=s(Nr,"."),Nr.forEach(t),nu=h(pe),Qt=r(pe,"LI",{});var Ir=i(Qt);Rr=r(Ir,"A",{href:!0});var Sb=i(Rr);su=s(Sb,"FlaxGPT2LMHeadModel"),Sb.forEach(t),au=s(Ir," is supported by this "),Hs=r(Ir,"A",{href:!0,rel:!0});var Wb=i(Hs);ru=s(Wb,"causal language modeling example script"),Wb.forEach(t),iu=s(Ir," and "),Ns=r(Ir,"A",{href:!0,rel:!0});var Ub=i(Ns);lu=s(Ub,"notebook"),Ub.forEach(t),du=s(Ir,"."),Ir.forEach(t),pe.forEach(t),mc=h(o),ho=r(o,"H2",{class:!0});var np=i(ho);Vo=r(np,"A",{id:!0,class:!0,href:!0});var Bb=i(Vo);Ui=r(Bb,"SPAN",{});var Rb=i(Ui);k(Is.$$.fragment,Rb),Rb.forEach(t),Bb.forEach(t),cu=h(np),Bi=r(np,"SPAN",{});var Kb=i(Bi);pu=s(Kb,"GPT2Config"),Kb.forEach(t),np.forEach(t),fc=h(o),Mt=r(o,"DIV",{class:!0});var Zn=i(Mt);k(Ss.$$.fragment,Zn),hu=h(Zn),Bt=r(Zn,"P",{});var es=i(Bt);uu=s(es,"This is the configuration class to store the configuration of a "),Kr=r(es,"A",{href:!0});var Vb=i(Kr);mu=s(Vb,"GPT2Model"),Vb.forEach(t),fu=s(es," or a "),Vr=r(es,"A",{href:!0});var Jb=i(Vr);gu=s(Jb,"TFGPT2Model"),Jb.forEach(t),_u=s(es,`. It is used to
instantiate a GPT-2 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 GPT-2
`),Ws=r(es,"A",{href:!0,rel:!0});var Xb=i(Ws);Tu=s(Xb,"gpt2"),Xb.forEach(t),bu=s(es," architecture."),es.forEach(t),yu=h(Zn),uo=r(Zn,"P",{});var $i=i(uo);vu=s($i,"Configuration objects inherit from "),Jr=r($i,"A",{href:!0});var Yb=i(Jr);ku=s(Yb,"PretrainedConfig"),Yb.forEach(t),wu=s($i,` and can be used to control the model outputs. Read the
documentation from `),Xr=r($i,"A",{href:!0});var Qb=i(Xr);$u=s(Qb,"PretrainedConfig"),Qb.forEach(t),Pu=s($i," for more information."),$i.forEach(t),Mu=h(Zn),k(Jo.$$.fragment,Zn),Zn.forEach(t),gc=h(o),mo=r(o,"H2",{class:!0});var sp=i(mo);Xo=r(sp,"A",{id:!0,class:!0,href:!0});var Zb=i(Xo);Ri=r(Zb,"SPAN",{});var ey=i(Ri);k(Us.$$.fragment,ey),ey.forEach(t),Zb.forEach(t),xu=h(sp),Ki=r(sp,"SPAN",{});var ty=i(Ki);Gu=s(ty,"GPT2Tokenizer"),ty.forEach(t),sp.forEach(t),_c=h(o),be=r(o,"DIV",{class:!0});var nt=i(be);k(Bs.$$.fragment,nt),zu=h(nt),Vi=r(nt,"P",{});var oy=i(Vi);Fu=s(oy,"Construct a GPT-2 tokenizer. Based on byte-level Byte-Pair-Encoding."),oy.forEach(t),Eu=h(nt),Ji=r(nt,"P",{});var ny=i(Ji);ju=s(ny,"This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will"),ny.forEach(t),qu=h(nt),k(Yo.$$.fragment,nt),Cu=h(nt),Rs=r(nt,"P",{});var ap=i(Rs);Au=s(ap,"You can get around that behavior by passing "),Xi=r(ap,"CODE",{});var sy=i(Xi);Du=s(sy,"add_prefix_space=True"),sy.forEach(t),Lu=s(ap,` when instantiating this tokenizer or when you
call it on some text, but since the model was not pretrained this way, it might yield a decrease in performance.`),ap.forEach(t),Ou=h(nt),k(Qo.$$.fragment,nt),Hu=h(nt),Ks=r(nt,"P",{});var rp=i(Ks);Nu=s(rp,"This tokenizer inherits from "),Yr=r(rp,"A",{href:!0});var ay=i(Yr);Iu=s(ay,"PreTrainedTokenizer"),ay.forEach(t),Su=s(rp,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),rp.forEach(t),Wu=h(nt),Qr=r(nt,"DIV",{class:!0});var ry=i(Qr);k(Vs.$$.fragment,ry),ry.forEach(t),nt.forEach(t),Tc=h(o),fo=r(o,"H2",{class:!0});var ip=i(fo);Zo=r(ip,"A",{id:!0,class:!0,href:!0});var iy=i(Zo);Yi=r(iy,"SPAN",{});var ly=i(Yi);k(Js.$$.fragment,ly),ly.forEach(t),iy.forEach(t),Uu=h(ip),Qi=r(ip,"SPAN",{});var dy=i(Qi);Bu=s(dy,"GPT2TokenizerFast"),dy.forEach(t),ip.forEach(t),bc=h(o),We=r(o,"DIV",{class:!0});var yt=i(We);k(Xs.$$.fragment,yt),Ru=h(yt),Ys=r(yt,"P",{});var lp=i(Ys);Ku=s(lp,"Construct a \u201Cfast\u201D GPT-2 tokenizer (backed by HuggingFace\u2019s "),Zi=r(lp,"EM",{});var cy=i(Zi);Vu=s(cy,"tokenizers"),cy.forEach(t),Ju=s(lp,` library). Based on byte-level
Byte-Pair-Encoding.`),lp.forEach(t),Xu=h(yt),el=r(yt,"P",{});var py=i(el);Yu=s(py,"This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will"),py.forEach(t),Qu=h(yt),k(en.$$.fragment,yt),Zu=h(yt),Qs=r(yt,"P",{});var dp=i(Qs);em=s(dp,"You can get around that behavior by passing "),tl=r(dp,"CODE",{});var hy=i(tl);tm=s(hy,"add_prefix_space=True"),hy.forEach(t),om=s(dp,` when instantiating this tokenizer, but since
the model was not pretrained this way, it might yield a decrease in performance.`),dp.forEach(t),nm=h(yt),k(tn.$$.fragment,yt),sm=h(yt),Zs=r(yt,"P",{});var cp=i(Zs);am=s(cp,"This tokenizer inherits from "),Zr=r(cp,"A",{href:!0});var uy=i(Zr);rm=s(uy,"PreTrainedTokenizerFast"),uy.forEach(t),im=s(cp,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),cp.forEach(t),yt.forEach(t),yc=h(o),go=r(o,"H2",{class:!0});var pp=i(go);on=r(pp,"A",{id:!0,class:!0,href:!0});var my=i(on);ol=r(my,"SPAN",{});var fy=i(ol);k(ea.$$.fragment,fy),fy.forEach(t),my.forEach(t),lm=h(pp),nl=r(pp,"SPAN",{});var gy=i(nl);dm=s(gy,"GPT2 specific outputs"),gy.forEach(t),pp.forEach(t),vc=h(o),_o=r(o,"DIV",{class:!0});var hp=i(_o);k(ta.$$.fragment,hp),cm=h(hp),sl=r(hp,"P",{});var _y=i(sl);pm=s(_y,"Base class for outputs of models predicting if two sentences are consecutive or not."),_y.forEach(t),hp.forEach(t),kc=h(o),To=r(o,"DIV",{class:!0});var up=i(To);k(oa.$$.fragment,up),hm=h(up),al=r(up,"P",{});var Ty=i(al);um=s(Ty,"Base class for outputs of models predicting if two sentences are consecutive or not."),Ty.forEach(t),up.forEach(t),wc=h(o),bo=r(o,"H2",{class:!0});var mp=i(bo);nn=r(mp,"A",{id:!0,class:!0,href:!0});var by=i(nn);rl=r(by,"SPAN",{});var yy=i(rl);k(na.$$.fragment,yy),yy.forEach(t),by.forEach(t),mm=h(mp),il=r(mp,"SPAN",{});var vy=i(il);fm=s(vy,"GPT2Model"),vy.forEach(t),mp.forEach(t),$c=h(o),Ue=r(o,"DIV",{class:!0});var vt=i(Ue);k(sa.$$.fragment,vt),gm=h(vt),ll=r(vt,"P",{});var ky=i(ll);_m=s(ky,"The bare GPT2 Model transformer outputting raw hidden-states without any specific head on top."),ky.forEach(t),Tm=h(vt),aa=r(vt,"P",{});var fp=i(aa);bm=s(fp,"This model inherits from "),ei=r(fp,"A",{href:!0});var wy=i(ei);ym=s(wy,"PreTrainedModel"),wy.forEach(t),vm=s(fp,`. 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.)`),fp.forEach(t),km=h(vt),ra=r(vt,"P",{});var gp=i(ra);wm=s(gp,"This model is also a PyTorch "),ia=r(gp,"A",{href:!0,rel:!0});var $y=i(ia);$m=s($y,"torch.nn.Module"),$y.forEach(t),Pm=s(gp,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),gp.forEach(t),Mm=h(vt),Ft=r(vt,"DIV",{class:!0});var ts=i(Ft);k(la.$$.fragment,ts),xm=h(ts),yo=r(ts,"P",{});var Pi=i(yo);Gm=s(Pi,"The "),ti=r(Pi,"A",{href:!0});var Py=i(ti);zm=s(Py,"GPT2Model"),Py.forEach(t),Fm=s(Pi," forward method, overrides the "),dl=r(Pi,"CODE",{});var My=i(dl);Em=s(My,"__call__"),My.forEach(t),jm=s(Pi," special method."),Pi.forEach(t),qm=h(ts),k(sn.$$.fragment,ts),Cm=h(ts),k(an.$$.fragment,ts),ts.forEach(t),Am=h(vt),Et=r(vt,"DIV",{class:!0});var os=i(Et);k(da.$$.fragment,os),Dm=h(os),cl=r(os,"P",{});var xy=i(cl);Lm=s(xy,"This is an experimental feature and is a subject to change at a moment\u2019s notice."),xy.forEach(t),Om=h(os),pl=r(os,"P",{});var Gy=i(pl);Hm=s(Gy,`Uses a device map to distribute attention modules of the model across several devices. If no device map is given,
it will evenly distribute blocks across all devices.`),Gy.forEach(t),Nm=h(os),k(rn.$$.fragment,os),os.forEach(t),Im=h(vt),Zt=r(vt,"DIV",{class:!0});var Mi=i(Zt);k(ca.$$.fragment,Mi),Sm=h(Mi),hl=r(Mi,"P",{});var zy=i(hl);Wm=s(zy,"Moves the model to cpu from a model parallel state."),zy.forEach(t),Um=h(Mi),k(ln.$$.fragment,Mi),Mi.forEach(t),vt.forEach(t),Pc=h(o),vo=r(o,"H2",{class:!0});var _p=i(vo);dn=r(_p,"A",{id:!0,class:!0,href:!0});var Fy=i(dn);ul=r(Fy,"SPAN",{});var Ey=i(ul);k(pa.$$.fragment,Ey),Ey.forEach(t),Fy.forEach(t),Bm=h(_p),ml=r(_p,"SPAN",{});var jy=i(ml);Rm=s(jy,"GPT2LMHeadModel"),jy.forEach(t),_p.forEach(t),Mc=h(o),Be=r(o,"DIV",{class:!0});var kt=i(Be);k(ha.$$.fragment,kt),Km=h(kt),fl=r(kt,"P",{});var qy=i(fl);Vm=s(qy,`The GPT2 Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),qy.forEach(t),Jm=h(kt),ua=r(kt,"P",{});var Tp=i(ua);Xm=s(Tp,"This model inherits from "),oi=r(Tp,"A",{href:!0});var Cy=i(oi);Ym=s(Cy,"PreTrainedModel"),Cy.forEach(t),Qm=s(Tp,`. 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.)`),Tp.forEach(t),Zm=h(kt),ma=r(kt,"P",{});var bp=i(ma);ef=s(bp,"This model is also a PyTorch "),fa=r(bp,"A",{href:!0,rel:!0});var Ay=i(fa);tf=s(Ay,"torch.nn.Module"),Ay.forEach(t),of=s(bp,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),bp.forEach(t),nf=h(kt),jt=r(kt,"DIV",{class:!0});var ns=i(jt);k(ga.$$.fragment,ns),sf=h(ns),ko=r(ns,"P",{});var xi=i(ko);af=s(xi,"The "),ni=r(xi,"A",{href:!0});var Dy=i(ni);rf=s(Dy,"GPT2LMHeadModel"),Dy.forEach(t),lf=s(xi," forward method, overrides the "),gl=r(xi,"CODE",{});var Ly=i(gl);df=s(Ly,"__call__"),Ly.forEach(t),cf=s(xi," special method."),xi.forEach(t),pf=h(ns),k(cn.$$.fragment,ns),hf=h(ns),k(pn.$$.fragment,ns),ns.forEach(t),uf=h(kt),qt=r(kt,"DIV",{class:!0});var ss=i(qt);k(_a.$$.fragment,ss),mf=h(ss),_l=r(ss,"P",{});var Oy=i(_l);ff=s(Oy,"This is an experimental feature and is a subject to change at a moment\u2019s notice."),Oy.forEach(t),gf=h(ss),Tl=r(ss,"P",{});var Hy=i(Tl);_f=s(Hy,`Uses a device map to distribute attention modules of the model across several devices. If no device map is given,
it will evenly distribute blocks across all devices.`),Hy.forEach(t),Tf=h(ss),k(hn.$$.fragment,ss),ss.forEach(t),bf=h(kt),eo=r(kt,"DIV",{class:!0});var Gi=i(eo);k(Ta.$$.fragment,Gi),yf=h(Gi),bl=r(Gi,"P",{});var Ny=i(bl);vf=s(Ny,"Moves the model to cpu from a model parallel state."),Ny.forEach(t),kf=h(Gi),k(un.$$.fragment,Gi),Gi.forEach(t),kt.forEach(t),xc=h(o),wo=r(o,"H2",{class:!0});var yp=i(wo);mn=r(yp,"A",{id:!0,class:!0,href:!0});var Iy=i(mn);yl=r(Iy,"SPAN",{});var Sy=i(yl);k(ba.$$.fragment,Sy),Sy.forEach(t),Iy.forEach(t),wf=h(yp),vl=r(yp,"SPAN",{});var Wy=i(vl);$f=s(Wy,"GPT2DoubleHeadsModel"),Wy.forEach(t),yp.forEach(t),Gc=h(o),gt=r(o,"DIV",{class:!0});var no=i(gt);k(ya.$$.fragment,no),Pf=h(no),kl=r(no,"P",{});var Uy=i(kl);Mf=s(Uy,`The GPT2 Model transformer with a language modeling and a multiple-choice classification head on top e.g. for
RocStories/SWAG tasks. The two heads are two linear layers. The language modeling head has its weights tied to the
input embeddings, the classification head takes as input the input of a specified classification token index in the
input sequence).`),Uy.forEach(t),xf=h(no),va=r(no,"P",{});var vp=i(va);Gf=s(vp,"This model inherits from "),si=r(vp,"A",{href:!0});var By=i(si);zf=s(By,"PreTrainedModel"),By.forEach(t),Ff=s(vp,`. 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.)`),vp.forEach(t),Ef=h(no),ka=r(no,"P",{});var kp=i(ka);jf=s(kp,"This model is also a PyTorch "),wa=r(kp,"A",{href:!0,rel:!0});var Ry=i(wa);qf=s(Ry,"torch.nn.Module"),Ry.forEach(t),Cf=s(kp,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),kp.forEach(t),Af=h(no),Ct=r(no,"DIV",{class:!0});var as=i(Ct);k($a.$$.fragment,as),Df=h(as),$o=r(as,"P",{});var zi=i($o);Lf=s(zi,"The "),ai=r(zi,"A",{href:!0});var Ky=i(ai);Of=s(Ky,"GPT2DoubleHeadsModel"),Ky.forEach(t),Hf=s(zi," forward method, overrides the "),wl=r(zi,"CODE",{});var Vy=i(wl);Nf=s(Vy,"__call__"),Vy.forEach(t),If=s(zi," special method."),zi.forEach(t),Sf=h(as),k(fn.$$.fragment,as),Wf=h(as),k(gn.$$.fragment,as),as.forEach(t),no.forEach(t),zc=h(o),Po=r(o,"H2",{class:!0});var wp=i(Po);_n=r(wp,"A",{id:!0,class:!0,href:!0});var Jy=i(_n);$l=r(Jy,"SPAN",{});var Xy=i($l);k(Pa.$$.fragment,Xy),Xy.forEach(t),Jy.forEach(t),Uf=h(wp),Pl=r(wp,"SPAN",{});var Yy=i(Pl);Bf=s(Yy,"GPT2ForSequenceClassification"),Yy.forEach(t),wp.forEach(t),Fc=h(o),Re=r(o,"DIV",{class:!0});var wt=i(Re);k(Ma.$$.fragment,wt),Rf=h(wt),Ml=r(wt,"P",{});var Qy=i(Ml);Kf=s(Qy,"The GPT2 Model transformer with a sequence classification head on top (linear layer)."),Qy.forEach(t),Vf=h(wt),ri=r(wt,"P",{});var kb=i(ri);ii=r(kb,"A",{href:!0});var Zy=i(ii);Jf=s(Zy,"GPT2ForSequenceClassification"),Zy.forEach(t),Xf=s(kb,` uses the last token in order to do the classification, as other causal models
(e.g. GPT-1) do.`),kb.forEach(t),Yf=h(wt),xt=r(wt,"P",{});var so=i(xt);Qf=s(so,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),xl=r(so,"CODE",{});var ev=i(xl);Zf=s(ev,"pad_token_id"),ev.forEach(t),eg=s(so,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Gl=r(so,"CODE",{});var tv=i(Gl);tg=s(tv,"pad_token_id"),tv.forEach(t),og=s(so,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),zl=r(so,"CODE",{});var ov=i(zl);ng=s(ov,"inputs_embeds"),ov.forEach(t),sg=s(so," are passed instead of "),Fl=r(so,"CODE",{});var nv=i(Fl);ag=s(nv,"input_ids"),nv.forEach(t),rg=s(so,`, it does the same (take the last value in
each row of the batch).`),so.forEach(t),ig=h(wt),xa=r(wt,"P",{});var $p=i(xa);lg=s($p,"This model inherits from "),li=r($p,"A",{href:!0});var sv=i(li);dg=s(sv,"PreTrainedModel"),sv.forEach(t),cg=s($p,`. 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.)`),$p.forEach(t),pg=h(wt),Ga=r(wt,"P",{});var Pp=i(Ga);hg=s(Pp,"This model is also a PyTorch "),za=r(Pp,"A",{href:!0,rel:!0});var av=i(za);ug=s(av,"torch.nn.Module"),av.forEach(t),mg=s(Pp,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Pp.forEach(t),fg=h(wt),Tt=r(wt,"DIV",{class:!0});var ao=i(Tt);k(Fa.$$.fragment,ao),gg=h(ao),Mo=r(ao,"P",{});var Fi=i(Mo);_g=s(Fi,"The "),di=r(Fi,"A",{href:!0});var rv=i(di);Tg=s(rv,"GPT2ForSequenceClassification"),rv.forEach(t),bg=s(Fi," forward method, overrides the "),El=r(Fi,"CODE",{});var iv=i(El);yg=s(iv,"__call__"),iv.forEach(t),vg=s(Fi," special method."),Fi.forEach(t),kg=h(ao),k(Tn.$$.fragment,ao),wg=h(ao),k(bn.$$.fragment,ao),$g=h(ao),k(yn.$$.fragment,ao),ao.forEach(t),wt.forEach(t),Ec=h(o),xo=r(o,"H2",{class:!0});var Mp=i(xo);vn=r(Mp,"A",{id:!0,class:!0,href:!0});var lv=i(vn);jl=r(lv,"SPAN",{});var dv=i(jl);k(Ea.$$.fragment,dv),dv.forEach(t),lv.forEach(t),Pg=h(Mp),ql=r(Mp,"SPAN",{});var cv=i(ql);Mg=s(cv,"GPT2ForTokenClassification"),cv.forEach(t),Mp.forEach(t),jc=h(o),_t=r(o,"DIV",{class:!0});var ro=i(_t);k(ja.$$.fragment,ro),xg=h(ro),Cl=r(ro,"P",{});var pv=i(Cl);Gg=s(pv,`GPT2 Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g. for
Named-Entity-Recognition (NER) tasks.`),pv.forEach(t),zg=h(ro),qa=r(ro,"P",{});var xp=i(qa);Fg=s(xp,"This model inherits from "),ci=r(xp,"A",{href:!0});var hv=i(ci);Eg=s(hv,"PreTrainedModel"),hv.forEach(t),jg=s(xp,`. 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.)`),xp.forEach(t),qg=h(ro),Ca=r(ro,"P",{});var Gp=i(Ca);Cg=s(Gp,"This model is also a PyTorch "),Aa=r(Gp,"A",{href:!0,rel:!0});var uv=i(Aa);Ag=s(uv,"torch.nn.Module"),uv.forEach(t),Dg=s(Gp,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Gp.forEach(t),Lg=h(ro),At=r(ro,"DIV",{class:!0});var rs=i(At);k(Da.$$.fragment,rs),Og=h(rs),Go=r(rs,"P",{});var Ei=i(Go);Hg=s(Ei,"The "),pi=r(Ei,"A",{href:!0});var mv=i(pi);Ng=s(mv,"GPT2ForTokenClassification"),mv.forEach(t),Ig=s(Ei," forward method, overrides the "),Al=r(Ei,"CODE",{});var fv=i(Al);Sg=s(fv,"__call__"),fv.forEach(t),Wg=s(Ei," special method."),Ei.forEach(t),Ug=h(rs),k(kn.$$.fragment,rs),Bg=h(rs),k(wn.$$.fragment,rs),rs.forEach(t),ro.forEach(t),qc=h(o),zo=r(o,"H2",{class:!0});var zp=i(zo);$n=r(zp,"A",{id:!0,class:!0,href:!0});var gv=i($n);Dl=r(gv,"SPAN",{});var _v=i(Dl);k(La.$$.fragment,_v),_v.forEach(t),gv.forEach(t),Rg=h(zp),Ll=r(zp,"SPAN",{});var Tv=i(Ll);Kg=s(Tv,"TFGPT2Model"),Tv.forEach(t),zp.forEach(t),Cc=h(o),Qe=r(o,"DIV",{class:!0});var It=i(Qe);k(Oa.$$.fragment,It),Vg=h(It),Ol=r(It,"P",{});var bv=i(Ol);Jg=s(bv,"The bare GPT2 Model transformer outputting raw hidden-states without any specific head on top."),bv.forEach(t),Xg=h(It),Ha=r(It,"P",{});var Fp=i(Ha);Yg=s(Fp,"This model inherits from "),hi=r(Fp,"A",{href:!0});var yv=i(hi);Qg=s(yv,"TFPreTrainedModel"),yv.forEach(t),Zg=s(Fp,`. 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.)`),Fp.forEach(t),e_=h(It),Na=r(It,"P",{});var Ep=i(Na);t_=s(Ep,"This model is also a "),Ia=r(Ep,"A",{href:!0,rel:!0});var vv=i(Ia);o_=s(vv,"tf.keras.Model"),vv.forEach(t),n_=s(Ep,` 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.`),Ep.forEach(t),s_=h(It),k(Pn.$$.fragment,It),a_=h(It),Dt=r(It,"DIV",{class:!0});var is=i(Dt);k(Sa.$$.fragment,is),r_=h(is),Fo=r(is,"P",{});var ji=i(Fo);i_=s(ji,"The "),ui=r(ji,"A",{href:!0});var kv=i(ui);l_=s(kv,"TFGPT2Model"),kv.forEach(t),d_=s(ji," forward method, overrides the "),Hl=r(ji,"CODE",{});var wv=i(Hl);c_=s(wv,"__call__"),wv.forEach(t),p_=s(ji," special method."),ji.forEach(t),h_=h(is),k(Mn.$$.fragment,is),u_=h(is),k(xn.$$.fragment,is),is.forEach(t),It.forEach(t),Ac=h(o),Eo=r(o,"H2",{class:!0});var jp=i(Eo);Gn=r(jp,"A",{id:!0,class:!0,href:!0});var $v=i(Gn);Nl=r($v,"SPAN",{});var Pv=i(Nl);k(Wa.$$.fragment,Pv),Pv.forEach(t),$v.forEach(t),m_=h(jp),Il=r(jp,"SPAN",{});var Mv=i(Il);f_=s(Mv,"TFGPT2LMHeadModel"),Mv.forEach(t),jp.forEach(t),Dc=h(o),Ze=r(o,"DIV",{class:!0});var St=i(Ze);k(Ua.$$.fragment,St),g_=h(St),Sl=r(St,"P",{});var xv=i(Sl);__=s(xv,`The GPT2 Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),xv.forEach(t),T_=h(St),Ba=r(St,"P",{});var qp=i(Ba);b_=s(qp,"This model inherits from "),mi=r(qp,"A",{href:!0});var Gv=i(mi);y_=s(Gv,"TFPreTrainedModel"),Gv.forEach(t),v_=s(qp,`. 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.)`),qp.forEach(t),k_=h(St),Ra=r(St,"P",{});var Cp=i(Ra);w_=s(Cp,"This model is also a "),Ka=r(Cp,"A",{href:!0,rel:!0});var zv=i(Ka);$_=s(zv,"tf.keras.Model"),zv.forEach(t),P_=s(Cp,` 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.`),Cp.forEach(t),M_=h(St),k(zn.$$.fragment,St),x_=h(St),Lt=r(St,"DIV",{class:!0});var ls=i(Lt);k(Va.$$.fragment,ls),G_=h(ls),jo=r(ls,"P",{});var qi=i(jo);z_=s(qi,"The "),fi=r(qi,"A",{href:!0});var Fv=i(fi);F_=s(Fv,"TFGPT2LMHeadModel"),Fv.forEach(t),E_=s(qi," forward method, overrides the "),Wl=r(qi,"CODE",{});var Ev=i(Wl);j_=s(Ev,"__call__"),Ev.forEach(t),q_=s(qi," special method."),qi.forEach(t),C_=h(ls),k(Fn.$$.fragment,ls),A_=h(ls),k(En.$$.fragment,ls),ls.forEach(t),St.forEach(t),Lc=h(o),qo=r(o,"H2",{class:!0});var Ap=i(qo);jn=r(Ap,"A",{id:!0,class:!0,href:!0});var jv=i(jn);Ul=r(jv,"SPAN",{});var qv=i(Ul);k(Ja.$$.fragment,qv),qv.forEach(t),jv.forEach(t),D_=h(Ap),Bl=r(Ap,"SPAN",{});var Cv=i(Bl);L_=s(Cv,"TFGPT2DoubleHeadsModel"),Cv.forEach(t),Ap.forEach(t),Oc=h(o),et=r(o,"DIV",{class:!0});var Wt=i(et);k(Xa.$$.fragment,Wt),O_=h(Wt),Rl=r(Wt,"P",{});var Av=i(Rl);H_=s(Av,`The GPT2 Model transformer with a language modeling and a multiple-choice classification head on top e.g. for
RocStories/SWAG tasks. The two heads are two linear layers. The language modeling head has its weights tied to the
input embeddings, the classification head takes as input the input of a specified classification token index in the
input sequence).`),Av.forEach(t),N_=h(Wt),Ya=r(Wt,"P",{});var Dp=i(Ya);I_=s(Dp,"This model inherits from "),gi=r(Dp,"A",{href:!0});var Dv=i(gi);S_=s(Dv,"TFPreTrainedModel"),Dv.forEach(t),W_=s(Dp,`. 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.)`),Dp.forEach(t),U_=h(Wt),Qa=r(Wt,"P",{});var Lp=i(Qa);B_=s(Lp,"This model is also a "),Za=r(Lp,"A",{href:!0,rel:!0});var Lv=i(Za);R_=s(Lv,"tf.keras.Model"),Lv.forEach(t),K_=s(Lp,` 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.`),Lp.forEach(t),V_=h(Wt),k(qn.$$.fragment,Wt),J_=h(Wt),Ot=r(Wt,"DIV",{class:!0});var ds=i(Ot);k(er.$$.fragment,ds),X_=h(ds),Co=r(ds,"P",{});var Ci=i(Co);Y_=s(Ci,"The "),_i=r(Ci,"A",{href:!0});var Ov=i(_i);Q_=s(Ov,"TFGPT2DoubleHeadsModel"),Ov.forEach(t),Z_=s(Ci," forward method, overrides the "),Kl=r(Ci,"CODE",{});var Hv=i(Kl);eT=s(Hv,"__call__"),Hv.forEach(t),tT=s(Ci," special method."),Ci.forEach(t),oT=h(ds),k(Cn.$$.fragment,ds),nT=h(ds),k(An.$$.fragment,ds),ds.forEach(t),Wt.forEach(t),Hc=h(o),Ao=r(o,"H2",{class:!0});var Op=i(Ao);Dn=r(Op,"A",{id:!0,class:!0,href:!0});var Nv=i(Dn);Vl=r(Nv,"SPAN",{});var Iv=i(Vl);k(tr.$$.fragment,Iv),Iv.forEach(t),Nv.forEach(t),sT=h(Op),Jl=r(Op,"SPAN",{});var Sv=i(Jl);aT=s(Sv,"TFGPT2ForSequenceClassification"),Sv.forEach(t),Op.forEach(t),Nc=h(o),ye=r(o,"DIV",{class:!0});var st=i(ye);k(or.$$.fragment,st),rT=h(st),Xl=r(st,"P",{});var Wv=i(Xl);iT=s(Wv,"The GPT2 Model transformer with a sequence classification head on top (linear layer)."),Wv.forEach(t),lT=h(st),Ti=r(st,"P",{});var wb=i(Ti);bi=r(wb,"A",{href:!0});var Uv=i(bi);dT=s(Uv,"TFGPT2ForSequenceClassification"),Uv.forEach(t),cT=s(wb,` uses the last token in order to do the classification, as other causal models
(e.g. GPT-1) do.`),wb.forEach(t),pT=h(st),Gt=r(st,"P",{});var io=i(Gt);hT=s(io,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Yl=r(io,"CODE",{});var Bv=i(Yl);uT=s(Bv,"pad_token_id"),Bv.forEach(t),mT=s(io,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),Ql=r(io,"CODE",{});var Rv=i(Ql);fT=s(Rv,"pad_token_id"),Rv.forEach(t),gT=s(io,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Zl=r(io,"CODE",{});var Kv=i(Zl);_T=s(Kv,"inputs_embeds"),Kv.forEach(t),TT=s(io," are passed instead of "),ed=r(io,"CODE",{});var Vv=i(ed);bT=s(Vv,"input_ids"),Vv.forEach(t),yT=s(io,`, it does the same (take the last value in
each row of the batch).`),io.forEach(t),vT=h(st),nr=r(st,"P",{});var Hp=i(nr);kT=s(Hp,"This model inherits from "),yi=r(Hp,"A",{href:!0});var Jv=i(yi);wT=s(Jv,"TFPreTrainedModel"),Jv.forEach(t),$T=s(Hp,`. 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.)`),Hp.forEach(t),PT=h(st),sr=r(st,"P",{});var Np=i(sr);MT=s(Np,"This model is also a "),ar=r(Np,"A",{href:!0,rel:!0});var Xv=i(ar);xT=s(Xv,"tf.keras.Model"),Xv.forEach(t),GT=s(Np,` 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.`),Np.forEach(t),zT=h(st),k(Ln.$$.fragment,st),FT=h(st),bt=r(st,"DIV",{class:!0});var lo=i(bt);k(rr.$$.fragment,lo),ET=h(lo),Do=r(lo,"P",{});var Ai=i(Do);jT=s(Ai,"The "),vi=r(Ai,"A",{href:!0});var Yv=i(vi);qT=s(Yv,"TFGPT2ForSequenceClassification"),Yv.forEach(t),CT=s(Ai," forward method, overrides the "),td=r(Ai,"CODE",{});var Qv=i(td);AT=s(Qv,"__call__"),Qv.forEach(t),DT=s(Ai," special method."),Ai.forEach(t),LT=h(lo),k(On.$$.fragment,lo),OT=h(lo),k(Hn.$$.fragment,lo),HT=h(lo),k(Nn.$$.fragment,lo),lo.forEach(t),st.forEach(t),Ic=h(o),Lo=r(o,"H2",{class:!0});var Ip=i(Lo);In=r(Ip,"A",{id:!0,class:!0,href:!0});var Zv=i(In);od=r(Zv,"SPAN",{});var ek=i(od);k(ir.$$.fragment,ek),ek.forEach(t),Zv.forEach(t),NT=h(Ip),nd=r(Ip,"SPAN",{});var tk=i(nd);IT=s(tk,"TFSequenceClassifierOutputWithPast"),tk.forEach(t),Ip.forEach(t),Sc=h(o),Oo=r(o,"DIV",{class:!0});var Sp=i(Oo);k(lr.$$.fragment,Sp),ST=h(Sp),sd=r(Sp,"P",{});var ok=i(sd);WT=s(ok,"Base class for outputs of sentence classification models."),ok.forEach(t),Sp.forEach(t),Wc=h(o),Ho=r(o,"H2",{class:!0});var Wp=i(Ho);Sn=r(Wp,"A",{id:!0,class:!0,href:!0});var nk=i(Sn);ad=r(nk,"SPAN",{});var sk=i(ad);k(dr.$$.fragment,sk),sk.forEach(t),nk.forEach(t),UT=h(Wp),rd=r(Wp,"SPAN",{});var ak=i(rd);BT=s(ak,"TFGPT2Tokenizer"),ak.forEach(t),Wp.forEach(t),Uc=h(o),tt=r(o,"DIV",{class:!0});var Ut=i(tt);k(cr.$$.fragment,Ut),RT=h(Ut),No=r(Ut,"P",{});var Di=i(No);KT=s(Di,`This is an in-graph tokenizer for GPT2. It should be initialized similarly to other tokenizers, using the
`),id=r(Di,"CODE",{});var rk=i(id);VT=s(rk,"from_pretrained()"),rk.forEach(t),JT=s(Di," method. It can also be initialized with the "),ld=r(Di,"CODE",{});var ik=i(ld);XT=s(ik,"from_tokenizer()"),ik.forEach(t),YT=s(Di,` method, which imports settings
from an existing standard tokenizer object.`),Di.forEach(t),QT=h(Ut),pr=r(Ut,"P",{});var Up=i(pr);ZT=s(Up,`In-graph tokenizers, unlike other Hugging Face tokenizers, are actually Keras layers and are designed to be run
when the model is called, rather than during preprocessing. As a result, they have somewhat more limited options
than standard tokenizer classes. They are most useful when you want to create an end-to-end model that goes
straight from `),dd=r(Up,"CODE",{});var lk=i(dd);e2=s(lk,"tf.string"),lk.forEach(t),t2=s(Up," inputs to outputs."),Up.forEach(t),o2=h(Ut),Wn=r(Ut,"DIV",{class:!0});var Bp=i(Wn);k(hr.$$.fragment,Bp),n2=h(Bp),cd=r(Bp,"P",{});var dk=i(cd);s2=s(dk,"Creates TFGPT2Tokenizer from configurations"),dk.forEach(t),Bp.forEach(t),a2=h(Ut),to=r(Ut,"DIV",{class:!0});var Li=i(to);k(ur.$$.fragment,Li),r2=h(Li),pd=r(Li,"P",{});var ck=i(pd);i2=s(ck,"Creates TFGPT2Tokenizer from pretrained GPT2Tokenizer"),ck.forEach(t),l2=h(Li),k(Un.$$.fragment,Li),Li.forEach(t),d2=h(Ut),oo=r(Ut,"DIV",{class:!0});var Oi=i(oo);k(mr.$$.fragment,Oi),c2=h(Oi),hd=r(Oi,"P",{});var pk=i(hd);p2=s(pk,"Creates TFGPT2Tokenizer from GPT2Tokenizer"),pk.forEach(t),h2=h(Oi),k(Bn.$$.fragment,Oi),Oi.forEach(t),Ut.forEach(t),Bc=h(o),Io=r(o,"H2",{class:!0});var Rp=i(Io);Rn=r(Rp,"A",{id:!0,class:!0,href:!0});var hk=i(Rn);ud=r(hk,"SPAN",{});var uk=i(ud);k(fr.$$.fragment,uk),uk.forEach(t),hk.forEach(t),u2=h(Rp),md=r(Rp,"SPAN",{});var mk=i(md);m2=s(mk,"FlaxGPT2Model"),mk.forEach(t),Rp.forEach(t),Rc=h(o),Ke=r(o,"DIV",{class:!0});var $t=i(Ke);k(gr.$$.fragment,$t),f2=h($t),fd=r($t,"P",{});var fk=i(fd);g2=s(fk,"The bare GPT2 Model transformer outputting raw hidden-states without any specific head on top."),fk.forEach(t),_2=h($t),_r=r($t,"P",{});var Kp=i(_r);T2=s(Kp,"This model inherits from "),ki=r(Kp,"A",{href:!0});var gk=i(ki);b2=s(gk,"FlaxPreTrainedModel"),gk.forEach(t),y2=s(Kp,`. 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.)`),Kp.forEach(t),v2=h($t),Tr=r($t,"P",{});var Vp=i(Tr);k2=s(Vp,`This model is also a Flax Linen
`),br=r(Vp,"A",{href:!0,rel:!0});var _k=i(br);w2=s(_k,"flax.nn.Module"),_k.forEach(t),$2=s(Vp,` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),Vp.forEach(t),P2=h($t),gd=r($t,"P",{});var Tk=i(gd);M2=s(Tk,"Finally, this model supports inherent JAX features such as:"),Tk.forEach(t),x2=h($t),Rt=r($t,"UL",{});var cs=i(Rt);_d=r(cs,"LI",{});var bk=i(_d);yr=r(bk,"A",{href:!0,rel:!0});var yk=i(yr);G2=s(yk,"Just-In-Time (JIT) compilation"),yk.forEach(t),bk.forEach(t),z2=h(cs),Td=r(cs,"LI",{});var vk=i(Td);vr=r(vk,"A",{href:!0,rel:!0});var kk=i(vr);F2=s(kk,"Automatic Differentiation"),kk.forEach(t),vk.forEach(t),E2=h(cs),bd=r(cs,"LI",{});var wk=i(bd);kr=r(wk,"A",{href:!0,rel:!0});var $k=i(kr);j2=s($k,"Vectorization"),$k.forEach(t),wk.forEach(t),q2=h(cs),yd=r(cs,"LI",{});var Pk=i(yd);wr=r(Pk,"A",{href:!0,rel:!0});var Mk=i(wr);C2=s(Mk,"Parallelization"),Mk.forEach(t),Pk.forEach(t),cs.forEach(t),A2=h($t),Ht=r($t,"DIV",{class:!0});var ps=i(Ht);k($r.$$.fragment,ps),D2=h(ps),So=r(ps,"P",{});var Hi=i(So);L2=s(Hi,"The "),vd=r(Hi,"CODE",{});var xk=i(vd);O2=s(xk,"FlaxGPT2PreTrainedModel"),xk.forEach(t),H2=s(Hi," forward method, overrides the "),kd=r(Hi,"CODE",{});var Gk=i(kd);N2=s(Gk,"__call__"),Gk.forEach(t),I2=s(Hi," special method."),Hi.forEach(t),S2=h(ps),k(Kn.$$.fragment,ps),W2=h(ps),k(Vn.$$.fragment,ps),ps.forEach(t),$t.forEach(t),Kc=h(o),Wo=r(o,"H2",{class:!0});var Jp=i(Wo);Jn=r(Jp,"A",{id:!0,class:!0,href:!0});var zk=i(Jn);wd=r(zk,"SPAN",{});var Fk=i(wd);k(Pr.$$.fragment,Fk),Fk.forEach(t),zk.forEach(t),U2=h(Jp),$d=r(Jp,"SPAN",{});var Ek=i($d);B2=s(Ek,"FlaxGPT2LMHeadModel"),Ek.forEach(t),Jp.forEach(t),Vc=h(o),Ve=r(o,"DIV",{class:!0});var Pt=i(Ve);k(Mr.$$.fragment,Pt),R2=h(Pt),Pd=r(Pt,"P",{});var jk=i(Pd);K2=s(jk,`The GPT2 Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`),jk.forEach(t),V2=h(Pt),xr=r(Pt,"P",{});var Xp=i(xr);J2=s(Xp,"This model inherits from "),wi=r(Xp,"A",{href:!0});var qk=i(wi);X2=s(qk,"FlaxPreTrainedModel"),qk.forEach(t),Y2=s(Xp,`. 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.)`),Xp.forEach(t),Q2=h(Pt),Gr=r(Pt,"P",{});var Yp=i(Gr);Z2=s(Yp,`This model is also a Flax Linen
`),zr=r(Yp,"A",{href:!0,rel:!0});var Ck=i(zr);eb=s(Ck,"flax.nn.Module"),Ck.forEach(t),tb=s(Yp,` subclass. Use it as a
regular Flax Module and refer to the Flax documentation for all matter related to general usage and behavior.`),Yp.forEach(t),ob=h(Pt),Md=r(Pt,"P",{});var Ak=i(Md);nb=s(Ak,"Finally, this model supports inherent JAX features such as:"),Ak.forEach(t),sb=h(Pt),Kt=r(Pt,"UL",{});var hs=i(Kt);xd=r(hs,"LI",{});var Dk=i(xd);Fr=r(Dk,"A",{href:!0,rel:!0});var Lk=i(Fr);ab=s(Lk,"Just-In-Time (JIT) compilation"),Lk.forEach(t),Dk.forEach(t),rb=h(hs),Gd=r(hs,"LI",{});var Ok=i(Gd);Er=r(Ok,"A",{href:!0,rel:!0});var Hk=i(Er);ib=s(Hk,"Automatic Differentiation"),Hk.forEach(t),Ok.forEach(t),lb=h(hs),zd=r(hs,"LI",{});var Nk=i(zd);jr=r(Nk,"A",{href:!0,rel:!0});var Ik=i(jr);db=s(Ik,"Vectorization"),Ik.forEach(t),Nk.forEach(t),cb=h(hs),Fd=r(hs,"LI",{});var Sk=i(Fd);qr=r(Sk,"A",{href:!0,rel:!0});var Wk=i(qr);pb=s(Wk,"Parallelization"),Wk.forEach(t),Sk.forEach(t),hs.forEach(t),hb=h(Pt),Nt=r(Pt,"DIV",{class:!0});var us=i(Nt);k(Cr.$$.fragment,us),ub=h(us),Uo=r(us,"P",{});var Ni=i(Uo);mb=s(Ni,"The "),Ed=r(Ni,"CODE",{});var Uk=i(Ed);fb=s(Uk,"FlaxGPT2PreTrainedModel"),Uk.forEach(t),gb=s(Ni," forward method, overrides the "),jd=r(Ni,"CODE",{});var Bk=i(jd);_b=s(Bk,"__call__"),Bk.forEach(t),Tb=s(Ni," special method."),Ni.forEach(t),bb=h(us),k(Xn.$$.fragment,us),yb=h(us),k(Yn.$$.fragment,us),us.forEach(t),Pt.forEach(t),this.h()},h(){m(d,"name","hf:doc:metadata"),m(d,"content",JSON.stringify(Ow)),m(u,"id","openai-gpt2"),m(u,"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"),m(u,"href","#openai-gpt2"),m(f,"class","relative group"),m(J,"id","overview"),m(J,"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"),m(J,"href","#overview"),m(H,"class","relative group"),m(de,"href","https://cdn.openai.com/better-language-models/language_models_are_unsupervised_multitask_learners.pdf"),m(de,"rel","nofollow"),m(ne,"href","/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Model.forward"),m(Je,"href","/docs/transformers/main/en/model_doc/gpt2#transformers.TFGPT2Model.call"),m(oe,"href","https://github.com/stanford-crfm/mistral/"),m(oe,"rel","nofollow"),m(ms,"href","https://transformer.huggingface.co/doc/gpt2-large"),m(ms,"rel","nofollow"),m(fs,"href","https://huggingface.co/thomwolf"),m(fs,"rel","nofollow"),m(gs,"href","https://openai.com/blog/better-language-models/"),m(gs,"rel","nofollow"),m(Ko,"id","resources"),m(Ko,"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"),m(Ko,"href","#resources"),m(po,"class","relative group"),m(ys,"href","https://www.philschmid.de/fine-tune-a-non-english-gpt-2-model-with-huggingface"),m(ys,"rel","nofollow"),m(ks,"href","https://huggingface.co/blog/how-to-generate"),m(ks,"rel","nofollow"),m($s,"href","https://huggingface.co/blog/codeparrot"),m($s,"rel","nofollow"),m(Ms,"href","https://huggingface.co/blog/tf-xla-generate"),m(Ms,"rel","nofollow"),m(Gs,"href","https://huggingface.co/blog/megatron-training"),m(Gs,"rel","nofollow"),m(Fs,"href","https://colab.research.google.com/github/AlekseyKorshuk/huggingartists/blob/master/huggingartists-demo.ipynb"),m(Fs,"rel","nofollow"),m(js,"href","https://colab.research.google.com/github/borisdayma/huggingtweets/blob/master/huggingtweets-demo.ipynb"),m(js,"rel","nofollow"),m(qs,"href","https://huggingface.co/course/en/chapter7/6?fw=pt#training-a-causal-language-model-from-scratch"),m(qs,"rel","nofollow"),m(Ur,"href","/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2LMHeadModel"),m(Cs,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/language-modeling#gpt-2gpt-and-causal-language-modeling"),m(Cs,"rel","nofollow"),m(As,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-generation"),m(As,"rel","nofollow"),m(Ds,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb"),m(Ds,"rel","nofollow"),m(Br,"href","/docs/transformers/main/en/model_doc/gpt2#transformers.TFGPT2LMHeadModel"),m(Ls,"href","https://github.com/huggingface/transformers/tree/main/examples/tensorflow/language-modeling#run_clmpy"),m(Ls,"rel","nofollow"),m(Os,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb"),m(Os,"rel","nofollow"),m(Rr,"href","/docs/transformers/main/en/model_doc/gpt2#transformers.FlaxGPT2LMHeadModel"),m(Hs,"href","https://github.com/huggingface/transformers/tree/main/examples/flax/language-modeling#causal-language-modeling"),m(Hs,"rel","nofollow"),m(Ns,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/causal_language_modeling_flax.ipynb"),m(Ns,"rel","nofollow"),m(Vo,"id","transformers.GPT2Config"),m(Vo,"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"),m(Vo,"href","#transformers.GPT2Config"),m(ho,"class","relative group"),m(Kr,"href","/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Model"),m(Vr,"href","/docs/transformers/main/en/model_doc/gpt2#transformers.TFGPT2Model"),m(Ws,"href","https://huggingface.co/gpt2"),m(Ws,"rel","nofollow"),m(Jr,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),m(Xr,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),m(Mt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Xo,"id","transformers.GPT2Tokenizer"),m(Xo,"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"),m(Xo,"href","#transformers.GPT2Tokenizer"),m(mo,"class","relative group"),m(Yr,"href","/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),m(Qr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Zo,"id","transformers.GPT2TokenizerFast"),m(Zo,"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"),m(Zo,"href","#transformers.GPT2TokenizerFast"),m(fo,"class","relative group"),m(Zr,"href","/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast"),m(We,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(on,"id","transformers.models.gpt2.modeling_gpt2.GPT2DoubleHeadsModelOutput"),m(on,"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"),m(on,"href","#transformers.models.gpt2.modeling_gpt2.GPT2DoubleHeadsModelOutput"),m(go,"class","relative group"),m(_o,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(To,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(nn,"id","transformers.GPT2Model"),m(nn,"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"),m(nn,"href","#transformers.GPT2Model"),m(bo,"class","relative group"),m(ei,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),m(ia,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(ia,"rel","nofollow"),m(ti,"href","/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2Model"),m(Ft,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Et,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Zt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(dn,"id","transformers.GPT2LMHeadModel"),m(dn,"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"),m(dn,"href","#transformers.GPT2LMHeadModel"),m(vo,"class","relative group"),m(oi,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),m(fa,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(fa,"rel","nofollow"),m(ni,"href","/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2LMHeadModel"),m(jt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(qt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(eo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(mn,"id","transformers.GPT2DoubleHeadsModel"),m(mn,"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"),m(mn,"href","#transformers.GPT2DoubleHeadsModel"),m(wo,"class","relative group"),m(si,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),m(wa,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(wa,"rel","nofollow"),m(ai,"href","/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2DoubleHeadsModel"),m(Ct,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(gt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(_n,"id","transformers.GPT2ForSequenceClassification"),m(_n,"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"),m(_n,"href","#transformers.GPT2ForSequenceClassification"),m(Po,"class","relative group"),m(ii,"href","/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2ForSequenceClassification"),m(li,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),m(za,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(za,"rel","nofollow"),m(di,"href","/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2ForSequenceClassification"),m(Tt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(vn,"id","transformers.GPT2ForTokenClassification"),m(vn,"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"),m(vn,"href","#transformers.GPT2ForTokenClassification"),m(xo,"class","relative group"),m(ci,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),m(Aa,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(Aa,"rel","nofollow"),m(pi,"href","/docs/transformers/main/en/model_doc/gpt2#transformers.GPT2ForTokenClassification"),m(At,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(_t,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m($n,"id","transformers.TFGPT2Model"),m($n,"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"),m($n,"href","#transformers.TFGPT2Model"),m(zo,"class","relative group"),m(hi,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),m(Ia,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),m(Ia,"rel","nofollow"),m(ui,"href","/docs/transformers/main/en/model_doc/gpt2#transformers.TFGPT2Model"),m(Dt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Qe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Gn,"id","transformers.TFGPT2LMHeadModel"),m(Gn,"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"),m(Gn,"href","#transformers.TFGPT2LMHeadModel"),m(Eo,"class","relative group"),m(mi,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),m(Ka,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),m(Ka,"rel","nofollow"),m(fi,"href","/docs/transformers/main/en/model_doc/gpt2#transformers.TFGPT2LMHeadModel"),m(Lt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(jn,"id","transformers.TFGPT2DoubleHeadsModel"),m(jn,"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"),m(jn,"href","#transformers.TFGPT2DoubleHeadsModel"),m(qo,"class","relative group"),m(gi,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),m(Za,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),m(Za,"rel","nofollow"),m(_i,"href","/docs/transformers/main/en/model_doc/gpt2#transformers.TFGPT2DoubleHeadsModel"),m(Ot,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(et,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Dn,"id","transformers.TFGPT2ForSequenceClassification"),m(Dn,"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"),m(Dn,"href","#transformers.TFGPT2ForSequenceClassification"),m(Ao,"class","relative group"),m(bi,"href","/docs/transformers/main/en/model_doc/gpt2#transformers.TFGPT2ForSequenceClassification"),m(yi,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel"),m(ar,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),m(ar,"rel","nofollow"),m(vi,"href","/docs/transformers/main/en/model_doc/gpt2#transformers.TFGPT2ForSequenceClassification"),m(bt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(In,"id","transformers.modeling_tf_outputs.TFSequenceClassifierOutputWithPast"),m(In,"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"),m(In,"href","#transformers.modeling_tf_outputs.TFSequenceClassifierOutputWithPast"),m(Lo,"class","relative group"),m(Oo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Sn,"id","transformers.TFGPT2Tokenizer"),m(Sn,"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"),m(Sn,"href","#transformers.TFGPT2Tokenizer"),m(Ho,"class","relative group"),m(Wn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(to,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(oo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(tt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Rn,"id","transformers.FlaxGPT2Model"),m(Rn,"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"),m(Rn,"href","#transformers.FlaxGPT2Model"),m(Io,"class","relative group"),m(ki,"href","/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel"),m(br,"href","https://flax.readthedocs.io/en/latest/_autosummary/flax.nn.module.html"),m(br,"rel","nofollow"),m(yr,"href","https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit"),m(yr,"rel","nofollow"),m(vr,"href","https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation"),m(vr,"rel","nofollow"),m(kr,"href","https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap"),m(kr,"rel","nofollow"),m(wr,"href","https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap"),m(wr,"rel","nofollow"),m(Ht,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ke,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Jn,"id","transformers.FlaxGPT2LMHeadModel"),m(Jn,"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"),m(Jn,"href","#transformers.FlaxGPT2LMHeadModel"),m(Wo,"class","relative group"),m(wi,"href","/docs/transformers/main/en/main_classes/model#transformers.FlaxPreTrainedModel"),m(zr,"href","https://flax.readthedocs.io/en/latest/_autosummary/flax.nn.module.html"),m(zr,"rel","nofollow"),m(Fr,"href","https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit"),m(Fr,"rel","nofollow"),m(Er,"href","https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation"),m(Er,"rel","nofollow"),m(jr,"href","https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap"),m(jr,"rel","nofollow"),m(qr,"href","https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap"),m(qr,"rel","nofollow"),m(Nt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ve,"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,T){e(document.head,d),g(o,b,T),g(o,f,T),e(f,u),e(u,_),w(l,_,null),e(f,c),e(f,z),e(z,ae),g(o,K,T),g(o,H,T),e(H,J),e(J,re),w(G,re,null),e(H,xe),e(H,V),e(V,Ge),g(o,ke,T),g(o,S,T),e(S,ze),e(S,de),e(de,X),e(S,Fe),g(o,we,T),g(o,B,T),e(B,Ee),g(o,$e,T),g(o,R,T),e(R,fe),e(fe,je),g(o,le,T),g(o,j,T),e(j,C),g(o,Pe,T),g(o,N,T),e(N,ge),e(ge,qe),e(N,Y),e(N,ce),e(ce,Ce),e(ce,q),e(q,Ae),e(ce,Q),e(N,De),e(N,D),e(D,Z),e(D,_e),e(_e,Le),e(D,W),e(D,Te),e(Te,ee),e(D,Oe),e(D,ie),e(ie,A),e(D,He),e(D,L),e(L,Ne),e(D,Ie),e(D,y),e(y,F),e(D,at),e(D,ne),e(ne,rt),e(D,it),e(D,E),e(E,lt),e(D,dt),e(D,Je),e(Je,ct),e(D,pt),e(N,U),e(N,I),e(I,ht),e(I,Xe),e(Xe,te),e(I,ut),e(I,Ye),e(Ye,Se),e(I,mt),e(I,oe),e(oe,ft),e(I,Qp),g(o,lc,T),g(o,co,T),e(co,ms),e(ms,Zp),e(co,eh),e(co,Ii),e(Ii,th),e(co,oh),g(o,dc,T),g(o,Xt,T),e(Xt,nh),e(Xt,fs),e(fs,sh),e(Xt,ah),e(Xt,gs),e(gs,rh),e(Xt,ih),g(o,cc,T),g(o,po,T),e(po,Ko),e(Ko,Si),w(_s,Si,null),e(po,lh),e(po,Wi),e(Wi,dh),g(o,pc,T),g(o,Sr,T),e(Sr,ch),g(o,hc,T),w(Ts,o,T),g(o,uc,T),g(o,se,T),e(se,bs),e(bs,ph),e(bs,ys),e(ys,hh),e(bs,uh),e(se,mh),e(se,vs),e(vs,fh),e(vs,ks),e(ks,gh),e(vs,_h),e(se,Th),e(se,ws),e(ws,bh),e(ws,$s),e($s,yh),e(ws,vh),e(se,kh),e(se,Ps),e(Ps,wh),e(Ps,Ms),e(Ms,$h),e(Ps,Ph),e(se,Mh),e(se,xs),e(xs,xh),e(xs,Gs),e(Gs,Gh),e(xs,zh),e(se,Fh),e(se,zs),e(zs,Eh),e(zs,Fs),e(Fs,jh),e(zs,qh),e(se,Ch),e(se,Es),e(Es,Ah),e(Es,js),e(js,Dh),e(Es,Lh),e(se,Oh),e(se,Wr),e(Wr,qs),e(qs,Hh),e(Wr,Nh),e(se,Ih),e(se,zt),e(zt,Ur),e(Ur,Sh),e(zt,Wh),e(zt,Cs),e(Cs,Uh),e(zt,Bh),e(zt,As),e(As,Rh),e(zt,Kh),e(zt,Ds),e(Ds,Vh),e(zt,Jh),e(se,Xh),e(se,Yt),e(Yt,Br),e(Br,Yh),e(Yt,Qh),e(Yt,Ls),e(Ls,Zh),e(Yt,eu),e(Yt,Os),e(Os,tu),e(Yt,ou),e(se,nu),e(se,Qt),e(Qt,Rr),e(Rr,su),e(Qt,au),e(Qt,Hs),e(Hs,ru),e(Qt,iu),e(Qt,Ns),e(Ns,lu),e(Qt,du),g(o,mc,T),g(o,ho,T),e(ho,Vo),e(Vo,Ui),w(Is,Ui,null),e(ho,cu),e(ho,Bi),e(Bi,pu),g(o,fc,T),g(o,Mt,T),w(Ss,Mt,null),e(Mt,hu),e(Mt,Bt),e(Bt,uu),e(Bt,Kr),e(Kr,mu),e(Bt,fu),e(Bt,Vr),e(Vr,gu),e(Bt,_u),e(Bt,Ws),e(Ws,Tu),e(Bt,bu),e(Mt,yu),e(Mt,uo),e(uo,vu),e(uo,Jr),e(Jr,ku),e(uo,wu),e(uo,Xr),e(Xr,$u),e(uo,Pu),e(Mt,Mu),w(Jo,Mt,null),g(o,gc,T),g(o,mo,T),e(mo,Xo),e(Xo,Ri),w(Us,Ri,null),e(mo,xu),e(mo,Ki),e(Ki,Gu),g(o,_c,T),g(o,be,T),w(Bs,be,null),e(be,zu),e(be,Vi),e(Vi,Fu),e(be,Eu),e(be,Ji),e(Ji,ju),e(be,qu),w(Yo,be,null),e(be,Cu),e(be,Rs),e(Rs,Au),e(Rs,Xi),e(Xi,Du),e(Rs,Lu),e(be,Ou),w(Qo,be,null),e(be,Hu),e(be,Ks),e(Ks,Nu),e(Ks,Yr),e(Yr,Iu),e(Ks,Su),e(be,Wu),e(be,Qr),w(Vs,Qr,null),g(o,Tc,T),g(o,fo,T),e(fo,Zo),e(Zo,Yi),w(Js,Yi,null),e(fo,Uu),e(fo,Qi),e(Qi,Bu),g(o,bc,T),g(o,We,T),w(Xs,We,null),e(We,Ru),e(We,Ys),e(Ys,Ku),e(Ys,Zi),e(Zi,Vu),e(Ys,Ju),e(We,Xu),e(We,el),e(el,Yu),e(We,Qu),w(en,We,null),e(We,Zu),e(We,Qs),e(Qs,em),e(Qs,tl),e(tl,tm),e(Qs,om),e(We,nm),w(tn,We,null),e(We,sm),e(We,Zs),e(Zs,am),e(Zs,Zr),e(Zr,rm),e(Zs,im),g(o,yc,T),g(o,go,T),e(go,on),e(on,ol),w(ea,ol,null),e(go,lm),e(go,nl),e(nl,dm),g(o,vc,T),g(o,_o,T),w(ta,_o,null),e(_o,cm),e(_o,sl),e(sl,pm),g(o,kc,T),g(o,To,T),w(oa,To,null),e(To,hm),e(To,al),e(al,um),g(o,wc,T),g(o,bo,T),e(bo,nn),e(nn,rl),w(na,rl,null),e(bo,mm),e(bo,il),e(il,fm),g(o,$c,T),g(o,Ue,T),w(sa,Ue,null),e(Ue,gm),e(Ue,ll),e(ll,_m),e(Ue,Tm),e(Ue,aa),e(aa,bm),e(aa,ei),e(ei,ym),e(aa,vm),e(Ue,km),e(Ue,ra),e(ra,wm),e(ra,ia),e(ia,$m),e(ra,Pm),e(Ue,Mm),e(Ue,Ft),w(la,Ft,null),e(Ft,xm),e(Ft,yo),e(yo,Gm),e(yo,ti),e(ti,zm),e(yo,Fm),e(yo,dl),e(dl,Em),e(yo,jm),e(Ft,qm),w(sn,Ft,null),e(Ft,Cm),w(an,Ft,null),e(Ue,Am),e(Ue,Et),w(da,Et,null),e(Et,Dm),e(Et,cl),e(cl,Lm),e(Et,Om),e(Et,pl),e(pl,Hm),e(Et,Nm),w(rn,Et,null),e(Ue,Im),e(Ue,Zt),w(ca,Zt,null),e(Zt,Sm),e(Zt,hl),e(hl,Wm),e(Zt,Um),w(ln,Zt,null),g(o,Pc,T),g(o,vo,T),e(vo,dn),e(dn,ul),w(pa,ul,null),e(vo,Bm),e(vo,ml),e(ml,Rm),g(o,Mc,T),g(o,Be,T),w(ha,Be,null),e(Be,Km),e(Be,fl),e(fl,Vm),e(Be,Jm),e(Be,ua),e(ua,Xm),e(ua,oi),e(oi,Ym),e(ua,Qm),e(Be,Zm),e(Be,ma),e(ma,ef),e(ma,fa),e(fa,tf),e(ma,of),e(Be,nf),e(Be,jt),w(ga,jt,null),e(jt,sf),e(jt,ko),e(ko,af),e(ko,ni),e(ni,rf),e(ko,lf),e(ko,gl),e(gl,df),e(ko,cf),e(jt,pf),w(cn,jt,null),e(jt,hf),w(pn,jt,null),e(Be,uf),e(Be,qt),w(_a,qt,null),e(qt,mf),e(qt,_l),e(_l,ff),e(qt,gf),e(qt,Tl),e(Tl,_f),e(qt,Tf),w(hn,qt,null),e(Be,bf),e(Be,eo),w(Ta,eo,null),e(eo,yf),e(eo,bl),e(bl,vf),e(eo,kf),w(un,eo,null),g(o,xc,T),g(o,wo,T),e(wo,mn),e(mn,yl),w(ba,yl,null),e(wo,wf),e(wo,vl),e(vl,$f),g(o,Gc,T),g(o,gt,T),w(ya,gt,null),e(gt,Pf),e(gt,kl),e(kl,Mf),e(gt,xf),e(gt,va),e(va,Gf),e(va,si),e(si,zf),e(va,Ff),e(gt,Ef),e(gt,ka),e(ka,jf),e(ka,wa),e(wa,qf),e(ka,Cf),e(gt,Af),e(gt,Ct),w($a,Ct,null),e(Ct,Df),e(Ct,$o),e($o,Lf),e($o,ai),e(ai,Of),e($o,Hf),e($o,wl),e(wl,Nf),e($o,If),e(Ct,Sf),w(fn,Ct,null),e(Ct,Wf),w(gn,Ct,null),g(o,zc,T),g(o,Po,T),e(Po,_n),e(_n,$l),w(Pa,$l,null),e(Po,Uf),e(Po,Pl),e(Pl,Bf),g(o,Fc,T),g(o,Re,T),w(Ma,Re,null),e(Re,Rf),e(Re,Ml),e(Ml,Kf),e(Re,Vf),e(Re,ri),e(ri,ii),e(ii,Jf),e(ri,Xf),e(Re,Yf),e(Re,xt),e(xt,Qf),e(xt,xl),e(xl,Zf),e(xt,eg),e(xt,Gl),e(Gl,tg),e(xt,og),e(xt,zl),e(zl,ng),e(xt,sg),e(xt,Fl),e(Fl,ag),e(xt,rg),e(Re,ig),e(Re,xa),e(xa,lg),e(xa,li),e(li,dg),e(xa,cg),e(Re,pg),e(Re,Ga),e(Ga,hg),e(Ga,za),e(za,ug),e(Ga,mg),e(Re,fg),e(Re,Tt),w(Fa,Tt,null),e(Tt,gg),e(Tt,Mo),e(Mo,_g),e(Mo,di),e(di,Tg),e(Mo,bg),e(Mo,El),e(El,yg),e(Mo,vg),e(Tt,kg),w(Tn,Tt,null),e(Tt,wg),w(bn,Tt,null),e(Tt,$g),w(yn,Tt,null),g(o,Ec,T),g(o,xo,T),e(xo,vn),e(vn,jl),w(Ea,jl,null),e(xo,Pg),e(xo,ql),e(ql,Mg),g(o,jc,T),g(o,_t,T),w(ja,_t,null),e(_t,xg),e(_t,Cl),e(Cl,Gg),e(_t,zg),e(_t,qa),e(qa,Fg),e(qa,ci),e(ci,Eg),e(qa,jg),e(_t,qg),e(_t,Ca),e(Ca,Cg),e(Ca,Aa),e(Aa,Ag),e(Ca,Dg),e(_t,Lg),e(_t,At),w(Da,At,null),e(At,Og),e(At,Go),e(Go,Hg),e(Go,pi),e(pi,Ng),e(Go,Ig),e(Go,Al),e(Al,Sg),e(Go,Wg),e(At,Ug),w(kn,At,null),e(At,Bg),w(wn,At,null),g(o,qc,T),g(o,zo,T),e(zo,$n),e($n,Dl),w(La,Dl,null),e(zo,Rg),e(zo,Ll),e(Ll,Kg),g(o,Cc,T),g(o,Qe,T),w(Oa,Qe,null),e(Qe,Vg),e(Qe,Ol),e(Ol,Jg),e(Qe,Xg),e(Qe,Ha),e(Ha,Yg),e(Ha,hi),e(hi,Qg),e(Ha,Zg),e(Qe,e_),e(Qe,Na),e(Na,t_),e(Na,Ia),e(Ia,o_),e(Na,n_),e(Qe,s_),w(Pn,Qe,null),e(Qe,a_),e(Qe,Dt),w(Sa,Dt,null),e(Dt,r_),e(Dt,Fo),e(Fo,i_),e(Fo,ui),e(ui,l_),e(Fo,d_),e(Fo,Hl),e(Hl,c_),e(Fo,p_),e(Dt,h_),w(Mn,Dt,null),e(Dt,u_),w(xn,Dt,null),g(o,Ac,T),g(o,Eo,T),e(Eo,Gn),e(Gn,Nl),w(Wa,Nl,null),e(Eo,m_),e(Eo,Il),e(Il,f_),g(o,Dc,T),g(o,Ze,T),w(Ua,Ze,null),e(Ze,g_),e(Ze,Sl),e(Sl,__),e(Ze,T_),e(Ze,Ba),e(Ba,b_),e(Ba,mi),e(mi,y_),e(Ba,v_),e(Ze,k_),e(Ze,Ra),e(Ra,w_),e(Ra,Ka),e(Ka,$_),e(Ra,P_),e(Ze,M_),w(zn,Ze,null),e(Ze,x_),e(Ze,Lt),w(Va,Lt,null),e(Lt,G_),e(Lt,jo),e(jo,z_),e(jo,fi),e(fi,F_),e(jo,E_),e(jo,Wl),e(Wl,j_),e(jo,q_),e(Lt,C_),w(Fn,Lt,null),e(Lt,A_),w(En,Lt,null),g(o,Lc,T),g(o,qo,T),e(qo,jn),e(jn,Ul),w(Ja,Ul,null),e(qo,D_),e(qo,Bl),e(Bl,L_),g(o,Oc,T),g(o,et,T),w(Xa,et,null),e(et,O_),e(et,Rl),e(Rl,H_),e(et,N_),e(et,Ya),e(Ya,I_),e(Ya,gi),e(gi,S_),e(Ya,W_),e(et,U_),e(et,Qa),e(Qa,B_),e(Qa,Za),e(Za,R_),e(Qa,K_),e(et,V_),w(qn,et,null),e(et,J_),e(et,Ot),w(er,Ot,null),e(Ot,X_),e(Ot,Co),e(Co,Y_),e(Co,_i),e(_i,Q_),e(Co,Z_),e(Co,Kl),e(Kl,eT),e(Co,tT),e(Ot,oT),w(Cn,Ot,null),e(Ot,nT),w(An,Ot,null),g(o,Hc,T),g(o,Ao,T),e(Ao,Dn),e(Dn,Vl),w(tr,Vl,null),e(Ao,sT),e(Ao,Jl),e(Jl,aT),g(o,Nc,T),g(o,ye,T),w(or,ye,null),e(ye,rT),e(ye,Xl),e(Xl,iT),e(ye,lT),e(ye,Ti),e(Ti,bi),e(bi,dT),e(Ti,cT),e(ye,pT),e(ye,Gt),e(Gt,hT),e(Gt,Yl),e(Yl,uT),e(Gt,mT),e(Gt,Ql),e(Ql,fT),e(Gt,gT),e(Gt,Zl),e(Zl,_T),e(Gt,TT),e(Gt,ed),e(ed,bT),e(Gt,yT),e(ye,vT),e(ye,nr),e(nr,kT),e(nr,yi),e(yi,wT),e(nr,$T),e(ye,PT),e(ye,sr),e(sr,MT),e(sr,ar),e(ar,xT),e(sr,GT),e(ye,zT),w(Ln,ye,null),e(ye,FT),e(ye,bt),w(rr,bt,null),e(bt,ET),e(bt,Do),e(Do,jT),e(Do,vi),e(vi,qT),e(Do,CT),e(Do,td),e(td,AT),e(Do,DT),e(bt,LT),w(On,bt,null),e(bt,OT),w(Hn,bt,null),e(bt,HT),w(Nn,bt,null),g(o,Ic,T),g(o,Lo,T),e(Lo,In),e(In,od),w(ir,od,null),e(Lo,NT),e(Lo,nd),e(nd,IT),g(o,Sc,T),g(o,Oo,T),w(lr,Oo,null),e(Oo,ST),e(Oo,sd),e(sd,WT),g(o,Wc,T),g(o,Ho,T),e(Ho,Sn),e(Sn,ad),w(dr,ad,null),e(Ho,UT),e(Ho,rd),e(rd,BT),g(o,Uc,T),g(o,tt,T),w(cr,tt,null),e(tt,RT),e(tt,No),e(No,KT),e(No,id),e(id,VT),e(No,JT),e(No,ld),e(ld,XT),e(No,YT),e(tt,QT),e(tt,pr),e(pr,ZT),e(pr,dd),e(dd,e2),e(pr,t2),e(tt,o2),e(tt,Wn),w(hr,Wn,null),e(Wn,n2),e(Wn,cd),e(cd,s2),e(tt,a2),e(tt,to),w(ur,to,null),e(to,r2),e(to,pd),e(pd,i2),e(to,l2),w(Un,to,null),e(tt,d2),e(tt,oo),w(mr,oo,null),e(oo,c2),e(oo,hd),e(hd,p2),e(oo,h2),w(Bn,oo,null),g(o,Bc,T),g(o,Io,T),e(Io,Rn),e(Rn,ud),w(fr,ud,null),e(Io,u2),e(Io,md),e(md,m2),g(o,Rc,T),g(o,Ke,T),w(gr,Ke,null),e(Ke,f2),e(Ke,fd),e(fd,g2),e(Ke,_2),e(Ke,_r),e(_r,T2),e(_r,ki),e(ki,b2),e(_r,y2),e(Ke,v2),e(Ke,Tr),e(Tr,k2),e(Tr,br),e(br,w2),e(Tr,$2),e(Ke,P2),e(Ke,gd),e(gd,M2),e(Ke,x2),e(Ke,Rt),e(Rt,_d),e(_d,yr),e(yr,G2),e(Rt,z2),e(Rt,Td),e(Td,vr),e(vr,F2),e(Rt,E2),e(Rt,bd),e(bd,kr),e(kr,j2),e(Rt,q2),e(Rt,yd),e(yd,wr),e(wr,C2),e(Ke,A2),e(Ke,Ht),w($r,Ht,null),e(Ht,D2),e(Ht,So),e(So,L2),e(So,vd),e(vd,O2),e(So,H2),e(So,kd),e(kd,N2),e(So,I2),e(Ht,S2),w(Kn,Ht,null),e(Ht,W2),w(Vn,Ht,null),g(o,Kc,T),g(o,Wo,T),e(Wo,Jn),e(Jn,wd),w(Pr,wd,null),e(Wo,U2),e(Wo,$d),e($d,B2),g(o,Vc,T),g(o,Ve,T),w(Mr,Ve,null),e(Ve,R2),e(Ve,Pd),e(Pd,K2),e(Ve,V2),e(Ve,xr),e(xr,J2),e(xr,wi),e(wi,X2),e(xr,Y2),e(Ve,Q2),e(Ve,Gr),e(Gr,Z2),e(Gr,zr),e(zr,eb),e(Gr,tb),e(Ve,ob),e(Ve,Md),e(Md,nb),e(Ve,sb),e(Ve,Kt),e(Kt,xd),e(xd,Fr),e(Fr,ab),e(Kt,rb),e(Kt,Gd),e(Gd,Er),e(Er,ib),e(Kt,lb),e(Kt,zd),e(zd,jr),e(jr,db),e(Kt,cb),e(Kt,Fd),e(Fd,qr),e(qr,pb),e(Ve,hb),e(Ve,Nt),w(Cr,Nt,null),e(Nt,ub),e(Nt,Uo),e(Uo,mb),e(Uo,Ed),e(Ed,fb),e(Uo,gb),e(Uo,jd),e(jd,_b),e(Uo,Tb),e(Nt,bb),w(Xn,Nt,null),e(Nt,yb),w(Yn,Nt,null),Jc=!0},p(o,[T]){const Ar={};T&2&&(Ar.$$scope={dirty:T,ctx:o}),Jo.$set(Ar);const qd={};T&2&&(qd.$$scope={dirty:T,ctx:o}),Yo.$set(qd);const Cd={};T&2&&(Cd.$$scope={dirty:T,ctx:o}),Qo.$set(Cd);const Ad={};T&2&&(Ad.$$scope={dirty:T,ctx:o}),en.$set(Ad);const Dr={};T&2&&(Dr.$$scope={dirty:T,ctx:o}),tn.$set(Dr);const Dd={};T&2&&(Dd.$$scope={dirty:T,ctx:o}),sn.$set(Dd);const Ld={};T&2&&(Ld.$$scope={dirty:T,ctx:o}),an.$set(Ld);const Od={};T&2&&(Od.$$scope={dirty:T,ctx:o}),rn.$set(Od);const Lr={};T&2&&(Lr.$$scope={dirty:T,ctx:o}),ln.$set(Lr);const Hd={};T&2&&(Hd.$$scope={dirty:T,ctx:o}),cn.$set(Hd);const Nd={};T&2&&(Nd.$$scope={dirty:T,ctx:o}),pn.$set(Nd);const Id={};T&2&&(Id.$$scope={dirty:T,ctx:o}),hn.$set(Id);const Sd={};T&2&&(Sd.$$scope={dirty:T,ctx:o}),un.$set(Sd);const Wd={};T&2&&(Wd.$$scope={dirty:T,ctx:o}),fn.$set(Wd);const Vt={};T&2&&(Vt.$$scope={dirty:T,ctx:o}),gn.$set(Vt);const Ud={};T&2&&(Ud.$$scope={dirty:T,ctx:o}),Tn.$set(Ud);const Or={};T&2&&(Or.$$scope={dirty:T,ctx:o}),bn.$set(Or);const Bd={};T&2&&(Bd.$$scope={dirty:T,ctx:o}),yn.$set(Bd);const ve={};T&2&&(ve.$$scope={dirty:T,ctx:o}),kn.$set(ve);const Rd={};T&2&&(Rd.$$scope={dirty:T,ctx:o}),wn.$set(Rd);const Kd={};T&2&&(Kd.$$scope={dirty:T,ctx:o}),Pn.$set(Kd);const Vd={};T&2&&(Vd.$$scope={dirty:T,ctx:o}),Mn.$set(Vd);const Jd={};T&2&&(Jd.$$scope={dirty:T,ctx:o}),xn.$set(Jd);const Xd={};T&2&&(Xd.$$scope={dirty:T,ctx:o}),zn.$set(Xd);const Yd={};T&2&&(Yd.$$scope={dirty:T,ctx:o}),Fn.$set(Yd);const Qd={};T&2&&(Qd.$$scope={dirty:T,ctx:o}),En.$set(Qd);const Zd={};T&2&&(Zd.$$scope={dirty:T,ctx:o}),qn.$set(Zd);const Jt={};T&2&&(Jt.$$scope={dirty:T,ctx:o}),Cn.$set(Jt);const ec={};T&2&&(ec.$$scope={dirty:T,ctx:o}),An.$set(ec);const tc={};T&2&&(tc.$$scope={dirty:T,ctx:o}),Ln.$set(tc);const oc={};T&2&&(oc.$$scope={dirty:T,ctx:o}),On.$set(oc);const Qn={};T&2&&(Qn.$$scope={dirty:T,ctx:o}),Hn.$set(Qn);const nc={};T&2&&(nc.$$scope={dirty:T,ctx:o}),Nn.$set(nc);const sc={};T&2&&(sc.$$scope={dirty:T,ctx:o}),Un.$set(sc);const Bo={};T&2&&(Bo.$$scope={dirty:T,ctx:o}),Bn.$set(Bo);const ac={};T&2&&(ac.$$scope={dirty:T,ctx:o}),Kn.$set(ac);const rc={};T&2&&(rc.$$scope={dirty:T,ctx:o}),Vn.$set(rc);const Hr={};T&2&&(Hr.$$scope={dirty:T,ctx:o}),Xn.$set(Hr);const ic={};T&2&&(ic.$$scope={dirty:T,ctx:o}),Yn.$set(ic)},i(o){Jc||($(l.$$.fragment,o),$(G.$$.fragment,o),$(_s.$$.fragment,o),$(Ts.$$.fragment,o),$(Is.$$.fragment,o),$(Ss.$$.fragment,o),$(Jo.$$.fragment,o),$(Us.$$.fragment,o),$(Bs.$$.fragment,o),$(Yo.$$.fragment,o),$(Qo.$$.fragment,o),$(Vs.$$.fragment,o),$(Js.$$.fragment,o),$(Xs.$$.fragment,o),$(en.$$.fragment,o),$(tn.$$.fragment,o),$(ea.$$.fragment,o),$(ta.$$.fragment,o),$(oa.$$.fragment,o),$(na.$$.fragment,o),$(sa.$$.fragment,o),$(la.$$.fragment,o),$(sn.$$.fragment,o),$(an.$$.fragment,o),$(da.$$.fragment,o),$(rn.$$.fragment,o),$(ca.$$.fragment,o),$(ln.$$.fragment,o),$(pa.$$.fragment,o),$(ha.$$.fragment,o),$(ga.$$.fragment,o),$(cn.$$.fragment,o),$(pn.$$.fragment,o),$(_a.$$.fragment,o),$(hn.$$.fragment,o),$(Ta.$$.fragment,o),$(un.$$.fragment,o),$(ba.$$.fragment,o),$(ya.$$.fragment,o),$($a.$$.fragment,o),$(fn.$$.fragment,o),$(gn.$$.fragment,o),$(Pa.$$.fragment,o),$(Ma.$$.fragment,o),$(Fa.$$.fragment,o),$(Tn.$$.fragment,o),$(bn.$$.fragment,o),$(yn.$$.fragment,o),$(Ea.$$.fragment,o),$(ja.$$.fragment,o),$(Da.$$.fragment,o),$(kn.$$.fragment,o),$(wn.$$.fragment,o),$(La.$$.fragment,o),$(Oa.$$.fragment,o),$(Pn.$$.fragment,o),$(Sa.$$.fragment,o),$(Mn.$$.fragment,o),$(xn.$$.fragment,o),$(Wa.$$.fragment,o),$(Ua.$$.fragment,o),$(zn.$$.fragment,o),$(Va.$$.fragment,o),$(Fn.$$.fragment,o),$(En.$$.fragment,o),$(Ja.$$.fragment,o),$(Xa.$$.fragment,o),$(qn.$$.fragment,o),$(er.$$.fragment,o),$(Cn.$$.fragment,o),$(An.$$.fragment,o),$(tr.$$.fragment,o),$(or.$$.fragment,o),$(Ln.$$.fragment,o),$(rr.$$.fragment,o),$(On.$$.fragment,o),$(Hn.$$.fragment,o),$(Nn.$$.fragment,o),$(ir.$$.fragment,o),$(lr.$$.fragment,o),$(dr.$$.fragment,o),$(cr.$$.fragment,o),$(hr.$$.fragment,o),$(ur.$$.fragment,o),$(Un.$$.fragment,o),$(mr.$$.fragment,o),$(Bn.$$.fragment,o),$(fr.$$.fragment,o),$(gr.$$.fragment,o),$($r.$$.fragment,o),$(Kn.$$.fragment,o),$(Vn.$$.fragment,o),$(Pr.$$.fragment,o),$(Mr.$$.fragment,o),$(Cr.$$.fragment,o),$(Xn.$$.fragment,o),$(Yn.$$.fragment,o),Jc=!0)},o(o){P(l.$$.fragment,o),P(G.$$.fragment,o),P(_s.$$.fragment,o),P(Ts.$$.fragment,o),P(Is.$$.fragment,o),P(Ss.$$.fragment,o),P(Jo.$$.fragment,o),P(Us.$$.fragment,o),P(Bs.$$.fragment,o),P(Yo.$$.fragment,o),P(Qo.$$.fragment,o),P(Vs.$$.fragment,o),P(Js.$$.fragment,o),P(Xs.$$.fragment,o),P(en.$$.fragment,o),P(tn.$$.fragment,o),P(ea.$$.fragment,o),P(ta.$$.fragment,o),P(oa.$$.fragment,o),P(na.$$.fragment,o),P(sa.$$.fragment,o),P(la.$$.fragment,o),P(sn.$$.fragment,o),P(an.$$.fragment,o),P(da.$$.fragment,o),P(rn.$$.fragment,o),P(ca.$$.fragment,o),P(ln.$$.fragment,o),P(pa.$$.fragment,o),P(ha.$$.fragment,o),P(ga.$$.fragment,o),P(cn.$$.fragment,o),P(pn.$$.fragment,o),P(_a.$$.fragment,o),P(hn.$$.fragment,o),P(Ta.$$.fragment,o),P(un.$$.fragment,o),P(ba.$$.fragment,o),P(ya.$$.fragment,o),P($a.$$.fragment,o),P(fn.$$.fragment,o),P(gn.$$.fragment,o),P(Pa.$$.fragment,o),P(Ma.$$.fragment,o),P(Fa.$$.fragment,o),P(Tn.$$.fragment,o),P(bn.$$.fragment,o),P(yn.$$.fragment,o),P(Ea.$$.fragment,o),P(ja.$$.fragment,o),P(Da.$$.fragment,o),P(kn.$$.fragment,o),P(wn.$$.fragment,o),P(La.$$.fragment,o),P(Oa.$$.fragment,o),P(Pn.$$.fragment,o),P(Sa.$$.fragment,o),P(Mn.$$.fragment,o),P(xn.$$.fragment,o),P(Wa.$$.fragment,o),P(Ua.$$.fragment,o),P(zn.$$.fragment,o),P(Va.$$.fragment,o),P(Fn.$$.fragment,o),P(En.$$.fragment,o),P(Ja.$$.fragment,o),P(Xa.$$.fragment,o),P(qn.$$.fragment,o),P(er.$$.fragment,o),P(Cn.$$.fragment,o),P(An.$$.fragment,o),P(tr.$$.fragment,o),P(or.$$.fragment,o),P(Ln.$$.fragment,o),P(rr.$$.fragment,o),P(On.$$.fragment,o),P(Hn.$$.fragment,o),P(Nn.$$.fragment,o),P(ir.$$.fragment,o),P(lr.$$.fragment,o),P(dr.$$.fragment,o),P(cr.$$.fragment,o),P(hr.$$.fragment,o),P(ur.$$.fragment,o),P(Un.$$.fragment,o),P(mr.$$.fragment,o),P(Bn.$$.fragment,o),P(fr.$$.fragment,o),P(gr.$$.fragment,o),P($r.$$.fragment,o),P(Kn.$$.fragment,o),P(Vn.$$.fragment,o),P(Pr.$$.fragment,o),P(Mr.$$.fragment,o),P(Cr.$$.fragment,o),P(Xn.$$.fragment,o),P(Yn.$$.fragment,o),Jc=!1},d(o){t(d),o&&t(b),o&&t(f),M(l),o&&t(K),o&&t(H),M(G),o&&t(ke),o&&t(S),o&&t(we),o&&t(B),o&&t($e),o&&t(R),o&&t(le),o&&t(j),o&&t(Pe),o&&t(N),o&&t(lc),o&&t(co),o&&t(dc),o&&t(Xt),o&&t(cc),o&&t(po),M(_s),o&&t(pc),o&&t(Sr),o&&t(hc),M(Ts,o),o&&t(uc),o&&t(se),o&&t(mc),o&&t(ho),M(Is),o&&t(fc),o&&t(Mt),M(Ss),M(Jo),o&&t(gc),o&&t(mo),M(Us),o&&t(_c),o&&t(be),M(Bs),M(Yo),M(Qo),M(Vs),o&&t(Tc),o&&t(fo),M(Js),o&&t(bc),o&&t(We),M(Xs),M(en),M(tn),o&&t(yc),o&&t(go),M(ea),o&&t(vc),o&&t(_o),M(ta),o&&t(kc),o&&t(To),M(oa),o&&t(wc),o&&t(bo),M(na),o&&t($c),o&&t(Ue),M(sa),M(la),M(sn),M(an),M(da),M(rn),M(ca),M(ln),o&&t(Pc),o&&t(vo),M(pa),o&&t(Mc),o&&t(Be),M(ha),M(ga),M(cn),M(pn),M(_a),M(hn),M(Ta),M(un),o&&t(xc),o&&t(wo),M(ba),o&&t(Gc),o&&t(gt),M(ya),M($a),M(fn),M(gn),o&&t(zc),o&&t(Po),M(Pa),o&&t(Fc),o&&t(Re),M(Ma),M(Fa),M(Tn),M(bn),M(yn),o&&t(Ec),o&&t(xo),M(Ea),o&&t(jc),o&&t(_t),M(ja),M(Da),M(kn),M(wn),o&&t(qc),o&&t(zo),M(La),o&&t(Cc),o&&t(Qe),M(Oa),M(Pn),M(Sa),M(Mn),M(xn),o&&t(Ac),o&&t(Eo),M(Wa),o&&t(Dc),o&&t(Ze),M(Ua),M(zn),M(Va),M(Fn),M(En),o&&t(Lc),o&&t(qo),M(Ja),o&&t(Oc),o&&t(et),M(Xa),M(qn),M(er),M(Cn),M(An),o&&t(Hc),o&&t(Ao),M(tr),o&&t(Nc),o&&t(ye),M(or),M(Ln),M(rr),M(On),M(Hn),M(Nn),o&&t(Ic),o&&t(Lo),M(ir),o&&t(Sc),o&&t(Oo),M(lr),o&&t(Wc),o&&t(Ho),M(dr),o&&t(Uc),o&&t(tt),M(cr),M(hr),M(ur),M(Un),M(mr),M(Bn),o&&t(Bc),o&&t(Io),M(fr),o&&t(Rc),o&&t(Ke),M(gr),M($r),M(Kn),M(Vn),o&&t(Kc),o&&t(Wo),M(Pr),o&&t(Vc),o&&t(Ve),M(Mr),M(Cr),M(Xn),M(Yn)}}}const Ow={local:"openai-gpt2",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.GPT2Config",title:"GPT2Config"},{local:"transformers.GPT2Tokenizer",title:"GPT2Tokenizer"},{local:"transformers.GPT2TokenizerFast",title:"GPT2TokenizerFast"},{local:"transformers.models.gpt2.modeling_gpt2.GPT2DoubleHeadsModelOutput",title:"GPT2 specific outputs"},{local:"transformers.GPT2Model",title:"GPT2Model"},{local:"transformers.GPT2LMHeadModel",title:"GPT2LMHeadModel"},{local:"transformers.GPT2DoubleHeadsModel",title:"GPT2DoubleHeadsModel"},{local:"transformers.GPT2ForSequenceClassification",title:"GPT2ForSequenceClassification"},{local:"transformers.GPT2ForTokenClassification",title:"GPT2ForTokenClassification"},{local:"transformers.TFGPT2Model",title:"TFGPT2Model"},{local:"transformers.TFGPT2LMHeadModel",title:"TFGPT2LMHeadModel"},{local:"transformers.TFGPT2DoubleHeadsModel",title:"TFGPT2DoubleHeadsModel"},{local:"transformers.TFGPT2ForSequenceClassification",title:"TFGPT2ForSequenceClassification"},{local:"transformers.modeling_tf_outputs.TFSequenceClassifierOutputWithPast",title:"TFSequenceClassifierOutputWithPast"},{local:"transformers.TFGPT2Tokenizer",title:"TFGPT2Tokenizer"},{local:"transformers.FlaxGPT2Model",title:"FlaxGPT2Model"},{local:"transformers.FlaxGPT2LMHeadModel",title:"FlaxGPT2LMHeadModel"}],title:"OpenAI GPT2"};function Hw(x){return Xk(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Kw extends Rk{constructor(d){super();Kk(this,d,Hw,Lw,Vk,{})}}export{Kw as default,Ow as metadata};
