import{s as Ao,o as Do,n as xe}from"../chunks/scheduler.25b97de1.js";import{S as Xo,i as Qo,g as i,s,r as h,A as Yo,h as d,f as o,c as a,j as U,u as f,x as p,k as W,l as Ko,y as l,a as n,v as g,d as _,t as b,w as T}from"../chunks/index.d9030fc9.js";import{T as xt}from"../chunks/Tip.baa67368.js";import{D as S}from"../chunks/Docstring.e257edda.js";import{C as Ye}from"../chunks/CodeBlock.e6cd0d95.js";import{E as lo}from"../chunks/ExampleCodeBlock.20db4b6e.js";import{H as Bt,E as en}from"../chunks/EditOnGithub.91d95064.js";function tn(M){let r,v="Example:",m,u,y;return u=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(){r=i("p"),r.textContent=v,m=s(),h(u.$$.fragment)},l(c){r=d(c,"P",{"data-svelte-h":!0}),p(r)!=="svelte-11lpom8"&&(r.textContent=v),m=a(c),f(u.$$.fragment,c)},m(c,k){n(c,r,k),n(c,m,k),g(u,c,k),y=!0},p:xe,i(c){y||(_(u.$$.fragment,c),y=!0)},o(c){b(u.$$.fragment,c),y=!1},d(c){c&&(o(r),o(m)),T(u,c)}}}function on(M){let r,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(){r=i("p"),r.innerHTML=v},l(m){r=d(m,"P",{"data-svelte-h":!0}),p(r)!=="svelte-fincs2"&&(r.innerHTML=v)},m(m,u){n(m,r,u)},p:xe,d(m){m&&o(r)}}}function nn(M){let r,v="Example:",m,u,y;return u=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(){r=i("p"),r.textContent=v,m=s(),h(u.$$.fragment)},l(c){r=d(c,"P",{"data-svelte-h":!0}),p(r)!=="svelte-11lpom8"&&(r.textContent=v),m=a(c),f(u.$$.fragment,c)},m(c,k){n(c,r,k),n(c,m,k),g(u,c,k),y=!0},p:xe,i(c){y||(_(u.$$.fragment,c),y=!0)},o(c){b(u.$$.fragment,c),y=!1},d(c){c&&(o(r),o(m)),T(u,c)}}}function sn(M){let r,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(){r=i("p"),r.innerHTML=v},l(m){r=d(m,"P",{"data-svelte-h":!0}),p(r)!=="svelte-fincs2"&&(r.innerHTML=v)},m(m,u){n(m,r,u)},p:xe,d(m){m&&o(r)}}}function an(M){let r,v="Example:",m,u,y;return u=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(){r=i("p"),r.textContent=v,m=s(),h(u.$$.fragment)},l(c){r=d(c,"P",{"data-svelte-h":!0}),p(r)!=="svelte-11lpom8"&&(r.textContent=v),m=a(c),f(u.$$.fragment,c)},m(c,k){n(c,r,k),n(c,m,k),g(u,c,k),y=!0},p:xe,i(c){y||(_(u.$$.fragment,c),y=!0)},o(c){b(u.$$.fragment,c),y=!1},d(c){c&&(o(r),o(m)),T(u,c)}}}function rn(M){let r,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(){r=i("p"),r.innerHTML=v},l(m){r=d(m,"P",{"data-svelte-h":!0}),p(r)!=="svelte-fincs2"&&(r.innerHTML=v)},m(m,u){n(m,r,u)},p:xe,d(m){m&&o(r)}}}function dn(M){let r,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(){r=i("p"),r.innerHTML=v},l(m){r=d(m,"P",{"data-svelte-h":!0}),p(r)!=="svelte-fincs2"&&(r.innerHTML=v)},m(m,u){n(m,r,u)},p:xe,d(m){m&&o(r)}}}function ln(M){let r,v,m,u,y,c,k,Ke,Y,co='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,K,po="The abstract from the paper is the following:",tt,ee,mo='<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,te,uo='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,oe,st,ne,ho="The main differences compared to GPT2.",at,se,fo="<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 openai-community/gpt2 model).</li>",rt,ae,go='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,re,dt,ie,_o="First, make sure to install the latest version of Flash Attention 2 to include the sliding window attention feature.",lt,de,ct,le,bo="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,ce,To="To load and run a model using Flash Attention 2, refer to the snippet below:",mt,pe,ut,me,vo="### Expected speedups",ht,ue,yo="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,R,ko='<img src="https://huggingface.co/datasets/ybelkada/documentation-images/resolve/main/starcoder-speedup.png"/>',gt,he,Co="## GPTBigCodeConfig[[transformers.GPTBigCodeConfig]]",_t,x,fe,zt,Be,wo=`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.`,Ft,ze,Mo=`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.`,It,V,bt,ge,$o="## GPTBigCodeModel[[transformers.GPTBigCodeModel]]",Tt,$,_e,qt,Fe,Po="The bare GPT_BIGCODE Model transformer outputting raw hidden-states without any specific head on top.",Jt,Ie,Go=`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.)`,jt,qe,xo=`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.`,Ut,F,be,Wt,Je,Bo='The <a href="/docs/transformers/main/en/model_doc/gpt_bigcode#transformers.GPTBigCodeModel">GPTBigCodeModel</a> forward method, overrides the <code>__call__</code> special method.',Lt,E,Zt,O,vt,Te,zo="## GPTBigCodeForCausalLM[[transformers.GPTBigCodeForCausalLM]]",yt,P,ve,Nt,je,Fo=`The GPT_BIGCODE Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`,Ht,Ue,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.)`,St,We,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.`,Rt,I,ye,Vt,Le,Jo='The <a href="/docs/transformers/main/en/model_doc/gpt_bigcode#transformers.GPTBigCodeForCausalLM">GPTBigCodeForCausalLM</a> forward method, overrides the <code>__call__</code> special method.',Et,A,Ot,D,kt,ke,jo="## GPTBigCodeForSequenceClassification[[transformers.GPTBigCodeForSequenceClassification]]",Ct,C,Ce,At,Ze,Uo="The GPTBigCode Model transformer with a sequence classification head on top (linear layer).",Dt,Ne,Wo=`<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.`,Xt,He,Lo=`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).`,Qt,Se,Zo=`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.)`,Yt,Re,No=`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.`,Kt,L,we,eo,Ve,Ho='The <a href="/docs/transformers/main/en/model_doc/gpt_bigcode#transformers.GPTBigCodeForSequenceClassification">GPTBigCodeForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',to,X,wt,Me,So="## GPTBigCodeForTokenClassification[[transformers.GPTBigCodeForTokenClassification]]",Mt,G,$e,oo,Ee,Ro=`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.`,no,Oe,Vo=`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.)`,so,Ae,Eo=`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.`,ao,Z,Pe,ro,De,Oo='The <a href="/docs/transformers/main/en/model_doc/gpt_bigcode#transformers.GPTBigCodeForTokenClassification">GPTBigCodeForTokenClassification</a> forward method, overrides the <code>__call__</code> special method.',io,Q,$t,Ge,Pt,Qe,Gt;return y=new Bt({props:{title:"GPTBigCode",local:"gptbigcode",headingTag:"h1"}}),k=new Bt({props:{title:"Overview",local:"overview",headingTag:"h2"}}),oe=new Bt({props:{title:"Implementation details",local:"implementation-details",headingTag:"h2"}}),re=new Bt({props:{title:"Combining Starcoder and Flash Attention 2",local:"combining-starcoder-and-flash-attention-2",headingTag:"h2"}}),de=new Ye({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1VJTIwZmxhc2gtYXR0biUyMC0tbm8tYnVpbGQtaXNvbGF0aW9u",highlighted:"pip install -U flash-attn --no-build-isolation",wrap:!1}}),pe=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}}),fe=new S({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#L24"}}),V=new lo({props:{anchor:"transformers.GPTBigCodeConfig.example",$$slots:{default:[tn]},$$scope:{ctx:M}}}),_e=new S({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#L893"}}),be=new S({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#L929",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>
`}}),E=new xt({props:{$$slots:{default:[on]},$$scope:{ctx:M}}}),O=new lo({props:{anchor:"transformers.GPTBigCodeModel.forward.example",$$slots:{default:[nn]},$$scope:{ctx:M}}}),ve=new S({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#L1142"}}),ye=new S({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#L1233",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>
`}}),A=new xt({props:{$$slots:{default:[sn]},$$scope:{ctx:M}}}),D=new lo({props:{anchor:"transformers.GPTBigCodeForCausalLM.forward.example",$$slots:{default:[an]},$$scope:{ctx:M}}}),Ce=new S({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#L1317"}}),we=new S({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#L1342"}}),X=new xt({props:{$$slots:{default:[rn]},$$scope:{ctx:M}}}),$e=new S({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#L1444"}}),Pe=new S({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#L1469"}}),Q=new xt({props:{$$slots:{default:[dn]},$$scope:{ctx:M}}}),Ge=new en({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/gpt_bigcode.md"}}),{c(){r=i("meta"),v=s(),m=i("p"),u=s(),h(y.$$.fragment),c=s(),h(k.$$.fragment),Ke=s(),Y=i("p"),Y.innerHTML=co,et=s(),K=i("p"),K.textContent=po,tt=s(),ee=i("p"),ee.innerHTML=mo,ot=s(),te=i("p"),te.innerHTML=uo,nt=s(),h(oe.$$.fragment),st=s(),ne=i("p"),ne.textContent=ho,at=s(),se=i("ul"),se.innerHTML=fo,rt=s(),ae=i("p"),ae.innerHTML=go,it=s(),h(re.$$.fragment),dt=s(),ie=i("p"),ie.textContent=_o,lt=s(),h(de.$$.fragment),ct=s(),le=i("p"),le.textContent=bo,pt=s(),ce=i("p"),ce.textContent=To,mt=s(),h(pe.$$.fragment),ut=s(),me=i("p"),me.textContent=vo,ht=s(),ue=i("p"),ue.innerHTML=yo,ft=s(),R=i("div"),R.innerHTML=ko,gt=s(),he=i("p"),he.textContent=Co,_t=s(),x=i("div"),h(fe.$$.fragment),zt=s(),Be=i("p"),Be.innerHTML=wo,Ft=s(),ze=i("p"),ze.innerHTML=Mo,It=s(),h(V.$$.fragment),bt=s(),ge=i("p"),ge.textContent=$o,Tt=s(),$=i("div"),h(_e.$$.fragment),qt=s(),Fe=i("p"),Fe.textContent=Po,Jt=s(),Ie=i("p"),Ie.innerHTML=Go,jt=s(),qe=i("p"),qe.innerHTML=xo,Ut=s(),F=i("div"),h(be.$$.fragment),Wt=s(),Je=i("p"),Je.innerHTML=Bo,Lt=s(),h(E.$$.fragment),Zt=s(),h(O.$$.fragment),vt=s(),Te=i("p"),Te.textContent=zo,yt=s(),P=i("div"),h(ve.$$.fragment),Nt=s(),je=i("p"),je.textContent=Fo,Ht=s(),Ue=i("p"),Ue.innerHTML=Io,St=s(),We=i("p"),We.innerHTML=qo,Rt=s(),I=i("div"),h(ye.$$.fragment),Vt=s(),Le=i("p"),Le.innerHTML=Jo,Et=s(),h(A.$$.fragment),Ot=s(),h(D.$$.fragment),kt=s(),ke=i("p"),ke.textContent=jo,Ct=s(),C=i("div"),h(Ce.$$.fragment),At=s(),Ze=i("p"),Ze.textContent=Uo,Dt=s(),Ne=i("p"),Ne.innerHTML=Wo,Xt=s(),He=i("p"),He.innerHTML=Lo,Qt=s(),Se=i("p"),Se.innerHTML=Zo,Yt=s(),Re=i("p"),Re.innerHTML=No,Kt=s(),L=i("div"),h(we.$$.fragment),eo=s(),Ve=i("p"),Ve.innerHTML=Ho,to=s(),h(X.$$.fragment),wt=s(),Me=i("p"),Me.textContent=So,Mt=s(),G=i("div"),h($e.$$.fragment),oo=s(),Ee=i("p"),Ee.textContent=Ro,no=s(),Oe=i("p"),Oe.innerHTML=Vo,so=s(),Ae=i("p"),Ae.innerHTML=Eo,ao=s(),Z=i("div"),h(Pe.$$.fragment),ro=s(),De=i("p"),De.innerHTML=Oo,io=s(),h(Q.$$.fragment),$t=s(),h(Ge.$$.fragment),Pt=s(),Qe=i("p"),this.h()},l(e){const t=Yo("svelte-u9bgzb",document.head);r=d(t,"META",{name:!0,content:!0}),t.forEach(o),v=a(e),m=d(e,"P",{}),U(m).forEach(o),u=a(e),f(y.$$.fragment,e),c=a(e),f(k.$$.fragment,e),Ke=a(e),Y=d(e,"P",{"data-svelte-h":!0}),p(Y)!=="svelte-1y7x4r1"&&(Y.innerHTML=co),et=a(e),K=d(e,"P",{"data-svelte-h":!0}),p(K)!=="svelte-vfdo9a"&&(K.textContent=po),tt=a(e),ee=d(e,"P",{"data-svelte-h":!0}),p(ee)!=="svelte-smsn49"&&(ee.innerHTML=mo),ot=a(e),te=d(e,"P",{"data-svelte-h":!0}),p(te)!=="svelte-1v15zxi"&&(te.innerHTML=uo),nt=a(e),f(oe.$$.fragment,e),st=a(e),ne=d(e,"P",{"data-svelte-h":!0}),p(ne)!=="svelte-kswcp9"&&(ne.textContent=ho),at=a(e),se=d(e,"UL",{"data-svelte-h":!0}),p(se)!=="svelte-ll4zqs"&&(se.innerHTML=fo),rt=a(e),ae=d(e,"P",{"data-svelte-h":!0}),p(ae)!=="svelte-4sqm6f"&&(ae.innerHTML=go),it=a(e),f(re.$$.fragment,e),dt=a(e),ie=d(e,"P",{"data-svelte-h":!0}),p(ie)!=="svelte-o3pzzu"&&(ie.textContent=_o),lt=a(e),f(de.$$.fragment,e),ct=a(e),le=d(e,"P",{"data-svelte-h":!0}),p(le)!=="svelte-enej3y"&&(le.textContent=bo),pt=a(e),ce=d(e,"P",{"data-svelte-h":!0}),p(ce)!=="svelte-14hchid"&&(ce.textContent=To),mt=a(e),f(pe.$$.fragment,e),ut=a(e),me=d(e,"P",{"data-svelte-h":!0}),p(me)!=="svelte-1dwgw8m"&&(me.textContent=vo),ht=a(e),ue=d(e,"P",{"data-svelte-h":!0}),p(ue)!=="svelte-15phqwn"&&(ue.innerHTML=yo),ft=a(e),R=d(e,"DIV",{style:!0,"data-svelte-h":!0}),p(R)!=="svelte-1sxfobm"&&(R.innerHTML=ko),gt=a(e),he=d(e,"P",{"data-svelte-h":!0}),p(he)!=="svelte-7usfto"&&(he.textContent=Co),_t=a(e),x=d(e,"DIV",{class:!0});var q=U(x);f(fe.$$.fragment,q),zt=a(q),Be=d(q,"P",{"data-svelte-h":!0}),p(Be)!=="svelte-1f17kym"&&(Be.innerHTML=wo),Ft=a(q),ze=d(q,"P",{"data-svelte-h":!0}),p(ze)!=="svelte-mby5n"&&(ze.innerHTML=Mo),It=a(q),f(V.$$.fragment,q),q.forEach(o),bt=a(e),ge=d(e,"P",{"data-svelte-h":!0}),p(ge)!=="svelte-nedm0s"&&(ge.textContent=$o),Tt=a(e),$=d(e,"DIV",{class:!0});var B=U($);f(_e.$$.fragment,B),qt=a(B),Fe=d(B,"P",{"data-svelte-h":!0}),p(Fe)!=="svelte-ig0mxc"&&(Fe.textContent=Po),Jt=a(B),Ie=d(B,"P",{"data-svelte-h":!0}),p(Ie)!=="svelte-7tllb6"&&(Ie.innerHTML=Go),jt=a(B),qe=d(B,"P",{"data-svelte-h":!0}),p(qe)!=="svelte-1ydu1el"&&(qe.innerHTML=xo),Ut=a(B),F=d(B,"DIV",{class:!0});var J=U(F);f(be.$$.fragment,J),Wt=a(J),Je=d(J,"P",{"data-svelte-h":!0}),p(Je)!=="svelte-t9tbc4"&&(Je.innerHTML=Bo),Lt=a(J),f(E.$$.fragment,J),Zt=a(J),f(O.$$.fragment,J),J.forEach(o),B.forEach(o),vt=a(e),Te=d(e,"P",{"data-svelte-h":!0}),p(Te)!=="svelte-1gcvts8"&&(Te.textContent=zo),yt=a(e),P=d(e,"DIV",{class:!0});var z=U(P);f(ve.$$.fragment,z),Nt=a(z),je=d(z,"P",{"data-svelte-h":!0}),p(je)!=="svelte-ckfo62"&&(je.textContent=Fo),Ht=a(z),Ue=d(z,"P",{"data-svelte-h":!0}),p(Ue)!=="svelte-7tllb6"&&(Ue.innerHTML=Io),St=a(z),We=d(z,"P",{"data-svelte-h":!0}),p(We)!=="svelte-1ydu1el"&&(We.innerHTML=qo),Rt=a(z),I=d(z,"DIV",{class:!0});var j=U(I);f(ye.$$.fragment,j),Vt=a(j),Le=d(j,"P",{"data-svelte-h":!0}),p(Le)!=="svelte-1hjpuf4"&&(Le.innerHTML=Jo),Et=a(j),f(A.$$.fragment,j),Ot=a(j),f(D.$$.fragment,j),j.forEach(o),z.forEach(o),kt=a(e),ke=d(e,"P",{"data-svelte-h":!0}),p(ke)!=="svelte-3vtk0o"&&(ke.textContent=jo),Ct=a(e),C=d(e,"DIV",{class:!0});var w=U(C);f(Ce.$$.fragment,w),At=a(w),Ze=d(w,"P",{"data-svelte-h":!0}),p(Ze)!=="svelte-x1zjre"&&(Ze.textContent=Uo),Dt=a(w),Ne=d(w,"P",{"data-svelte-h":!0}),p(Ne)!=="svelte-1thefsm"&&(Ne.innerHTML=Wo),Xt=a(w),He=d(w,"P",{"data-svelte-h":!0}),p(He)!=="svelte-10ugs3m"&&(He.innerHTML=Lo),Qt=a(w),Se=d(w,"P",{"data-svelte-h":!0}),p(Se)!=="svelte-7tllb6"&&(Se.innerHTML=Zo),Yt=a(w),Re=d(w,"P",{"data-svelte-h":!0}),p(Re)!=="svelte-1ydu1el"&&(Re.innerHTML=No),Kt=a(w),L=d(w,"DIV",{class:!0});var H=U(L);f(we.$$.fragment,H),eo=a(H),Ve=d(H,"P",{"data-svelte-h":!0}),p(Ve)!=="svelte-qro26w"&&(Ve.innerHTML=Ho),to=a(H),f(X.$$.fragment,H),H.forEach(o),w.forEach(o),wt=a(e),Me=d(e,"P",{"data-svelte-h":!0}),p(Me)!=="svelte-1vx38e8"&&(Me.textContent=So),Mt=a(e),G=d(e,"DIV",{class:!0});var N=U(G);f($e.$$.fragment,N),oo=a(N),Ee=d(N,"P",{"data-svelte-h":!0}),p(Ee)!=="svelte-1hph7pq"&&(Ee.textContent=Ro),no=a(N),Oe=d(N,"P",{"data-svelte-h":!0}),p(Oe)!=="svelte-7tllb6"&&(Oe.innerHTML=Vo),so=a(N),Ae=d(N,"P",{"data-svelte-h":!0}),p(Ae)!=="svelte-1ydu1el"&&(Ae.innerHTML=Eo),ao=a(N),Z=d(N,"DIV",{class:!0});var Xe=U(Z);f(Pe.$$.fragment,Xe),ro=a(Xe),De=d(Xe,"P",{"data-svelte-h":!0}),p(De)!=="svelte-1cwu2nc"&&(De.innerHTML=Oo),io=a(Xe),f(Q.$$.fragment,Xe),Xe.forEach(o),N.forEach(o),$t=a(e),f(Ge.$$.fragment,e),Pt=a(e),Qe=d(e,"P",{}),U(Qe).forEach(o),this.h()},h(){W(r,"name","hf:doc:metadata"),W(r,"content",cn),Ko(R,"text-align","center"),W(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(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){l(document.head,r),n(e,v,t),n(e,m,t),n(e,u,t),g(y,e,t),n(e,c,t),g(k,e,t),n(e,Ke,t),n(e,Y,t),n(e,et,t),n(e,K,t),n(e,tt,t),n(e,ee,t),n(e,ot,t),n(e,te,t),n(e,nt,t),g(oe,e,t),n(e,st,t),n(e,ne,t),n(e,at,t),n(e,se,t),n(e,rt,t),n(e,ae,t),n(e,it,t),g(re,e,t),n(e,dt,t),n(e,ie,t),n(e,lt,t),g(de,e,t),n(e,ct,t),n(e,le,t),n(e,pt,t),n(e,ce,t),n(e,mt,t),g(pe,e,t),n(e,ut,t),n(e,me,t),n(e,ht,t),n(e,ue,t),n(e,ft,t),n(e,R,t),n(e,gt,t),n(e,he,t),n(e,_t,t),n(e,x,t),g(fe,x,null),l(x,zt),l(x,Be),l(x,Ft),l(x,ze),l(x,It),g(V,x,null),n(e,bt,t),n(e,ge,t),n(e,Tt,t),n(e,$,t),g(_e,$,null),l($,qt),l($,Fe),l($,Jt),l($,Ie),l($,jt),l($,qe),l($,Ut),l($,F),g(be,F,null),l(F,Wt),l(F,Je),l(F,Lt),g(E,F,null),l(F,Zt),g(O,F,null),n(e,vt,t),n(e,Te,t),n(e,yt,t),n(e,P,t),g(ve,P,null),l(P,Nt),l(P,je),l(P,Ht),l(P,Ue),l(P,St),l(P,We),l(P,Rt),l(P,I),g(ye,I,null),l(I,Vt),l(I,Le),l(I,Et),g(A,I,null),l(I,Ot),g(D,I,null),n(e,kt,t),n(e,ke,t),n(e,Ct,t),n(e,C,t),g(Ce,C,null),l(C,At),l(C,Ze),l(C,Dt),l(C,Ne),l(C,Xt),l(C,He),l(C,Qt),l(C,Se),l(C,Yt),l(C,Re),l(C,Kt),l(C,L),g(we,L,null),l(L,eo),l(L,Ve),l(L,to),g(X,L,null),n(e,wt,t),n(e,Me,t),n(e,Mt,t),n(e,G,t),g($e,G,null),l(G,oo),l(G,Ee),l(G,no),l(G,Oe),l(G,so),l(G,Ae),l(G,ao),l(G,Z),g(Pe,Z,null),l(Z,ro),l(Z,De),l(Z,io),g(Q,Z,null),n(e,$t,t),g(Ge,e,t),n(e,Pt,t),n(e,Qe,t),Gt=!0},p(e,[t]){const q={};t&2&&(q.$$scope={dirty:t,ctx:e}),V.$set(q);const B={};t&2&&(B.$$scope={dirty:t,ctx:e}),E.$set(B);const J={};t&2&&(J.$$scope={dirty:t,ctx:e}),O.$set(J);const z={};t&2&&(z.$$scope={dirty:t,ctx:e}),A.$set(z);const j={};t&2&&(j.$$scope={dirty:t,ctx:e}),D.$set(j);const w={};t&2&&(w.$$scope={dirty:t,ctx:e}),X.$set(w);const H={};t&2&&(H.$$scope={dirty:t,ctx:e}),Q.$set(H)},i(e){Gt||(_(y.$$.fragment,e),_(k.$$.fragment,e),_(oe.$$.fragment,e),_(re.$$.fragment,e),_(de.$$.fragment,e),_(pe.$$.fragment,e),_(fe.$$.fragment,e),_(V.$$.fragment,e),_(_e.$$.fragment,e),_(be.$$.fragment,e),_(E.$$.fragment,e),_(O.$$.fragment,e),_(ve.$$.fragment,e),_(ye.$$.fragment,e),_(A.$$.fragment,e),_(D.$$.fragment,e),_(Ce.$$.fragment,e),_(we.$$.fragment,e),_(X.$$.fragment,e),_($e.$$.fragment,e),_(Pe.$$.fragment,e),_(Q.$$.fragment,e),_(Ge.$$.fragment,e),Gt=!0)},o(e){b(y.$$.fragment,e),b(k.$$.fragment,e),b(oe.$$.fragment,e),b(re.$$.fragment,e),b(de.$$.fragment,e),b(pe.$$.fragment,e),b(fe.$$.fragment,e),b(V.$$.fragment,e),b(_e.$$.fragment,e),b(be.$$.fragment,e),b(E.$$.fragment,e),b(O.$$.fragment,e),b(ve.$$.fragment,e),b(ye.$$.fragment,e),b(A.$$.fragment,e),b(D.$$.fragment,e),b(Ce.$$.fragment,e),b(we.$$.fragment,e),b(X.$$.fragment,e),b($e.$$.fragment,e),b(Pe.$$.fragment,e),b(Q.$$.fragment,e),b(Ge.$$.fragment,e),Gt=!1},d(e){e&&(o(v),o(m),o(u),o(c),o(Ke),o(Y),o(et),o(K),o(tt),o(ee),o(ot),o(te),o(nt),o(st),o(ne),o(at),o(se),o(rt),o(ae),o(it),o(dt),o(ie),o(lt),o(ct),o(le),o(pt),o(ce),o(mt),o(ut),o(me),o(ht),o(ue),o(ft),o(R),o(gt),o(he),o(_t),o(x),o(bt),o(ge),o(Tt),o($),o(vt),o(Te),o(yt),o(P),o(kt),o(ke),o(Ct),o(C),o(wt),o(Me),o(Mt),o(G),o($t),o(Pt),o(Qe)),o(r),T(y,e),T(k,e),T(oe,e),T(re,e),T(de,e),T(pe,e),T(fe),T(V),T(_e),T(be),T(E),T(O),T(ve),T(ye),T(A),T(D),T(Ce),T(we),T(X),T($e),T(Pe),T(Q),T(Ge,e)}}}const cn='{"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":[],"depth":2}],"depth":1}';function pn(M){return Do(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Tn extends Xo{constructor(r){super(),Qo(this,r,pn,ln,Ao,{})}}export{Tn as component};
