import{s as Zo,o as No,n as Be}from"../chunks/scheduler.9bc65507.js";import{S as Ho,i as So,g as d,s,r as u,A as Ro,h as l,f as o,c as a,j as U,u as f,x as m,k as L,l as Vo,y as i,a as r,v as g,d as _,t as T,w as b}from"../chunks/index.707bf1b6.js";import{T as Gt}from"../chunks/Tip.c2ecdbf4.js";import{D as R}from"../chunks/Docstring.17db21ae.js";import{C as Ye}from"../chunks/CodeBlock.54a9f38d.js";import{E as ro}from"../chunks/ExampleCodeBlock.4f515aa9.js";import{H}from"../chunks/Heading.342b1fa6.js";function Eo(M){let n,v="Example:",p,h,y;return h=new Ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdQVEJpZ0NvZGVDb25maWclMkMlMjBHUFRCaWdDb2RlTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwR1BUQmlnQ29kZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwR1BUQmlnQ29kZUNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBHUFRCaWdDb2RlTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPTBigCodeConfig, GPTBigCodeModel

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

<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 = GPTBigCodeModel(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`,wrap:!1}}),{c(){n=d("p"),n.textContent=v,p=s(),u(h.$$.fragment)},l(c){n=l(c,"P",{"data-svelte-h":!0}),m(n)!=="svelte-11lpom8"&&(n.textContent=v),p=a(c),f(h.$$.fragment,c)},m(c,k){r(c,n,k),r(c,p,k),g(h,c,k),y=!0},p:Be,i(c){y||(_(h.$$.fragment,c),y=!0)},o(c){T(h.$$.fragment,c),y=!1},d(c){c&&(o(n),o(p)),b(h,c)}}}function Oo(M){let n,v=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){n=d("p"),n.innerHTML=v},l(p){n=l(p,"P",{"data-svelte-h":!0}),m(n)!=="svelte-fincs2"&&(n.innerHTML=v)},m(p,h){r(p,n,h)},p:Be,d(p){p&&o(n)}}}function Ao(M){let n,v="Example:",p,h,y;return h=new Ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBHUFRCaWdDb2RlTW9kZWwlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmJpZ2NvZGUlMkZncHRfYmlnY29kZS1zYW50YWNvZGVyJTIyKSUwQW1vZGVsJTIwJTNEJTIwR1BUQmlnQ29kZU1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJiaWdjb2RlJTJGZ3B0X2JpZ2NvZGUtc2FudGFjb2RlciUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGU=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, GPTBigCodeModel
<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;bigcode/gpt_bigcode-santacoder&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTBigCodeModel.from_pretrained(<span class="hljs-string">&quot;bigcode/gpt_bigcode-santacoder&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`,wrap:!1}}),{c(){n=d("p"),n.textContent=v,p=s(),u(h.$$.fragment)},l(c){n=l(c,"P",{"data-svelte-h":!0}),m(n)!=="svelte-11lpom8"&&(n.textContent=v),p=a(c),f(h.$$.fragment,c)},m(c,k){r(c,n,k),r(c,p,k),g(h,c,k),y=!0},p:Be,i(c){y||(_(h.$$.fragment,c),y=!0)},o(c){T(h.$$.fragment,c),y=!1},d(c){c&&(o(n),o(p)),b(h,c)}}}function Do(M){let n,v=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){n=d("p"),n.innerHTML=v},l(p){n=l(p,"P",{"data-svelte-h":!0}),m(n)!=="svelte-fincs2"&&(n.innerHTML=v)},m(p,h){r(p,n,h)},p:Be,d(p){p&&o(n)}}}function Xo(M){let n,v="Example:",p,h,y;return h=new Ye({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMEdQVEJpZ0NvZGVGb3JDYXVzYWxMTSUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmJpZ2NvZGUlMkZncHRfYmlnY29kZS1zYW50YWNvZGVyJTIyKSUwQW1vZGVsJTIwJTNEJTIwR1BUQmlnQ29kZUZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJiaWdjb2RlJTJGZ3B0X2JpZ2NvZGUtc2FudGFjb2RlciUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzJTJDJTIwbGFiZWxzJTNEaW5wdXRzJTVCJTIyaW5wdXRfaWRzJTIyJTVEKSUwQWxvc3MlMjAlM0QlMjBvdXRwdXRzLmxvc3MlMEFsb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0cw==",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, GPTBigCodeForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;bigcode/gpt_bigcode-santacoder&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = GPTBigCodeForCausalLM.from_pretrained(<span class="hljs-string">&quot;bigcode/gpt_bigcode-santacoder&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`,wrap:!1}}),{c(){n=d("p"),n.textContent=v,p=s(),u(h.$$.fragment)},l(c){n=l(c,"P",{"data-svelte-h":!0}),m(n)!=="svelte-11lpom8"&&(n.textContent=v),p=a(c),f(h.$$.fragment,c)},m(c,k){r(c,n,k),r(c,p,k),g(h,c,k),y=!0},p:Be,i(c){y||(_(h.$$.fragment,c),y=!0)},o(c){T(h.$$.fragment,c),y=!1},d(c){c&&(o(n),o(p)),b(h,c)}}}function Qo(M){let n,v=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){n=d("p"),n.innerHTML=v},l(p){n=l(p,"P",{"data-svelte-h":!0}),m(n)!=="svelte-fincs2"&&(n.innerHTML=v)},m(p,h){r(p,n,h)},p:Be,d(p){p&&o(n)}}}function Yo(M){let n,v=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){n=d("p"),n.innerHTML=v},l(p){n=l(p,"P",{"data-svelte-h":!0}),m(n)!=="svelte-fincs2"&&(n.innerHTML=v)},m(p,h){r(p,n,h)},p:Be,d(p){p&&o(n)}}}function Ko(M){let n,v,p,h,y,c,k,Ke,K,io='The GPTBigCode model was proposed in <a href="https://arxiv.org/abs/2301.03988" rel="nofollow">SantaCoder: don’t reach for the stars!</a> by BigCode. The listed authors are: Loubna Ben Allal, Raymond Li, Denis Kocetkov, Chenghao Mou, Christopher Akiki, Carlos Munoz Ferrandis, Niklas Muennighoff, Mayank Mishra, Alex Gu, Manan Dey, Logesh Kumar Umapathi, Carolyn Jane Anderson, Yangtian Zi, Joel Lamy Poirier, Hailey Schoelkopf, Sergey Troshin, Dmitry Abulkhanov, Manuel Romero, Michael Lappert, Francesco De Toni, Bernardo García del Río, Qian Liu, Shamik Bose, Urvashi Bhattacharyya, Terry Yue Zhuo, Ian Yu, Paulo Villegas, Marco Zocca, Sourab Mangrulkar, David Lansky, Huu Nguyen, Danish Contractor, Luis Villa, Jia Li, Dzmitry Bahdanau, Yacine Jernite, Sean Hughes, Daniel Fried, Arjun Guha, Harm de Vries, Leandro von Werra.',et,ee,lo="The abstract from the paper is the following:",tt,te,co='<em>The BigCode project is an open-scientific collaboration working on the responsible development of large language models for code. This tech report describes the progress of the collaboration until December 2022, outlining the current state of the Personally Identifiable Information (PII) redaction pipeline, the experiments conducted to de-risk the model architecture, and the experiments investigating better preprocessing methods for the training data. We train 1.1B parameter models on the Java, JavaScript, and Python subsets of The Stack and evaluate them on the MultiPL-E text-to-code benchmark. We find that more aggressive filtering of near-duplicates can further boost performance and, surprisingly, that selecting files from repositories with 5+ GitHub stars deteriorates performance significantly. Our best model outperforms previous open-source multilingual code generation models (InCoder-6.7B and CodeGen-Multi-2.7B) in both left-to-right generation and infilling on the Java, JavaScript, and Python portions of MultiPL-E, despite being a substantially smaller model. All models are released under an OpenRAIL license at <a href="https://huggingface.co/bigcode" rel="nofollow">this https URL.</a></em>',ot,oe,po='The model is an optimized <a href="https://huggingface.co/docs/transformers/model_doc/gpt2" rel="nofollow">GPT2 model</a> with support for Multi-Query Attention.',nt,ne,st,se,mo="The main differences compared to GPT2.",at,ae,ho="<li>Added support for Multi-Query Attention.</li> <li>Use <code>gelu_pytorch_tanh</code> instead of classic <code>gelu</code>.</li> <li>Avoid unnecessary synchronizations (this has since been added to GPT2 in #20061, but wasn’t in the reference codebase).</li> <li>Use Linear layers instead of Conv1D (good speedup but makes the checkpoints incompatible).</li> <li>Merge <code>_attn</code> and <code>_upcast_and_reordered_attn</code>. Always merge the matmul with scaling. Rename <code>reorder_and_upcast_attn</code>-&gt;<code>attention_softmax_in_fp32</code></li> <li>Cache the attention mask value to avoid recreating it every time.</li> <li>Use jit to fuse the attention fp32 casting, masking, softmax, and scaling.</li> <li>Combine the attention and causal masks into a single one, pre-computed for the whole model instead of every layer.</li> <li>Merge the key and value caches into one (this changes the format of layer_past/ present, does it risk creating problems?)</li> <li>Use the memory layout (self.num_heads, 3, self.head_dim) instead of <code>(3, self.num_heads, self.head_dim)</code> for the QKV tensor with MHA. (prevents an overhead with the merged key and values, but makes the checkpoints incompatible with the original gpt2 model).</li>",rt,re,uo='You can read more about the optimizations in the <a href="https://github.com/huggingface/transformers/pull/22575" rel="nofollow">original pull request</a>',it,ie,dt,de,fo="First, make sure to install the latest version of Flash Attention 2 to include the sliding window attention feature.",lt,le,ct,ce,go="Make also sure that you have a hardware that is compatible with Flash-Attention 2. Read more about it in the official documentation of flash-attn repository. Make also sure to load your model in half-precision (e.g. `torch.float16“)",pt,pe,_o="To load and run a model using Flash Attention 2, refer to the snippet below:",mt,me,ht,he,ut,ue,To="Below is a expected speedup diagram that compares pure inference time between the native implementation in transformers using <code>bigcode/starcoder</code> checkpoint and the Flash Attention 2 version of the model using two different sequence lengths.",ft,V,bo='<img src="https://huggingface.co/datasets/ybelkada/documentation-images/resolve/main/starcoder-speedup.png"/>',gt,fe,_t,B,ge,Bt,xe,vo=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/gpt_bigcode#transformers.GPTBigCodeModel">GPTBigCodeModel</a>. It is used to instantiate a
GPTBigCode 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 GPTBigCode
<a href="https://huggingface.co/gpt_bigcode" rel="nofollow">gpt_bigcode</a> architecture.`,xt,ze,yo=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,zt,E,Tt,_e,bt,$,Te,Ft,Fe,ko="The bare GPT_BIGCODE Model transformer outputting raw hidden-states without any specific head on top.",It,Ie,Co=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,qt,qe,wo=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,Jt,F,be,jt,Je,Mo='The <a href="/docs/transformers/main/en/model_doc/gpt_bigcode#transformers.GPTBigCodeModel">GPTBigCodeModel</a> forward method, overrides the <code>__call__</code> special method.',Ut,O,Lt,A,vt,ve,yt,P,ye,Wt,je,$o=`The GPT_BIGCODE Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`,Zt,Ue,Po=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,Nt,Le,Go=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,Ht,I,ke,St,We,Bo='The <a href="/docs/transformers/main/en/model_doc/gpt_bigcode#transformers.GPTBigCodeForCausalLM">GPTBigCodeForCausalLM</a> forward method, overrides the <code>__call__</code> special method.',Rt,D,Vt,X,kt,Ce,Ct,C,we,Et,Ze,xo="The GPTBigCode Model transformer with a sequence classification head on top (linear layer).",Ot,Ne,zo=`<a href="/docs/transformers/main/en/model_doc/gpt_bigcode#transformers.GPTBigCodeForSequenceClassification">GPTBigCodeForSequenceClassification</a> uses the last token in order to do the classification, as other causal
models (e.g. GPT-1) do.`,At,He,Fo=`Since it does classification on the last token, it requires to know the position of the last token. If a
<code>pad_token_id</code> is defined in the configuration, it finds the last token that is not a padding token in each row. If
no <code>pad_token_id</code> is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when <code>inputs_embeds</code> are passed instead of <code>input_ids</code>, it does the same (take the last value in
each row of the batch).`,Dt,Se,Io=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,Xt,Re,qo=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,Qt,W,Me,Yt,Ve,Jo='The <a href="/docs/transformers/main/en/model_doc/gpt_bigcode#transformers.GPTBigCodeForSequenceClassification">GPTBigCodeForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',Kt,Q,wt,$e,Mt,G,Pe,eo,Ee,jo=`GPT_BIGCODE 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.`,to,Oe,Uo=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,oo,Ae,Lo=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,no,Z,Ge,so,De,Wo='The <a href="/docs/transformers/main/en/model_doc/gpt_bigcode#transformers.GPTBigCodeForTokenClassification">GPTBigCodeForTokenClassification</a> forward method, overrides the <code>__call__</code> special method.',ao,Y,$t,Qe,Pt;return y=new H({props:{title:"GPTBigCode",local:"gptbigcode",headingTag:"h1"}}),k=new H({props:{title:"Overview",local:"overview",headingTag:"h2"}}),ne=new H({props:{title:"Implementation details",local:"implementation-details",headingTag:"h2"}}),ie=new H({props:{title:"Combining Starcoder and Flash Attention 2",local:"combining-starcoder-and-flash-attention-2",headingTag:"h2"}}),le=new Ye({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1VJTIwZmxhc2gtYXR0biUyMC0tbm8tYnVpbGQtaXNvbGF0aW9u",highlighted:"pip install -U flash-attn --no-build-isolation",wrap:!1}}),me=new Ye({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMkMlMjBBdXRvVG9rZW5pemVyJTBBZGV2aWNlJTIwJTNEJTIwJTIyY3VkYSUyMiUyMCUyMyUyMHRoZSUyMGRldmljZSUyMHRvJTIwbG9hZCUyMHRoZSUyMG1vZGVsJTIwb250byUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmJpZ2NvZGUlMkZncHRfYmlnY29kZS1zYW50YWNvZGVyJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwYXR0bl9pbXBsZW1lbnRhdGlvbiUzRCUyMmZsYXNoX2F0dGVudGlvbl8yJTIyKSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmJpZ2NvZGUlMkZncHRfYmlnY29kZS1zYW50YWNvZGVyJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMmRlZiUyMGhlbGxvX3dvcmxkKCklM0ElMjIlMEElMEFtb2RlbF9pbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTVCcHJvbXB0JTVEJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikudG8oZGV2aWNlKSUwQW1vZGVsLnRvKGRldmljZSklMEElMEFnZW5lcmF0ZWRfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoKiptb2RlbF9pbnB1dHMlMkMlMjBtYXhfbmV3X3Rva2VucyUzRDMwJTJDJTIwZG9fc2FtcGxlJTNERmFsc2UpJTBBdG9rZW5pemVyLmJhdGNoX2RlY29kZShnZW5lcmF0ZWRfaWRzKSU1QjAlNUQ=",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> AutoModelForCausalLM, AutoTokenizer
<span class="hljs-meta">&gt;&gt;&gt; </span>device = <span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-comment"># the device to load the model onto</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;bigcode/gpt_bigcode-santacoder&quot;</span>, torch_dtype=torch.float16, attn_implementation=<span class="hljs-string">&quot;flash_attention_2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;bigcode/gpt_bigcode-santacoder&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;def hello_world():&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>model_inputs = tokenizer([prompt], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(device)
<span class="hljs-meta">&gt;&gt;&gt; </span>model.to(device)

<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = model.generate(**model_inputs, max_new_tokens=<span class="hljs-number">30</span>, do_sample=<span class="hljs-literal">False</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(generated_ids)[<span class="hljs-number">0</span>]
<span class="hljs-string">&#x27;def hello_world():\\n    print(&quot;hello world&quot;)\\n\\nif __name__ == &quot;__main__&quot;:\\n    print(&quot;hello world&quot;)\\n&lt;|endoftext|&gt;&#x27;</span>`,wrap:!1}}),he=new H({props:{title:"Expected speedups",local:"expected-speedups",headingTag:"h3"}}),fe=new H({props:{title:"GPTBigCodeConfig",local:"transformers.GPTBigCodeConfig",headingTag:"h2"}}),ge=new R({props:{name:"class transformers.GPTBigCodeConfig",anchor:"transformers.GPTBigCodeConfig",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_pytorch_tanh'"},{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:"scale_attn_weights",val:" = True"},{name:"use_cache",val:" = True"},{name:"bos_token_id",val:" = 50256"},{name:"eos_token_id",val:" = 50256"},{name:"attention_softmax_in_fp32",val:" = True"},{name:"scale_attention_softmax_in_fp32",val:" = True"},{name:"multi_query",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.GPTBigCodeConfig.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/gpt_bigcode#transformers.GPTBigCodeModel">GPTBigCodeModel</a>.`,name:"vocab_size"},{anchor:"transformers.GPTBigCodeConfig.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.GPTBigCodeConfig.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.GPTBigCodeConfig.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.GPTBigCodeConfig.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.GPTBigCodeConfig.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.GPTBigCodeConfig.activation_function",description:`<strong>activation_function</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;gelu_pytorch_tanh&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;, &quot;gelu_pytorch_tanh&quot;]</code>.`,name:"activation_function"},{anchor:"transformers.GPTBigCodeConfig.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.GPTBigCodeConfig.embd_pdrop",description:`<strong>embd_pdrop</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the embeddings.`,name:"embd_pdrop"},{anchor:"transformers.GPTBigCodeConfig.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.GPTBigCodeConfig.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.GPTBigCodeConfig.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.GPTBigCodeConfig.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.GPTBigCodeConfig.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.GPTBigCodeConfig.attention_softmax_in_fp32",description:`<strong>attention_softmax_in_fp32</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to call the fused softmax in float32.`,name:"attention_softmax_in_fp32"},{anchor:"transformers.GPTBigCodeConfig.scale_attention_softmax_in_fp32",description:`<strong>scale_attention_softmax_in_fp32</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to scale the attention softmax in float32.`,name:"scale_attention_softmax_in_fp32"},{anchor:"transformers.GPTBigCodeConfig.attention_type",description:`<strong>attention_type</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use Multi-Query Attion (<code>True</code>) or Multi-Head Attention (<code>False</code>).`,name:"attention_type"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/gpt_bigcode/configuration_gpt_bigcode.py#L28"}}),E=new ro({props:{anchor:"transformers.GPTBigCodeConfig.example",$$slots:{default:[Eo]},$$scope:{ctx:M}}}),_e=new H({props:{title:"GPTBigCodeModel",local:"transformers.GPTBigCodeModel",headingTag:"h2"}}),Te=new R({props:{name:"class transformers.GPTBigCodeModel",anchor:"transformers.GPTBigCodeModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GPTBigCodeModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gpt_bigcode#transformers.GPTBigCodeConfig">GPTBigCodeConfig</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/gpt_bigcode/modeling_gpt_bigcode.py#L903"}}),be=new R({props:{name:"forward",anchor:"transformers.GPTBigCodeModel.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"past_key_values",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"token_type_ids",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"encoder_hidden_states",val:": Optional = None"},{name:"encoder_attention_mask",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.GPTBigCodeModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.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][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.GPTBigCodeModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>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.GPTBigCodeModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p>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.GPTBigCodeModel.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.Tensor</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.GPTBigCodeModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.Tensor</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.GPTBigCodeModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.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.GPTBigCodeModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.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.</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.GPTBigCodeModel.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.GPTBigCodeModel.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.GPTBigCodeModel.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.GPTBigCodeModel.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/gpt_bigcode/modeling_gpt_bigcode.py#L939",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<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/gpt_bigcode#transformers.GPTBigCodeConfig"
>GPTBigCodeConfig</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>) — 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>) — 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>) — 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>) — 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>) — 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’s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<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>
`}}),O=new Gt({props:{$$slots:{default:[Oo]},$$scope:{ctx:M}}}),A=new ro({props:{anchor:"transformers.GPTBigCodeModel.forward.example",$$slots:{default:[Ao]},$$scope:{ctx:M}}}),ve=new H({props:{title:"GPTBigCodeForCausalLM",local:"transformers.GPTBigCodeForCausalLM",headingTag:"h2"}}),ye=new R({props:{name:"class transformers.GPTBigCodeForCausalLM",anchor:"transformers.GPTBigCodeForCausalLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GPTBigCodeForCausalLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gpt_bigcode#transformers.GPTBigCodeConfig">GPTBigCodeConfig</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/gpt_bigcode/modeling_gpt_bigcode.py#L1153"}}),ke=new R({props:{name:"forward",anchor:"transformers.GPTBigCodeForCausalLM.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"past_key_values",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"token_type_ids",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"encoder_hidden_states",val:": Optional = None"},{name:"encoder_attention_mask",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.GPTBigCodeForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.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][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.GPTBigCodeForCausalLM.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>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.GPTBigCodeForCausalLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p>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.GPTBigCodeForCausalLM.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.Tensor</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.GPTBigCodeForCausalLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.Tensor</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.GPTBigCodeForCausalLM.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.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.GPTBigCodeForCausalLM.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.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.</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.GPTBigCodeForCausalLM.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.GPTBigCodeForCausalLM.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.GPTBigCodeForCausalLM.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.GPTBigCodeForCausalLM.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.GPTBigCodeForCausalLM.forward.labels",description:`<strong>labels</strong> (<code>torch.Tensor</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/gpt_bigcode/modeling_gpt_bigcode.py#L1226",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<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/gpt_bigcode#transformers.GPTBigCodeConfig"
>GPTBigCodeConfig</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) — 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>) — 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>) — 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>) — 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>) — 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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script>


<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>
`}}),D=new Gt({props:{$$slots:{default:[Do]},$$scope:{ctx:M}}}),X=new ro({props:{anchor:"transformers.GPTBigCodeForCausalLM.forward.example",$$slots:{default:[Xo]},$$scope:{ctx:M}}}),Ce=new H({props:{title:"GPTBigCodeForSequenceClassification",local:"transformers.GPTBigCodeForSequenceClassification",headingTag:"h2"}}),we=new R({props:{name:"class transformers.GPTBigCodeForSequenceClassification",anchor:"transformers.GPTBigCodeForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GPTBigCodeForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gpt_bigcode#transformers.GPTBigCodeConfig">GPTBigCodeConfig</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/gpt_bigcode/modeling_gpt_bigcode.py#L1310"}}),Me=new R({props:{name:"forward",anchor:"transformers.GPTBigCodeForSequenceClassification.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"past_key_values",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"token_type_ids",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.GPTBigCodeForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.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][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.GPTBigCodeForSequenceClassification.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>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.GPTBigCodeForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p>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.GPTBigCodeForSequenceClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.Tensor</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.GPTBigCodeForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.Tensor</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.GPTBigCodeForSequenceClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.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.GPTBigCodeForSequenceClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.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.</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.GPTBigCodeForSequenceClassification.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.GPTBigCodeForSequenceClassification.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.GPTBigCodeForSequenceClassification.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.GPTBigCodeForSequenceClassification.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.GPTBigCodeForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.Tensor</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/gpt_bigcode/modeling_gpt_bigcode.py#L1335"}}),Q=new Gt({props:{$$slots:{default:[Qo]},$$scope:{ctx:M}}}),$e=new H({props:{title:"GPTBigCodeForTokenClassification",local:"transformers.GPTBigCodeForTokenClassification",headingTag:"h2"}}),Pe=new R({props:{name:"class transformers.GPTBigCodeForTokenClassification",anchor:"transformers.GPTBigCodeForTokenClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.GPTBigCodeForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/gpt_bigcode#transformers.GPTBigCodeConfig">GPTBigCodeConfig</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/gpt_bigcode/modeling_gpt_bigcode.py#L1437"}}),Ge=new R({props:{name:"forward",anchor:"transformers.GPTBigCodeForTokenClassification.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"past_key_values",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"token_type_ids",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.GPTBigCodeForTokenClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.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][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.GPTBigCodeForTokenClassification.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>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.GPTBigCodeForTokenClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p>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.GPTBigCodeForTokenClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.Tensor</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.GPTBigCodeForTokenClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.Tensor</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.GPTBigCodeForTokenClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.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.GPTBigCodeForTokenClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.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.</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.GPTBigCodeForTokenClassification.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.GPTBigCodeForTokenClassification.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.GPTBigCodeForTokenClassification.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.GPTBigCodeForTokenClassification.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.GPTBigCodeForTokenClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.Tensor</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/gpt_bigcode/modeling_gpt_bigcode.py#L1462"}}),Y=new Gt({props:{$$slots:{default:[Yo]},$$scope:{ctx:M}}}),{c(){n=d("meta"),v=s(),p=d("p"),h=s(),u(y.$$.fragment),c=s(),u(k.$$.fragment),Ke=s(),K=d("p"),K.innerHTML=io,et=s(),ee=d("p"),ee.textContent=lo,tt=s(),te=d("p"),te.innerHTML=co,ot=s(),oe=d("p"),oe.innerHTML=po,nt=s(),u(ne.$$.fragment),st=s(),se=d("p"),se.textContent=mo,at=s(),ae=d("ul"),ae.innerHTML=ho,rt=s(),re=d("p"),re.innerHTML=uo,it=s(),u(ie.$$.fragment),dt=s(),de=d("p"),de.textContent=fo,lt=s(),u(le.$$.fragment),ct=s(),ce=d("p"),ce.textContent=go,pt=s(),pe=d("p"),pe.textContent=_o,mt=s(),u(me.$$.fragment),ht=s(),u(he.$$.fragment),ut=s(),ue=d("p"),ue.innerHTML=To,ft=s(),V=d("div"),V.innerHTML=bo,gt=s(),u(fe.$$.fragment),_t=s(),B=d("div"),u(ge.$$.fragment),Bt=s(),xe=d("p"),xe.innerHTML=vo,xt=s(),ze=d("p"),ze.innerHTML=yo,zt=s(),u(E.$$.fragment),Tt=s(),u(_e.$$.fragment),bt=s(),$=d("div"),u(Te.$$.fragment),Ft=s(),Fe=d("p"),Fe.textContent=ko,It=s(),Ie=d("p"),Ie.innerHTML=Co,qt=s(),qe=d("p"),qe.innerHTML=wo,Jt=s(),F=d("div"),u(be.$$.fragment),jt=s(),Je=d("p"),Je.innerHTML=Mo,Ut=s(),u(O.$$.fragment),Lt=s(),u(A.$$.fragment),vt=s(),u(ve.$$.fragment),yt=s(),P=d("div"),u(ye.$$.fragment),Wt=s(),je=d("p"),je.textContent=$o,Zt=s(),Ue=d("p"),Ue.innerHTML=Po,Nt=s(),Le=d("p"),Le.innerHTML=Go,Ht=s(),I=d("div"),u(ke.$$.fragment),St=s(),We=d("p"),We.innerHTML=Bo,Rt=s(),u(D.$$.fragment),Vt=s(),u(X.$$.fragment),kt=s(),u(Ce.$$.fragment),Ct=s(),C=d("div"),u(we.$$.fragment),Et=s(),Ze=d("p"),Ze.textContent=xo,Ot=s(),Ne=d("p"),Ne.innerHTML=zo,At=s(),He=d("p"),He.innerHTML=Fo,Dt=s(),Se=d("p"),Se.innerHTML=Io,Xt=s(),Re=d("p"),Re.innerHTML=qo,Qt=s(),W=d("div"),u(Me.$$.fragment),Yt=s(),Ve=d("p"),Ve.innerHTML=Jo,Kt=s(),u(Q.$$.fragment),wt=s(),u($e.$$.fragment),Mt=s(),G=d("div"),u(Pe.$$.fragment),eo=s(),Ee=d("p"),Ee.textContent=jo,to=s(),Oe=d("p"),Oe.innerHTML=Uo,oo=s(),Ae=d("p"),Ae.innerHTML=Lo,no=s(),Z=d("div"),u(Ge.$$.fragment),so=s(),De=d("p"),De.innerHTML=Wo,ao=s(),u(Y.$$.fragment),$t=s(),Qe=d("p"),this.h()},l(e){const t=Ro("svelte-u9bgzb",document.head);n=l(t,"META",{name:!0,content:!0}),t.forEach(o),v=a(e),p=l(e,"P",{}),U(p).forEach(o),h=a(e),f(y.$$.fragment,e),c=a(e),f(k.$$.fragment,e),Ke=a(e),K=l(e,"P",{"data-svelte-h":!0}),m(K)!=="svelte-1y7x4r1"&&(K.innerHTML=io),et=a(e),ee=l(e,"P",{"data-svelte-h":!0}),m(ee)!=="svelte-vfdo9a"&&(ee.textContent=lo),tt=a(e),te=l(e,"P",{"data-svelte-h":!0}),m(te)!=="svelte-smsn49"&&(te.innerHTML=co),ot=a(e),oe=l(e,"P",{"data-svelte-h":!0}),m(oe)!=="svelte-1v15zxi"&&(oe.innerHTML=po),nt=a(e),f(ne.$$.fragment,e),st=a(e),se=l(e,"P",{"data-svelte-h":!0}),m(se)!=="svelte-kswcp9"&&(se.textContent=mo),at=a(e),ae=l(e,"UL",{"data-svelte-h":!0}),m(ae)!=="svelte-1nib397"&&(ae.innerHTML=ho),rt=a(e),re=l(e,"P",{"data-svelte-h":!0}),m(re)!=="svelte-4sqm6f"&&(re.innerHTML=uo),it=a(e),f(ie.$$.fragment,e),dt=a(e),de=l(e,"P",{"data-svelte-h":!0}),m(de)!=="svelte-o3pzzu"&&(de.textContent=fo),lt=a(e),f(le.$$.fragment,e),ct=a(e),ce=l(e,"P",{"data-svelte-h":!0}),m(ce)!=="svelte-enej3y"&&(ce.textContent=go),pt=a(e),pe=l(e,"P",{"data-svelte-h":!0}),m(pe)!=="svelte-14hchid"&&(pe.textContent=_o),mt=a(e),f(me.$$.fragment,e),ht=a(e),f(he.$$.fragment,e),ut=a(e),ue=l(e,"P",{"data-svelte-h":!0}),m(ue)!=="svelte-15phqwn"&&(ue.innerHTML=To),ft=a(e),V=l(e,"DIV",{style:!0,"data-svelte-h":!0}),m(V)!=="svelte-1sxfobm"&&(V.innerHTML=bo),gt=a(e),f(fe.$$.fragment,e),_t=a(e),B=l(e,"DIV",{class:!0});var q=U(B);f(ge.$$.fragment,q),Bt=a(q),xe=l(q,"P",{"data-svelte-h":!0}),m(xe)!=="svelte-1mey874"&&(xe.innerHTML=vo),xt=a(q),ze=l(q,"P",{"data-svelte-h":!0}),m(ze)!=="svelte-o55m63"&&(ze.innerHTML=yo),zt=a(q),f(E.$$.fragment,q),q.forEach(o),Tt=a(e),f(_e.$$.fragment,e),bt=a(e),$=l(e,"DIV",{class:!0});var x=U($);f(Te.$$.fragment,x),Ft=a(x),Fe=l(x,"P",{"data-svelte-h":!0}),m(Fe)!=="svelte-ig0mxc"&&(Fe.textContent=ko),It=a(x),Ie=l(x,"P",{"data-svelte-h":!0}),m(Ie)!=="svelte-6pahdo"&&(Ie.innerHTML=Co),qt=a(x),qe=l(x,"P",{"data-svelte-h":!0}),m(qe)!=="svelte-hswkmf"&&(qe.innerHTML=wo),Jt=a(x),F=l(x,"DIV",{class:!0});var J=U(F);f(be.$$.fragment,J),jt=a(J),Je=l(J,"P",{"data-svelte-h":!0}),m(Je)!=="svelte-1oqee4y"&&(Je.innerHTML=Mo),Ut=a(J),f(O.$$.fragment,J),Lt=a(J),f(A.$$.fragment,J),J.forEach(o),x.forEach(o),vt=a(e),f(ve.$$.fragment,e),yt=a(e),P=l(e,"DIV",{class:!0});var z=U(P);f(ye.$$.fragment,z),Wt=a(z),je=l(z,"P",{"data-svelte-h":!0}),m(je)!=="svelte-ckfo62"&&(je.textContent=$o),Zt=a(z),Ue=l(z,"P",{"data-svelte-h":!0}),m(Ue)!=="svelte-6pahdo"&&(Ue.innerHTML=Po),Nt=a(z),Le=l(z,"P",{"data-svelte-h":!0}),m(Le)!=="svelte-hswkmf"&&(Le.innerHTML=Go),Ht=a(z),I=l(z,"DIV",{class:!0});var j=U(I);f(ke.$$.fragment,j),St=a(j),We=l(j,"P",{"data-svelte-h":!0}),m(We)!=="svelte-i9apum"&&(We.innerHTML=Bo),Rt=a(j),f(D.$$.fragment,j),Vt=a(j),f(X.$$.fragment,j),j.forEach(o),z.forEach(o),kt=a(e),f(Ce.$$.fragment,e),Ct=a(e),C=l(e,"DIV",{class:!0});var w=U(C);f(we.$$.fragment,w),Et=a(w),Ze=l(w,"P",{"data-svelte-h":!0}),m(Ze)!=="svelte-x1zjre"&&(Ze.textContent=xo),Ot=a(w),Ne=l(w,"P",{"data-svelte-h":!0}),m(Ne)!=="svelte-14x7550"&&(Ne.innerHTML=zo),At=a(w),He=l(w,"P",{"data-svelte-h":!0}),m(He)!=="svelte-10ugs3m"&&(He.innerHTML=Fo),Dt=a(w),Se=l(w,"P",{"data-svelte-h":!0}),m(Se)!=="svelte-6pahdo"&&(Se.innerHTML=Io),Xt=a(w),Re=l(w,"P",{"data-svelte-h":!0}),m(Re)!=="svelte-hswkmf"&&(Re.innerHTML=qo),Qt=a(w),W=l(w,"DIV",{class:!0});var S=U(W);f(Me.$$.fragment,S),Yt=a(S),Ve=l(S,"P",{"data-svelte-h":!0}),m(Ve)!=="svelte-yrv006"&&(Ve.innerHTML=Jo),Kt=a(S),f(Q.$$.fragment,S),S.forEach(o),w.forEach(o),wt=a(e),f($e.$$.fragment,e),Mt=a(e),G=l(e,"DIV",{class:!0});var N=U(G);f(Pe.$$.fragment,N),eo=a(N),Ee=l(N,"P",{"data-svelte-h":!0}),m(Ee)!=="svelte-1hph7pq"&&(Ee.textContent=jo),to=a(N),Oe=l(N,"P",{"data-svelte-h":!0}),m(Oe)!=="svelte-6pahdo"&&(Oe.innerHTML=Uo),oo=a(N),Ae=l(N,"P",{"data-svelte-h":!0}),m(Ae)!=="svelte-hswkmf"&&(Ae.innerHTML=Lo),no=a(N),Z=l(N,"DIV",{class:!0});var Xe=U(Z);f(Ge.$$.fragment,Xe),so=a(Xe),De=l(Xe,"P",{"data-svelte-h":!0}),m(De)!=="svelte-16z49hy"&&(De.innerHTML=Wo),ao=a(Xe),f(Y.$$.fragment,Xe),Xe.forEach(o),N.forEach(o),$t=a(e),Qe=l(e,"P",{}),U(Qe).forEach(o),this.h()},h(){L(n,"name","hf:doc:metadata"),L(n,"content",en),Vo(V,"text-align","center"),L(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){i(document.head,n),r(e,v,t),r(e,p,t),r(e,h,t),g(y,e,t),r(e,c,t),g(k,e,t),r(e,Ke,t),r(e,K,t),r(e,et,t),r(e,ee,t),r(e,tt,t),r(e,te,t),r(e,ot,t),r(e,oe,t),r(e,nt,t),g(ne,e,t),r(e,st,t),r(e,se,t),r(e,at,t),r(e,ae,t),r(e,rt,t),r(e,re,t),r(e,it,t),g(ie,e,t),r(e,dt,t),r(e,de,t),r(e,lt,t),g(le,e,t),r(e,ct,t),r(e,ce,t),r(e,pt,t),r(e,pe,t),r(e,mt,t),g(me,e,t),r(e,ht,t),g(he,e,t),r(e,ut,t),r(e,ue,t),r(e,ft,t),r(e,V,t),r(e,gt,t),g(fe,e,t),r(e,_t,t),r(e,B,t),g(ge,B,null),i(B,Bt),i(B,xe),i(B,xt),i(B,ze),i(B,zt),g(E,B,null),r(e,Tt,t),g(_e,e,t),r(e,bt,t),r(e,$,t),g(Te,$,null),i($,Ft),i($,Fe),i($,It),i($,Ie),i($,qt),i($,qe),i($,Jt),i($,F),g(be,F,null),i(F,jt),i(F,Je),i(F,Ut),g(O,F,null),i(F,Lt),g(A,F,null),r(e,vt,t),g(ve,e,t),r(e,yt,t),r(e,P,t),g(ye,P,null),i(P,Wt),i(P,je),i(P,Zt),i(P,Ue),i(P,Nt),i(P,Le),i(P,Ht),i(P,I),g(ke,I,null),i(I,St),i(I,We),i(I,Rt),g(D,I,null),i(I,Vt),g(X,I,null),r(e,kt,t),g(Ce,e,t),r(e,Ct,t),r(e,C,t),g(we,C,null),i(C,Et),i(C,Ze),i(C,Ot),i(C,Ne),i(C,At),i(C,He),i(C,Dt),i(C,Se),i(C,Xt),i(C,Re),i(C,Qt),i(C,W),g(Me,W,null),i(W,Yt),i(W,Ve),i(W,Kt),g(Q,W,null),r(e,wt,t),g($e,e,t),r(e,Mt,t),r(e,G,t),g(Pe,G,null),i(G,eo),i(G,Ee),i(G,to),i(G,Oe),i(G,oo),i(G,Ae),i(G,no),i(G,Z),g(Ge,Z,null),i(Z,so),i(Z,De),i(Z,ao),g(Y,Z,null),r(e,$t,t),r(e,Qe,t),Pt=!0},p(e,[t]){const q={};t&2&&(q.$$scope={dirty:t,ctx:e}),E.$set(q);const x={};t&2&&(x.$$scope={dirty:t,ctx:e}),O.$set(x);const J={};t&2&&(J.$$scope={dirty:t,ctx:e}),A.$set(J);const z={};t&2&&(z.$$scope={dirty:t,ctx:e}),D.$set(z);const j={};t&2&&(j.$$scope={dirty:t,ctx:e}),X.$set(j);const w={};t&2&&(w.$$scope={dirty:t,ctx:e}),Q.$set(w);const S={};t&2&&(S.$$scope={dirty:t,ctx:e}),Y.$set(S)},i(e){Pt||(_(y.$$.fragment,e),_(k.$$.fragment,e),_(ne.$$.fragment,e),_(ie.$$.fragment,e),_(le.$$.fragment,e),_(me.$$.fragment,e),_(he.$$.fragment,e),_(fe.$$.fragment,e),_(ge.$$.fragment,e),_(E.$$.fragment,e),_(_e.$$.fragment,e),_(Te.$$.fragment,e),_(be.$$.fragment,e),_(O.$$.fragment,e),_(A.$$.fragment,e),_(ve.$$.fragment,e),_(ye.$$.fragment,e),_(ke.$$.fragment,e),_(D.$$.fragment,e),_(X.$$.fragment,e),_(Ce.$$.fragment,e),_(we.$$.fragment,e),_(Me.$$.fragment,e),_(Q.$$.fragment,e),_($e.$$.fragment,e),_(Pe.$$.fragment,e),_(Ge.$$.fragment,e),_(Y.$$.fragment,e),Pt=!0)},o(e){T(y.$$.fragment,e),T(k.$$.fragment,e),T(ne.$$.fragment,e),T(ie.$$.fragment,e),T(le.$$.fragment,e),T(me.$$.fragment,e),T(he.$$.fragment,e),T(fe.$$.fragment,e),T(ge.$$.fragment,e),T(E.$$.fragment,e),T(_e.$$.fragment,e),T(Te.$$.fragment,e),T(be.$$.fragment,e),T(O.$$.fragment,e),T(A.$$.fragment,e),T(ve.$$.fragment,e),T(ye.$$.fragment,e),T(ke.$$.fragment,e),T(D.$$.fragment,e),T(X.$$.fragment,e),T(Ce.$$.fragment,e),T(we.$$.fragment,e),T(Me.$$.fragment,e),T(Q.$$.fragment,e),T($e.$$.fragment,e),T(Pe.$$.fragment,e),T(Ge.$$.fragment,e),T(Y.$$.fragment,e),Pt=!1},d(e){e&&(o(v),o(p),o(h),o(c),o(Ke),o(K),o(et),o(ee),o(tt),o(te),o(ot),o(oe),o(nt),o(st),o(se),o(at),o(ae),o(rt),o(re),o(it),o(dt),o(de),o(lt),o(ct),o(ce),o(pt),o(pe),o(mt),o(ht),o(ut),o(ue),o(ft),o(V),o(gt),o(_t),o(B),o(Tt),o(bt),o($),o(vt),o(yt),o(P),o(kt),o(Ct),o(C),o(wt),o(Mt),o(G),o($t),o(Qe)),o(n),b(y,e),b(k,e),b(ne,e),b(ie,e),b(le,e),b(me,e),b(he,e),b(fe,e),b(ge),b(E),b(_e,e),b(Te),b(be),b(O),b(A),b(ve,e),b(ye),b(ke),b(D),b(X),b(Ce,e),b(we),b(Me),b(Q),b($e,e),b(Pe),b(Ge),b(Y)}}}const en='{"title":"GPTBigCode","local":"gptbigcode","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Implementation details","local":"implementation-details","sections":[],"depth":2},{"title":"Combining Starcoder and Flash Attention 2","local":"combining-starcoder-and-flash-attention-2","sections":[{"title":"Expected speedups","local":"expected-speedups","sections":[],"depth":3}],"depth":2},{"title":"GPTBigCodeConfig","local":"transformers.GPTBigCodeConfig","sections":[],"depth":2},{"title":"GPTBigCodeModel","local":"transformers.GPTBigCodeModel","sections":[],"depth":2},{"title":"GPTBigCodeForCausalLM","local":"transformers.GPTBigCodeForCausalLM","sections":[],"depth":2},{"title":"GPTBigCodeForSequenceClassification","local":"transformers.GPTBigCodeForSequenceClassification","sections":[],"depth":2},{"title":"GPTBigCodeForTokenClassification","local":"transformers.GPTBigCodeForTokenClassification","sections":[],"depth":2}],"depth":1}';function tn(M){return No(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class cn extends Ho{constructor(n){super(),So(this,n,tn,Ko,Zo,{})}}export{cn as component};
