Buckets:

rtrm's picture
download
raw
76.7 kB
import{s as En,o as Dn,n as D}from"../chunks/scheduler.25b97de1.js";import{S as Rn,i as An,g as p,s as a,r as h,A as Sn,h as m,f as s,c as r,j as z,u as f,x as y,k as j,y as l,a as c,v as g,d as _,t as b,w as k}from"../chunks/index.d9030fc9.js";import{T as jt}from"../chunks/Tip.baa67368.js";import{D as E}from"../chunks/Docstring.ffac8efa.js";import{C as re}from"../chunks/CodeBlock.e6cd0d95.js";import{E as Fe}from"../chunks/ExampleCodeBlock.22dfe688.js";import{H as R,E as Xn}from"../chunks/EditOnGithub.91d95064.js";function On(C){let n,v="Example:",d,i,u;return i=new re({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENvZGVHZW5Db25maWclMkMlMjBDb2RlR2VuTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwQ29kZUdlbiUyMDZCJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBDb2RlR2VuQ29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjAod2l0aCUyMHJhbmRvbSUyMHdlaWdodHMpJTIwZnJvbSUyMHRoZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMENvZGVHZW5Nb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CodeGenConfig, CodeGenModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a CodeGen 6B configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = CodeGenConfig()
<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 = CodeGenModel(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=p("p"),n.textContent=v,d=a(),h(i.$$.fragment)},l(t){n=m(t,"P",{"data-svelte-h":!0}),y(n)!=="svelte-11lpom8"&&(n.textContent=v),d=r(t),f(i.$$.fragment,t)},m(t,$){c(t,n,$),c(t,d,$),g(i,t,$),u=!0},p:D,i(t){u||(_(i.$$.fragment,t),u=!0)},o(t){b(i.$$.fragment,t),u=!1},d(t){t&&(s(n),s(d)),k(i,t)}}}function Qn(C){let n,v="be encoded differently whether it is at the beginning of the sentence (without space) or not:",d,i,u;return i=new re({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENvZGVHZW5Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBDb2RlR2VuVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJTYWxlc2ZvcmNlJTJGY29kZWdlbi0zNTBNLW1vbm8lMjIpJTBBdG9rZW5pemVyKCUyMkhlbGxvJTIwd29ybGQlMjIpJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTBBJTBBdG9rZW5pemVyKCUyMiUyMEhlbGxvJTIwd29ybGQlMjIpJTVCJTIyaW5wdXRfaWRzJTIyJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CodeGenTokenizer
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = CodeGenTokenizer.from_pretrained(<span class="hljs-string">&quot;Salesforce/codegen-350M-mono&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer(<span class="hljs-string">&quot;Hello world&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]
[<span class="hljs-number">15496</span>, <span class="hljs-number">995</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer(<span class="hljs-string">&quot; Hello world&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]
[<span class="hljs-number">18435</span>, <span class="hljs-number">995</span>]`,wrap:!1}}),{c(){n=p("p"),n.textContent=v,d=a(),h(i.$$.fragment)},l(t){n=m(t,"P",{"data-svelte-h":!0}),y(n)!=="svelte-12atnao"&&(n.textContent=v),d=r(t),f(i.$$.fragment,t)},m(t,$){c(t,n,$),c(t,d,$),g(i,t,$),u=!0},p:D,i(t){u||(_(i.$$.fragment,t),u=!0)},o(t){b(i.$$.fragment,t),u=!1},d(t){t&&(s(n),s(d)),k(i,t)}}}function Yn(C){let n,v="When used with <code>is_split_into_words=True</code>, this tokenizer will add a space before each word (even the first one).";return{c(){n=p("p"),n.innerHTML=v},l(d){n=m(d,"P",{"data-svelte-h":!0}),y(n)!=="svelte-jhmxzm"&&(n.innerHTML=v)},m(d,i){c(d,n,i)},p:D,d(d){d&&s(n)}}}function Kn(C){let n,v="pair mask has the following format:",d,i,u;return i=new re({props:{code:"MCUyMDAlMjAwJTIwMCUyMDAlMjAwJTIwMCUyMDAlMjAwJTIwMCUyMDAlMjAxJTIwMSUyMDElMjAxJTIwMSUyMDElMjAxJTIwMSUyMDElMEElN0MlMjBmaXJzdCUyMHNlcXVlbmNlJTIwJTIwJTIwJTIwJTdDJTIwc2Vjb25kJTIwc2VxdWVuY2UlMjAlN0M=",highlighted:`0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1 1
| first sequence | second sequence |`,wrap:!1}}),{c(){n=p("p"),n.textContent=v,d=a(),h(i.$$.fragment)},l(t){n=m(t,"P",{"data-svelte-h":!0}),y(n)!=="svelte-qjgeij"&&(n.textContent=v),d=r(t),f(i.$$.fragment,t)},m(t,$){c(t,n,$),c(t,d,$),g(i,t,$),u=!0},p:D,i(t){u||(_(i.$$.fragment,t),u=!0)},o(t){b(i.$$.fragment,t),u=!1},d(t){t&&(s(n),s(d)),k(i,t)}}}function eo(C){let n,v="be encoded differently whether it is at the beginning of the sentence (without space) or not:",d,i,u;return i=new re({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENvZGVHZW5Ub2tlbml6ZXJGYXN0JTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQ29kZUdlblRva2VuaXplckZhc3QuZnJvbV9wcmV0cmFpbmVkKCUyMlNhbGVzZm9yY2UlMkZjb2RlZ2VuLTM1ME0tbW9ubyUyMiklMEF0b2tlbml6ZXIoJTIySGVsbG8lMjB3b3JsZCUyMiklNUIlMjJpbnB1dF9pZHMlMjIlNUQlMEElMEF0b2tlbml6ZXIoJTIyJTIwSGVsbG8lMjB3b3JsZCUyMiklNUIlMjJpbnB1dF9pZHMlMjIlNUQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CodeGenTokenizerFast
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = CodeGenTokenizerFast.from_pretrained(<span class="hljs-string">&quot;Salesforce/codegen-350M-mono&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer(<span class="hljs-string">&quot;Hello world&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]
[<span class="hljs-number">15496</span>, <span class="hljs-number">995</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer(<span class="hljs-string">&quot; Hello world&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]
[<span class="hljs-number">18435</span>, <span class="hljs-number">995</span>]`,wrap:!1}}),{c(){n=p("p"),n.textContent=v,d=a(),h(i.$$.fragment)},l(t){n=m(t,"P",{"data-svelte-h":!0}),y(n)!=="svelte-12atnao"&&(n.textContent=v),d=r(t),f(i.$$.fragment,t)},m(t,$){c(t,n,$),c(t,d,$),g(i,t,$),u=!0},p:D,i(t){u||(_(i.$$.fragment,t),u=!0)},o(t){b(i.$$.fragment,t),u=!1},d(t){t&&(s(n),s(d)),k(i,t)}}}function to(C){let n,v="When used with <code>is_split_into_words=True</code>, this tokenizer needs to be instantiated with <code>add_prefix_space=True</code>.";return{c(){n=p("p"),n.innerHTML=v},l(d){n=m(d,"P",{"data-svelte-h":!0}),y(n)!=="svelte-9gg91e"&&(n.innerHTML=v)},m(d,i){c(d,n,i)},p:D,d(d){d&&s(n)}}}function no(C){let n,v="pair mask has the following format:",d,i,u;return i=new re({props:{code:"MCUyMDAlMjAwJTIwMCUyMDAlMjAwJTIwMCUyMDAlMjAwJTIwMCUyMDAlMjAxJTIwMSUyMDElMjAxJTIwMSUyMDElMjAxJTIwMSUyMDElMEElN0MlMjBmaXJzdCUyMHNlcXVlbmNlJTIwJTIwJTIwJTIwJTdDJTIwc2Vjb25kJTIwc2VxdWVuY2UlMjAlN0M=",highlighted:`0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1 1
| first sequence | second sequence |`,wrap:!1}}),{c(){n=p("p"),n.textContent=v,d=a(),h(i.$$.fragment)},l(t){n=m(t,"P",{"data-svelte-h":!0}),y(n)!=="svelte-qjgeij"&&(n.textContent=v),d=r(t),f(i.$$.fragment,t)},m(t,$){c(t,n,$),c(t,d,$),g(i,t,$),u=!0},p:D,i(t){u||(_(i.$$.fragment,t),u=!0)},o(t){b(i.$$.fragment,t),u=!1},d(t){t&&(s(n),s(d)),k(i,t)}}}function oo(C){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=p("p"),n.innerHTML=v},l(d){n=m(d,"P",{"data-svelte-h":!0}),y(n)!=="svelte-fincs2"&&(n.innerHTML=v)},m(d,i){c(d,n,i)},p:D,d(d){d&&s(n)}}}function so(C){let n,v="Example:",d,i,u;return i=new re({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBDb2RlR2VuTW9kZWwlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMlNhbGVzZm9yY2UlMkZjb2RlZ2VuLTJCLW1vbm8lMjIpJTBBbW9kZWwlMjAlM0QlMjBDb2RlR2VuTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMlNhbGVzZm9yY2UlMkZjb2RlZ2VuLTJCLW1vbm8lMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRl",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, CodeGenModel
<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;Salesforce/codegen-2B-mono&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = CodeGenModel.from_pretrained(<span class="hljs-string">&quot;Salesforce/codegen-2B-mono&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=p("p"),n.textContent=v,d=a(),h(i.$$.fragment)},l(t){n=m(t,"P",{"data-svelte-h":!0}),y(n)!=="svelte-11lpom8"&&(n.textContent=v),d=r(t),f(i.$$.fragment,t)},m(t,$){c(t,n,$),c(t,d,$),g(i,t,$),u=!0},p:D,i(t){u||(_(i.$$.fragment,t),u=!0)},o(t){b(i.$$.fragment,t),u=!1},d(t){t&&(s(n),s(d)),k(i,t)}}}function ao(C){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=p("p"),n.innerHTML=v},l(d){n=m(d,"P",{"data-svelte-h":!0}),y(n)!=="svelte-fincs2"&&(n.innerHTML=v)},m(d,i){c(d,n,i)},p:D,d(d){d&&s(n)}}}function ro(C){let n,v="Example:",d,i,u;return i=new re({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMENvZGVHZW5Gb3JDYXVzYWxMTSUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMlNhbGVzZm9yY2UlMkZjb2RlZ2VuLTJCLW1vbm8lMjIpJTBBbW9kZWwlMjAlM0QlMjBDb2RlR2VuRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMlNhbGVzZm9yY2UlMkZjb2RlZ2VuLTJCLW1vbm8lMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGlucHV0cyU1QiUyMmlucHV0X2lkcyUyMiU1RCklMEFsb3NzJTIwJTNEJTIwb3V0cHV0cy5sb3NzJTBBbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHM=",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, CodeGenForCausalLM
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;Salesforce/codegen-2B-mono&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = CodeGenForCausalLM.from_pretrained(<span class="hljs-string">&quot;Salesforce/codegen-2B-mono&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=p("p"),n.textContent=v,d=a(),h(i.$$.fragment)},l(t){n=m(t,"P",{"data-svelte-h":!0}),y(n)!=="svelte-11lpom8"&&(n.textContent=v),d=r(t),f(i.$$.fragment,t)},m(t,$){c(t,n,$),c(t,d,$),g(i,t,$),u=!0},p:D,i(t){u||(_(i.$$.fragment,t),u=!0)},o(t){b(i.$$.fragment,t),u=!1},d(t){t&&(s(n),s(d)),k(i,t)}}}function io(C){let n,v,d,i,u,t,$,rt,ie,gn='The CodeGen model was proposed in <a href="https://arxiv.org/abs/2203.13474" rel="nofollow">A Conversational Paradigm for Program Synthesis</a> by Erik Nijkamp, Bo Pang, Hiroaki Hayashi, Lifu Tu, Huan Wang, Yingbo Zhou, Silvio Savarese, and Caiming Xiong.',it,le,_n='CodeGen is an autoregressive language model for program synthesis trained sequentially on <a href="https://pile.eleuther.ai/" rel="nofollow">The Pile</a>, BigQuery, and BigPython.',lt,de,bn="The abstract from the paper is the following:",dt,ce,kn='<em>Program synthesis strives to generate a computer program as a solution to a given problem specification. We propose a conversational program synthesis approach via large language models, which addresses the challenges of searching over a vast program space and user intent specification faced in prior approaches. Our new approach casts the process of writing a specification and program as a multi-turn conversation between a user and a system. It treats program synthesis as a sequence prediction problem, in which the specification is expressed in natural language and the desired program is conditionally sampled. We train a family of large language models, called CodeGen, on natural language and programming language data. With weak supervision in the data and the scaling up of data size and model size, conversational capacities emerge from the simple autoregressive language modeling. To study the model behavior on conversational program synthesis, we develop a multi-turn programming benchmark (MTPB), where solving each problem requires multi-step synthesis via multi-turn conversation between the user and the model. Our findings show the emergence of conversational capabilities and the effectiveness of the proposed conversational program synthesis paradigm. In addition, our model CodeGen (with up to 16B parameters trained on TPU-v4) outperforms OpenAI’s Codex on the HumanEval benchmark. We make the training library JaxFormer including checkpoints available as open source contribution: <a href="https://github.com/salesforce/codegen" rel="nofollow">this https URL</a>.</em>',ct,pe,yn=`This model was contributed by <a href="https://huggingface.co/rooa" rel="nofollow">Hiroaki Hayashi</a>.
The original code can be found <a href="https://github.com/salesforce/codegen" rel="nofollow">here</a>.`,pt,me,mt,ue,vn='<li>CodeGen model <a href="https://huggingface.co/models?other=codegen" rel="nofollow">checkpoints</a> are available on different pre-training data with variable sizes.</li> <li>The format is: <code>Salesforce/codegen-{size}-{data}</code>, where<ul><li><code>size</code>: <code>350M</code>, <code>2B</code>, <code>6B</code>, <code>16B</code></li> <li><code>data</code>: <ul><li><code>nl</code>: Pre-trained on the Pile</li> <li><code>multi</code>: Initialized with <code>nl</code>, then further pre-trained on multiple programming languages data</li> <li><code>mono</code>: Initialized with <code>multi</code>, then further pre-trained on Python data</li></ul></li></ul></li> <li>For example, <code>Salesforce/codegen-350M-mono</code> offers a 350 million-parameter checkpoint pre-trained sequentially on the Pile, multiple programming languages, and Python.</li>',ut,he,ht,fe,ft,ge,gt,_e,$n='<li><a href="../tasks/language_modeling">Causal language modeling task guide</a></li>',_t,be,bt,L,ke,qt,Le,Cn=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_34606/en/model_doc/codegen#transformers.CodeGenModel">CodeGenModel</a>. It is used to instantiate a
CodeGen 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 CodeGen
<a href="https://huggingface.co/Salesforce/codegen-2B-mono" rel="nofollow">Salesforce/codegen-2B-mono</a> architecture. Configuration objects
inherit from <a href="/docs/transformers/pr_34606/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/pr_34606/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Ut,X,kt,ye,yt,T,ve,It,We,Tn="Construct a CodeGen tokenizer. Based on byte-level Byte-Pair-Encoding.",Jt,Ze,wn="This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will",Ft,O,Lt,Ve,Mn=`You can get around that behavior by passing <code>add_prefix_space=True</code> when instantiating this tokenizer or when you
call it on some text, but since the model was not pretrained this way, it might yield a decrease in performance.`,Wt,Q,Zt,Ne,xn=`This tokenizer inherits from <a href="/docs/transformers/pr_34606/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a> which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`,Vt,q,$e,Nt,He,Gn="Create a mask from the two sequences passed to be used in a sequence-pair classification task. A sequence",Ht,Y,Pt,Pe,zn="If <code>token_ids_1</code> is <code>None</code>, this method only returns the first portion of the mask (0s).",Bt,Be,Ce,vt,Te,$t,w,we,Et,Ee,jn=`Construct a “fast” CodeGen tokenizer (backed by HuggingFace’s <em>tokenizers</em> library). Based on byte-level
Byte-Pair-Encoding.`,Dt,De,qn="This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will",Rt,K,At,Re,Un=`You can get around that behavior by passing <code>add_prefix_space=True</code> when instantiating this tokenizer, but since
the model was not pretrained this way, it might yield a decrease in performance.`,St,ee,Xt,Ae,In=`This tokenizer inherits from <a href="/docs/transformers/pr_34606/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast">PreTrainedTokenizerFast</a> which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`,Ot,U,Me,Qt,Se,Jn="Create a mask from the two sequences passed to be used in a sequence-pair classification task. A sequence",Yt,te,Kt,Xe,Fn="If <code>token_ids_1</code> is <code>None</code>, this method only returns the first portion of the mask (0s).",en,I,xe,tn,Oe,Ln=`Converts a sequence of ids in a string, using the tokenizer and vocabulary with options to remove special
tokens and clean up tokenization spaces.`,nn,Qe,Wn="Similar to doing <code>self.convert_tokens_to_string(self.convert_ids_to_tokens(token_ids))</code>.",on,Ye,Zn=`”]\`.
kwargs (additional keyword arguments, <em>optional</em>):
Will be passed to the underlying model specific decode method.`,Ct,Ge,Tt,W,ze,sn,Ke,Vn=`The bare CodeGen Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,an,J,je,rn,et,Nn='The <a href="/docs/transformers/pr_34606/en/model_doc/codegen#transformers.CodeGenModel">CodeGenModel</a> forward method, overrides the <code>__call__</code> special method.',ln,ne,dn,oe,wt,qe,Mt,G,Ue,cn,tt,Hn="The CodeGen Model transformer with a language modeling head on top.",pn,nt,Pn=`This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,mn,F,Ie,un,ot,Bn='The <a href="/docs/transformers/pr_34606/en/model_doc/codegen#transformers.CodeGenForCausalLM">CodeGenForCausalLM</a> forward method, overrides the <code>__call__</code> special method.',hn,se,fn,ae,xt,Je,Gt,st,zt;return u=new R({props:{title:"CodeGen",local:"codegen",headingTag:"h1"}}),$=new R({props:{title:"Overview",local:"overview",headingTag:"h2"}}),me=new R({props:{title:"Checkpoint Naming",local:"checkpoint-naming",headingTag:"h2"}}),he=new R({props:{title:"Usage example",local:"usage-example",headingTag:"h2"}}),fe=new re({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUwQSUwQWNoZWNrcG9pbnQlMjAlM0QlMjAlMjJTYWxlc2ZvcmNlJTJGY29kZWdlbi0zNTBNLW1vbm8lMjIlMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZChjaGVja3BvaW50KSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKGNoZWNrcG9pbnQpJTBBJTBBdGV4dCUyMCUzRCUyMCUyMmRlZiUyMGhlbGxvX3dvcmxkKCklM0ElMjIlMEElMEFjb21wbGV0aW9uJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoKip0b2tlbml6ZXIodGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpKSUwQSUwQXByaW50KHRva2VuaXplci5kZWNvZGUoY29tcGxldGlvbiU1QjAlNUQpKSUwQQ==",highlighted:`<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>checkpoint = <span class="hljs-string">&quot;Salesforce/codegen-350M-mono&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(checkpoint)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(checkpoint)
<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;def hello_world():&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>completion = model.generate(**tokenizer(text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.decode(completion[<span class="hljs-number">0</span>]))
<span class="hljs-keyword">def</span> <span class="hljs-title function_">hello_world</span>():
<span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Hello World&quot;</span>)
hello_world()`,wrap:!1}}),ge=new R({props:{title:"Resources",local:"resources",headingTag:"h2"}}),be=new R({props:{title:"CodeGenConfig",local:"transformers.CodeGenConfig",headingTag:"h2"}}),ke=new E({props:{name:"class transformers.CodeGenConfig",anchor:"transformers.CodeGenConfig",parameters:[{name:"vocab_size",val:" = 50400"},{name:"n_positions",val:" = 2048"},{name:"n_ctx",val:" = 2048"},{name:"n_embd",val:" = 4096"},{name:"n_layer",val:" = 28"},{name:"n_head",val:" = 16"},{name:"rotary_dim",val:" = 64"},{name:"n_inner",val:" = None"},{name:"activation_function",val:" = 'gelu_new'"},{name:"resid_pdrop",val:" = 0.0"},{name:"embd_pdrop",val:" = 0.0"},{name:"attn_pdrop",val:" = 0.0"},{name:"layer_norm_epsilon",val:" = 1e-05"},{name:"initializer_range",val:" = 0.02"},{name:"use_cache",val:" = True"},{name:"bos_token_id",val:" = 50256"},{name:"eos_token_id",val:" = 50256"},{name:"tie_word_embeddings",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CodeGenConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 50400) &#x2014;
Vocabulary size of the CodeGen model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/pr_34606/en/model_doc/codegen#transformers.CodeGenModel">CodeGenModel</a>.`,name:"vocab_size"},{anchor:"transformers.CodeGenConfig.n_positions",description:`<strong>n_positions</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"n_positions"},{anchor:"transformers.CodeGenConfig.n_ctx",description:`<strong>n_ctx</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
This attribute is used in <code>CodeGenModel.__init__</code> without any real effect.`,name:"n_ctx"},{anchor:"transformers.CodeGenConfig.n_embd",description:`<strong>n_embd</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Dimensionality of the embeddings and hidden states.`,name:"n_embd"},{anchor:"transformers.CodeGenConfig.n_layer",description:`<strong>n_layer</strong> (<code>int</code>, <em>optional</em>, defaults to 28) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"n_layer"},{anchor:"transformers.CodeGenConfig.n_head",description:`<strong>n_head</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"n_head"},{anchor:"transformers.CodeGenConfig.rotary_dim",description:`<strong>rotary_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Number of dimensions in the embedding that Rotary Position Embedding is applied to.`,name:"rotary_dim"},{anchor:"transformers.CodeGenConfig.n_inner",description:`<strong>n_inner</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Dimensionality of the inner feed-forward layers. <code>None</code> will set it to 4 times n_embd`,name:"n_inner"},{anchor:"transformers.CodeGenConfig.activation_function",description:`<strong>activation_function</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;gelu_new&quot;</code>) &#x2014;
Activation function, to be selected in the list <code>[&quot;relu&quot;, &quot;silu&quot;, &quot;gelu&quot;, &quot;tanh&quot;, &quot;gelu_new&quot;]</code>.`,name:"activation_function"},{anchor:"transformers.CodeGenConfig.resid_pdrop",description:`<strong>resid_pdrop</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"resid_pdrop"},{anchor:"transformers.CodeGenConfig.embd_pdrop",description:`<strong>embd_pdrop</strong> (<code>int</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the embeddings.`,name:"embd_pdrop"},{anchor:"transformers.CodeGenConfig.attn_pdrop",description:`<strong>attn_pdrop</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention.`,name:"attn_pdrop"},{anchor:"transformers.CodeGenConfig.layer_norm_epsilon",description:`<strong>layer_norm_epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The epsilon to use in the layer normalization layers.`,name:"layer_norm_epsilon"},{anchor:"transformers.CodeGenConfig.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.CodeGenConfig.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.CodeGenConfig.bos_token_id",description:`<strong>bos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 50256) &#x2014;
Beginning of stream token id.`,name:"bos_token_id"},{anchor:"transformers.CodeGenConfig.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 50256) &#x2014;
End of stream token id.`,name:"eos_token_id"},{anchor:"transformers.CodeGenConfig.tie_word_embeddings",description:`<strong>tie_word_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether the model&#x2019;s input and output word embeddings should be tied. Note that this is only relevant if the
model has a output word embedding layer.`,name:"tie_word_embeddings"}],source:"https://github.com/huggingface/transformers/blob/vr_34606/src/transformers/models/codegen/configuration_codegen.py#L29"}}),X=new Fe({props:{anchor:"transformers.CodeGenConfig.example",$$slots:{default:[On]},$$scope:{ctx:C}}}),ye=new R({props:{title:"CodeGenTokenizer",local:"transformers.CodeGenTokenizer",headingTag:"h2"}}),ve=new E({props:{name:"class transformers.CodeGenTokenizer",anchor:"transformers.CodeGenTokenizer",parameters:[{name:"vocab_file",val:""},{name:"merges_file",val:""},{name:"errors",val:" = 'replace'"},{name:"unk_token",val:" = '<|endoftext|>'"},{name:"bos_token",val:" = '<|endoftext|>'"},{name:"eos_token",val:" = '<|endoftext|>'"},{name:"pad_token",val:" = None"},{name:"add_prefix_space",val:" = False"},{name:"add_bos_token",val:" = False"},{name:"return_token_type_ids",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CodeGenTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.CodeGenTokenizer.merges_file",description:`<strong>merges_file</strong> (<code>str</code>) &#x2014;
Path to the merges file.`,name:"merges_file"},{anchor:"transformers.CodeGenTokenizer.errors",description:`<strong>errors</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;replace&quot;</code>) &#x2014;
Paradigm to follow when decoding bytes to UTF-8. See
<a href="https://docs.python.org/3/library/stdtypes.html#bytes.decode" rel="nofollow">bytes.decode</a> for more information.`,name:"errors"},{anchor:"transformers.CodeGenTokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|endoftext|&gt;&quot;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"},{anchor:"transformers.CodeGenTokenizer.bos_token",description:`<strong>bos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|endoftext|&gt;&quot;</code>) &#x2014;
The beginning of sequence token.`,name:"bos_token"},{anchor:"transformers.CodeGenTokenizer.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|endoftext|&gt;&quot;</code>) &#x2014;
The end of sequence token.`,name:"eos_token"},{anchor:"transformers.CodeGenTokenizer.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.CodeGenTokenizer.add_prefix_space",description:`<strong>add_prefix_space</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to add an initial space to the input. This allows to treat the leading word just as any
other word. (CodeGen tokenizer detect beginning of words by the preceding space).`,name:"add_prefix_space"},{anchor:"transformers.CodeGenTokenizer.add_bos_token",description:`<strong>add_bos_token</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to add a beginning of sequence token at the start of sequences.`,name:"add_bos_token"},{anchor:"transformers.CodeGenTokenizer.return_token_type_ids",description:`<strong>return_token_type_ids</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to return token type IDs.`,name:"return_token_type_ids"}],source:"https://github.com/huggingface/transformers/blob/vr_34606/src/transformers/models/codegen/tokenization_codegen.py#L84"}}),O=new Fe({props:{anchor:"transformers.CodeGenTokenizer.example",$$slots:{default:[Qn]},$$scope:{ctx:C}}}),Q=new jt({props:{$$slots:{default:[Yn]},$$scope:{ctx:C}}}),$e=new E({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.CodeGenTokenizer.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": List"},{name:"token_ids_1",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.CodeGenTokenizer.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.CodeGenTokenizer.create_token_type_ids_from_sequences.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/vr_34606/src/transformers/models/codegen/tokenization_codegen.py#L279",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>List of <a href="../glossary#token-type-ids">token type IDs</a> according to the given sequence(s).</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><code>List[int]</code></p>
`}}),Y=new Fe({props:{anchor:"transformers.CodeGenTokenizer.create_token_type_ids_from_sequences.example",$$slots:{default:[Kn]},$$scope:{ctx:C}}}),Ce=new E({props:{name:"save_vocabulary",anchor:"transformers.CodeGenTokenizer.save_vocabulary",parameters:[{name:"save_directory",val:": str"},{name:"filename_prefix",val:": Optional = None"}],source:"https://github.com/huggingface/transformers/blob/vr_34606/src/transformers/models/codegen/tokenization_codegen.py#L308"}}),Te=new R({props:{title:"CodeGenTokenizerFast",local:"transformers.CodeGenTokenizerFast",headingTag:"h2"}}),we=new E({props:{name:"class transformers.CodeGenTokenizerFast",anchor:"transformers.CodeGenTokenizerFast",parameters:[{name:"vocab_file",val:" = None"},{name:"merges_file",val:" = None"},{name:"tokenizer_file",val:" = None"},{name:"unk_token",val:" = '<|endoftext|>'"},{name:"bos_token",val:" = '<|endoftext|>'"},{name:"eos_token",val:" = '<|endoftext|>'"},{name:"add_prefix_space",val:" = False"},{name:"return_token_type_ids",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CodeGenTokenizerFast.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.CodeGenTokenizerFast.merges_file",description:`<strong>merges_file</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Path to the merges file.`,name:"merges_file"},{anchor:"transformers.CodeGenTokenizerFast.tokenizer_file",description:`<strong>tokenizer_file</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Path to <a href="https://github.com/huggingface/tokenizers" rel="nofollow">tokenizers</a> file (generally has a .json extension) that
contains everything needed to load the tokenizer.`,name:"tokenizer_file"},{anchor:"transformers.CodeGenTokenizerFast.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|endoftext|&gt;&quot;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"},{anchor:"transformers.CodeGenTokenizerFast.bos_token",description:`<strong>bos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|endoftext|&gt;&quot;</code>) &#x2014;
The beginning of sequence token.`,name:"bos_token"},{anchor:"transformers.CodeGenTokenizerFast.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|endoftext|&gt;&quot;</code>) &#x2014;
The end of sequence token.`,name:"eos_token"},{anchor:"transformers.CodeGenTokenizerFast.add_prefix_space",description:`<strong>add_prefix_space</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to add an initial space to the input. This allows to treat the leading word just as any
other word. (CodeGen tokenizer detect beginning of words by the preceding space).`,name:"add_prefix_space"},{anchor:"transformers.CodeGenTokenizerFast.return_token_type_ids",description:`<strong>return_token_type_ids</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to return token type IDs.`,name:"return_token_type_ids"}],source:"https://github.com/huggingface/transformers/blob/vr_34606/src/transformers/models/codegen/tokenization_codegen_fast.py#L44"}}),K=new Fe({props:{anchor:"transformers.CodeGenTokenizerFast.example",$$slots:{default:[eo]},$$scope:{ctx:C}}}),ee=new jt({props:{$$slots:{default:[to]},$$scope:{ctx:C}}}),Me=new E({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.CodeGenTokenizerFast.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": List"},{name:"token_ids_1",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.CodeGenTokenizerFast.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.CodeGenTokenizerFast.create_token_type_ids_from_sequences.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/vr_34606/src/transformers/models/codegen/tokenization_codegen_fast.py#L168",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>List of <a href="../glossary#token-type-ids">token type IDs</a> according to the given sequence(s).</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><code>List[int]</code></p>
`}}),te=new Fe({props:{anchor:"transformers.CodeGenTokenizerFast.create_token_type_ids_from_sequences.example",$$slots:{default:[no]},$$scope:{ctx:C}}}),xe=new E({props:{name:"decode",anchor:"transformers.CodeGenTokenizerFast.decode",parameters:[{name:"token_ids",val:": Union"},{name:"skip_special_tokens",val:": bool = False"},{name:"clean_up_tokenization_spaces",val:": bool = None"},{name:"truncate_before_pattern",val:": Optional = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CodeGenTokenizerFast.decode.token_ids",description:`<strong>token_ids</strong> (<code>Union[int, List[int], np.ndarray, torch.Tensor, tf.Tensor]</code>) &#x2014;
List of tokenized input ids. Can be obtained using the <code>__call__</code> method.`,name:"token_ids"},{anchor:"transformers.CodeGenTokenizerFast.decode.skip_special_tokens",description:`<strong>skip_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to remove special tokens in the decoding.`,name:"skip_special_tokens"},{anchor:"transformers.CodeGenTokenizerFast.decode.clean_up_tokenization_spaces",description:`<strong>clean_up_tokenization_spaces</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to clean up the tokenization spaces. If <code>None</code>, will default to
<code>self.clean_up_tokenization_spaces</code> (available in the <code>tokenizer_config</code>).`,name:"clean_up_tokenization_spaces"},{anchor:"transformers.CodeGenTokenizerFast.decode.truncate_before_pattern",description:`<strong>truncate_before_pattern</strong> (<code>List[str]</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
A list of regular expression strings that will be used to truncate the returned string. This can be
used to remove extra pieces of code (e.g. truncate if observing a comment symbol &#x201D;#&#x201D; at the beginning
of a new line). An example pattern could be \`[&#x201D;^#&#x201D;, re.escape(&#x201D;&lt;|endoftext|&gt;&#x201D;), &#x201D;^&apos;&apos;&apos;&#x201D;, &#x201D;`,name:"truncate_before_pattern"}],source:"https://github.com/huggingface/transformers/blob/vr_34606/src/transformers/models/codegen/tokenization_codegen_fast.py#L201",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>The decoded sentence.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><code>str</code></p>
`}}),Ge=new R({props:{title:"CodeGenModel",local:"transformers.CodeGenModel",headingTag:"h2"}}),ze=new E({props:{name:"class transformers.CodeGenModel",anchor:"transformers.CodeGenModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.CodeGenModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_34606/en/model_doc/codegen#transformers.CodeGenConfig">CodeGenConfig</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/pr_34606/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/vr_34606/src/transformers/models/codegen/modeling_codegen.py#L406"}}),je=new E({props:{name:"forward",anchor:"transformers.CodeGenModel.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"past_key_values",val:": Union = 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:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"},{name:"cache_position",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.CodeGenModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <code>AutoProcenizer</code>. See <a href="/docs/transformers/pr_34606/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_34606/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.CodeGenModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.CodeGenModel.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.CodeGenModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.CodeGenModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_attention_heads,)</code> or <code>(n_layer, num_attention_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.CodeGenModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_dim)</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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.CodeGenModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code> or <code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>) &#x2014;
Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code>
returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p>
<p>Two formats are allowed:</p>
<ul>
<li>a <a href="/docs/transformers/pr_34606/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our
<a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>;</li>
<li>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>). This is also known as the legacy
cache format.</li>
</ul>
<p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the
legacy cache format will be returned.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don&#x2019;t
have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code>
of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.CodeGenModel.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.CodeGenModel.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.CodeGenModel.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/pr_34606/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.CodeGenModel.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) &#x2014;
Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>,
this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
the complete sequence length.`,name:"cache_position"}],source:"https://github.com/huggingface/transformers/blob/vr_34606/src/transformers/models/codegen/modeling_codegen.py#L433",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>A <a
href="/docs/transformers/pr_34606/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast"
>transformers.modeling_outputs.BaseModelOutputWithPast</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
href="/docs/transformers/pr_34606/en/model_doc/codegen#transformers.CodeGenConfig"
>CodeGenConfig</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>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><a
href="/docs/transformers/pr_34606/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast"
>transformers.modeling_outputs.BaseModelOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ne=new jt({props:{$$slots:{default:[oo]},$$scope:{ctx:C}}}),oe=new Fe({props:{anchor:"transformers.CodeGenModel.forward.example",$$slots:{default:[so]},$$scope:{ctx:C}}}),qe=new R({props:{title:"CodeGenForCausalLM",local:"transformers.CodeGenForCausalLM",headingTag:"h2"}}),Ue=new E({props:{name:"class transformers.CodeGenForCausalLM",anchor:"transformers.CodeGenForCausalLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.CodeGenForCausalLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_34606/en/model_doc/codegen#transformers.CodeGenConfig">CodeGenConfig</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/pr_34606/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/vr_34606/src/transformers/models/codegen/modeling_codegen.py#L700"}}),Ie=new E({props:{name:"forward",anchor:"transformers.CodeGenForCausalLM.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"past_key_values",val:": Union = 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"},{name:"cache_position",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.CodeGenForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <code>AutoProcenizer</code>. See <a href="/docs/transformers/pr_34606/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_34606/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.CodeGenForCausalLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.CodeGenForCausalLM.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.CodeGenForCausalLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.CodeGenForCausalLM.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_attention_heads,)</code> or <code>(n_layer, num_attention_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.CodeGenForCausalLM.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_dim)</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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.CodeGenForCausalLM.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code> or <code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>) &#x2014;
Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code>
returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p>
<p>Two formats are allowed:</p>
<ul>
<li>a <a href="/docs/transformers/pr_34606/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our
<a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>;</li>
<li>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>). This is also known as the legacy
cache format.</li>
</ul>
<p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the
legacy cache format will be returned.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don&#x2019;t
have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code>
of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.CodeGenForCausalLM.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.CodeGenForCausalLM.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.CodeGenForCausalLM.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/pr_34606/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.CodeGenForCausalLM.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) &#x2014;
Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>,
this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
the complete sequence length.`,name:"cache_position"},{anchor:"transformers.CodeGenForCausalLM.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for language modeling. Note that the labels <strong>are shifted</strong> inside the model, i.e. you can set
<code>labels = input_ids</code> Indices are selected in <code>[-100, 0, ..., config.vocab_size]</code> All labels set to <code>-100</code>
are ignored (masked), the loss is only computed for labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_34606/src/transformers/models/codegen/modeling_codegen.py#L723",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>A <a
href="/docs/transformers/pr_34606/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
href="/docs/transformers/pr_34606/en/model_doc/codegen#transformers.CodeGenConfig"
>CodeGenConfig</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>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>)</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — 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>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><a
href="/docs/transformers/pr_34606/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),se=new jt({props:{$$slots:{default:[ao]},$$scope:{ctx:C}}}),ae=new Fe({props:{anchor:"transformers.CodeGenForCausalLM.forward.example",$$slots:{default:[ro]},$$scope:{ctx:C}}}),Je=new Xn({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/codegen.md"}}),{c(){n=p("meta"),v=a(),d=p("p"),i=a(),h(u.$$.fragment),t=a(),h($.$$.fragment),rt=a(),ie=p("p"),ie.innerHTML=gn,it=a(),le=p("p"),le.innerHTML=_n,lt=a(),de=p("p"),de.textContent=bn,dt=a(),ce=p("p"),ce.innerHTML=kn,ct=a(),pe=p("p"),pe.innerHTML=yn,pt=a(),h(me.$$.fragment),mt=a(),ue=p("ul"),ue.innerHTML=vn,ut=a(),h(he.$$.fragment),ht=a(),h(fe.$$.fragment),ft=a(),h(ge.$$.fragment),gt=a(),_e=p("ul"),_e.innerHTML=$n,_t=a(),h(be.$$.fragment),bt=a(),L=p("div"),h(ke.$$.fragment),qt=a(),Le=p("p"),Le.innerHTML=Cn,Ut=a(),h(X.$$.fragment),kt=a(),h(ye.$$.fragment),yt=a(),T=p("div"),h(ve.$$.fragment),It=a(),We=p("p"),We.textContent=Tn,Jt=a(),Ze=p("p"),Ze.textContent=wn,Ft=a(),h(O.$$.fragment),Lt=a(),Ve=p("p"),Ve.innerHTML=Mn,Wt=a(),h(Q.$$.fragment),Zt=a(),Ne=p("p"),Ne.innerHTML=xn,Vt=a(),q=p("div"),h($e.$$.fragment),Nt=a(),He=p("p"),He.textContent=Gn,Ht=a(),h(Y.$$.fragment),Pt=a(),Pe=p("p"),Pe.innerHTML=zn,Bt=a(),Be=p("div"),h(Ce.$$.fragment),vt=a(),h(Te.$$.fragment),$t=a(),w=p("div"),h(we.$$.fragment),Et=a(),Ee=p("p"),Ee.innerHTML=jn,Dt=a(),De=p("p"),De.textContent=qn,Rt=a(),h(K.$$.fragment),At=a(),Re=p("p"),Re.innerHTML=Un,St=a(),h(ee.$$.fragment),Xt=a(),Ae=p("p"),Ae.innerHTML=In,Ot=a(),U=p("div"),h(Me.$$.fragment),Qt=a(),Se=p("p"),Se.textContent=Jn,Yt=a(),h(te.$$.fragment),Kt=a(),Xe=p("p"),Xe.innerHTML=Fn,en=a(),I=p("div"),h(xe.$$.fragment),tn=a(),Oe=p("p"),Oe.textContent=Ln,nn=a(),Qe=p("p"),Qe.innerHTML=Wn,on=a(),Ye=p("p"),Ye.innerHTML=Zn,Ct=a(),h(Ge.$$.fragment),Tt=a(),W=p("div"),h(ze.$$.fragment),sn=a(),Ke=p("p"),Ke.innerHTML=Vn,an=a(),J=p("div"),h(je.$$.fragment),rn=a(),et=p("p"),et.innerHTML=Nn,ln=a(),h(ne.$$.fragment),dn=a(),h(oe.$$.fragment),wt=a(),h(qe.$$.fragment),Mt=a(),G=p("div"),h(Ue.$$.fragment),cn=a(),tt=p("p"),tt.textContent=Hn,pn=a(),nt=p("p"),nt.innerHTML=Pn,mn=a(),F=p("div"),h(Ie.$$.fragment),un=a(),ot=p("p"),ot.innerHTML=Bn,hn=a(),h(se.$$.fragment),fn=a(),h(ae.$$.fragment),xt=a(),h(Je.$$.fragment),Gt=a(),st=p("p"),this.h()},l(e){const o=Sn("svelte-u9bgzb",document.head);n=m(o,"META",{name:!0,content:!0}),o.forEach(s),v=r(e),d=m(e,"P",{}),z(d).forEach(s),i=r(e),f(u.$$.fragment,e),t=r(e),f($.$$.fragment,e),rt=r(e),ie=m(e,"P",{"data-svelte-h":!0}),y(ie)!=="svelte-18sg9sp"&&(ie.innerHTML=gn),it=r(e),le=m(e,"P",{"data-svelte-h":!0}),y(le)!=="svelte-1otqweb"&&(le.innerHTML=_n),lt=r(e),de=m(e,"P",{"data-svelte-h":!0}),y(de)!=="svelte-vfdo9a"&&(de.textContent=bn),dt=r(e),ce=m(e,"P",{"data-svelte-h":!0}),y(ce)!=="svelte-wlq8gq"&&(ce.innerHTML=kn),ct=r(e),pe=m(e,"P",{"data-svelte-h":!0}),y(pe)!=="svelte-1tmo4v6"&&(pe.innerHTML=yn),pt=r(e),f(me.$$.fragment,e),mt=r(e),ue=m(e,"UL",{"data-svelte-h":!0}),y(ue)!=="svelte-df3ea3"&&(ue.innerHTML=vn),ut=r(e),f(he.$$.fragment,e),ht=r(e),f(fe.$$.fragment,e),ft=r(e),f(ge.$$.fragment,e),gt=r(e),_e=m(e,"UL",{"data-svelte-h":!0}),y(_e)!=="svelte-162aebv"&&(_e.innerHTML=$n),_t=r(e),f(be.$$.fragment,e),bt=r(e),L=m(e,"DIV",{class:!0});var A=z(L);f(ke.$$.fragment,A),qt=r(A),Le=m(A,"P",{"data-svelte-h":!0}),y(Le)!=="svelte-ey2hyq"&&(Le.innerHTML=Cn),Ut=r(A),f(X.$$.fragment,A),A.forEach(s),kt=r(e),f(ye.$$.fragment,e),yt=r(e),T=m(e,"DIV",{class:!0});var M=z(T);f(ve.$$.fragment,M),It=r(M),We=m(M,"P",{"data-svelte-h":!0}),y(We)!=="svelte-3tmseo"&&(We.textContent=Tn),Jt=r(M),Ze=m(M,"P",{"data-svelte-h":!0}),y(Ze)!=="svelte-1s077p3"&&(Ze.textContent=wn),Ft=r(M),f(O.$$.fragment,M),Lt=r(M),Ve=m(M,"P",{"data-svelte-h":!0}),y(Ve)!=="svelte-1jfcabo"&&(Ve.innerHTML=Mn),Wt=r(M),f(Q.$$.fragment,M),Zt=r(M),Ne=m(M,"P",{"data-svelte-h":!0}),y(Ne)!=="svelte-1kwh55n"&&(Ne.innerHTML=xn),Vt=r(M),q=m(M,"DIV",{class:!0});var Z=z(q);f($e.$$.fragment,Z),Nt=r(Z),He=m(Z,"P",{"data-svelte-h":!0}),y(He)!=="svelte-1oby08q"&&(He.textContent=Gn),Ht=r(Z),f(Y.$$.fragment,Z),Pt=r(Z),Pe=m(Z,"P",{"data-svelte-h":!0}),y(Pe)!=="svelte-owoxgn"&&(Pe.innerHTML=zn),Z.forEach(s),Bt=r(M),Be=m(M,"DIV",{class:!0});var at=z(Be);f(Ce.$$.fragment,at),at.forEach(s),M.forEach(s),vt=r(e),f(Te.$$.fragment,e),$t=r(e),w=m(e,"DIV",{class:!0});var x=z(w);f(we.$$.fragment,x),Et=r(x),Ee=m(x,"P",{"data-svelte-h":!0}),y(Ee)!=="svelte-ct13nj"&&(Ee.innerHTML=jn),Dt=r(x),De=m(x,"P",{"data-svelte-h":!0}),y(De)!=="svelte-1s077p3"&&(De.textContent=qn),Rt=r(x),f(K.$$.fragment,x),At=r(x),Re=m(x,"P",{"data-svelte-h":!0}),y(Re)!=="svelte-1afeqmz"&&(Re.innerHTML=Un),St=r(x),f(ee.$$.fragment,x),Xt=r(x),Ae=m(x,"P",{"data-svelte-h":!0}),y(Ae)!=="svelte-1khtnuf"&&(Ae.innerHTML=In),Ot=r(x),U=m(x,"DIV",{class:!0});var V=z(U);f(Me.$$.fragment,V),Qt=r(V),Se=m(V,"P",{"data-svelte-h":!0}),y(Se)!=="svelte-1oby08q"&&(Se.textContent=Jn),Yt=r(V),f(te.$$.fragment,V),Kt=r(V),Xe=m(V,"P",{"data-svelte-h":!0}),y(Xe)!=="svelte-owoxgn"&&(Xe.innerHTML=Fn),V.forEach(s),en=r(x),I=m(x,"DIV",{class:!0});var N=z(I);f(xe.$$.fragment,N),tn=r(N),Oe=m(N,"P",{"data-svelte-h":!0}),y(Oe)!=="svelte-vbfkpu"&&(Oe.textContent=Ln),nn=r(N),Qe=m(N,"P",{"data-svelte-h":!0}),y(Qe)!=="svelte-125uxon"&&(Qe.innerHTML=Wn),on=r(N),Ye=m(N,"P",{"data-svelte-h":!0}),y(Ye)!=="svelte-zuidod"&&(Ye.innerHTML=Zn),N.forEach(s),x.forEach(s),Ct=r(e),f(Ge.$$.fragment,e),Tt=r(e),W=m(e,"DIV",{class:!0});var S=z(W);f(ze.$$.fragment,S),sn=r(S),Ke=m(S,"P",{"data-svelte-h":!0}),y(Ke)!=="svelte-4cc469"&&(Ke.innerHTML=Vn),an=r(S),J=m(S,"DIV",{class:!0});var H=z(J);f(je.$$.fragment,H),rn=r(H),et=m(H,"P",{"data-svelte-h":!0}),y(et)!=="svelte-1ol5465"&&(et.innerHTML=Nn),ln=r(H),f(ne.$$.fragment,H),dn=r(H),f(oe.$$.fragment,H),H.forEach(s),S.forEach(s),wt=r(e),f(qe.$$.fragment,e),Mt=r(e),G=m(e,"DIV",{class:!0});var P=z(G);f(Ue.$$.fragment,P),cn=r(P),tt=m(P,"P",{"data-svelte-h":!0}),y(tt)!=="svelte-8jmfdo"&&(tt.textContent=Hn),pn=r(P),nt=m(P,"P",{"data-svelte-h":!0}),y(nt)!=="svelte-68lg8f"&&(nt.innerHTML=Pn),mn=r(P),F=m(P,"DIV",{class:!0});var B=z(F);f(Ie.$$.fragment,B),un=r(B),ot=m(B,"P",{"data-svelte-h":!0}),y(ot)!=="svelte-6txlpp"&&(ot.innerHTML=Bn),hn=r(B),f(se.$$.fragment,B),fn=r(B),f(ae.$$.fragment,B),B.forEach(s),P.forEach(s),xt=r(e),f(Je.$$.fragment,e),Gt=r(e),st=m(e,"P",{}),z(st).forEach(s),this.h()},h(){j(n,"name","hf:doc:metadata"),j(n,"content",lo),j(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(Be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(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,o){l(document.head,n),c(e,v,o),c(e,d,o),c(e,i,o),g(u,e,o),c(e,t,o),g($,e,o),c(e,rt,o),c(e,ie,o),c(e,it,o),c(e,le,o),c(e,lt,o),c(e,de,o),c(e,dt,o),c(e,ce,o),c(e,ct,o),c(e,pe,o),c(e,pt,o),g(me,e,o),c(e,mt,o),c(e,ue,o),c(e,ut,o),g(he,e,o),c(e,ht,o),g(fe,e,o),c(e,ft,o),g(ge,e,o),c(e,gt,o),c(e,_e,o),c(e,_t,o),g(be,e,o),c(e,bt,o),c(e,L,o),g(ke,L,null),l(L,qt),l(L,Le),l(L,Ut),g(X,L,null),c(e,kt,o),g(ye,e,o),c(e,yt,o),c(e,T,o),g(ve,T,null),l(T,It),l(T,We),l(T,Jt),l(T,Ze),l(T,Ft),g(O,T,null),l(T,Lt),l(T,Ve),l(T,Wt),g(Q,T,null),l(T,Zt),l(T,Ne),l(T,Vt),l(T,q),g($e,q,null),l(q,Nt),l(q,He),l(q,Ht),g(Y,q,null),l(q,Pt),l(q,Pe),l(T,Bt),l(T,Be),g(Ce,Be,null),c(e,vt,o),g(Te,e,o),c(e,$t,o),c(e,w,o),g(we,w,null),l(w,Et),l(w,Ee),l(w,Dt),l(w,De),l(w,Rt),g(K,w,null),l(w,At),l(w,Re),l(w,St),g(ee,w,null),l(w,Xt),l(w,Ae),l(w,Ot),l(w,U),g(Me,U,null),l(U,Qt),l(U,Se),l(U,Yt),g(te,U,null),l(U,Kt),l(U,Xe),l(w,en),l(w,I),g(xe,I,null),l(I,tn),l(I,Oe),l(I,nn),l(I,Qe),l(I,on),l(I,Ye),c(e,Ct,o),g(Ge,e,o),c(e,Tt,o),c(e,W,o),g(ze,W,null),l(W,sn),l(W,Ke),l(W,an),l(W,J),g(je,J,null),l(J,rn),l(J,et),l(J,ln),g(ne,J,null),l(J,dn),g(oe,J,null),c(e,wt,o),g(qe,e,o),c(e,Mt,o),c(e,G,o),g(Ue,G,null),l(G,cn),l(G,tt),l(G,pn),l(G,nt),l(G,mn),l(G,F),g(Ie,F,null),l(F,un),l(F,ot),l(F,hn),g(se,F,null),l(F,fn),g(ae,F,null),c(e,xt,o),g(Je,e,o),c(e,Gt,o),c(e,st,o),zt=!0},p(e,[o]){const A={};o&2&&(A.$$scope={dirty:o,ctx:e}),X.$set(A);const M={};o&2&&(M.$$scope={dirty:o,ctx:e}),O.$set(M);const Z={};o&2&&(Z.$$scope={dirty:o,ctx:e}),Q.$set(Z);const at={};o&2&&(at.$$scope={dirty:o,ctx:e}),Y.$set(at);const x={};o&2&&(x.$$scope={dirty:o,ctx:e}),K.$set(x);const V={};o&2&&(V.$$scope={dirty:o,ctx:e}),ee.$set(V);const N={};o&2&&(N.$$scope={dirty:o,ctx:e}),te.$set(N);const S={};o&2&&(S.$$scope={dirty:o,ctx:e}),ne.$set(S);const H={};o&2&&(H.$$scope={dirty:o,ctx:e}),oe.$set(H);const P={};o&2&&(P.$$scope={dirty:o,ctx:e}),se.$set(P);const B={};o&2&&(B.$$scope={dirty:o,ctx:e}),ae.$set(B)},i(e){zt||(_(u.$$.fragment,e),_($.$$.fragment,e),_(me.$$.fragment,e),_(he.$$.fragment,e),_(fe.$$.fragment,e),_(ge.$$.fragment,e),_(be.$$.fragment,e),_(ke.$$.fragment,e),_(X.$$.fragment,e),_(ye.$$.fragment,e),_(ve.$$.fragment,e),_(O.$$.fragment,e),_(Q.$$.fragment,e),_($e.$$.fragment,e),_(Y.$$.fragment,e),_(Ce.$$.fragment,e),_(Te.$$.fragment,e),_(we.$$.fragment,e),_(K.$$.fragment,e),_(ee.$$.fragment,e),_(Me.$$.fragment,e),_(te.$$.fragment,e),_(xe.$$.fragment,e),_(Ge.$$.fragment,e),_(ze.$$.fragment,e),_(je.$$.fragment,e),_(ne.$$.fragment,e),_(oe.$$.fragment,e),_(qe.$$.fragment,e),_(Ue.$$.fragment,e),_(Ie.$$.fragment,e),_(se.$$.fragment,e),_(ae.$$.fragment,e),_(Je.$$.fragment,e),zt=!0)},o(e){b(u.$$.fragment,e),b($.$$.fragment,e),b(me.$$.fragment,e),b(he.$$.fragment,e),b(fe.$$.fragment,e),b(ge.$$.fragment,e),b(be.$$.fragment,e),b(ke.$$.fragment,e),b(X.$$.fragment,e),b(ye.$$.fragment,e),b(ve.$$.fragment,e),b(O.$$.fragment,e),b(Q.$$.fragment,e),b($e.$$.fragment,e),b(Y.$$.fragment,e),b(Ce.$$.fragment,e),b(Te.$$.fragment,e),b(we.$$.fragment,e),b(K.$$.fragment,e),b(ee.$$.fragment,e),b(Me.$$.fragment,e),b(te.$$.fragment,e),b(xe.$$.fragment,e),b(Ge.$$.fragment,e),b(ze.$$.fragment,e),b(je.$$.fragment,e),b(ne.$$.fragment,e),b(oe.$$.fragment,e),b(qe.$$.fragment,e),b(Ue.$$.fragment,e),b(Ie.$$.fragment,e),b(se.$$.fragment,e),b(ae.$$.fragment,e),b(Je.$$.fragment,e),zt=!1},d(e){e&&(s(v),s(d),s(i),s(t),s(rt),s(ie),s(it),s(le),s(lt),s(de),s(dt),s(ce),s(ct),s(pe),s(pt),s(mt),s(ue),s(ut),s(ht),s(ft),s(gt),s(_e),s(_t),s(bt),s(L),s(kt),s(yt),s(T),s(vt),s($t),s(w),s(Ct),s(Tt),s(W),s(wt),s(Mt),s(G),s(xt),s(Gt),s(st)),s(n),k(u,e),k($,e),k(me,e),k(he,e),k(fe,e),k(ge,e),k(be,e),k(ke),k(X),k(ye,e),k(ve),k(O),k(Q),k($e),k(Y),k(Ce),k(Te,e),k(we),k(K),k(ee),k(Me),k(te),k(xe),k(Ge,e),k(ze),k(je),k(ne),k(oe),k(qe,e),k(Ue),k(Ie),k(se),k(ae),k(Je,e)}}}const lo='{"title":"CodeGen","local":"codegen","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Checkpoint Naming","local":"checkpoint-naming","sections":[],"depth":2},{"title":"Usage example","local":"usage-example","sections":[],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"CodeGenConfig","local":"transformers.CodeGenConfig","sections":[],"depth":2},{"title":"CodeGenTokenizer","local":"transformers.CodeGenTokenizer","sections":[],"depth":2},{"title":"CodeGenTokenizerFast","local":"transformers.CodeGenTokenizerFast","sections":[],"depth":2},{"title":"CodeGenModel","local":"transformers.CodeGenModel","sections":[],"depth":2},{"title":"CodeGenForCausalLM","local":"transformers.CodeGenForCausalLM","sections":[],"depth":2}],"depth":1}';function co(C){return Dn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class bo extends Rn{constructor(n){super(),An(this,n,co,io,En,{})}}export{bo as component};

Xet Storage Details

Size:
76.7 kB
·
Xet hash:
2bdec303cf67ec74b9a177b3785b758a183e2ecc7323d63e1b0a61e86dd912bd

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.