import{S as AM,i as OM,s as HM,e as s,k as c,w as g,t as a,M as QM,c as o,d as r,m as l,a as n,x as f,h as i,b as d,G as t,g as m,y as u,q as _,o as b,B as y,v as YM,L as wt}from"../../chunks/vendor-hf-doc-builder.js";import{T as jl}from"../../chunks/Tip-hf-doc-builder.js";import{D as T}from"../../chunks/Docstring-hf-doc-builder.js";import{C as ye}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as be}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Tt}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function KM(E){let v,M,k,w,x;return w=new ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTSUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGdwdDIlMjIpJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsZ3B0MiUyMiklMEFtb2RlbC5jb25maWcucGFkX3Rva2VuX2lkJTIwJTNEJTIwbW9kZWwuY29uZmlnLmVvc190b2tlbl9pZCUwQW1vZGVsLmdlbmVyYXRpb25fY29uZmlnLnBhZF90b2tlbl9pZCUyMCUzRCUyMG1vZGVsLmNvbmZpZy5lb3NfdG9rZW5faWQlMEFpbnB1dF9jb250ZXh0JTIwJTNEJTIwJTIySHVnZ2luZyUyMEZhY2UlMjBDb21wYW55JTIwaXMlMjIlMEFpbnB1dF9pZHMlMjAlM0QlMjB0b2tlbml6ZXIuZW5jb2RlKGlucHV0X2NvbnRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQSUyMyUyMFdpdGhvdXQlMjAlNjBlb3NfdG9rZW5faWQlNjAlMkMlMjBpdCUyMHdpbGwlMjBnZW5lcmF0ZSUyMHRoZSUyMGRlZmF1bHQlMjBsZW5ndGglMkMlMjAyMCUyQyUyMGlnbm9yaW5nJTIwJTYwbWluX25ld190b2tlbnMlNjAlMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRfaWRzJTNEaW5wdXRfaWRzJTJDJTIwbWluX25ld190b2tlbnMlM0QzMCklMEFwcmludCh0b2tlbml6ZXIuZGVjb2RlKG91dHB1dHMlNUIwJTVEJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpKSUwQSUwQSUyMyUyMElmJTIwJTYwZW9zX3Rva2VuX2lkJTYwJTIwaXMlMjBzZXQlMjB0byUyMCU2MCUyMGNvbXBhbnklNjAlMjBpdCUyMHdpbGwlMjB0YWtlJTIwaW50byUyMGFjY291bnQlMjBob3clMjBtYW55JTIwJTYwbWluX25ld190b2tlbnMlNjAlMjBoYXZlJTIwYmVlbiUyMGdlbmVyYXRlZCUwQSUyMyUyMGJlZm9yZSUyMHN0b3BwaW5nLiUyME5vdGUlMjB0aGF0JTIwJTYwJTIwQ29tcGFueSU2MCUyMCg1ODM0KSUyMGFuZCUyMCU2MCUyMGNvbXBhbnklNjAlMjAoMTY2NCklMjBhcmUlMjBub3QlMjBhY3R1YWxseSUyMHRoZSUyMHNhbWUlMjB0b2tlbiUyQyUyMGFuZCUyMGV2ZW4lMEElMjMlMjBpZiUyMHRoZXklMjB3ZXJlJTIwJTYwJTIwQ29tcGFueSU2MCUyMHdvdWxkJTIwYmUlMjBpZ25vcmVkJTIwYnklMjAlNjBtaW5fbmV3X3Rva2VucyU2MCUyMGFzJTIwaXQlMjBleGNsdWRlcyUyMHRoZSUyMHByb21wdC4lMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRfaWRzJTNEaW5wdXRfaWRzJTJDJTIwbWluX25ld190b2tlbnMlM0QxJTJDJTIwZW9zX3Rva2VuX2lkJTNEMTY2NCklMEFwcmludCh0b2tlbml6ZXIuZGVjb2RlKG91dHB1dHMlNUIwJTVEJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpKSUwQSUwQSUyMyUyMEluY3JlYXNpbmclMjAlNjBtaW5fbmV3X3Rva2VucyU2MCUyMHdpbGwlMjBidXJ5JTIwdGhlJTIwZmlyc3QlMjBvY2N1cnJlbmNlJTIwb2YlMjAlNjAlMjBjb21wYW55JTYwJTIwZ2VuZXJhdGluZyUyMGElMjBkaWZmZXJlbnQlMjBzZXF1ZW5jZS4lMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRfaWRzJTNEaW5wdXRfaWRzJTJDJTIwbWluX25ld190b2tlbnMlM0QyJTJDJTIwZW9zX3Rva2VuX2lkJTNEMTY2NCklMEFwcmludCh0b2tlbml6ZXIuZGVjb2RlKG91dHB1dHMlNUIwJTVEJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpKSUwQSUwQSUyMyUyMElmJTIwbm8lMjBtb3JlJTIwb2NjdXJyZW5jZXMlMjBvZiUyMHRoZSUyMCU2MGVvc190b2tlbiU2MCUyMGhhcHBlbiUyMGFmdGVyJTIwJTYwbWluX25ld190b2tlbnMlNjAlMjBpdCUyMHJldHVybnMlMjB0byUyMHRoZSUyMDIwJTIwZGVmYXVsdCUyMHRva2Vucy4lMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRfaWRzJTNEaW5wdXRfaWRzJTJDJTIwbWluX25ld190b2tlbnMlM0QxMCUyQyUyMGVvc190b2tlbl9pZCUzRDE2NjQpJTBBcHJpbnQodG9rZW5pemVyLmRlY29kZShvdXRwdXRzJTVCMCU1RCUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModelForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;distilgpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;distilgpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.pad_token_id = model.config.eos_token_id
<span class="hljs-meta">&gt;&gt;&gt; </span>model.generation_config.pad_token_id = model.config.eos_token_id
<span class="hljs-meta">&gt;&gt;&gt; </span>input_context = <span class="hljs-string">&quot;Hugging Face Company is&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = tokenizer.encode(input_context, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Without \`eos_token_id\`, it will generate the default length, 20, ignoring \`min_new_tokens\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(input_ids=input_ids, min_new_tokens=<span class="hljs-number">30</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.decode(outputs[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>))
Hugging Face Company <span class="hljs-keyword">is</span> a company that has been working on a new product <span class="hljs-keyword">for</span> the past year.

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># If \`eos_token_id\` is set to \` company\` it will take into account how many \`min_new_tokens\` have been generated</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># before stopping. Note that \` Company\` (5834) and \` company\` (1664) are not actually the same token, and even</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># if they were \` Company\` would be ignored by \`min_new_tokens\` as it excludes the prompt.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(input_ids=input_ids, min_new_tokens=<span class="hljs-number">1</span>, eos_token_id=<span class="hljs-number">1664</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.decode(outputs[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>))
Hugging Face Company <span class="hljs-keyword">is</span> a company

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Increasing \`min_new_tokens\` will bury the first occurrence of \` company\` generating a different sequence.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(input_ids=input_ids, min_new_tokens=<span class="hljs-number">2</span>, eos_token_id=<span class="hljs-number">1664</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.decode(outputs[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>))
Hugging Face Company <span class="hljs-keyword">is</span> a new company

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># If no more occurrences of the \`eos_token\` happen after \`min_new_tokens\` it returns to the 20 default tokens.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(input_ids=input_ids, min_new_tokens=<span class="hljs-number">10</span>, eos_token_id=<span class="hljs-number">1664</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.decode(outputs[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>))
Hugging Face Company <span class="hljs-keyword">is</span> a new <span class="hljs-keyword">and</span> innovative brand of facial recognition technology that <span class="hljs-keyword">is</span> designed to <span class="hljs-built_in">help</span> you`}}),{c(){v=s("p"),M=a("Examples:"),k=c(),g(w.$$.fragment)},l(h){v=o(h,"P",{});var $=n(v);M=i($,"Examples:"),$.forEach(r),k=l(h),f(w.$$.fragment,h)},m(h,$){m(h,v,$),t(v,M),m(h,k,$),u(w,h,$),x=!0},p:wt,i(h){x||(_(w.$$.fragment,h),x=!0)},o(h){b(w.$$.fragment,h),x=!1},d(h){h&&r(v),h&&r(k),y(w,h)}}}function ex(E){let v,M,k,w,x,h,$,V;return{c(){v=s("p"),M=a("Make sure that "),k=s("code"),w=a("do_sample=True"),x=a(" is included in the "),h=s("code"),$=a("generate"),V=a(` arguments otherwise the temperature value won\u2019t have
any effect.`)},l(z){v=o(z,"P",{});var U=n(v);M=i(U,"Make sure that "),k=o(U,"CODE",{});var F=n(k);w=i(F,"do_sample=True"),F.forEach(r),x=i(U," is included in the "),h=o(U,"CODE",{});var Z=n(h);$=i(Z,"generate"),Z.forEach(r),V=i(U,` arguments otherwise the temperature value won\u2019t have
any effect.`),U.forEach(r)},m(z,U){m(z,v,U),t(v,M),t(v,k),t(k,w),t(v,x),t(v,h),t(h,$),t(v,V)},d(z){z&&r(v)}}}function tx(E){let v,M,k,w,x;return w=new ye({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZ3B0MiUyMiklMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJncHQyJTIyKSUwQW1vZGVsLmNvbmZpZy5wYWRfdG9rZW5faWQlMjAlM0QlMjBtb2RlbC5jb25maWcuZW9zX3Rva2VuX2lkJTBBbW9kZWwuZ2VuZXJhdGlvbl9jb25maWcucGFkX3Rva2VuX2lkJTIwJTNEJTIwbW9kZWwuY29uZmlnLmVvc190b2tlbl9pZCUwQWlucHV0X2NvbnRleHQlMjAlM0QlMjAlMjJIdWdnaW5nJTIwRmFjZSUyMENvbXBhbnklMjBpcyUyMiUwQWlucHV0X2lkcyUyMCUzRCUyMHRva2VuaXplci5lbmNvZGUoaW5wdXRfY29udGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBdG9yY2gubWFudWFsX3NlZWQoMCklMEElMEElMjMlMjBXaXRoJTIwdGVtcGVyYXR1cmUlM0QxJTJDJTIwdGhlJTIwZGVmYXVsdCUyQyUyMHdlJTIwY29uc2lzdGVudGx5JTIwZ2V0JTIwcmFuZG9tJTIwb3V0cHV0cyUyMGR1ZSUyMHRvJTIwcmFuZG9tJTIwc2FtcGxpbmcuJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKGlucHV0X2lkcyUzRGlucHV0X2lkcyUyQyUyMG1heF9uZXdfdG9rZW5zJTNEMTAlMkMlMjB0ZW1wZXJhdHVyZSUzRDElMkMlMjBkb19zYW1wbGUlM0RUcnVlKSUwQXByaW50KHRva2VuaXplci5kZWNvZGUob3V0cHV0cyU1QjAlNUQlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSkpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKGlucHV0X2lkcyUzRGlucHV0X2lkcyUyQyUyMG1heF9uZXdfdG9rZW5zJTNEMTAlMkMlMjB0ZW1wZXJhdHVyZSUzRDElMkMlMjBkb19zYW1wbGUlM0RUcnVlKSUwQXByaW50KHRva2VuaXplci5kZWNvZGUob3V0cHV0cyU1QjAlNUQlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSkpJTBBJTBBJTIzJTIwSG93ZXZlciUyQyUyMHdpdGglMjB0ZW1wZXJhdHVyZSUyMGNsb3NlJTIwdG8lMjAwJTIwJTJDJTIwdGhlJTIwb3V0cHV0JTIwcmVtYWlucyUyMGludmFyaWFudC4lMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRfaWRzJTNEaW5wdXRfaWRzJTJDJTIwbWF4X25ld190b2tlbnMlM0QxMCUyQyUyMHRlbXBlcmF0dXJlJTNEMC4wMDAxJTJDJTIwZG9fc2FtcGxlJTNEVHJ1ZSklMEFwcmludCh0b2tlbml6ZXIuZGVjb2RlKG91dHB1dHMlNUIwJTVEJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpKSUwQSUwQSUyMyUyMGV2ZW4lMjBpZiUyMHdlJTIwc2V0JTIwYSUyMGRpZmZlcmVudCUyMHNlZWQuJTBBdG9yY2gubWFudWFsX3NlZWQoNDIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKGlucHV0X2lkcyUzRGlucHV0X2lkcyUyQyUyMG1heF9uZXdfdG9rZW5zJTNEMTAlMkMlMjB0ZW1wZXJhdHVyZSUzRDAuMDAwMSUyQyUyMGRvX3NhbXBsZSUzRFRydWUpJTBBcHJpbnQodG9rZW5pemVyLmRlY29kZShvdXRwdXRzJTVCMCU1RCUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSk=",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, AutoModelForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.pad_token_id = model.config.eos_token_id
<span class="hljs-meta">&gt;&gt;&gt; </span>model.generation_config.pad_token_id = model.config.eos_token_id
<span class="hljs-meta">&gt;&gt;&gt; </span>input_context = <span class="hljs-string">&quot;Hugging Face Company is&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = tokenizer.encode(input_context, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>torch.manual_seed(<span class="hljs-number">0</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># With temperature=1, the default, we consistently get random outputs due to random sampling.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(input_ids=input_ids, max_new_tokens=<span class="hljs-number">10</span>, temperature=<span class="hljs-number">1</span>, do_sample=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.decode(outputs[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>))
Hugging Face Company <span class="hljs-keyword">is</span> one of these companies that <span class="hljs-keyword">is</span> going to take a

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(input_ids=input_ids, max_new_tokens=<span class="hljs-number">10</span>, temperature=<span class="hljs-number">1</span>, do_sample=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.decode(outputs[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>))
Hugging Face Company <span class="hljs-keyword">is</span> one of these companies, you can make a very

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># However, with temperature close to 0 , the output remains invariant.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(input_ids=input_ids, max_new_tokens=<span class="hljs-number">10</span>, temperature=<span class="hljs-number">0.0001</span>, do_sample=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.decode(outputs[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>))
Hugging Face Company <span class="hljs-keyword">is</span> a company that has been around <span class="hljs-keyword">for</span> over <span class="hljs-number">20</span> years

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># even if we set a different seed.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>torch.manual_seed(<span class="hljs-number">42</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(input_ids=input_ids, max_new_tokens=<span class="hljs-number">10</span>, temperature=<span class="hljs-number">0.0001</span>, do_sample=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.decode(outputs[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>))
Hugging Face Company <span class="hljs-keyword">is</span> a company that has been around <span class="hljs-keyword">for</span> over <span class="hljs-number">20</span> years`}}),{c(){v=s("p"),M=a("Examples:"),k=c(),g(w.$$.fragment)},l(h){v=o(h,"P",{});var $=n(v);M=i($,"Examples:"),$.forEach(r),k=l(h),f(w.$$.fragment,h)},m(h,$){m(h,v,$),t(v,M),m(h,k,$),u(w,h,$),x=!0},p:wt,i(h){x||(_(w.$$.fragment,h),x=!0)},o(h){b(w.$$.fragment,h),x=!1},d(h){h&&r(v),h&&r(k),y(w,h)}}}function rx(E){let v,M,k,w,x;return w=new ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMHRoZSUyMG1vZGVsJTIwYW5kJTIwdG9rZW5pemVyJTIwZm9yJTIwaXQlMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJncHQyJTIyKSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmdwdDIlMjIpJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCU1QiUyMkknbSUyMG5vdCUyMGdvaW5nJTIwdG8lMjIlNUQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQSUyMyUyMFRoaXMlMjBzaG93cyUyMGElMjBub3JtYWwlMjBnZW5lcmF0ZSUyMHdpdGhvdXQlMjBhbnklMjBzcGVjaWZpYyUyMHBhcmFtZXRlcnMlMEFzdW1tYXJ5X2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKGlucHV0cyU1QiUyMmlucHV0X2lkcyUyMiU1RCUyQyUyMG1heF9sZW5ndGglM0QyMCklMEFwcmludCh0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKHN1bW1hcnlfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTVCMCU1RCklMEElMEElMjMlMjBUaGlzJTIwZ2VuZXJhdGVzJTIwYSUyMHBlbmFsdHklMjBmb3IlMjByZXBlYXRlZCUyMHRva2VucyUwQXBlbmFsaXplZF9pZHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZShpbnB1dHMlNUIlMjJpbnB1dF9pZHMlMjIlNUQlMkMlMjBtYXhfbGVuZ3RoJTNEMjAlMkMlMjByZXBldGl0aW9uX3BlbmFsdHklM0QxLjIpJTBBcHJpbnQodG9rZW5pemVyLmJhdGNoX2RlY29kZShiaWFzZWRfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTVCMCU1RCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModelForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing the model and tokenizer for it</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer([<span class="hljs-string">&quot;I&#x27;m not going to&quot;</span>], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># This shows a normal generate without any specific parameters</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>summary_ids = model.generate(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>], max_length=<span class="hljs-number">20</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.batch_decode(summary_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>])
I<span class="hljs-string">&#x27;m not going to lie, I&#x27;</span>m <span class="hljs-keyword">not</span> going to lie. I<span class="hljs-string">&#x27;m not going to lie

&gt;&gt;&gt; # This generates a penalty for repeated tokens
&gt;&gt;&gt; penalized_ids = model.generate(inputs[&quot;input_ids&quot;], max_length=20, repetition_penalty=1.2)
&gt;&gt;&gt; print(tokenizer.batch_decode(biased_ids, skip_special_tokens=True)[0])
I&#x27;</span>m <span class="hljs-keyword">not</span> going to lie, I was really excited about this. It<span class="hljs-string">&#x27;s a great game</span>`}}),{c(){v=s("p"),M=a("Examples:"),k=c(),g(w.$$.fragment)},l(h){v=o(h,"P",{});var $=n(v);M=i($,"Examples:"),$.forEach(r),k=l(h),f(w.$$.fragment,h)},m(h,$){m(h,v,$),t(v,M),m(h,k,$),u(w,h,$),x=!0},p:wt,i(h){x||(_(w.$$.fragment,h),x=!0)},o(h){b(w.$$.fragment,h),x=!1},d(h){h&&r(v),h&&r(k),y(w,h)}}}function sx(E){let v,M,k,w,x;return w=new ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTSUyQyUyMHNldF9zZWVkJTBBJTBBc2V0X3NlZWQoMCklMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJncHQyJTIyKSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmdwdDIlMjIpJTBBJTBBdGV4dCUyMCUzRCUyMCUyMkl0JTIwaXMlMjBwcm9iYWJseSUyMG9uZSUyMG9mJTIwdGhlJTIwbW9zdCUyMGltcG9ydGFudCUyMHRoaW5ncyUyMGZvciUyMHBhcmVudHMlMjB0byUyMHRlYWNoJTIwY2hpbGRyZW4lMjBhYm91dCUyMHBhdGllbmNlJTIwYW5kJTIwYWNjZXB0YW5jZS4lMjBJbiUyMHRoaXMlMjB3YXklMkMlMjB3ZSUyMGFzJTIwYSUyMHNvY2lldHklMjBjYW4lMjBlbnN1cmUlMjIlMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIodGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBJTIzJTIwR2VuZXJhdGUlMjBzZXF1ZW5jZXMlMjB3aXRob3V0JTIwdG9wX3AlMjBzYW1wbGluZyUwQSUyMyUyMFdlJTIwc2VlJTIwdGhhdCUyMHRoZSUyMGFuc3dlciUyMHRlbmRzJTIwdG8lMjBoYXZlJTIwYSUyMGxvdCUyMG9mJTIwcmVwZWF0ZWQlMjB0b2tlbnMlMjBhbmQlMjBwaHJhc2VzJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqaW5wdXRzJTJDJTIwbWF4X2xlbmd0aCUzRDU1KSUwQXByaW50KHRva2VuaXplci5iYXRjaF9kZWNvZGUob3V0cHV0cyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSU1QjAlNUQpJTBBJTBBJTBBJTIzJTIwR2VuZXJhdGUlMjBzZXF1ZW5jZXMlMjB3aXRoJTIwdG9wX3AlMjBzYW1wbGluZyUzQSUyMHNldCUyMCU2MGRvX3NhbXBsZSUzRFRydWUlNjAlMjB0byUyMHVzZSUyMHRvcF9wJTIwc2FtcGxpbmclMjB3aXRoJTIwJTYwdG9wX3AlNjAlMjBhcnVnbWVudCUwQSUyMyUyMFdlJTIwYWxyZWFkeSUyMHNlZSUyMHRoYXQlMjB0aGUlMjBhbnN3ZXIlMjBoYXMlMjBsZXNzJTIwcmVwZXRpdGl2ZSUyMHRva2VucyUyMGFuZCUyMGlzJTIwbW9yZSUyMGRpdmVyc2UlMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoKippbnB1dHMlMkMlMjBtYXhfbGVuZ3RoJTNENTUlMkMlMjBkb19zYW1wbGUlM0RUcnVlJTJDJTIwdG9wX3AlM0QwLjI1KSUwQXByaW50KHRva2VuaXplci5iYXRjaF9kZWNvZGUob3V0cHV0cyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSU1QjAlNUQpJTBBJTBBJTBBJTIzJTIwR2VuZXJhdGUlMjBzZXF1ZW5jZXMlMjB3aXRoJTIwdG9wX3AlMjBzYW1wbGluZyUyMHdpdGglMjBhJTIwbGFyZ2VyJTIwdG9wX3AlMjB2YWx1ZSUwQSUyMyUyMFdlJTIwc2VlJTIwdGhhdCUyMGFzJTIwd2UlMjBpbmNyZWFzZSUyMHRoZSUyMHRvcF9wJTIwdmFsdWUlMkMlMjBsZXNzJTIwcHJvYmFibGUlMjB0b2tlbnMlMjBhbHNvJTIwZ2V0JTIwc2VsZWN0ZWQlMjBkdXJpbmclMjB0ZXh0JTIwZ2VuZXJhdGlvbiUyQyUyMG1ha2luZyUyMHRoZSUyMGFuc3dlciUyMG1vcmUlMjBkaXZlcnNlJTBBJTIzJTIwUHJvJTIwVGlwJTNBJTIwSW4lMjBwcmFjdGljZSUyQyUyMHdlJTIwdGVuZCUyMHRvJTIwdXNlJTIwdG9wX3AlMjB2YWx1ZXMlMjBiZXR3ZWVuJTIwMC45JTIwYW5kJTIwMS4wISUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSgqKmlucHV0cyUyQyUyMG1heF9sZW5ndGglM0Q1NSUyQyUyMGRvX3NhbXBsZSUzRFRydWUlMkMlMjB0b3BfcCUzRDAuOTUpJTBBcHJpbnQodG9rZW5pemVyLmJhdGNoX2RlY29kZShvdXRwdXRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTVCMCU1RCklMEElMEE=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModelForCausalLM, set_seed

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

<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;It is probably one of the most important things for parents to teach children about patience and acceptance. In this way, we as a society can ensure&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Generate sequences without top_p sampling</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># We see that the answer tends to have a lot of repeated tokens and phrases</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(**inputs, max_length=<span class="hljs-number">55</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.batch_decode(outputs, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>])
<span class="hljs-string">&#x27;It is probably one of the most important things for parents to teach children about patience and acceptance. In this way, we as a society can ensure that our children are not taught to be impatient or to be afraid of the future.

first step is to teach them&#x27;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Generate sequences with top_p sampling: set \`do_sample=True\` to use top_p sampling with \`top_p\` arugment</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># We already see that the answer has less repetitive tokens and is more diverse</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(**inputs, max_length=<span class="hljs-number">55</span>, do_sample=<span class="hljs-literal">True</span>, top_p=<span class="hljs-number">0.25</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.batch_decode(outputs, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>])
<span class="hljs-string">&#x27;It is probably one of the most important things for parents to teach children about patience and acceptance. In this way, we as a society can ensure that children learn to be more accepting of others and to be more tolerant of others.

an also teach children to be&#x27;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Generate sequences with top_p sampling with a larger top_p value</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># We see that as we increase the top_p value, less probable tokens also get selected during text generation, making the answer more diverse</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Pro Tip: In practice, we tend to use top_p values between 0.9 and 1.0!</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(**inputs, max_length=<span class="hljs-number">55</span>, do_sample=<span class="hljs-literal">True</span>, top_p=<span class="hljs-number">0.95</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.batch_decode(outputs, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>])
<span class="hljs-string">&#x27;It is probably one of the most important things for parents to teach children about patience and acceptance. In this way, we as a society can ensure we have the best learning environment, so that we can teach to learn and not just take advantage of the environment.

</span>`}}),{c(){v=s("p"),M=a("Examples:"),k=c(),g(w.$$.fragment)},l(h){v=o(h,"P",{});var $=n(v);M=i($,"Examples:"),$.forEach(r),k=l(h),f(w.$$.fragment,h)},m(h,$){m(h,v,$),t(v,M),m(h,k,$),u(w,h,$),x=!0},p:wt,i(h){x||(_(w.$$.fragment,h),x=!0)},o(h){b(w.$$.fragment,h),x=!1},d(h){h&&r(v),h&&r(k),y(w,h)}}}function ox(E){let v,M,k,w;return{c(){v=s("p"),M=a(`Use n-gram penalties with care. For instance, penalizing 2-grams (bigrams) in an article about the city of New York
might lead to undesirable outcomes where the city\u2019s name appears only once in the entire text.
`),k=s("a"),w=a("Reference"),this.h()},l(x){v=o(x,"P",{});var h=n(v);M=i(h,`Use n-gram penalties with care. For instance, penalizing 2-grams (bigrams) in an article about the city of New York
might lead to undesirable outcomes where the city\u2019s name appears only once in the entire text.
`),k=o(h,"A",{href:!0,rel:!0});var $=n(k);w=i($,"Reference"),$.forEach(r),h.forEach(r),this.h()},h(){d(k,"href","https://huggingface.co/blog/how-to-generate"),d(k,"rel","nofollow")},m(x,h){m(x,v,h),t(v,M),t(v,k),t(k,w)},d(x){x&&r(v)}}}function nx(E){let v,M,k,w,x;return w=new ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdQVDJUb2tlbml6ZXIlMkMlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTSUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmdwdDIlMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwR1BUMlRva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZ3B0MiUyMiklMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTVCJTIySSUyMGVuam95JTIwd2F0Y2hpbmclMjBmb290YmFsbCUyMiU1RCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBb3V0cHV0JTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoKippbnB1dHMlMkMlMjBtYXhfbGVuZ3RoJTNENTApJTBBcHJpbnQodG9rZW5pemVyLmRlY29kZShvdXRwdXQlNUIwJTVEJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpKSUwQSUwQSUyMyUyME5vdyUyMGxldCdzJTIwYWRkJTIwbmdyYW0lMjBzaXplJTIwdXNpbmclMjAlM0Nub19yZXBlYXRfbmdyYW1fc2l6ZSUzRSUyMGluJTIwbW9kZWwuZ2VuZXJhdGUuJTIwVGhpcyUyMHNob3VsZCUyMHN0b3AlMjB0aGUlMjByZXBldGl0aW9ucyUyMGluJTIwdGhlJTIwb3V0cHV0LiUwQW91dHB1dCUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqaW5wdXRzJTJDJTIwbWF4X2xlbmd0aCUzRDUwJTJDJTIwbm9fcmVwZWF0X25ncmFtX3NpemUlM0QyKSUwQXByaW50KHRva2VuaXplci5kZWNvZGUob3V0cHV0JTVCMCU1RCUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPT2Tokenizer, AutoModelForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = GPT2Tokenizer.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer([<span class="hljs-string">&quot;I enjoy watching football&quot;</span>], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>output = model.generate(**inputs, max_length=<span class="hljs-number">50</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.decode(output[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>))
<span class="hljs-string">&quot;I enjoy playing football on the weekends, but I&#x27;m not a big fan of the idea of playing in the middle of the night. I&#x27;m not a big fan of the idea of playing in the middle of the night. I&#x27;m not a big&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Now let&#x27;s add ngram size using &lt;no_repeat_ngram_size&gt; in model.generate. This should stop the repetitions in the output.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>output = model.generate(**inputs, max_length=<span class="hljs-number">50</span>, no_repeat_ngram_size=<span class="hljs-number">2</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.decode(output[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>))
I enjoy playing football on the weekends, but I<span class="hljs-string">&#x27;m not a big fan of the idea of playing in the middle of a game. I think it&#x27;</span>s a bit of an overreaction to the fact that we<span class="hljs-string">&#x27;re playing a team that&#x27;</span>s playing<span class="hljs-string">&quot;</span>`}}),{c(){v=s("p"),M=a("Examples:"),k=c(),g(w.$$.fragment)},l(h){v=o(h,"P",{});var $=n(v);M=i($,"Examples:"),$.forEach(r),k=l(h),f(w.$$.fragment,h)},m(h,$){m(h,v,$),t(v,M),m(h,k,$),u(w,h,$),x=!0},p:wt,i(h){x||(_(w.$$.fragment,h),x=!0)},o(h){b(w.$$.fragment,h),x=!1},d(h){h&&r(v),h&&r(k),y(w,h)}}}function ax(E){let v,M,k,w,x,h,$,V,z,U,F,Z,H,ve,W,Q,Te;return{c(){v=s("p"),M=a("In order to get the token ids of the sequences that you want to bias, make sure to set "),k=s("code"),w=a("add_prefix_space=True"),x=a(` when
initializing the tokenizer, and use `),h=s("code"),$=a("tokenizer(bad_words, add_special_tokens=False).input_ids"),V=a(`. The
`),z=s("code"),U=a("add_prefix_space"),F=a(` argument is only supported for some slow tokenizers, as fast tokenizers\u2019 prefixing behaviours
come from `),Z=s("code"),H=a("pre tokenizers"),ve=a(". Read more "),W=s("a"),Q=a("here"),Te=a("."),this.h()},l(X){v=o(X,"P",{});var j=n(v);M=i(j,"In order to get the token ids of the sequences that you want to bias, make sure to set "),k=o(j,"CODE",{});var kt=n(k);w=i(kt,"add_prefix_space=True"),kt.forEach(r),x=i(j,` when
initializing the tokenizer, and use `),h=o(j,"CODE",{});var $t=n(h);$=i($t,"tokenizer(bad_words, add_special_tokens=False).input_ids"),$t.forEach(r),V=i(j,`. The
`),z=o(j,"CODE",{});var me=n(z);U=i(me,"add_prefix_space"),me.forEach(r),F=i(j,` argument is only supported for some slow tokenizers, as fast tokenizers\u2019 prefixing behaviours
come from `),Z=o(j,"CODE",{});var Mt=n(Z);H=i(Mt,"pre tokenizers"),Mt.forEach(r),ve=i(j,". Read more "),W=o(j,"A",{href:!0,rel:!0});var xt=n(W);Q=i(xt,"here"),xt.forEach(r),Te=i(j,"."),j.forEach(r),this.h()},h(){d(W,"href","https://huggingface.co/docs/tokenizers/api/pre-tokenizers"),d(W,"rel","nofollow")},m(X,j){m(X,v,j),t(v,M),t(v,k),t(k,w),t(v,x),t(v,h),t(h,$),t(v,V),t(v,z),t(z,U),t(v,F),t(v,Z),t(Z,H),t(v,ve),t(v,W),t(W,Q),t(v,Te)},d(X){X&&r(v)}}}function ix(E){let v,M,k,w,x;return w=new ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTSUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmdwdDIlMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZ3B0MiUyMiklMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTVCJTIyVGhlJTIwZnVsbCUyMG5hbWUlMjBvZiUyMERvbmFsZCUyMGlzJTIwRG9uYWxkJTIyJTVEJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEFzdW1tYXJ5X2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKGlucHV0cyU1QiUyMmlucHV0X2lkcyUyMiU1RCUyQyUyMG1heF9uZXdfdG9rZW5zJTNENCklMEFwcmludCh0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKHN1bW1hcnlfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTVCMCU1RCklMEElMEElMjMlMjBOb3clMjBsZXQncyUyMGNvbnRyb2wlMjBnZW5lcmF0aW9uJTIwdGhyb3VnaCUyMGElMjBiaWFzLiUyMFBsZWFzZSUyMG5vdGUlMjB0aGF0JTIwdGhlJTIwdG9rZW5pemVyJTIwaXMlMjBpbml0aWFsaXplZCUyMGRpZmZlcmVudGx5ISUwQXRva2VuaXplcl93aXRoX3ByZWZpeF9zcGFjZSUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmdwdDIlMjIlMkMlMjBhZGRfcHJlZml4X3NwYWNlJTNEVHJ1ZSklMEElMEElMEFkZWYlMjBnZXRfdG9rZW5zX2FzX3R1cGxlKHdvcmQpJTNBJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwdHVwbGUodG9rZW5pemVyX3dpdGhfcHJlZml4X3NwYWNlKCU1QndvcmQlNUQlMkMlMjBhZGRfc3BlY2lhbF90b2tlbnMlM0RGYWxzZSkuaW5wdXRfaWRzJTVCMCU1RCklMEElMEElMEElMjMlMjBJZiUyMHdlJTIwYWRkJTIwYSUyMG5lZ2F0aXZlJTIwYmlhcyUyMHdpdGhvdXQlMjBiZWFtJTIwc2VhcmNoJTJDJTIwaXQlMjBtYXklMjBiZWNvbWUlMjAlMjJzdHVjayUyMiUyMGluJTIwYSUyMHByZWZpeCUyMHdpdGhvdXQlMjBnb29kJTIwY29udGludWF0aW9ucyUwQXNlcXVlbmNlX2JpYXMlMjAlM0QlMjAlN0JnZXRfdG9rZW5zX2FzX3R1cGxlKCUyMlRydW1wJTIyKSUzQSUyMC0xMC4wJTdEJTBBYmlhc2VkX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKGlucHV0cyU1QiUyMmlucHV0X2lkcyUyMiU1RCUyQyUyMG1heF9uZXdfdG9rZW5zJTNENCUyQyUyMHNlcXVlbmNlX2JpYXMlM0RzZXF1ZW5jZV9iaWFzKSUwQXByaW50KHRva2VuaXplci5iYXRjaF9kZWNvZGUoYmlhc2VkX2lkcyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSU1QjAlNUQpJTBBJTBBYmlhc2VkX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKGlucHV0cyU1QiUyMmlucHV0X2lkcyUyMiU1RCUyQyUyMG1heF9uZXdfdG9rZW5zJTNENCUyQyUyMG51bV9iZWFtcyUzRDQlMkMlMjBzZXF1ZW5jZV9iaWFzJTNEc2VxdWVuY2VfYmlhcyklMEFwcmludCh0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKGJpYXNlZF9pZHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSklNUIwJTVEKSUwQSUwQSUyMyUyMFdlJTIwY2FuJTIwYWxzbyUyMGFkZCUyMGElMjBwb3NpdGl2ZSUyMGJpYXMlMjB0byUyMG51ZGdlJTIwdGhlJTIwbW9kZWwlMjB0b3dhcmRzJTIwc3BlY2lmaWMlMjB0b2tlbnMlMjBvciUyMGNvbnRpbnVhdGlvbnMlMEFzZXF1ZW5jZV9iaWFzJTIwJTNEJTIwJTdCZ2V0X3Rva2Vuc19hc190dXBsZSglMjJEb25hbGQlMjBEdWNrJTIyKSUzQSUyMDEwLjAlN0QlMEFiaWFzZWRfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRzJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTJDJTIwbWF4X25ld190b2tlbnMlM0Q0JTJDJTIwbnVtX2JlYW1zJTNENCUyQyUyMHNlcXVlbmNlX2JpYXMlM0RzZXF1ZW5jZV9iaWFzKSUwQXByaW50KHRva2VuaXplci5iYXRjaF9kZWNvZGUoYmlhc2VkX2lkcyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSU1QjAlNUQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModelForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer([<span class="hljs-string">&quot;The full name of Donald is Donald&quot;</span>], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>summary_ids = model.generate(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>], max_new_tokens=<span class="hljs-number">4</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.batch_decode(summary_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>])
The full name of Donald <span class="hljs-keyword">is</span> Donald J. Trump Jr

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Now let&#x27;s control generation through a bias. Please note that the tokenizer is initialized differently!</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer_with_prefix_space = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>, add_prefix_space=<span class="hljs-literal">True</span>)


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">get_tokens_as_tuple</span>(<span class="hljs-params">word</span>):
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> <span class="hljs-built_in">tuple</span>(tokenizer_with_prefix_space([word], add_special_tokens=<span class="hljs-literal">False</span>).input_ids[<span class="hljs-number">0</span>])


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># If we add a negative bias without beam search, it may become &quot;stuck&quot; in a prefix without good continuations</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>sequence_bias = {get_tokens_as_tuple(<span class="hljs-string">&quot;Trump&quot;</span>): -<span class="hljs-number">10.0</span>}
<span class="hljs-meta">&gt;&gt;&gt; </span>biased_ids = model.generate(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>], max_new_tokens=<span class="hljs-number">4</span>, sequence_bias=sequence_bias)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.batch_decode(biased_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>])
The full name of Donald <span class="hljs-keyword">is</span> Donald J. Donald,

<span class="hljs-meta">&gt;&gt;&gt; </span>biased_ids = model.generate(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>], max_new_tokens=<span class="hljs-number">4</span>, num_beams=<span class="hljs-number">4</span>, sequence_bias=sequence_bias)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.batch_decode(biased_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>])
The full name of Donald <span class="hljs-keyword">is</span> Donald Rumsfeld,

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># We can also add a positive bias to nudge the model towards specific tokens or continuations</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>sequence_bias = {get_tokens_as_tuple(<span class="hljs-string">&quot;Donald Duck&quot;</span>): <span class="hljs-number">10.0</span>}
<span class="hljs-meta">&gt;&gt;&gt; </span>biased_ids = model.generate(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>], max_new_tokens=<span class="hljs-number">4</span>, num_beams=<span class="hljs-number">4</span>, sequence_bias=sequence_bias)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.batch_decode(biased_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>])
The full name of Donald <span class="hljs-keyword">is</span> Donald Duck.`}}),{c(){v=s("p"),M=a("Examples:"),k=c(),g(w.$$.fragment)},l(h){v=o(h,"P",{});var $=n(v);M=i($,"Examples:"),$.forEach(r),k=l(h),f(w.$$.fragment,h)},m(h,$){m(h,v,$),t(v,M),m(h,k,$),u(w,h,$),x=!0},p:wt,i(h){x||(_(w.$$.fragment,h),x=!0)},o(h){b(w.$$.fragment,h),x=!1},d(h){h&&r(v),h&&r(k),y(w,h)}}}function cx(E){let v,M,k,w,x,h,$,V,z,U,F,Z,H,ve,W,Q,Te;return{c(){v=s("p"),M=a(`In order to get the token ids of the words that should not appear in the generated text, make sure to set
`),k=s("code"),w=a("add_prefix_space=True"),x=a(" when initializing the tokenizer, and use "),h=s("code"),$=a("tokenizer(bad_words, add_special_tokens=False).input_ids"),V=a(". The "),z=s("code"),U=a("add_prefix_space"),F=a(` argument is only supported for some slow tokenizers,
as fast tokenizers\u2019 prefixing behaviours come from `),Z=s("code"),H=a("pre tokenizers"),ve=a(`. Read more
`),W=s("a"),Q=a("here"),Te=a("."),this.h()},l(X){v=o(X,"P",{});var j=n(v);M=i(j,`In order to get the token ids of the words that should not appear in the generated text, make sure to set
`),k=o(j,"CODE",{});var kt=n(k);w=i(kt,"add_prefix_space=True"),kt.forEach(r),x=i(j," when initializing the tokenizer, and use "),h=o(j,"CODE",{});var $t=n(h);$=i($t,"tokenizer(bad_words, add_special_tokens=False).input_ids"),$t.forEach(r),V=i(j,". The "),z=o(j,"CODE",{});var me=n(z);U=i(me,"add_prefix_space"),me.forEach(r),F=i(j,` argument is only supported for some slow tokenizers,
as fast tokenizers\u2019 prefixing behaviours come from `),Z=o(j,"CODE",{});var Mt=n(Z);H=i(Mt,"pre tokenizers"),Mt.forEach(r),ve=i(j,`. Read more
`),W=o(j,"A",{href:!0,rel:!0});var xt=n(W);Q=i(xt,"here"),xt.forEach(r),Te=i(j,"."),j.forEach(r),this.h()},h(){d(W,"href","https://huggingface.co/docs/tokenizers/api/pre-tokenizers"),d(W,"rel","nofollow")},m(X,j){m(X,v,j),t(v,M),t(v,k),t(k,w),t(v,x),t(v,h),t(h,$),t(v,V),t(v,z),t(z,U),t(v,F),t(v,Z),t(Z,H),t(v,ve),t(v,W),t(W,Q),t(v,Te)},d(X){X&&r(v)}}}function lx(E){let v,M,k,w,x;return w=new ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTSUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmdwdDIlMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZ3B0MiUyMiklMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTVCJTIySW4lMjBhJTIwd29yZCUyQyUyMHRoZSUyMGNha2UlMjBpcyUyMGElMjIlNUQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXN1bW1hcnlfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRzJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTJDJTIwbWF4X25ld190b2tlbnMlM0Q1JTJDJTIwcGFkX3Rva2VuX2lkJTNEdG9rZW5pemVyLmVvc190b2tlbl9pZCklMEFwcmludCh0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKHN1bW1hcnlfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTVCMCU1RCklMEElMEElMjMlMjBOb3clMjBsZXQncyUyMGNvbnRyb2wlMjBnZW5lcmF0aW9uJTIwdGFraW5nJTIwdGhlJTIwYmFkJTIwd29yZHMlMjBvdXQuJTIwUGxlYXNlJTIwbm90ZSUyMHRoYXQlMjB0aGUlMjB0b2tlbml6ZXIlMjBpcyUyMGluaXRpYWxpemVkJTIwZGlmZmVyZW50bHklMEElMEF0b2tlbml6ZXJfd2l0aF9wcmVmaXhfc3BhY2UlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJncHQyJTIyJTJDJTIwYWRkX3ByZWZpeF9zcGFjZSUzRFRydWUpJTBBJTBBJTBBZGVmJTIwZ2V0X3Rva2Vuc19hc19saXN0KHdvcmRfbGlzdCklM0ElMEElMjAlMjAlMjAlMjAlMjJDb252ZXJ0cyUyMGElMjBzZXF1ZW5jZSUyMG9mJTIwd29yZHMlMjBpbnRvJTIwYSUyMGxpc3QlMjBvZiUyMHRva2VucyUyMiUwQSUyMCUyMCUyMCUyMHRva2Vuc19saXN0JTIwJTNEJTIwJTVCJTVEJTBBJTIwJTIwJTIwJTIwZm9yJTIwd29yZCUyMGluJTIwd29yZF9saXN0LnNwbGl0KCUyMiUyMCUyMiklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB0b2tlbml6ZWRfd29yZCUyMCUzRCUyMHRva2VuaXplcl93aXRoX3ByZWZpeF9zcGFjZSglNUJ3b3JkJTVEJTJDJTIwYWRkX3NwZWNpYWxfdG9rZW5zJTNERmFsc2UpLmlucHV0X2lkcyU1QjAlNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB0b2tlbnNfbGlzdC5hcHBlbmQodG9rZW5pemVkX3dvcmQpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwdG9rZW5zX2xpc3QlMEElMEElMEF3b3JkX2xpc3QlMjAlM0QlMjAlMjJtZXNzJTIyJTBBYmFkX3dvcmRzX2lkcyUyMCUzRCUyMGdldF90b2tlbnNfYXNfbGlzdCh3b3JkX2xpc3QlM0R3b3JkX2xpc3QpJTBBJTBBYmFkd29yZHNfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoJTBBJTIwJTIwJTIwJTIwaW5wdXRzJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwbWF4X25ld190b2tlbnMlM0Q1JTJDJTBBJTIwJTIwJTIwJTIwYmFkX3dvcmRzX2lkcyUzRGJhZF93b3Jkc19pZHMlMkMlMEElMjAlMjAlMjAlMjBlb3NfdG9rZW5faWQlM0R0b2tlbml6ZXJfd2l0aF9wcmVmaXhfc3BhY2UuZW9zX3Rva2VuX2lkJTJDJTBBKSUwQXByaW50KHRva2VuaXplci5iYXRjaF9kZWNvZGUoYmFkd29yZHNfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTVCMCU1RCklMEElMEFiYWR3b3Jkc19pZHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZShpbnB1dHMlNUIlMjJpbnB1dF9pZHMlMjIlNUQlMkMlMjBtYXhfbmV3X3Rva2VucyUzRDQlMkMlMjBudW1fYmVhbXMlM0Q1JTJDJTIwYmFkX3dvcmRzX2lkcyUzRGJhZF93b3Jkc19pZHMpJTBBcHJpbnQodG9rZW5pemVyLmJhdGNoX2RlY29kZShiaWFzZWRfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTVCMCU1RCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModelForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer([<span class="hljs-string">&quot;In a word, the cake is a&quot;</span>], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>summary_ids = model.generate(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>], max_new_tokens=<span class="hljs-number">5</span>, pad_token_id=tokenizer.eos_token_id)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.batch_decode(summary_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>])
In a word, the cake <span class="hljs-keyword">is</span> a bit of a mess.

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Now let&#x27;s control generation taking the bad words out. Please note that the tokenizer is initialized differently</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer_with_prefix_space = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>, add_prefix_space=<span class="hljs-literal">True</span>)


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">get_tokens_as_list</span>(<span class="hljs-params">word_list</span>):
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Converts a sequence of words into a list of tokens&quot;</span>
<span class="hljs-meta">... </span>    tokens_list = []
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> word <span class="hljs-keyword">in</span> word_list.split(<span class="hljs-string">&quot; &quot;</span>):
<span class="hljs-meta">... </span>        tokenized_word = tokenizer_with_prefix_space([word], add_special_tokens=<span class="hljs-literal">False</span>).input_ids[<span class="hljs-number">0</span>]
<span class="hljs-meta">... </span>        tokens_list.append(tokenized_word)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> tokens_list


<span class="hljs-meta">&gt;&gt;&gt; </span>word_list = <span class="hljs-string">&quot;mess&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>bad_words_ids = get_tokens_as_list(word_list=word_list)

<span class="hljs-meta">&gt;&gt;&gt; </span>badwords_ids = model.generate(
<span class="hljs-meta">... </span>    inputs[<span class="hljs-string">&quot;input_ids&quot;</span>],
<span class="hljs-meta">... </span>    max_new_tokens=<span class="hljs-number">5</span>,
<span class="hljs-meta">... </span>    bad_words_ids=bad_words_ids,
<span class="hljs-meta">... </span>    eos_token_id=tokenizer_with_prefix_space.eos_token_id,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.batch_decode(badwords_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>])
In a word, the cake <span class="hljs-keyword">is</span> a bit of a surprise.

<span class="hljs-meta">&gt;&gt;&gt; </span>badwords_ids = model.generate(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>], max_new_tokens=<span class="hljs-number">4</span>, num_beams=<span class="hljs-number">5</span>, bad_words_ids=bad_words_ids)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.batch_decode(biased_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>])
In a word, the cake <span class="hljs-keyword">is</span> a great way to start`}}),{c(){v=s("p"),M=a("Examples:"),k=c(),g(w.$$.fragment)},l(h){v=o(h,"P",{});var $=n(v);M=i($,"Examples:"),$.forEach(r),k=l(h),f(w.$$.fragment,h)},m(h,$){m(h,v,$),t(v,M),m(h,k,$),u(w,h,$),x=!0},p:wt,i(h){x||(_(w.$$.fragment,h),x=!0)},o(h){b(w.$$.fragment,h),x=!1},d(h){h&&r(v),h&&r(k),y(w,h)}}}function dx(E){let v,M;return v=new ye({props:{code:"Y29tcGxldGVkJTIwJTNEJTIwRmFsc2UlMEF3aGlsZSUyMG5vdCUyMGNvbXBsZXRlZCUzQSUwQSUyMCUyMCUyMCUyMF8lMkMlMjBjb21wbGV0ZWQlMjAlM0QlMjBjb25zdHJhaW50LnVwZGF0ZShjb25zdHJhaW50LmFkdmFuY2UoKSk=",highlighted:`completed = <span class="hljs-literal">False</span>
<span class="hljs-keyword">while</span> <span class="hljs-keyword">not</span> completed:
    _, completed = constraint.update(constraint.advance())`}}),{c(){g(v.$$.fragment)},l(k){f(v.$$.fragment,k)},m(k,w){u(v,k,w),M=!0},p:wt,i(k){M||(_(v.$$.fragment,k),M=!0)},o(k){b(v.$$.fragment,k),M=!1},d(k){y(v,k)}}}function px(E){let v,M;return{c(){v=s("p"),M=a("The API for the streamer classes is still under development and may change in the future.")},l(k){v=o(k,"P",{});var w=n(v);M=i(w,"The API for the streamer classes is still under development and may change in the future."),w.forEach(r)},m(k,w){m(k,v,w),t(v,M)},d(k){k&&r(v)}}}function mx(E){let v,M,k,w,x;return w=new ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUyQyUyMFRleHRTdHJlYW1lciUwQSUwQXRvayUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmdwdDIlMjIpJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIyZ3B0MiUyMiklMEFpbnB1dHMlMjAlM0QlMjB0b2soJTVCJTIyQW4lMjBpbmNyZWFzaW5nJTIwc2VxdWVuY2UlM0ElMjBvbmUlMkMlMjIlNUQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQXN0cmVhbWVyJTIwJTNEJTIwVGV4dFN0cmVhbWVyKHRvayklMEElMEElMjMlMjBEZXNwaXRlJTIwcmV0dXJuaW5nJTIwdGhlJTIwdXN1YWwlMjBvdXRwdXQlMkMlMjB0aGUlMjBzdHJlYW1lciUyMHdpbGwlMjBhbHNvJTIwcHJpbnQlMjB0aGUlMjBnZW5lcmF0ZWQlMjB0ZXh0JTIwdG8lMjBzdGRvdXQuJTBBXyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqaW5wdXRzJTJDJTIwc3RyZWFtZXIlM0RzdHJlYW1lciUyQyUyMG1heF9uZXdfdG9rZW5zJTNEMjAp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer, TextStreamer

<span class="hljs-meta">&gt;&gt;&gt; </span>tok = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tok([<span class="hljs-string">&quot;An increasing sequence: one,&quot;</span>], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>streamer = TextStreamer(tok)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Despite returning the usual output, the streamer will also print the generated text to stdout.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>_ = model.generate(**inputs, streamer=streamer, max_new_tokens=<span class="hljs-number">20</span>)
An increasing sequence: one, two, three, four, five, six, seven, eight, nine, ten, eleven,`}}),{c(){v=s("p"),M=a("Examples:"),k=c(),g(w.$$.fragment)},l(h){v=o(h,"P",{});var $=n(v);M=i($,"Examples:"),$.forEach(r),k=l(h),f(w.$$.fragment,h)},m(h,$){m(h,v,$),t(v,M),m(h,k,$),u(w,h,$),x=!0},p:wt,i(h){x||(_(w.$$.fragment,h),x=!0)},o(h){b(w.$$.fragment,h),x=!1},d(h){h&&r(v),h&&r(k),y(w,h)}}}function hx(E){let v,M;return{c(){v=s("p"),M=a("The API for the streamer classes is still under development and may change in the future.")},l(k){v=o(k,"P",{});var w=n(v);M=i(w,"The API for the streamer classes is still under development and may change in the future."),w.forEach(r)},m(k,w){m(k,v,w),t(v,M)},d(k){k&&r(v)}}}function gx(E){let v,M,k,w,x;return w=new ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUyQyUyMFRleHRJdGVyYXRvclN0cmVhbWVyJTBBZnJvbSUyMHRocmVhZGluZyUyMGltcG9ydCUyMFRocmVhZCUwQSUwQXRvayUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmdwdDIlMjIpJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIyZ3B0MiUyMiklMEFpbnB1dHMlMjAlM0QlMjB0b2soJTVCJTIyQW4lMjBpbmNyZWFzaW5nJTIwc2VxdWVuY2UlM0ElMjBvbmUlMkMlMjIlNUQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQXN0cmVhbWVyJTIwJTNEJTIwVGV4dEl0ZXJhdG9yU3RyZWFtZXIodG9rKSUwQSUwQSUyMyUyMFJ1biUyMHRoZSUyMGdlbmVyYXRpb24lMjBpbiUyMGElMjBzZXBhcmF0ZSUyMHRocmVhZCUyQyUyMHNvJTIwdGhhdCUyMHdlJTIwY2FuJTIwZmV0Y2glMjB0aGUlMjBnZW5lcmF0ZWQlMjB0ZXh0JTIwaW4lMjBhJTIwbm9uLWJsb2NraW5nJTIwd2F5LiUwQWdlbmVyYXRpb25fa3dhcmdzJTIwJTNEJTIwZGljdChpbnB1dHMlMkMlMjBzdHJlYW1lciUzRHN0cmVhbWVyJTJDJTIwbWF4X25ld190b2tlbnMlM0QyMCklMEF0aHJlYWQlMjAlM0QlMjBUaHJlYWQodGFyZ2V0JTNEbW9kZWwuZ2VuZXJhdGUlMkMlMjBrd2FyZ3MlM0RnZW5lcmF0aW9uX2t3YXJncyklMEF0aHJlYWQuc3RhcnQoKSUwQWdlbmVyYXRlZF90ZXh0JTIwJTNEJTIwJTIyJTIyJTBBZm9yJTIwbmV3X3RleHQlMjBpbiUyMHN0cmVhbWVyJTNBJTBBJTIwJTIwJTIwJTIwZ2VuZXJhdGVkX3RleHQlMjAlMkIlM0QlMjBuZXdfdGV4dCUwQWdlbmVyYXRlZF90ZXh0",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> threading <span class="hljs-keyword">import</span> Thread

<span class="hljs-meta">&gt;&gt;&gt; </span>tok = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tok([<span class="hljs-string">&quot;An increasing sequence: one,&quot;</span>], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>streamer = TextIteratorStreamer(tok)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Run the generation in a separate thread, so that we can fetch the generated text in a non-blocking way.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>generation_kwargs = <span class="hljs-built_in">dict</span>(inputs, streamer=streamer, max_new_tokens=<span class="hljs-number">20</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>thread = Thread(target=model.generate, kwargs=generation_kwargs)
<span class="hljs-meta">&gt;&gt;&gt; </span>thread.start()
<span class="hljs-meta">&gt;&gt;&gt; </span>generated_text = <span class="hljs-string">&quot;&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> new_text <span class="hljs-keyword">in</span> streamer:
<span class="hljs-meta">... </span>    generated_text += new_text
<span class="hljs-meta">&gt;&gt;&gt; </span>generated_text
<span class="hljs-string">&#x27;An increasing sequence: one, two, three, four, five, six, seven, eight, nine, ten, eleven,&#x27;</span>`}}),{c(){v=s("p"),M=a("Examples:"),k=c(),g(w.$$.fragment)},l(h){v=o(h,"P",{});var $=n(v);M=i($,"Examples:"),$.forEach(r),k=l(h),f(w.$$.fragment,h)},m(h,$){m(h,v,$),t(v,M),m(h,k,$),u(w,h,$),x=!0},p:wt,i(h){x||(_(w.$$.fragment,h),x=!0)},o(h){b(w.$$.fragment,h),x=!1},d(h){h&&r(v),h&&r(k),y(w,h)}}}function fx(E){let v,M,k,w,x,h,$,V,z,U,F,Z,H,ve,W,Q,Te,X,j,kt,$t,me,Mt,xt,da,Bg,Zg,pa,Sg,Vg,ma,Pg,Dg,ha,qg,Gg,om,ga,Xg,nm,jt,Kt,El,ls,Rg,Fl,Cg,am,he,Ng,fa,Ag,Og,ua,Hg,Qg,_a,Yg,Kg,im,ba,ef,cm,ds,lm,ct,tf,Ll,rf,sf,ya,of,nf,dm,ge,va,Jl,af,cf,lf,Ta,zl,df,pf,mf,wa,Ul,hf,gf,ff,ka,Il,uf,_f,pm,S,bf,Wl,yf,vf,Bl,Tf,wf,Zl,kf,$f,Sl,Mf,xf,Vl,jf,Ef,Pl,Ff,Lf,mm,Y,Jf,Dl,zf,Uf,ql,If,Wf,Gl,Bf,Zf,Xl,Sf,Vf,hm,K,Pf,Rl,Df,qf,Cl,Gf,Xf,Nl,Rf,Cf,Al,Nf,Af,gm,ps,fm,er,Of,Ol,Hf,Qf,um,ee,Yf,Hl,Kf,eu,Ql,tu,ru,Yl,su,ou,Kl,nu,au,_m,$a,iu,bm,Et,tr,ed,ms,cu,td,lu,ym,Ft,hs,du,rd,pu,vm,Lt,gs,mu,sd,hu,Tm,we,fs,gu,od,fu,uu,rr,us,_u,nd,bu,wm,Jt,sr,ad,_s,yu,id,vu,km,zt,bs,Tu,cd,wu,$m,Ut,ys,ku,ld,$u,Mm,ke,vs,Mu,dd,xu,ju,or,Ts,Eu,pd,Fu,xm,It,nr,md,ws,Lu,hd,Ju,jm,Wt,ks,zu,gd,Uu,Em,Bt,$s,Iu,fd,Wu,Fm,Zt,ar,ud,Ms,Bu,_d,Zu,Lm,St,xs,Su,bd,Vu,Jm,Vt,js,Pu,yd,Du,zm,Pt,ir,vd,Es,qu,Td,Gu,Um,cr,Xu,Ma,Ru,Cu,Im,$e,Fs,Nu,wd,Au,Ou,xa,Ls,Wm,Me,Js,Hu,P,Qu,ja,Yu,Ku,Ea,e_,t_,kd,r_,s_,$d,Md,o_,n_,Fa,a_,i_,La,c_,l_,d_,Ja,zs,Bm,xe,Us,p_,xd,m_,h_,za,Is,Zm,je,Ws,g_,Ua,Ia,f_,u_,__,Wa,Bs,Sm,ne,Zs,b_,fe,Ba,y_,v_,jd,T_,w_,Ed,k_,$_,Fd,M_,x_,j_,lr,E_,Za,Ss,Vm,R,Vs,F_,Sa,Va,L_,J_,z_,dr,U_,pr,I_,Pa,Ps,Pm,ae,Ds,W_,mr,Da,B_,Z_,qs,S_,V_,P_,hr,D_,qa,Gs,Dm,ie,Xs,q_,Ga,Xa,G_,X_,R_,gr,C_,Ra,Rs,qm,Ee,Cs,N_,Ca,Na,A_,O_,H_,Aa,Ns,Gm,Fe,As,Q_,fr,Oa,Y_,K_,Os,eb,tb,rb,Ha,Hs,Xm,C,Qs,sb,Dt,ob,Qa,nb,ab,Ys,ib,cb,lb,ur,db,_r,pb,Ya,Ks,Rm,N,eo,mb,Ka,ei,hb,gb,fb,br,ub,yr,_b,ti,to,Cm,A,ro,bb,ri,si,yb,vb,Tb,vr,wb,Tr,kb,oi,so,Nm,Le,oo,$b,wr,ni,Mb,xb,no,jb,Eb,Fb,ai,ao,Am,Je,io,Lb,lt,ii,Jb,zb,ci,Ub,Ib,co,Wb,Bb,Zb,li,lo,Om,ze,po,Sb,di,pi,Vb,Pb,Db,mi,mo,Hm,Ue,ho,qb,kr,hi,Gb,Xb,Ld,Rb,Cb,Nb,gi,go,Qm,Ie,fo,Ab,dt,fi,Ob,Hb,Jd,Qb,Yb,zd,Kb,ey,ty,ui,uo,Ym,We,_o,ry,Ud,sy,oy,$r,bo,ny,Id,ay,Km,Be,yo,iy,ce,cy,_i,ly,dy,Wd,py,my,Bd,Zd,hy,gy,bi,fy,uy,_y,yi,vo,eh,Ze,To,by,Sd,yy,vy,Mr,wo,Ty,Vd,wy,th,Se,ko,ky,vi,Ti,$y,My,xy,wi,$o,rh,Ve,Mo,jy,ki,$i,Ey,Fy,Ly,Mi,xo,sh,Pe,jo,Jy,xi,ji,zy,Uy,Iy,Ei,Eo,oh,De,Fo,Wy,Fi,Li,By,Zy,Sy,Ji,Lo,nh,qe,Jo,Vy,zi,Ui,Py,Dy,qy,Ii,zo,ah,Ge,Uo,Gy,xr,Wi,Xy,Ry,Io,Cy,Ny,Ay,Bi,Wo,ih,Xe,Bo,Oy,Zi,Si,Hy,Qy,Yy,Vi,Zo,ch,Re,So,Ky,Pi,Di,ev,tv,rv,qi,Vo,lh,Ce,Po,sv,jr,Gi,ov,nv,Pd,av,iv,cv,Xi,Do,dh,Ne,qo,lv,Dd,dv,pv,Er,Go,mv,qd,hv,ph,Ae,Xo,gv,D,fv,Ri,uv,_v,Ci,bv,yv,Gd,vv,Tv,Xd,Rd,wv,kv,Ni,$v,Mv,Ai,xv,jv,Ev,Oi,Ro,mh,Oe,Co,Fv,Cd,Lv,Jv,Fr,No,zv,Nd,Uv,hh,He,Ao,Iv,Hi,Qi,Wv,Bv,Zv,Yi,Oo,gh,Qe,Ho,Sv,Ki,ec,Vv,Pv,Dv,tc,Qo,fh,Ye,Yo,qv,rc,sc,Gv,Xv,Rv,oc,Ko,uh,Ke,en,Cv,nc,ac,Nv,Av,Ov,ic,tn,_h,et,rn,Hv,Lr,cc,Qv,Yv,Ad,Kv,eT,tT,lc,sn,bh,tt,on,rT,dc,pc,sT,oT,nT,mc,nn,yh,qt,Jr,Od,an,aT,Hd,iT,vh,zr,cT,hc,lT,dT,Th,rt,cn,pT,Qd,mT,hT,gc,ln,wh,Gt,dn,gT,fc,pn,kh,st,mn,fT,hn,uT,Yd,_T,bT,yT,uc,gn,$h,ot,fn,vT,un,TT,Kd,wT,kT,$T,_c,_n,Mh,Xt,Ur,ep,bn,MT,tp,xT,xh,Ir,jT,bc,ET,FT,jh,L,yn,LT,rp,JT,zT,sp,UT,IT,Wr,WT,op,BT,ZT,Br,vn,ST,np,VT,PT,Zr,Tn,DT,ap,qT,GT,Sr,wn,XT,ip,RT,CT,Vr,kn,NT,$n,AT,cp,OT,HT,QT,Pr,Mn,YT,lp,KT,e2,Dr,xn,t2,dp,r2,s2,pt,jn,o2,En,n2,pp,a2,i2,c2,mp,l2,Eh,Rt,Fn,d2,yc,vc,p2,m2,Fh,Ct,Ln,h2,Jn,g2,Tc,f2,u2,Lh,le,zn,_2,hp,b2,y2,G,Un,v2,gp,T2,w2,Nt,k2,fp,$2,M2,up,x2,j2,E2,_p,bp,F2,L2,nt,J2,yp,z2,U2,vp,I2,W2,Tp,B2,Z2,S2,wp,V2,P2,qr,In,D2,kp,q2,Jh,At,Gr,$p,Wn,G2,Mp,X2,zh,de,Bn,R2,Ot,C2,wc,N2,A2,kc,O2,H2,Q2,$c,Zn,Y2,Mc,Sn,Uh,q,Vn,K2,xc,jc,ew,tw,rw,Pn,sw,Dn,ow,nw,aw,Ec,iw,qn,cw,lw,Fc,Gn,dw,Lc,Xn,Ih,pe,Rn,pw,Jc,zc,mw,hw,gw,Uc,Cn,fw,Ic,Nn,Wh,Ht,Xr,xp,An,uw,jp,_w,Bh,at,On,bw,Ep,yw,vw,Wc,Tw,Hn,ww,Zh,it,Qn,kw,Fp,$w,Mw,Bc,xw,Yn,jw,Sh,Qt,Rr,Lp,Kn,Ew,Jp,Fw,Vh,B,ea,Lw,zp,Jw,zw,Cr,Uw,Nr,Iw,Ar,ta,Ww,Up,Bw,Zw,Or,ra,Sw,Ip,Vw,Pw,Hr,sa,Dw,Wp,qw,Ph,O,oa,Gw,Bp,Xw,Rw,Qr,Cw,Yr,Nw,Kr,na,Aw,Zp,Ow,Dh;return h=new be({}),ls=new be({}),ds=new ye({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEdQVDJUb2tlbml6ZXIlMkMlMjBHUFQyTE1IZWFkTW9kZWwlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBHUFQyVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJncHQyJTIyKSUwQW1vZGVsJTIwJTNEJTIwR1BUMkxNSGVhZE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJncHQyJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIwYW5kJTIwJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFnZW5lcmF0aW9uX291dHB1dCUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqaW5wdXRzJTJDJTIwcmV0dXJuX2RpY3RfaW5fZ2VuZXJhdGUlM0RUcnVlJTJDJTIwb3V0cHV0X3Njb3JlcyUzRFRydWUp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> GPT2Tokenizer, GPT2LMHeadModel

tokenizer = GPT2Tokenizer.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)
model = GPT2LMHeadModel.from_pretrained(<span class="hljs-string">&quot;gpt2&quot;</span>)

inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute and &quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
generation_output = model.generate(**inputs, return_dict_in_generate=<span class="hljs-literal">True</span>, output_scores=<span class="hljs-literal">True</span>)`}}),ps=new ye({props:{code:"Z2VuZXJhdGlvbl9vdXRwdXQlNUIlM0EyJTVE",highlighted:'generation_output[:<span class="hljs-number">2</span>]'}}),ms=new be({}),hs=new T({props:{name:"class transformers.generation.GreedySearchDecoderOnlyOutput",anchor:"transformers.generation.GreedySearchDecoderOnlyOutput",parameters:[{name:"sequences",val:": LongTensor = None"},{name:"scores",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"}],parametersDescription:[{anchor:"transformers.generation.GreedySearchDecoderOnlyOutput.sequences",description:`<strong>sequences</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
The generated sequences. The second dimension (sequence_length) is either equal to <code>max_length</code> or shorter
if all batches finished early due to the <code>eos_token_id</code>.`,name:"sequences"},{anchor:"transformers.generation.GreedySearchDecoderOnlyOutput.scores",description:`<strong>scores</strong> (<code>tuple(torch.FloatTensor)</code> <em>optional</em>, returned when <code>output_scores=True</code> is passed or when <code>config.output_scores=True</code>) &#x2014;
Processed prediction scores of the language modeling head (scores for each vocabulary token before SoftMax)
at each generation step. Tuple of <code>torch.FloatTensor</code> with up to <code>max_new_tokens</code> elements (one element for
each generated token), with each tensor of shape <code>(batch_size, config.vocab_size)</code>.`,name:"scores"},{anchor:"transformers.generation.GreedySearchDecoderOnlyOutput.attentions",description:`<strong>attentions</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or <code>config.output_attentions=True</code>) &#x2014;
Tuple (one element for each generated token) of tuples (one element for each layer of the decoder) of
<code>torch.FloatTensor</code> of shape <code>(batch_size, num_heads, generated_length, sequence_length)</code>.`,name:"attentions"},{anchor:"transformers.generation.GreedySearchDecoderOnlyOutput.hidden_states",description:`<strong>hidden_states</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) &#x2014;
Tuple (one element for each generated token) of tuples (one element for each layer of the decoder) of
<code>torch.FloatTensor</code> of shape <code>(batch_size, generated_length, hidden_size)</code>.`,name:"hidden_states"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/utils.py#L85"}}),gs=new T({props:{name:"class transformers.generation.GreedySearchEncoderDecoderOutput",anchor:"transformers.generation.GreedySearchEncoderDecoderOutput",parameters:[{name:"sequences",val:": LongTensor = None"},{name:"scores",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"encoder_attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"encoder_hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"decoder_attentions",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"cross_attentions",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"decoder_hidden_states",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"}],parametersDescription:[{anchor:"transformers.generation.GreedySearchEncoderDecoderOutput.sequences",description:`<strong>sequences</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
The generated sequences. The second dimension (sequence_length) is either equal to <code>max_length</code> or shorter
if all batches finished early due to the <code>eos_token_id</code>.`,name:"sequences"},{anchor:"transformers.generation.GreedySearchEncoderDecoderOutput.scores",description:`<strong>scores</strong> (<code>tuple(torch.FloatTensor)</code> <em>optional</em>, returned when <code>output_scores=True</code> is passed or when <code>config.output_scores=True</code>) &#x2014;
Processed prediction scores of the language modeling head (scores for each vocabulary token before SoftMax)
at each generation step. Tuple of <code>torch.FloatTensor</code> with up to <code>max_new_tokens</code> elements (one element for
each generated token), with each tensor of shape <code>(batch_size, config.vocab_size)</code>.`,name:"scores"},{anchor:"transformers.generation.GreedySearchEncoderDecoderOutput.encoder_attentions",description:`<strong>encoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or <code>config.output_attentions=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for each layer of the decoder) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.`,name:"encoder_attentions"},{anchor:"transformers.generation.GreedySearchEncoderDecoderOutput.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.`,name:"encoder_hidden_states"},{anchor:"transformers.generation.GreedySearchEncoderDecoderOutput.decoder_attentions",description:`<strong>decoder_attentions</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or <code>config.output_attentions=True</code>) &#x2014;
Tuple (one element for each generated token) of tuples (one element for each layer of the decoder) of
<code>torch.FloatTensor</code> of shape <code>(batch_size, num_heads, generated_length, sequence_length)</code>.`,name:"decoder_attentions"},{anchor:"transformers.generation.GreedySearchEncoderDecoderOutput.cross_attentions",description:`<strong>cross_attentions</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or <code>config.output_attentions=True</code>) &#x2014;
Tuple (one element for each generated token) of tuples (one element for each layer of the decoder) of
<code>torch.FloatTensor</code> of shape <code>(batch_size, num_heads, generated_length, sequence_length)</code>.`,name:"cross_attentions"},{anchor:"transformers.generation.GreedySearchEncoderDecoderOutput.decoder_hidden_states",description:`<strong>decoder_hidden_states</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) &#x2014;
Tuple (one element for each generated token) of tuples (one element for each layer of the decoder) of
<code>torch.FloatTensor</code> of shape <code>(batch_size, generated_length, hidden_size)</code>.`,name:"decoder_hidden_states"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/utils.py#L181"}}),fs=new T({props:{name:"class transformers.generation.FlaxGreedySearchOutput",anchor:"transformers.generation.FlaxGreedySearchOutput",parameters:[{name:"sequences",val:": Array = None"}],parametersDescription:[{anchor:"transformers.generation.FlaxGreedySearchOutput.sequences",description:`<strong>sequences</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, max_length)</code>) &#x2014;
The generated sequences.`,name:"sequences"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_utils.py#L55"}}),us=new T({props:{name:"replace",anchor:"transformers.generation.FlaxGreedySearchOutput.replace",parameters:[{name:"**updates",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/flax/struct.py#L111"}}),_s=new be({}),bs=new T({props:{name:"class transformers.generation.SampleDecoderOnlyOutput",anchor:"transformers.generation.SampleDecoderOnlyOutput",parameters:[{name:"sequences",val:": LongTensor = None"},{name:"scores",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"}],parametersDescription:[{anchor:"transformers.generation.SampleDecoderOnlyOutput.sequences",description:`<strong>sequences</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size*num_return_sequences, sequence_length)</code>) &#x2014;
The generated sequences. The second dimension (sequence_length) is either equal to <code>max_length</code> or shorter
if all batches finished early due to the <code>eos_token_id</code>.`,name:"sequences"},{anchor:"transformers.generation.SampleDecoderOnlyOutput.scores",description:`<strong>scores</strong> (<code>tuple(torch.FloatTensor)</code> <em>optional</em>, returned when <code>output_scores=True</code> is passed or when <code>config.output_scores=True</code>) &#x2014;
Processed prediction scores of the language modeling head (scores for each vocabulary token before SoftMax)
at each generation step. Tuple of <code>torch.FloatTensor</code> with up to <code>max_new_tokens</code> elements (one element for
each generated token), with each tensor of shape <code>(batch_size*num_return_sequences, config.vocab_size)</code>.`,name:"scores"},{anchor:"transformers.generation.SampleDecoderOnlyOutput.attentions",description:`<strong>attentions</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or <code>config.output_attentions=True</code>) &#x2014;
Tuple (one element for each generated token) of tuples (one element for each layer of the decoder) of
<code>torch.FloatTensor</code> of shape <code>(num_return_sequences*batch_size, num_heads, generated_length, sequence_length)</code>.`,name:"attentions"},{anchor:"transformers.generation.SampleDecoderOnlyOutput.hidden_states",description:`<strong>hidden_states</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) &#x2014;
Tuple (one element for each generated token) of tuples (one element for each layer of the decoder) of
<code>torch.FloatTensor</code> of shape <code>(num_return_sequences*batch_size, generated_length, hidden_size)</code>.`,name:"hidden_states"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/utils.py#L223"}}),ys=new T({props:{name:"class transformers.generation.SampleEncoderDecoderOutput",anchor:"transformers.generation.SampleEncoderDecoderOutput",parameters:[{name:"sequences",val:": LongTensor = None"},{name:"scores",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"encoder_attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"encoder_hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"decoder_attentions",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"cross_attentions",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"decoder_hidden_states",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"}],parametersDescription:[{anchor:"transformers.generation.SampleEncoderDecoderOutput.sequences",description:`<strong>sequences</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size*num_return_sequences, sequence_length)</code>) &#x2014;
The generated sequences. The second dimension (sequence_length) is either equal to <code>max_length</code> or shorter
if all batches finished early due to the <code>eos_token_id</code>.`,name:"sequences"},{anchor:"transformers.generation.SampleEncoderDecoderOutput.scores",description:`<strong>scores</strong> (<code>tuple(torch.FloatTensor)</code> <em>optional</em>, returned when <code>output_scores=True</code> is passed or when <code>config.output_scores=True</code>) &#x2014;
Processed prediction scores of the language modeling head (scores for each vocabulary token before SoftMax)
at each generation step. Tuple of <code>torch.FloatTensor</code> with up to <code>max_new_tokens</code> elements (one element for
each generated token), with each tensor of shape <code>(batch_size*num_return_sequences, config.vocab_size)</code>.`,name:"scores"},{anchor:"transformers.generation.SampleEncoderDecoderOutput.encoder_attentions",description:`<strong>encoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or <code>config.output_attentions=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for each layer of the decoder) of shape
<code>(batch_size*num_return_sequences, num_heads, sequence_length, sequence_length)</code>.`,name:"encoder_attentions"},{anchor:"transformers.generation.SampleEncoderDecoderOutput.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size*num_return_sequences, sequence_length, hidden_size)</code>.`,name:"encoder_hidden_states"},{anchor:"transformers.generation.SampleEncoderDecoderOutput.decoder_attentions",description:`<strong>decoder_attentions</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or <code>config.output_attentions=True</code>) &#x2014;
Tuple (one element for each generated token) of tuples (one element for each layer of the decoder) of
<code>torch.FloatTensor</code> of shape <code>(batch_size*num_return_sequences, num_heads, generated_length, sequence_length)</code>.`,name:"decoder_attentions"},{anchor:"transformers.generation.SampleEncoderDecoderOutput.cross_attentions",description:`<strong>cross_attentions</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or <code>config.output_attentions=True</code>) &#x2014;
Tuple (one element for each generated token) of tuples (one element for each layer of the decoder) of
<code>torch.FloatTensor</code> of shape <code>(batch_size, num_heads, generated_length, sequence_length)</code>.`,name:"cross_attentions"},{anchor:"transformers.generation.SampleEncoderDecoderOutput.decoder_hidden_states",description:`<strong>decoder_hidden_states</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) &#x2014;
Tuple (one element for each generated token) of tuples (one element for each layer of the decoder) of
<code>torch.FloatTensor</code> of shape <code>(batch_size*num_return_sequences, generated_length, hidden_size)</code>.`,name:"decoder_hidden_states"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/utils.py#L252"}}),vs=new T({props:{name:"class transformers.generation.FlaxSampleOutput",anchor:"transformers.generation.FlaxSampleOutput",parameters:[{name:"sequences",val:": Array = None"}],parametersDescription:[{anchor:"transformers.generation.FlaxSampleOutput.sequences",description:`<strong>sequences</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, max_length)</code>) &#x2014;
The generated sequences.`,name:"sequences"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_utils.py#L69"}}),Ts=new T({props:{name:"replace",anchor:"transformers.generation.FlaxSampleOutput.replace",parameters:[{name:"**updates",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/flax/struct.py#L111"}}),ws=new be({}),ks=new T({props:{name:"class transformers.generation.BeamSearchDecoderOnlyOutput",anchor:"transformers.generation.BeamSearchDecoderOnlyOutput",parameters:[{name:"sequences",val:": LongTensor = None"},{name:"sequences_scores",val:": typing.Optional[torch.FloatTensor] = None"},{name:"scores",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"beam_indices",val:": typing.Optional[torch.LongTensor] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"}],parametersDescription:[{anchor:"transformers.generation.BeamSearchDecoderOnlyOutput.sequences",description:`<strong>sequences</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size*num_return_sequences, sequence_length)</code>) &#x2014;
The generated sequences. The second dimension (sequence_length) is either equal to <code>max_length</code> or shorter
if all batches finished early due to the <code>eos_token_id</code>.`,name:"sequences"},{anchor:"transformers.generation.BeamSearchDecoderOnlyOutput.sequences_scores",description:`<strong>sequences_scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size*num_return_sequences)</code>, <em>optional</em>, returned when <code>output_scores=True</code> is passed or when <code>config.output_scores=True</code>) &#x2014;
Final beam scores of the generated <code>sequences</code>.`,name:"sequences_scores"},{anchor:"transformers.generation.BeamSearchDecoderOnlyOutput.scores",description:`<strong>scores</strong> (<code>tuple(torch.FloatTensor)</code> <em>optional</em>, returned when <code>output_scores=True</code> is passed or when <code>config.output_scores=True</code>) &#x2014;
Beam transition scores for each vocabulary token at each generation step. Beam transition scores consisting
of log probabilities of tokens conditioned on log softmax of previously generated tokens in this beam.
Tuple of <code>torch.FloatTensor</code> with up to <code>max_new_tokens</code> elements (one element for each generated token),
with each tensor of shape <code>(batch_size*num_beams*num_return_sequences, config.vocab_size)</code>.`,name:"scores"},{anchor:"transformers.generation.BeamSearchDecoderOnlyOutput.beam_indices",description:`<strong>beam_indices</strong> (<code>torch.LongTensor</code>, <em>optional</em>, returned when <code>output_scores=True</code> is passed or when <code>config.output_scores=True</code>) &#x2014;
Beam indices of generated token id at each generation step. <code>torch.LongTensor</code> of shape
<code>(batch_size*num_return_sequences, sequence_length)</code>.`,name:"beam_indices"},{anchor:"transformers.generation.BeamSearchDecoderOnlyOutput.attentions",description:`<strong>attentions</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or <code>config.output_attentions=True</code>) &#x2014;
Tuple (one element for each generated token) of tuples (one element for each layer of the decoder) of
<code>torch.FloatTensor</code> of shape <code>(batch_size*num_beams, num_heads, generated_length, sequence_length)</code>.`,name:"attentions"},{anchor:"transformers.generation.BeamSearchDecoderOnlyOutput.hidden_states",description:`<strong>hidden_states</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) &#x2014;
Tuple (one element for each generated token) of tuples (one element for each layer of the decoder) of
<code>torch.FloatTensor</code> of shape <code>(batch_size*num_beams*num_return_sequences, generated_length, hidden_size)</code>.`,name:"hidden_states"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/utils.py#L295"}}),$s=new T({props:{name:"class transformers.generation.BeamSearchEncoderDecoderOutput",anchor:"transformers.generation.BeamSearchEncoderDecoderOutput",parameters:[{name:"sequences",val:": LongTensor = None"},{name:"sequences_scores",val:": typing.Optional[torch.FloatTensor] = None"},{name:"scores",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"beam_indices",val:": typing.Optional[torch.LongTensor] = None"},{name:"encoder_attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"encoder_hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"decoder_attentions",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"cross_attentions",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"decoder_hidden_states",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"}],parametersDescription:[{anchor:"transformers.generation.BeamSearchEncoderDecoderOutput.sequences",description:`<strong>sequences</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size*num_return_sequences, sequence_length)</code>) &#x2014;
The generated sequences. The second dimension (sequence_length) is either equal to <code>max_length</code> or shorter
if all batches finished early due to the <code>eos_token_id</code>.`,name:"sequences"},{anchor:"transformers.generation.BeamSearchEncoderDecoderOutput.sequences_scores",description:`<strong>sequences_scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size*num_return_sequences)</code>, <em>optional</em>, returned when <code>output_scores=True</code> is passed or when <code>config.output_scores=True</code>) &#x2014;
Final beam scores of the generated <code>sequences</code>.`,name:"sequences_scores"},{anchor:"transformers.generation.BeamSearchEncoderDecoderOutput.scores",description:`<strong>scores</strong> (<code>tuple(torch.FloatTensor)</code> <em>optional</em>, returned when <code>output_scores=True</code> is passed or when <code>config.output_scores=True</code>) &#x2014;
Beam transition scores for each vocabulary token at each generation step. Beam transition scores consisting
of log probabilities of tokens conditioned on log softmax of previously generated tokens in this beam.
Tuple of <code>torch.FloatTensor</code> with up to <code>max_new_tokens</code> elements (one element for each generated token),
with each tensor of shape <code>(batch_size*num_beams, config.vocab_size)</code>.`,name:"scores"},{anchor:"transformers.generation.BeamSearchEncoderDecoderOutput.beam_indices",description:`<strong>beam_indices</strong> (<code>torch.LongTensor</code>, <em>optional</em>, returned when <code>output_scores=True</code> is passed or when <code>config.output_scores=True</code>) &#x2014;
Beam indices of generated token id at each generation step. <code>torch.LongTensor</code> of shape
<code>(batch_size*num_return_sequences, sequence_length)</code>.`,name:"beam_indices"},{anchor:"transformers.generation.BeamSearchEncoderDecoderOutput.encoder_attentions",description:`<strong>encoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or <code>config.output_attentions=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for each layer of the decoder) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.`,name:"encoder_attentions"},{anchor:"transformers.generation.BeamSearchEncoderDecoderOutput.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size*num_beams*num_return_sequences, sequence_length, hidden_size)</code>.`,name:"encoder_hidden_states"},{anchor:"transformers.generation.BeamSearchEncoderDecoderOutput.decoder_attentions",description:`<strong>decoder_attentions</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or <code>config.output_attentions=True</code>) &#x2014;
Tuple (one element for each generated token) of tuples (one element for each layer of the decoder) of
<code>torch.FloatTensor</code> of shape <code>(batch_size*num_beams*num_return_sequences, num_heads, generated_length, sequence_length)</code>.`,name:"decoder_attentions"},{anchor:"transformers.generation.BeamSearchEncoderDecoderOutput.cross_attentions",description:`<strong>cross_attentions</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or <code>config.output_attentions=True</code>) &#x2014;
Tuple (one element for each generated token) of tuples (one element for each layer of the decoder) of
<code>torch.FloatTensor</code> of shape <code>(batch_size, num_heads, generated_length, sequence_length)</code>.`,name:"cross_attentions"},{anchor:"transformers.generation.BeamSearchEncoderDecoderOutput.decoder_hidden_states",description:`<strong>decoder_hidden_states</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) &#x2014;
Tuple (one element for each generated token) of tuples (one element for each layer of the decoder) of
<code>torch.FloatTensor</code> of shape <code>(batch_size*num_beams*num_return_sequences, generated_length, hidden_size)</code>.`,name:"decoder_hidden_states"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/utils.py#L330"}}),Ms=new be({}),xs=new T({props:{name:"class transformers.generation.BeamSampleDecoderOnlyOutput",anchor:"transformers.generation.BeamSampleDecoderOnlyOutput",parameters:[{name:"sequences",val:": LongTensor = None"},{name:"sequences_scores",val:": typing.Optional[torch.FloatTensor] = None"},{name:"scores",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"beam_indices",val:": typing.Optional[torch.LongTensor] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"}],parametersDescription:[{anchor:"transformers.generation.BeamSampleDecoderOnlyOutput.sequences",description:`<strong>sequences</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size*num_return_sequences, sequence_length)</code>) &#x2014;
The generated sequences. The second dimension (sequence_length) is either equal to <code>max_length</code> or shorter
if all batches finished early due to the <code>eos_token_id</code>.`,name:"sequences"},{anchor:"transformers.generation.BeamSampleDecoderOnlyOutput.sequences_scores",description:`<strong>sequences_scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size * num_return_sequence)</code>, <em>optional</em>, returned when <code>output_scores=True</code> is passed or when <code>config.output_scores=True</code>) &#x2014;
Final beam scores of the generated <code>sequences</code>.`,name:"sequences_scores"},{anchor:"transformers.generation.BeamSampleDecoderOnlyOutput.scores",description:`<strong>scores</strong> (<code>tuple(torch.FloatTensor)</code> <em>optional</em>, returned when <code>output_scores=True</code> is passed or when <code>config.output_scores=True</code>) &#x2014;
Beam transition scores for each vocabulary token at each generation step. Beam transition scores consisting
of log probabilities of tokens conditioned on log softmax of previously generated tokens in this beam.
Tuple of <code>torch.FloatTensor</code> with up to <code>max_new_tokens</code> elements (one element for each generated token),
with each tensor of shape <code>(batch_size*num_beams*num_return_sequences, config.vocab_size)</code>.`,name:"scores"},{anchor:"transformers.generation.BeamSampleDecoderOnlyOutput.beam_indices",description:`<strong>beam_indices</strong> (<code>torch.LongTensor</code>, <em>optional</em>, returned when <code>output_scores=True</code> is passed or when <code>config.output_scores=True</code>) &#x2014;
Beam indices of generated token id at each generation step. <code>torch.LongTensor</code> of shape
<code>(batch_size*num_return_sequences, sequence_length)</code>.`,name:"beam_indices"},{anchor:"transformers.generation.BeamSampleDecoderOnlyOutput.attentions",description:`<strong>attentions</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or <code>config.output_attentions=True</code>) &#x2014;
Tuple (one element for each generated token) of tuples (one element for each layer of the decoder) of
<code>torch.FloatTensor</code> of shape <code>(batch_size*num_beams, num_heads, generated_length, sequence_length)</code>.`,name:"attentions"},{anchor:"transformers.generation.BeamSampleDecoderOnlyOutput.hidden_states",description:`<strong>hidden_states</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) &#x2014;
Tuple (one element for each generated token) of tuples (one element for each layer of the decoder) of
<code>torch.FloatTensor</code> of shape <code>(batch_size*num_beams, generated_length, hidden_size)</code>.`,name:"hidden_states"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/utils.py#L380"}}),js=new T({props:{name:"class transformers.generation.BeamSampleEncoderDecoderOutput",anchor:"transformers.generation.BeamSampleEncoderDecoderOutput",parameters:[{name:"sequences",val:": LongTensor = None"},{name:"sequences_scores",val:": typing.Optional[torch.FloatTensor] = None"},{name:"scores",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"beam_indices",val:": typing.Optional[torch.LongTensor] = None"},{name:"encoder_attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"encoder_hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"decoder_attentions",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"cross_attentions",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"decoder_hidden_states",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"}],parametersDescription:[{anchor:"transformers.generation.BeamSampleEncoderDecoderOutput.sequences",description:`<strong>sequences</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size*num_beams, sequence_length)</code>) &#x2014;
The generated sequences. The second dimension (sequence_length) is either equal to <code>max_length</code> or shorter
if all batches finished early due to the <code>eos_token_id</code>.`,name:"sequences"},{anchor:"transformers.generation.BeamSampleEncoderDecoderOutput.sequences_scores",description:`<strong>sequences_scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size * num_return_sequence)</code>, <em>optional</em>, returned when <code>output_scores=True</code> is passed or when <code>config.output_scores=True</code>) &#x2014;
Final beam scores of the generated <code>sequences</code>.`,name:"sequences_scores"},{anchor:"transformers.generation.BeamSampleEncoderDecoderOutput.scores",description:`<strong>scores</strong> (<code>tuple(torch.FloatTensor)</code> <em>optional</em>, returned when <code>output_scores=True</code> is passed or when <code>config.output_scores=True</code>) &#x2014;
Beam transition scores for each vocabulary token at each generation step. Beam transition scores consisting
of log probabilities of tokens conditioned on log softmax of previously generated tokens in this beam.
Tuple of <code>torch.FloatTensor</code> with up to <code>max_new_tokens</code> elements (one element for each generated token),
with each tensor of shape <code>(batch_size*num_beams, config.vocab_size)</code>).`,name:"scores"},{anchor:"transformers.generation.BeamSampleEncoderDecoderOutput.beam_indices",description:`<strong>beam_indices</strong> (<code>torch.LongTensor</code>, <em>optional</em>, returned when <code>output_scores=True</code> is passed or when <code>config.output_scores=True</code>) &#x2014;
Beam indices of generated token id at each generation step. <code>torch.LongTensor</code> of shape
<code>(batch_size*num_return_sequences, sequence_length)</code>.`,name:"beam_indices"},{anchor:"transformers.generation.BeamSampleEncoderDecoderOutput.encoder_attentions",description:`<strong>encoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or <code>config.output_attentions=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for each layer of the decoder) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.`,name:"encoder_attentions"},{anchor:"transformers.generation.BeamSampleEncoderDecoderOutput.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size*num_beams, sequence_length, hidden_size)</code>.`,name:"encoder_hidden_states"},{anchor:"transformers.generation.BeamSampleEncoderDecoderOutput.decoder_attentions",description:`<strong>decoder_attentions</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or <code>config.output_attentions=True</code>) &#x2014;
Tuple (one element for each generated token) of tuples (one element for each layer of the decoder) of
<code>torch.FloatTensor</code> of shape <code>(batch_size*num_beams, num_heads, generated_length, sequence_length)</code>.`,name:"decoder_attentions"},{anchor:"transformers.generation.BeamSampleEncoderDecoderOutput.cross_attentions",description:`<strong>cross_attentions</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or <code>config.output_attentions=True</code>) &#x2014;
Tuple (one element for each generated token) of tuples (one element for each layer of the decoder) of
<code>torch.FloatTensor</code> of shape <code>(batch_size, num_heads, generated_length, sequence_length)</code>.`,name:"cross_attentions"},{anchor:"transformers.generation.BeamSampleEncoderDecoderOutput.decoder_hidden_states",description:`<strong>decoder_hidden_states</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) &#x2014;
Tuple (one element for each generated token) of tuples (one element for each layer of the decoder) of
<code>torch.FloatTensor</code> of shape <code>(batch_size*num_beams, generated_length, hidden_size)</code>.`,name:"decoder_hidden_states"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/utils.py#L415"}}),Es=new be({}),Fs=new T({props:{name:"class transformers.LogitsProcessor",anchor:"transformers.LogitsProcessor",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L44"}}),Ls=new T({props:{name:"__call__",anchor:"transformers.LogitsProcessor.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"}],parametersDescription:[{anchor:"transformers.LogitsProcessor.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. <a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.LogitsProcessor.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search`,name:"scores"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L47",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),Js=new T({props:{name:"class transformers.LogitsProcessorList",anchor:"transformers.LogitsProcessorList",parameters:[{name:"iterable",val:" = ()"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L64"}}),zs=new T({props:{name:"__call__",anchor:"transformers.LogitsProcessorList.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.LogitsProcessorList.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. <a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.LogitsProcessorList.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using
beam search or log softmax for each vocabulary token when using beam search`,name:"scores"},{anchor:"transformers.LogitsProcessorList.__call__.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional kwargs that are specific to a logits processor.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L71",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),Us=new T({props:{name:"class transformers.LogitsWarper",anchor:"transformers.LogitsWarper",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L54"}}),Is=new T({props:{name:"__call__",anchor:"transformers.LogitsWarper.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"}],parametersDescription:[{anchor:"transformers.LogitsWarper.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. <a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.LogitsWarper.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search`,name:"scores"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L57",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),Ws=new T({props:{name:"class transformers.MinLengthLogitsProcessor",anchor:"transformers.MinLengthLogitsProcessor",parameters:[{name:"min_length",val:": int"},{name:"eos_token_id",val:": typing.Union[int, typing.List[int]]"}],parametersDescription:[{anchor:"transformers.MinLengthLogitsProcessor.min_length",description:`<strong>min_length</strong> (<code>int</code>) &#x2014;
The minimum length below which the score of <code>eos_token_id</code> is set to <code>-float(&quot;Inf&quot;)</code>.`,name:"min_length"},{anchor:"transformers.MinLengthLogitsProcessor.eos_token_id",description:`<strong>eos_token_id</strong> (<code>Union[int, List[int]]</code>) &#x2014;
The id of the <em>end-of-sequence</em> token. Optionally, use a list to set multiple <em>end-of-sequence</em> tokens.`,name:"eos_token_id"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L101"}}),Bs=new T({props:{name:"__call__",anchor:"transformers.MinLengthLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"}],parametersDescription:[{anchor:"transformers.MinLengthLogitsProcessor.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. <a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.MinLengthLogitsProcessor.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search`,name:"scores"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L124",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),Zs=new T({props:{name:"class transformers.MinNewTokensLengthLogitsProcessor",anchor:"transformers.MinNewTokensLengthLogitsProcessor",parameters:[{name:"prompt_length_to_skip",val:": int"},{name:"min_new_tokens",val:": int"},{name:"eos_token_id",val:": typing.Union[int, typing.List[int]]"}],parametersDescription:[{anchor:"transformers.MinNewTokensLengthLogitsProcessor.prompt_length_to_skip",description:`<strong>prompt_length_to_skip</strong> (<code>int</code>) &#x2014;
The input tokens length. Not a valid argument when used with <code>generate</code> as it will automatically assign the
input length.`,name:"prompt_length_to_skip"},{anchor:"transformers.MinNewTokensLengthLogitsProcessor.min_new_tokens",description:`<strong>min_new_tokens</strong> (<code>int</code>) &#x2014;
The minimum <em>new</em> tokens length below which the score of <code>eos_token_id</code> is set to <code>-float(&quot;Inf&quot;)</code>.`,name:"min_new_tokens"},{anchor:"transformers.MinNewTokensLengthLogitsProcessor.eos_token_id",description:`<strong>eos_token_id</strong> (<code>Union[int, List[int]]</code>) &#x2014;
The id of the <em>end-of-sequence</em> token. Optionally, use a list to set multiple <em>end-of-sequence</em> tokens.`,name:"eos_token_id"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L133"}}),lr=new Tt({props:{anchor:"transformers.MinNewTokensLengthLogitsProcessor.example",$$slots:{default:[KM]},$$scope:{ctx:E}}}),Ss=new T({props:{name:"__call__",anchor:"transformers.MinNewTokensLengthLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"}],parametersDescription:[{anchor:"transformers.MinNewTokensLengthLogitsProcessor.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. <a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.MinNewTokensLengthLogitsProcessor.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search`,name:"scores"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L202",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),Vs=new T({props:{name:"class transformers.TemperatureLogitsWarper",anchor:"transformers.TemperatureLogitsWarper",parameters:[{name:"temperature",val:": float"}],parametersDescription:[{anchor:"transformers.TemperatureLogitsWarper.temperature",description:`<strong>temperature</strong> (<code>float</code>) &#x2014;
Strictly positive float value used to modulate the logits distribution. A value smaller than <code>1</code> decreases
randomness (and vice versa), with <code>0</code> being equivalent to shifting all probability mass to the most likely
token.`,name:"temperature"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L212"}}),dr=new jl({props:{$$slots:{default:[ex]},$$scope:{ctx:E}}}),pr=new Tt({props:{anchor:"transformers.TemperatureLogitsWarper.example",$$slots:{default:[tx]},$$scope:{ctx:E}}}),Ps=new T({props:{name:"__call__",anchor:"transformers.TemperatureLogitsWarper.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"}],parametersDescription:[{anchor:"transformers.TemperatureLogitsWarper.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. <a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TemperatureLogitsWarper.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search`,name:"scores"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L273",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),Ds=new T({props:{name:"class transformers.RepetitionPenaltyLogitsProcessor",anchor:"transformers.RepetitionPenaltyLogitsProcessor",parameters:[{name:"penalty",val:": float"}],parametersDescription:[{anchor:"transformers.RepetitionPenaltyLogitsProcessor.repetition_penalty",description:`<strong>repetition_penalty</strong> (<code>float</code>) &#x2014;
The parameter for repetition penalty. 1.0 means no penalty. See <a href="https://arxiv.org/pdf/1909.05858.pdf" rel="nofollow">this
paper</a> for more details.`,name:"repetition_penalty"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L279"}}),hr=new Tt({props:{anchor:"transformers.RepetitionPenaltyLogitsProcessor.example",$$slots:{default:[rx]},$$scope:{ctx:E}}}),Gs=new T({props:{name:"__call__",anchor:"transformers.RepetitionPenaltyLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"}],parametersDescription:[{anchor:"transformers.RepetitionPenaltyLogitsProcessor.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. <a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.RepetitionPenaltyLogitsProcessor.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search`,name:"scores"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L321",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),Xs=new T({props:{name:"class transformers.TopPLogitsWarper",anchor:"transformers.TopPLogitsWarper",parameters:[{name:"top_p",val:": float"},{name:"filter_value",val:": float = -inf"},{name:"min_tokens_to_keep",val:": int = 1"}],parametersDescription:[{anchor:"transformers.TopPLogitsWarper.top_p",description:`<strong>top_p</strong> (<code>float</code>) &#x2014;
If set to &lt; 1, only the smallest set of most probable tokens with probabilities that add up to <code>top_p</code> or
higher are kept for generation.`,name:"top_p"},{anchor:"transformers.TopPLogitsWarper.filter_value",description:`<strong>filter_value</strong> (<code>float</code>, <em>optional</em>, defaults to <code>-float(&quot;Inf&quot;)</code>) &#x2014;
All filtered values will be set to this float value.`,name:"filter_value"},{anchor:"transformers.TopPLogitsWarper.min_tokens_to_keep",description:`<strong>min_tokens_to_keep</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Minimum number of tokens that cannot be filtered.`,name:"min_tokens_to_keep"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L361"}}),gr=new Tt({props:{anchor:"transformers.TopPLogitsWarper.example",$$slots:{default:[sx]},$$scope:{ctx:E}}}),Rs=new T({props:{name:"__call__",anchor:"transformers.TopPLogitsWarper.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"}],parametersDescription:[{anchor:"transformers.TopPLogitsWarper.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. <a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TopPLogitsWarper.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search`,name:"scores"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L417",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),Cs=new T({props:{name:"class transformers.TopKLogitsWarper",anchor:"transformers.TopKLogitsWarper",parameters:[{name:"top_k",val:": int"},{name:"filter_value",val:": float = -inf"},{name:"min_tokens_to_keep",val:": int = 1"}],parametersDescription:[{anchor:"transformers.TopKLogitsWarper.top_k",description:`<strong>top_k</strong> (<code>int</code>) &#x2014;
The number of highest probability vocabulary tokens to keep for top-k-filtering.`,name:"top_k"},{anchor:"transformers.TopKLogitsWarper.filter_value",description:`<strong>filter_value</strong> (<code>float</code>, <em>optional</em>, defaults to <code>-float(&quot;Inf&quot;)</code>) &#x2014;
All filtered values will be set to this float value.`,name:"filter_value"},{anchor:"transformers.TopKLogitsWarper.min_tokens_to_keep",description:`<strong>min_tokens_to_keep</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Minimum number of tokens that cannot be filtered.`,name:"min_tokens_to_keep"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L433"}}),Ns=new T({props:{name:"__call__",anchor:"transformers.TopKLogitsWarper.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"}],parametersDescription:[{anchor:"transformers.TopKLogitsWarper.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. <a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TopKLogitsWarper.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search`,name:"scores"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L453",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),As=new T({props:{name:"class transformers.TypicalLogitsWarper",anchor:"transformers.TypicalLogitsWarper",parameters:[{name:"mass",val:": float = 0.9"},{name:"filter_value",val:": float = -inf"},{name:"min_tokens_to_keep",val:": int = 1"}],parametersDescription:[{anchor:"transformers.TypicalLogitsWarper.mass",description:`<strong>mass</strong> (<code>float</code>) &#x2014;
Value of typical_p between 0 and 1 inclusive, defaults to 0.9.`,name:"mass"},{anchor:"transformers.TypicalLogitsWarper.filter_value",description:`<strong>filter_value</strong> (<code>float</code>, <em>optional</em>, defaults to <code>-float(&quot;Inf&quot;)</code>) &#x2014;
All filtered values will be set to this float value.`,name:"filter_value"},{anchor:"transformers.TypicalLogitsWarper.min_tokens_to_keep",description:`<strong>min_tokens_to_keep</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Minimum number of tokens that cannot be filtered.`,name:"min_tokens_to_keep"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L462"}}),Hs=new T({props:{name:"__call__",anchor:"transformers.TypicalLogitsWarper.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"}],parametersDescription:[{anchor:"transformers.TypicalLogitsWarper.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. <a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TypicalLogitsWarper.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search`,name:"scores"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L487",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),Qs=new T({props:{name:"class transformers.NoRepeatNGramLogitsProcessor",anchor:"transformers.NoRepeatNGramLogitsProcessor",parameters:[{name:"ngram_size",val:": int"}],parametersDescription:[{anchor:"transformers.NoRepeatNGramLogitsProcessor.ngram_size",description:`<strong>ngram_size</strong> (<code>int</code>) &#x2014;
All ngrams of size <code>ngram_size</code> can only occur once.`,name:"ngram_size"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L715"}}),ur=new jl({props:{$$slots:{default:[ox]},$$scope:{ctx:E}}}),_r=new Tt({props:{anchor:"transformers.NoRepeatNGramLogitsProcessor.example",$$slots:{default:[nx]},$$scope:{ctx:E}}}),Ks=new T({props:{name:"__call__",anchor:"transformers.NoRepeatNGramLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"}],parametersDescription:[{anchor:"transformers.NoRepeatNGramLogitsProcessor.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. <a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.NoRepeatNGramLogitsProcessor.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search`,name:"scores"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L761",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),eo=new T({props:{name:"class transformers.SequenceBiasLogitsProcessor",anchor:"transformers.SequenceBiasLogitsProcessor",parameters:[{name:"sequence_bias",val:": typing.Dict[typing.Tuple[int], float]"}],parametersDescription:[{anchor:"transformers.SequenceBiasLogitsProcessor.sequence_bias",description:`<strong>sequence_bias</strong> (<code>Dict[Tuple[int], float]</code>) &#x2014;
Dictionary that maps a sequence of tokens to its bias term. Positive biases increase the odds of the
sequence being selected, while negative biases do the opposite. If a sequence has a length of 1, its bias
will always be applied. Otherwise, the bias will only be applied if the sequence in question is about to be
completed (in the token selection step after this processor is applied).`,name:"sequence_bias"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L814"}}),br=new jl({props:{$$slots:{default:[ax]},$$scope:{ctx:E}}}),yr=new Tt({props:{anchor:"transformers.SequenceBiasLogitsProcessor.example",$$slots:{default:[ix]},$$scope:{ctx:E}}}),to=new T({props:{name:"__call__",anchor:"transformers.SequenceBiasLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"}],parametersDescription:[{anchor:"transformers.SequenceBiasLogitsProcessor.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. <a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.SequenceBiasLogitsProcessor.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search`,name:"scores"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L885",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),ro=new T({props:{name:"class transformers.NoBadWordsLogitsProcessor",anchor:"transformers.NoBadWordsLogitsProcessor",parameters:[{name:"bad_words_ids",val:": typing.List[typing.List[int]]"},{name:"eos_token_id",val:": typing.Union[int, typing.List[int]]"}],parametersDescription:[{anchor:"transformers.NoBadWordsLogitsProcessor.bad_words_ids",description:`<strong>bad_words_ids</strong> (<code>List[List[int]]</code>) &#x2014;
List of list of token ids that are not allowed to be generated.`,name:"bad_words_ids"},{anchor:"transformers.NoBadWordsLogitsProcessor.eos_token_id",description:`<strong>eos_token_id</strong> (<code>Union[int, List[int]]</code>) &#x2014;
The id of the <em>end-of-sequence</em> token. Optionally, use a list to set multiple <em>end-of-sequence</em> tokens.`,name:"eos_token_id"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L962"}}),vr=new jl({props:{$$slots:{default:[cx]},$$scope:{ctx:E}}}),Tr=new Tt({props:{anchor:"transformers.NoBadWordsLogitsProcessor.example",$$slots:{default:[lx]},$$scope:{ctx:E}}}),so=new T({props:{name:"__call__",anchor:"transformers.NoBadWordsLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"}],parametersDescription:[{anchor:"transformers.NoBadWordsLogitsProcessor.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. <a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.NoBadWordsLogitsProcessor.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search`,name:"scores"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L885",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),oo=new T({props:{name:"class transformers.PrefixConstrainedLogitsProcessor",anchor:"transformers.PrefixConstrainedLogitsProcessor",parameters:[{name:"prefix_allowed_tokens_fn",val:": typing.Callable[[int, torch.Tensor], typing.List[int]]"},{name:"num_beams",val:": int"}],parametersDescription:[{anchor:"transformers.PrefixConstrainedLogitsProcessor.prefix_allowed_tokens_fn",description:`<strong>prefix_allowed_tokens_fn</strong> (<code>Callable[[int, torch.Tensor], List[int]]</code>) &#x2014;
This function constraints the beam search to allowed tokens only at each step. This function takes 2
arguments <code>inputs_ids</code> and the batch ID <code>batch_id</code>. It has to return a list with the allowed tokens for the
next generation step conditioned on the previously generated tokens <code>inputs_ids</code> and the batch ID
<code>batch_id</code>.`,name:"prefix_allowed_tokens_fn"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L1059"}}),ao=new T({props:{name:"__call__",anchor:"transformers.PrefixConstrainedLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"}],parametersDescription:[{anchor:"transformers.PrefixConstrainedLogitsProcessor.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. <a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.PrefixConstrainedLogitsProcessor.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search`,name:"scores"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L1076",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),io=new T({props:{name:"class transformers.HammingDiversityLogitsProcessor",anchor:"transformers.HammingDiversityLogitsProcessor",parameters:[{name:"diversity_penalty",val:": float"},{name:"num_beams",val:": int"},{name:"num_beam_groups",val:": int"}],parametersDescription:[{anchor:"transformers.HammingDiversityLogitsProcessor.diversity_penalty",description:`<strong>diversity_penalty</strong> (<code>float</code>) &#x2014;
This value is subtracted from a beam&#x2019;s score if it generates a token same as any beam from other group at a
particular time. Note that <code>diversity_penalty</code> is only effective if <code>group beam search</code> is enabled.`,name:"diversity_penalty"},{anchor:"transformers.HammingDiversityLogitsProcessor.num_beams",description:`<strong>num_beams</strong> (<code>int</code>) &#x2014;
Number of beams used for group beam search. See <a href="https://arxiv.org/pdf/1610.02424.pdf" rel="nofollow">this paper</a> for more
details.`,name:"num_beams"},{anchor:"transformers.HammingDiversityLogitsProcessor.num_beam_groups",description:`<strong>num_beam_groups</strong> (<code>int</code>) &#x2014;
Number of groups to divide <code>num_beams</code> into in order to ensure diversity among different groups of beams.
See <a href="https://arxiv.org/pdf/1610.02424.pdf" rel="nofollow">this paper</a> for more details.`,name:"num_beam_groups"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L1086"}}),lo=new T({props:{name:"__call__",anchor:"transformers.HammingDiversityLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"},{name:"current_tokens",val:": LongTensor"},{name:"beam_group_idx",val:": int"}],parametersDescription:[{anchor:"transformers.HammingDiversityLogitsProcessor.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. <a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.HammingDiversityLogitsProcessor.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using
beam search or log softmax for each vocabulary token when using beam search`,name:"scores"},{anchor:"transformers.HammingDiversityLogitsProcessor.__call__.current_tokens",description:`<strong>current_tokens</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary, corresponding to the tokens selected by the other
beam groups in the current generation step.`,name:"current_tokens"},{anchor:"transformers.HammingDiversityLogitsProcessor.__call__.beam_group_idx",description:`<strong>beam_group_idx</strong> (<code>int</code>) &#x2014;
The index of the beam group currently being processed.`,name:"beam_group_idx"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L1117",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),po=new T({props:{name:"class transformers.ForcedBOSTokenLogitsProcessor",anchor:"transformers.ForcedBOSTokenLogitsProcessor",parameters:[{name:"bos_token_id",val:": int"}],parametersDescription:[{anchor:"transformers.ForcedBOSTokenLogitsProcessor.bos_token_id",description:`<strong>bos_token_id</strong> (<code>int</code>) &#x2014;
The id of the token to force as the first generated token.`,name:"bos_token_id"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L1163"}}),mo=new T({props:{name:"__call__",anchor:"transformers.ForcedBOSTokenLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"}],parametersDescription:[{anchor:"transformers.ForcedBOSTokenLogitsProcessor.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. <a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.ForcedBOSTokenLogitsProcessor.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search`,name:"scores"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L1175",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),ho=new T({props:{name:"class transformers.ForcedEOSTokenLogitsProcessor",anchor:"transformers.ForcedEOSTokenLogitsProcessor",parameters:[{name:"max_length",val:": int"},{name:"eos_token_id",val:": typing.Union[int, typing.List[int]]"}],parametersDescription:[{anchor:"transformers.ForcedEOSTokenLogitsProcessor.max_length",description:`<strong>max_length</strong> (<code>int</code>) &#x2014;
The maximum length of the sequence to be generated.`,name:"max_length"},{anchor:"transformers.ForcedEOSTokenLogitsProcessor.eos_token_id",description:`<strong>eos_token_id</strong> (<code>Union[int, List[int]]</code>) &#x2014;
The id of the token to force as the last generated token when <code>max_length</code> is reached. Optionally, use a
list to set multiple <em>end-of-sequence</em> tokens.`,name:"eos_token_id"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L1185"}}),go=new T({props:{name:"__call__",anchor:"transformers.ForcedEOSTokenLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"}],parametersDescription:[{anchor:"transformers.ForcedEOSTokenLogitsProcessor.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. <a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.ForcedEOSTokenLogitsProcessor.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search`,name:"scores"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L1203",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),fo=new T({props:{name:"class transformers.InfNanRemoveLogitsProcessor",anchor:"transformers.InfNanRemoveLogitsProcessor",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L1214"}}),uo=new T({props:{name:"__call__",anchor:"transformers.InfNanRemoveLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"}],parametersDescription:[{anchor:"transformers.InfNanRemoveLogitsProcessor.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. <a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.InfNanRemoveLogitsProcessor.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search`,name:"scores"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/logits_process.py#L1220",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),_o=new T({props:{name:"class transformers.TFLogitsProcessor",anchor:"transformers.TFLogitsProcessor",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L53"}}),bo=new T({props:{name:"__call__",anchor:"transformers.TFLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": Tensor"},{name:"scores",val:": Tensor"},{name:"cur_len",val:": int"}],parametersDescription:[{anchor:"transformers.TFLogitsProcessor.__call__.input_ids",description:`<strong>input_ids</strong> (<code>tf.Tensor</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 <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.TFLogitsProcessor.__call__.scores",description:`<strong>scores</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search.`,name:"scores"},{anchor:"transformers.TFLogitsProcessor.__call__.cur_len",description:`<strong>cur_len</strong> (<code>int</code>) &#x2014;
The current length of valid input sequence tokens. In the TF implementation, the input_ids&#x2019; sequence length
is the maximum length generate can produce, and we need to know which of its tokens are valid.`,name:"cur_len"},{anchor:"transformers.TFLogitsProcessor.__call__.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional logits processor specific kwargs.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L56",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>tf.Tensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),yo=new T({props:{name:"class transformers.TFLogitsProcessorList",anchor:"transformers.TFLogitsProcessorList",parameters:[{name:"iterable",val:" = ()"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L75"}}),vo=new T({props:{name:"__call__",anchor:"transformers.TFLogitsProcessorList.__call__",parameters:[{name:"input_ids",val:": Tensor"},{name:"scores",val:": Tensor"},{name:"cur_len",val:": int"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFLogitsProcessorList.__call__.input_ids",description:`<strong>input_ids</strong> (<code>tf.Tensor</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 <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.TFLogitsProcessorList.__call__.scores",description:`<strong>scores</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search.`,name:"scores"},{anchor:"transformers.TFLogitsProcessorList.__call__.cur_len",description:`<strong>cur_len</strong> (<code>int</code>) &#x2014;
The current length of valid input sequence tokens. In the TF implementation, the input_ids&#x2019; sequence length
is the maximum length generate can produce, and we need to know which of its tokens are valid.`,name:"cur_len"},{anchor:"transformers.TFLogitsProcessorList.__call__.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional logits processor specific kwargs.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L82",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>tf.Tensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),To=new T({props:{name:"class transformers.TFLogitsWarper",anchor:"transformers.TFLogitsWarper",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L64"}}),wo=new T({props:{name:"__call__",anchor:"transformers.TFLogitsWarper.__call__",parameters:[{name:"input_ids",val:": Tensor"},{name:"scores",val:": Tensor"},{name:"cur_len",val:": int"}],parametersDescription:[{anchor:"transformers.TFLogitsWarper.__call__.input_ids",description:`<strong>input_ids</strong> (<code>tf.Tensor</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 <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.TFLogitsWarper.__call__.scores",description:`<strong>scores</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search.`,name:"scores"},{anchor:"transformers.TFLogitsWarper.__call__.cur_len",description:`<strong>cur_len</strong> (<code>int</code>) &#x2014;
The current length of valid input sequence tokens. In the TF implementation, the input_ids&#x2019; sequence length
is the maximum length generate can produce, and we need to know which of its tokens are valid.`,name:"cur_len"},{anchor:"transformers.TFLogitsWarper.__call__.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional logits processor specific kwargs.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L67",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>tf.Tensor</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),ko=new T({props:{name:"class transformers.TFTemperatureLogitsWarper",anchor:"transformers.TFTemperatureLogitsWarper",parameters:[{name:"temperature",val:": float"}],parametersDescription:[{anchor:"transformers.TFTemperatureLogitsWarper.temperature",description:`<strong>temperature</strong> (<code>float</code>) &#x2014;
The value used to module the logits distribution.`,name:"temperature"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L98"}}),$o=new T({props:{name:"__call__",anchor:"transformers.TFTemperatureLogitsWarper.__call__",parameters:[{name:"input_ids",val:": Tensor"},{name:"scores",val:": Tensor"},{name:"cur_len",val:": int"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L113"}}),Mo=new T({props:{name:"class transformers.TFTopPLogitsWarper",anchor:"transformers.TFTopPLogitsWarper",parameters:[{name:"top_p",val:": float"},{name:"filter_value",val:": float = -inf"},{name:"min_tokens_to_keep",val:": int = 1"}],parametersDescription:[{anchor:"transformers.TFTopPLogitsWarper.top_p",description:`<strong>top_p</strong> (<code>float</code>) &#x2014;
If set to &lt; 1, only the smallest set of most probable tokens with probabilities that add up to <code>top_p</code> or
higher are kept for generation.`,name:"top_p"},{anchor:"transformers.TFTopPLogitsWarper.filter_value",description:`<strong>filter_value</strong> (<code>float</code>, <em>optional</em>, defaults to <code>-float(&quot;Inf&quot;)</code>) &#x2014;
All filtered values will be set to this float value.`,name:"filter_value"},{anchor:"transformers.TFTopPLogitsWarper.min_tokens_to_keep",description:`<strong>min_tokens_to_keep</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Minimum number of tokens that cannot be filtered.`,name:"min_tokens_to_keep"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L146"}}),xo=new T({props:{name:"__call__",anchor:"transformers.TFTopPLogitsWarper.__call__",parameters:[{name:"input_ids",val:": Tensor"},{name:"scores",val:": Tensor"},{name:"cur_len",val:": int"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L170"}}),jo=new T({props:{name:"class transformers.TFTopKLogitsWarper",anchor:"transformers.TFTopKLogitsWarper",parameters:[{name:"top_k",val:": int"},{name:"filter_value",val:": float = -inf"},{name:"min_tokens_to_keep",val:": int = 1"}],parametersDescription:[{anchor:"transformers.TFTopKLogitsWarper.top_k",description:`<strong>top_k</strong> (<code>int</code>) &#x2014;
The number of highest probability vocabulary tokens to keep for top-k-filtering.`,name:"top_k"},{anchor:"transformers.TFTopKLogitsWarper.filter_value",description:`<strong>filter_value</strong> (<code>float</code>, <em>optional</em>, defaults to <code>-float(&quot;Inf&quot;)</code>) &#x2014;
All filtered values will be set to this float value.`,name:"filter_value"},{anchor:"transformers.TFTopKLogitsWarper.min_tokens_to_keep",description:`<strong>min_tokens_to_keep</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Minimum number of tokens that cannot be filtered.`,name:"min_tokens_to_keep"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L118"}}),Eo=new T({props:{name:"__call__",anchor:"transformers.TFTopKLogitsWarper.__call__",parameters:[{name:"input_ids",val:": Tensor"},{name:"scores",val:": Tensor"},{name:"cur_len",val:": int"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L138"}}),Fo=new T({props:{name:"class transformers.TFMinLengthLogitsProcessor",anchor:"transformers.TFMinLengthLogitsProcessor",parameters:[{name:"min_length",val:": int"},{name:"eos_token_id",val:": int"}],parametersDescription:[{anchor:"transformers.TFMinLengthLogitsProcessor.min_length",description:`<strong>min_length</strong> (<code>int</code>) &#x2014;
The minimum length below which the score of <code>eos_token_id</code> is set to <code>-float(&quot;Inf&quot;)</code>.`,name:"min_length"},{anchor:"transformers.TFMinLengthLogitsProcessor.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>) &#x2014;
The id of the <em>end-of-sequence</em> token.`,name:"eos_token_id"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L202"}}),Lo=new T({props:{name:"__call__",anchor:"transformers.TFMinLengthLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": Tensor"},{name:"scores",val:": Tensor"},{name:"cur_len",val:": int"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L228"}}),Jo=new T({props:{name:"class transformers.TFNoBadWordsLogitsProcessor",anchor:"transformers.TFNoBadWordsLogitsProcessor",parameters:[{name:"bad_words_ids",val:": typing.List[typing.List[int]]"},{name:"eos_token_id",val:": int"}],parametersDescription:[{anchor:"transformers.TFNoBadWordsLogitsProcessor.bad_words_ids",description:`<strong>bad_words_ids</strong> (<code>List[List[int]]</code>) &#x2014;
List of list of token ids that are not allowed to be generated. In order to get the tokens of the words
that should not appear in the generated text, make sure to set <code>add_prefix_space=True</code> when initializing
the tokenizer, and use <code>tokenizer(bad_words, add_special_tokens=False).input_ids</code>. The <code>add_prefix_space</code>
argument is only supported for some slow tokenizers, as fast tokenizers&#x2019; prefixing behaviours come from
<code>pre tokenizers</code>. Read more <a href="https://huggingface.co/docs/tokenizers/api/pre-tokenizers" rel="nofollow">here</a>.`,name:"bad_words_ids"},{anchor:"transformers.TFNoBadWordsLogitsProcessor.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>) &#x2014;
The id of the <em>end-of-sequence</em> token.`,name:"eos_token_id"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L288"}}),zo=new T({props:{name:"__call__",anchor:"transformers.TFNoBadWordsLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": Tensor"},{name:"scores",val:": Tensor"},{name:"cur_len",val:": int"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L367"}}),Uo=new T({props:{name:"class transformers.TFNoRepeatNGramLogitsProcessor",anchor:"transformers.TFNoRepeatNGramLogitsProcessor",parameters:[{name:"ngram_size",val:": int"}],parametersDescription:[{anchor:"transformers.TFNoRepeatNGramLogitsProcessor.ngram_size",description:`<strong>ngram_size</strong> (<code>int</code>) &#x2014;
All ngrams of size <code>ngram_size</code> can only occur once.`,name:"ngram_size"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L388"}}),Wo=new T({props:{name:"__call__",anchor:"transformers.TFNoRepeatNGramLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": Tensor"},{name:"scores",val:": Tensor"},{name:"cur_len",val:": int"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L427"}}),Bo=new T({props:{name:"class transformers.TFRepetitionPenaltyLogitsProcessor",anchor:"transformers.TFRepetitionPenaltyLogitsProcessor",parameters:[{name:"penalty",val:": float"}],parametersDescription:[{anchor:"transformers.TFRepetitionPenaltyLogitsProcessor.repetition_penalty",description:`<strong>repetition_penalty</strong> (<code>float</code>) &#x2014;
The parameter for repetition penalty. 1.0 means no penalty. See <a href="https://arxiv.org/pdf/1909.05858.pdf" rel="nofollow">this
paper</a> for more details.`,name:"repetition_penalty"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L238"}}),Zo=new T({props:{name:"__call__",anchor:"transformers.TFRepetitionPenaltyLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": Tensor"},{name:"scores",val:": Tensor"},{name:"cur_len",val:": int"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L280"}}),So=new T({props:{name:"class transformers.TFForcedBOSTokenLogitsProcessor",anchor:"transformers.TFForcedBOSTokenLogitsProcessor",parameters:[{name:"bos_token_id",val:": int"}],parametersDescription:[{anchor:"transformers.TFForcedBOSTokenLogitsProcessor.bos_token_id",description:`<strong>bos_token_id</strong> (<code>int</code>) &#x2014;
The id of the token to force as the first generated token.`,name:"bos_token_id"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L448"}}),Vo=new T({props:{name:"__call__",anchor:"transformers.TFForcedBOSTokenLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": Tensor"},{name:"scores",val:": Tensor"},{name:"cur_len",val:": int"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L462"}}),Po=new T({props:{name:"class transformers.TFForcedEOSTokenLogitsProcessor",anchor:"transformers.TFForcedEOSTokenLogitsProcessor",parameters:[{name:"max_length",val:": int"},{name:"eos_token_id",val:": int"}],parametersDescription:[{anchor:"transformers.TFForcedEOSTokenLogitsProcessor.max_length",description:`<strong>max_length</strong> (<code>int</code>) &#x2014;
The maximum length of the sequence to be generated.`,name:"max_length"},{anchor:"transformers.TFForcedEOSTokenLogitsProcessor.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>) &#x2014;
The id of the token to force as the last generated token when <code>max_length</code> is reached.`,name:"eos_token_id"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L478"}}),Do=new T({props:{name:"__call__",anchor:"transformers.TFForcedEOSTokenLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": Tensor"},{name:"scores",val:": Tensor"},{name:"cur_len",val:": int"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_logits_process.py#L495"}}),qo=new T({props:{name:"class transformers.FlaxLogitsProcessor",anchor:"transformers.FlaxLogitsProcessor",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_logits_process.py#L50"}}),Go=new T({props:{name:"__call__",anchor:"transformers.FlaxLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": Array"},{name:"scores",val:": Array"}],parametersDescription:[{anchor:"transformers.FlaxLogitsProcessor.__call__.input_ids",description:`<strong>input_ids</strong> (<code>jnp.ndarray</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 <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.FlaxLogitsProcessor.__call__.scores",description:`<strong>scores</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search`,name:"scores"},{anchor:"transformers.FlaxLogitsProcessor.__call__.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional logits processor specific kwargs.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_logits_process.py#L53",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>jnp.ndarray</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),Xo=new T({props:{name:"class transformers.FlaxLogitsProcessorList",anchor:"transformers.FlaxLogitsProcessorList",parameters:[{name:"iterable",val:" = ()"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_logits_process.py#L72"}}),Ro=new T({props:{name:"__call__",anchor:"transformers.FlaxLogitsProcessorList.__call__",parameters:[{name:"input_ids",val:": Array"},{name:"scores",val:": Array"},{name:"cur_len",val:": int"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxLogitsProcessorList.__call__.input_ids",description:`<strong>input_ids</strong> (<code>jnp.ndarray</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 <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.FlaxLogitsProcessorList.__call__.scores",description:`<strong>scores</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search`,name:"scores"},{anchor:"transformers.FlaxLogitsProcessorList.__call__.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional logits processor specific kwargs.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_logits_process.py#L79",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>jnp.ndarray</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),Co=new T({props:{name:"class transformers.FlaxLogitsWarper",anchor:"transformers.FlaxLogitsWarper",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_logits_process.py#L61"}}),No=new T({props:{name:"__call__",anchor:"transformers.FlaxLogitsWarper.__call__",parameters:[{name:"input_ids",val:": Array"},{name:"scores",val:": Array"}],parametersDescription:[{anchor:"transformers.FlaxLogitsWarper.__call__.input_ids",description:`<strong>input_ids</strong> (<code>jnp.ndarray</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 <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.FlaxLogitsWarper.__call__.scores",description:`<strong>scores</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam
search or log softmax for each vocabulary token when using beam search`,name:"scores"},{anchor:"transformers.FlaxLogitsWarper.__call__.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional logits processor specific kwargs.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_logits_process.py#L64",returnDescription:`
<p>The processed prediction scores.</p>
`,returnType:`
<p><code>jnp.ndarray</code> of shape <code>(batch_size, config.vocab_size)</code></p>
`}}),Ao=new T({props:{name:"class transformers.FlaxTemperatureLogitsWarper",anchor:"transformers.FlaxTemperatureLogitsWarper",parameters:[{name:"temperature",val:": float"}],parametersDescription:[{anchor:"transformers.FlaxTemperatureLogitsWarper.temperature",description:`<strong>temperature</strong> (<code>float</code>) &#x2014;
The value used to module the logits distribution.`,name:"temperature"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_logits_process.py#L95"}}),Oo=new T({props:{name:"__call__",anchor:"transformers.FlaxTemperatureLogitsWarper.__call__",parameters:[{name:"input_ids",val:": Array"},{name:"scores",val:": Array"},{name:"cur_len",val:": int"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_logits_process.py#L110"}}),Ho=new T({props:{name:"class transformers.FlaxTopPLogitsWarper",anchor:"transformers.FlaxTopPLogitsWarper",parameters:[{name:"top_p",val:": float"},{name:"filter_value",val:": float = -inf"},{name:"min_tokens_to_keep",val:": int = 1"}],parametersDescription:[{anchor:"transformers.FlaxTopPLogitsWarper.top_p",description:`<strong>top_p</strong> (<code>float</code>) &#x2014;
If set to &lt; 1, only the smallest set of most probable tokens with probabilities that add up to <code>top_p</code> or
higher are kept for generation.`,name:"top_p"},{anchor:"transformers.FlaxTopPLogitsWarper.filter_value",description:`<strong>filter_value</strong> (<code>float</code>, <em>optional</em>, defaults to <code>-float(&quot;Inf&quot;)</code>) &#x2014;
All filtered values will be set to this float value.`,name:"filter_value"},{anchor:"transformers.FlaxTopPLogitsWarper.min_tokens_to_keep",description:`<strong>min_tokens_to_keep</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Minimum number of tokens that cannot be filtered.`,name:"min_tokens_to_keep"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_logits_process.py#L115"}}),Qo=new T({props:{name:"__call__",anchor:"transformers.FlaxTopPLogitsWarper.__call__",parameters:[{name:"input_ids",val:": Array"},{name:"scores",val:": Array"},{name:"cur_len",val:": int"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_logits_process.py#L139"}}),Yo=new T({props:{name:"class transformers.FlaxTopKLogitsWarper",anchor:"transformers.FlaxTopKLogitsWarper",parameters:[{name:"top_k",val:": int"},{name:"filter_value",val:": float = -inf"},{name:"min_tokens_to_keep",val:": int = 1"}],parametersDescription:[{anchor:"transformers.FlaxTopKLogitsWarper.top_k",description:`<strong>top_k</strong> (<code>int</code>) &#x2014;
The number of highest probability vocabulary tokens to keep for top-k-filtering.`,name:"top_k"},{anchor:"transformers.FlaxTopKLogitsWarper.filter_value",description:`<strong>filter_value</strong> (<code>float</code>, <em>optional</em>, defaults to <code>-float(&quot;Inf&quot;)</code>) &#x2014;
All filtered values will be set to this float value.`,name:"filter_value"},{anchor:"transformers.FlaxTopKLogitsWarper.min_tokens_to_keep",description:`<strong>min_tokens_to_keep</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Minimum number of tokens that cannot be filtered.`,name:"min_tokens_to_keep"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_logits_process.py#L159"}}),Ko=new T({props:{name:"__call__",anchor:"transformers.FlaxTopKLogitsWarper.__call__",parameters:[{name:"input_ids",val:": Array"},{name:"scores",val:": Array"},{name:"cur_len",val:": int"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_logits_process.py#L179"}}),en=new T({props:{name:"class transformers.FlaxForcedBOSTokenLogitsProcessor",anchor:"transformers.FlaxForcedBOSTokenLogitsProcessor",parameters:[{name:"bos_token_id",val:": int"}],parametersDescription:[{anchor:"transformers.FlaxForcedBOSTokenLogitsProcessor.bos_token_id",description:`<strong>bos_token_id</strong> (<code>int</code>) &#x2014;
The id of the token to force as the first generated token.`,name:"bos_token_id"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_logits_process.py#L194"}}),tn=new T({props:{name:"__call__",anchor:"transformers.FlaxForcedBOSTokenLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": Array"},{name:"scores",val:": Array"},{name:"cur_len",val:": int"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_logits_process.py#L206"}}),rn=new T({props:{name:"class transformers.FlaxForcedEOSTokenLogitsProcessor",anchor:"transformers.FlaxForcedEOSTokenLogitsProcessor",parameters:[{name:"max_length",val:": int"},{name:"eos_token_id",val:": int"}],parametersDescription:[{anchor:"transformers.FlaxForcedEOSTokenLogitsProcessor.max_length",description:`<strong>max_length</strong> (<code>int</code>) &#x2014;
The maximum length of the sequence to be generated.`,name:"max_length"},{anchor:"transformers.FlaxForcedEOSTokenLogitsProcessor.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>) &#x2014;
The id of the token to force as the last generated token when <code>max_length</code> is reached.`,name:"eos_token_id"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_logits_process.py#L216"}}),sn=new T({props:{name:"__call__",anchor:"transformers.FlaxForcedEOSTokenLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": Array"},{name:"scores",val:": Array"},{name:"cur_len",val:": int"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_logits_process.py#L231"}}),on=new T({props:{name:"class transformers.FlaxMinLengthLogitsProcessor",anchor:"transformers.FlaxMinLengthLogitsProcessor",parameters:[{name:"min_length",val:": int"},{name:"eos_token_id",val:": int"}],parametersDescription:[{anchor:"transformers.FlaxMinLengthLogitsProcessor.min_length",description:`<strong>min_length</strong> (<code>int</code>) &#x2014;
The minimum length below which the score of <code>eos_token_id</code> is set to <code>-float(&quot;Inf&quot;)</code>.`,name:"min_length"},{anchor:"transformers.FlaxMinLengthLogitsProcessor.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>) &#x2014;
The id of the <em>end-of-sequence</em> token.`,name:"eos_token_id"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_logits_process.py#L241"}}),nn=new T({props:{name:"__call__",anchor:"transformers.FlaxMinLengthLogitsProcessor.__call__",parameters:[{name:"input_ids",val:": Array"},{name:"scores",val:": Array"},{name:"cur_len",val:": int"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_logits_process.py#L262"}}),an=new be({}),cn=new T({props:{name:"class transformers.StoppingCriteria",anchor:"transformers.StoppingCriteria",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/stopping_criteria.py#L36"}}),ln=new T({props:{name:"__call__",anchor:"transformers.StoppingCriteria.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.StoppingCriteria.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</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/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.StoppingCriteria.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be scores for each vocabulary token before SoftMax
or scores for each vocabulary token after SoftMax.`,name:"scores"},{anchor:"transformers.StoppingCriteria.__call__.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional stopping criteria specific kwargs.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/stopping_criteria.py#L39",returnDescription:`
<p><code>bool</code>. <code>False</code> indicates we should continue, <code>True</code> indicates we should stop.</p>
`}}),dn=new T({props:{name:"class transformers.StoppingCriteriaList",anchor:"transformers.StoppingCriteriaList",parameters:[{name:"iterable",val:" = ()"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/stopping_criteria.py#L124"}}),pn=new T({props:{name:"__call__",anchor:"transformers.StoppingCriteriaList.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.StoppingCriteriaList.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</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/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.StoppingCriteriaList.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be scores for each vocabulary token before SoftMax
or scores for each vocabulary token after SoftMax.`,name:"scores"},{anchor:"transformers.StoppingCriteriaList.__call__.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional stopping criteria specific kwargs.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/stopping_criteria.py#L125",returnDescription:`
<p><code>bool</code>. <code>False</code> indicates we should continue, <code>True</code> indicates we should stop.</p>
`}}),mn=new T({props:{name:"class transformers.MaxLengthCriteria",anchor:"transformers.MaxLengthCriteria",parameters:[{name:"max_length",val:": int"},{name:"max_position_embeddings",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"transformers.MaxLengthCriteria.max_length",description:`<strong>max_length</strong> (<code>int</code>) &#x2014;
The maximum length that the output sequence can have in number of tokens.`,name:"max_length"},{anchor:"transformers.MaxLengthCriteria.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <code>optional</code>) &#x2014;
The maximum model length, as defined by the model&#x2019;s <code>config.max_position_embeddings</code> attribute.`,name:"max_position_embeddings"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/stopping_criteria.py#L44"}}),gn=new T({props:{name:"__call__",anchor:"transformers.MaxLengthCriteria.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.MaxLengthCriteria.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</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/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.MaxLengthCriteria.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be scores for each vocabulary token before SoftMax
or scores for each vocabulary token after SoftMax.`,name:"scores"},{anchor:"transformers.MaxLengthCriteria.__call__.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional stopping criteria specific kwargs.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/stopping_criteria.py#L60",returnDescription:`
<p><code>bool</code>. <code>False</code> indicates we should continue, <code>True</code> indicates we should stop.</p>
`}}),fn=new T({props:{name:"class transformers.MaxTimeCriteria",anchor:"transformers.MaxTimeCriteria",parameters:[{name:"max_time",val:": float"},{name:"initial_timestamp",val:": typing.Optional[float] = None"}],parametersDescription:[{anchor:"transformers.MaxTimeCriteria.max_time",description:`<strong>max_time</strong> (<code>float</code>) &#x2014;
The maximum allowed time in seconds for the generation.`,name:"max_time"},{anchor:"transformers.MaxTimeCriteria.initial_time",description:`<strong>initial_time</strong> (<code>float</code>, <em>optional</em>, defaults to <code>time.time()</code>) &#x2014;
The start of the generation allowed time.`,name:"initial_time"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/stopping_criteria.py#L102"}}),_n=new T({props:{name:"__call__",anchor:"transformers.MaxTimeCriteria.__call__",parameters:[{name:"input_ids",val:": LongTensor"},{name:"scores",val:": FloatTensor"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.MaxTimeCriteria.__call__.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</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/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.MaxTimeCriteria.__call__.scores",description:`<strong>scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.vocab_size)</code>) &#x2014;
Prediction scores of a language modeling head. These can be scores for each vocabulary token before SoftMax
or scores for each vocabulary token after SoftMax.`,name:"scores"},{anchor:"transformers.MaxTimeCriteria.__call__.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional stopping criteria specific kwargs.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/stopping_criteria.py#L119",returnDescription:`
<p><code>bool</code>. <code>False</code> indicates we should continue, <code>True</code> indicates we should stop.</p>
`}}),bn=new be({}),yn=new T({props:{name:"class transformers.Constraint",anchor:"transformers.Constraint",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_constraints.py#L5"}}),Wr=new Tt({props:{anchor:"transformers.Constraint.example",$$slots:{default:[dx]},$$scope:{ctx:E}}}),vn=new T({props:{name:"advance",anchor:"transformers.Constraint.advance",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_constraints.py#L48",returnDescription:`
<p>Must be a tensor of a list of indexable tokens, not some integer.</p>
`,returnType:`
<p>token_ids(<code>torch.tensor</code>)</p>
`}}),Tn=new T({props:{name:"copy",anchor:"transformers.Constraint.copy",parameters:[{name:"stateful",val:" = False"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_constraints.py#L113",returnDescription:`
<p>The same constraint as the one being called from.</p>
`,returnType:`
<p>constraint(<code>Constraint</code>)</p>
`}}),wn=new T({props:{name:"does_advance",anchor:"transformers.Constraint.does_advance",parameters:[{name:"token_id",val:": int"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_constraints.py#L60"}}),kn=new T({props:{name:"remaining",anchor:"transformers.Constraint.remaining",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_constraints.py#L104"}}),Mn=new T({props:{name:"reset",anchor:"transformers.Constraint.reset",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_constraints.py#L94"}}),xn=new T({props:{name:"test",anchor:"transformers.Constraint.test",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_constraints.py#L24"}}),jn=new T({props:{name:"update",anchor:"transformers.Constraint.update",parameters:[{name:"token_id",val:": int"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_constraints.py#L69",returnDescription:`
<p>Whether this constraint has become one step closer to being fulfuilled.
completed(<code>bool</code>):
Whether this constraint has been completely fulfilled by this token being generated.
reset (<code>bool</code>):
Whether this constraint has reset its progress by this token being generated.</p>
`,returnType:`
<p>stepped(<code>bool</code>)</p>
`}}),Fn=new T({props:{name:"class transformers.PhrasalConstraint",anchor:"transformers.PhrasalConstraint",parameters:[{name:"token_ids",val:": typing.List[int]"}],parametersDescription:[{anchor:"transformers.PhrasalConstraint.token_ids",description:`<strong>token_ids</strong> (<code>List[int]</code>) &#x2014;
The id of the token that must be generated by the output.`,name:"token_ids"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_constraints.py#L129"}}),Ln=new T({props:{name:"class transformers.DisjunctiveConstraint",anchor:"transformers.DisjunctiveConstraint",parameters:[{name:"nested_token_ids",val:": typing.List[typing.List[int]]"}],parametersDescription:[{anchor:"transformers.DisjunctiveConstraint.nested_token_ids",description:"<strong>nested_token_ids</strong> (<code>List[List[int]]</code>) &#x2014; a list of words, where each word is a list of ids. This constraint",name:"nested_token_ids"},{anchor:"transformers.DisjunctiveConstraint.is",description:"<strong>is</strong> fulfilled by generating just one from the list of words. &#x2014;",name:"is"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_constraints.py#L261"}}),zn=new T({props:{name:"class transformers.ConstraintListState",anchor:"transformers.ConstraintListState",parameters:[{name:"constraints",val:": typing.List[transformers.generation.beam_constraints.Constraint]"}],parametersDescription:[{anchor:"transformers.ConstraintListState.constraints",description:`<strong>constraints</strong> (<code>List[Constraint]</code>) &#x2014;
A list of <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Constraint">Constraint</a> objects that must be fulfilled by the beam scorer.`,name:"constraints"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_constraints.py#L350"}}),Un=new T({props:{name:"advance",anchor:"transformers.ConstraintListState.advance",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_constraints.py#L382"}}),In=new T({props:{name:"reset",anchor:"transformers.ConstraintListState.reset",parameters:[{name:"token_ids",val:": typing.Optional[typing.List[int]]"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_constraints.py#L417"}}),Wn=new be({}),Bn=new T({props:{name:"class transformers.BeamScorer",anchor:"transformers.BeamScorer",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_search.py#L91"}}),Zn=new T({props:{name:"process",anchor:"transformers.BeamScorer.process",parameters:[{name:"input_ids",val:": LongTensor"},{name:"next_scores",val:": FloatTensor"},{name:"next_tokens",val:": LongTensor"},{name:"next_indices",val:": LongTensor"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BeamScorer.process.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size * num_beams, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using any class inheriting from <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>. See
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.BeamScorer.process.next_scores",description:`<strong>next_scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, 2 * num_beams)</code>) &#x2014;
Current scores of the top <code>2 * num_beams</code> non-finished beam hypotheses.`,name:"next_scores"},{anchor:"transformers.BeamScorer.process.next_tokens",description:`<strong>next_tokens</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, 2 * num_beams)</code>) &#x2014;
<code>input_ids</code> of the tokens corresponding to the top <code>2 * num_beams</code> non-finished beam hypotheses.`,name:"next_tokens"},{anchor:"transformers.BeamScorer.process.next_indices",description:`<strong>next_indices</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, 2 * num_beams)</code>) &#x2014;
Beam indices indicating to which beam hypothesis the <code>next_tokens</code> correspond.`,name:"next_indices"},{anchor:"transformers.BeamScorer.process.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The id of the <em>padding</em> token.`,name:"pad_token_id"},{anchor:"transformers.BeamScorer.process.eos_token_id",description:`<strong>eos_token_id</strong> (<code>Union[int, List[int]]</code>, <em>optional</em>) &#x2014;
The id of the <em>end-of-sequence</em> token. Optionally, use a list to set multiple <em>end-of-sequence</em> tokens.`,name:"eos_token_id"},{anchor:"transformers.BeamScorer.process.beam_indices",description:`<strong>beam_indices</strong> (<code>torch.LongTensor</code>, <em>optional</em>) &#x2014;
Beam indices indicating to which beam hypothesis each token correspond.`,name:"beam_indices"},{anchor:"transformers.BeamScorer.process.group_index",description:`<strong>group_index</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The index of the group of beams. Used with <a href="/docs/transformers/main/en/main_classes/text_generation#transformers.GenerationMixin.group_beam_search">group_beam_search()</a>.`,name:"group_index"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_search.py#L97",returnDescription:`
<p>A dictionary composed of the fields as defined above:</p>
<ul>
<li><strong>next_beam_scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size * num_beams)</code>) \u2014 Updated scores of all
non-finished beams.</li>
<li><strong>next_beam_tokens</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size * num_beams)</code>) \u2014 Next tokens to be added
to the non-finished beam_hypotheses.</li>
<li><strong>next_beam_indices</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size * num_beams)</code>) \u2014 Beam indices
indicating to which beam the next tokens shall be added.</li>
</ul>
`,returnType:`
<p><code>UserDict</code></p>
`}}),Sn=new T({props:{name:"finalize",anchor:"transformers.BeamScorer.finalize",parameters:[{name:"input_ids",val:": LongTensor"},{name:"next_scores",val:": FloatTensor"},{name:"next_tokens",val:": LongTensor"},{name:"next_indices",val:": LongTensor"},{name:"max_length",val:": int"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.BeamScorer.finalize.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size * num_beams, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using any class inheriting from <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>. See
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.BeamScorer.finalize.final_beam_scores",description:`<strong>final_beam_scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size * num_beams)</code>) &#x2014;
The final scores of all non-finished beams.`,name:"final_beam_scores"},{anchor:"transformers.BeamScorer.finalize.final_beam_tokens",description:`<strong>final_beam_tokens</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size * num_beams)</code>) &#x2014;
The last tokens to be added to the non-finished beam_hypotheses.`,name:"final_beam_tokens"},{anchor:"transformers.BeamScorer.finalize.final_beam_indices",description:`<strong>final_beam_indices</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size * num_beams)</code>) &#x2014;
The beam indices indicating to which beam the <code>final_beam_tokens</code> shall be added.`,name:"final_beam_indices"},{anchor:"transformers.BeamScorer.finalize.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The id of the <em>padding</em> token.`,name:"pad_token_id"},{anchor:"transformers.BeamScorer.finalize.eos_token_id",description:`<strong>eos_token_id</strong> (<code>Union[int, List[int]]</code>, <em>optional</em>) &#x2014;
The id of the <em>end-of-sequence</em> token. Optionally, use a list to set multiple <em>end-of-sequence</em> tokens.`,name:"eos_token_id"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_search.py#L109",returnDescription:`
<p>The generated sequences.
The second dimension (sequence_length) is either equal to <code>max_length</code> or shorter if all batches finished early
due to the <code>eos_token_id</code>.</p>
`,returnType:`
<p><code>torch.LongTensor</code> of shape <code>(batch_size * num_return_sequences, sequence_length)</code></p>
`}}),Vn=new T({props:{name:"class transformers.BeamSearchScorer",anchor:"transformers.BeamSearchScorer",parameters:[{name:"batch_size",val:": int"},{name:"num_beams",val:": int"},{name:"device",val:": device"},{name:"length_penalty",val:": typing.Optional[float] = 1.0"},{name:"do_early_stopping",val:": typing.Union[bool, str, NoneType] = False"},{name:"num_beam_hyps_to_keep",val:": typing.Optional[int] = 1"},{name:"num_beam_groups",val:": typing.Optional[int] = 1"},{name:"max_length",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"transformers.BeamSearchScorer.batch_size",description:`<strong>batch_size</strong> (<code>int</code>) &#x2014;
Batch Size of <code>input_ids</code> for which standard beam search decoding is run in parallel.`,name:"batch_size"},{anchor:"transformers.BeamSearchScorer.num_beams",description:`<strong>num_beams</strong> (<code>int</code>) &#x2014;
Number of beams for beam search.`,name:"num_beams"},{anchor:"transformers.BeamSearchScorer.device",description:`<strong>device</strong> (<code>torch.device</code>) &#x2014;
Defines the device type (<em>e.g.</em>, <code>&quot;cpu&quot;</code> or <code>&quot;cuda&quot;</code>) on which this instance of <code>BeamSearchScorer</code> will be
allocated.`,name:"device"},{anchor:"transformers.BeamSearchScorer.length_penalty",description:`<strong>length_penalty</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Exponential penalty to the length that is used with beam-based generation. It is applied as an exponent to
the sequence length, which in turn is used to divide the score of the sequence. Since the score is the log
likelihood of the sequence (i.e. negative), <code>length_penalty</code> &gt; 0.0 promotes longer sequences, while
<code>length_penalty</code> &lt; 0.0 encourages shorter sequences.`,name:"length_penalty"},{anchor:"transformers.BeamSearchScorer.do_early_stopping",description:`<strong>do_early_stopping</strong> (<code>bool</code> or <code>str</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Controls the stopping condition for beam-based methods, like beam-search. It accepts the following values:
<code>True</code>, where the generation stops as soon as there are <code>num_beams</code> complete candidates; <code>False</code>, where an
heuristic is applied and the generation stops when is it very unlikely to find better candidates;
<code>&quot;never&quot;</code>, where the beam search procedure only stops when there cannot be better candidates (canonical
beam search algorithm).`,name:"do_early_stopping"},{anchor:"transformers.BeamSearchScorer.num_beam_hyps_to_keep",description:`<strong>num_beam_hyps_to_keep</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of beam hypotheses that shall be returned upon calling
<code>~transformer.BeamSearchScorer.finalize</code>.`,name:"num_beam_hyps_to_keep"},{anchor:"transformers.BeamSearchScorer.num_beam_groups",description:`<strong>num_beam_groups</strong> (<code>int</code>) &#x2014;
Number of groups to divide <code>num_beams</code> into in order to ensure diversity among different groups of beams.
See <a href="https://arxiv.org/pdf/1610.02424.pdf" rel="nofollow">this paper</a> for more details.`,name:"num_beam_groups"},{anchor:"transformers.BeamSearchScorer.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The maximum length of the sequence to be generated.`,name:"max_length"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_search.py#L123"}}),Gn=new T({props:{name:"process",anchor:"transformers.BeamSearchScorer.process",parameters:[{name:"input_ids",val:": LongTensor"},{name:"next_scores",val:": FloatTensor"},{name:"next_tokens",val:": LongTensor"},{name:"next_indices",val:": LongTensor"},{name:"pad_token_id",val:": typing.Optional[int] = None"},{name:"eos_token_id",val:": typing.Union[int, typing.List[int], NoneType] = None"},{name:"beam_indices",val:": typing.Optional[torch.LongTensor] = None"},{name:"group_index",val:": typing.Optional[int] = 0"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_search.py#L215"}}),Xn=new T({props:{name:"finalize",anchor:"transformers.BeamSearchScorer.finalize",parameters:[{name:"input_ids",val:": LongTensor"},{name:"final_beam_scores",val:": FloatTensor"},{name:"final_beam_tokens",val:": LongTensor"},{name:"final_beam_indices",val:": LongTensor"},{name:"max_length",val:": int"},{name:"pad_token_id",val:": typing.Optional[int] = None"},{name:"eos_token_id",val:": typing.Union[int, typing.List[int], NoneType] = None"},{name:"beam_indices",val:": typing.Optional[torch.LongTensor] = None"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_search.py#L315"}}),Rn=new T({props:{name:"class transformers.ConstrainedBeamSearchScorer",anchor:"transformers.ConstrainedBeamSearchScorer",parameters:[{name:"batch_size",val:": int"},{name:"num_beams",val:": int"},{name:"constraints",val:": typing.List[transformers.generation.beam_constraints.Constraint]"},{name:"device",val:": device"},{name:"length_penalty",val:": typing.Optional[float] = 1.0"},{name:"do_early_stopping",val:": typing.Union[bool, str, NoneType] = False"},{name:"num_beam_hyps_to_keep",val:": typing.Optional[int] = 1"},{name:"num_beam_groups",val:": typing.Optional[int] = 1"},{name:"max_length",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"transformers.ConstrainedBeamSearchScorer.batch_size",description:`<strong>batch_size</strong> (<code>int</code>) &#x2014;
Batch Size of <code>input_ids</code> for which standard beam search decoding is run in parallel.`,name:"batch_size"},{anchor:"transformers.ConstrainedBeamSearchScorer.num_beams",description:`<strong>num_beams</strong> (<code>int</code>) &#x2014;
Number of beams for beam search.`,name:"num_beams"},{anchor:"transformers.ConstrainedBeamSearchScorer.constraints",description:`<strong>constraints</strong> (<code>List[Constraint]</code>) &#x2014;
A list of positive constraints represented as <code>Constraint</code> objects that must be fulfilled in the generation
output. For more information, the documentation of <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Constraint">Constraint</a> should be read.`,name:"constraints"},{anchor:"transformers.ConstrainedBeamSearchScorer.device",description:`<strong>device</strong> (<code>torch.device</code>) &#x2014;
Defines the device type (<em>e.g.</em>, <code>&quot;cpu&quot;</code> or <code>&quot;cuda&quot;</code>) on which this instance of <code>BeamSearchScorer</code> will be
allocated.`,name:"device"},{anchor:"transformers.ConstrainedBeamSearchScorer.length_penalty",description:`<strong>length_penalty</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Exponential penalty to the length that is used with beam-based generation. It is applied as an exponent to
the sequence length, which in turn is used to divide the score of the sequence. Since the score is the log
likelihood of the sequence (i.e. negative), <code>length_penalty</code> &gt; 0.0 promotes longer sequences, while
<code>length_penalty</code> &lt; 0.0 encourages shorter sequences.`,name:"length_penalty"},{anchor:"transformers.ConstrainedBeamSearchScorer.do_early_stopping",description:`<strong>do_early_stopping</strong> (<code>bool</code> or <code>str</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Controls the stopping condition for beam-based methods, like beam-search. It accepts the following values:
<code>True</code>, where the generation stops as soon as there are <code>num_beams</code> complete candidates; <code>False</code>, where an
heuristic is applied and the generation stops when is it very unlikely to find better candidates;
<code>&quot;never&quot;</code>, where the beam search procedure only stops when there cannot be better candidates (canonical
beam search algorithm).`,name:"do_early_stopping"},{anchor:"transformers.ConstrainedBeamSearchScorer.num_beam_hyps_to_keep",description:`<strong>num_beam_hyps_to_keep</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of beam hypotheses that shall be returned upon calling
<code>~transformer.BeamSearchScorer.finalize</code>.`,name:"num_beam_hyps_to_keep"},{anchor:"transformers.ConstrainedBeamSearchScorer.num_beam_groups",description:`<strong>num_beam_groups</strong> (<code>int</code>) &#x2014;
Number of groups to divide <code>num_beams</code> into in order to ensure diversity among different groups of beams.
See <a href="https://arxiv.org/pdf/1610.02424.pdf" rel="nofollow">this paper</a> for more details.`,name:"num_beam_groups"},{anchor:"transformers.ConstrainedBeamSearchScorer.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The maximum length of the sequence to be generated.`,name:"max_length"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_search.py#L410"}}),Cn=new T({props:{name:"process",anchor:"transformers.ConstrainedBeamSearchScorer.process",parameters:[{name:"input_ids",val:": LongTensor"},{name:"next_scores",val:": FloatTensor"},{name:"next_tokens",val:": LongTensor"},{name:"next_indices",val:": LongTensor"},{name:"scores_for_all_vocab",val:": FloatTensor"},{name:"pad_token_id",val:": typing.Optional[int] = None"},{name:"eos_token_id",val:": typing.Union[int, typing.List[int], NoneType] = None"},{name:"beam_indices",val:": typing.Optional[torch.LongTensor] = None"}],parametersDescription:[{anchor:"transformers.ConstrainedBeamSearchScorer.process.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size * num_beams, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using any class inheriting from <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>. See
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/main/en/model_doc/perceiver#transformers.PerceiverTokenizer.__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.ConstrainedBeamSearchScorer.process.next_scores",description:`<strong>next_scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, 2 * num_beams)</code>) &#x2014;
Current scores of the top <code>2 * num_beams</code> non-finished beam hypotheses.`,name:"next_scores"},{anchor:"transformers.ConstrainedBeamSearchScorer.process.next_tokens",description:`<strong>next_tokens</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, 2 * num_beams)</code>) &#x2014;
<code>input_ids</code> of the tokens corresponding to the top <code>2 * num_beams</code> non-finished beam hypotheses.`,name:"next_tokens"},{anchor:"transformers.ConstrainedBeamSearchScorer.process.next_indices",description:`<strong>next_indices</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, 2 * num_beams)</code>) &#x2014;
Beam indices indicating to which beam hypothesis the <code>next_tokens</code> correspond.`,name:"next_indices"},{anchor:"transformers.ConstrainedBeamSearchScorer.process.scores_for_all_vocab",description:`<strong>scores_for_all_vocab</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size * num_beams, sequence_length)</code>) &#x2014;
The scores of all tokens in the vocabulary for each of the beam hypotheses.`,name:"scores_for_all_vocab"},{anchor:"transformers.ConstrainedBeamSearchScorer.process.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The id of the <em>padding</em> token.`,name:"pad_token_id"},{anchor:"transformers.ConstrainedBeamSearchScorer.process.eos_token_id",description:`<strong>eos_token_id</strong> (<code>Union[int, List[int]]</code>, <em>optional</em>) &#x2014;
The id of the <em>end-of-sequence</em> token. Optionally, use a list to set multiple <em>end-of-sequence</em> tokens.`,name:"eos_token_id"},{anchor:"transformers.ConstrainedBeamSearchScorer.process.beam_indices",description:`<strong>beam_indices</strong> (<code>torch.LongTensor</code>, <em>optional</em>) &#x2014;
Beam indices indicating to which beam hypothesis each token correspond.`,name:"beam_indices"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_search.py#L504",returnDescription:`
<p>A dictionary composed of the fields as defined above:</p>
<ul>
<li>
<p><strong>next_beam_scores</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size * num_beams)</code>) \u2014 Updated scores of
all
non-finished beams.</p>
</li>
<li>
<p><strong>next_beam_tokens</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size * num_beams)</code>) \u2014 Next tokens to be
added
to the non-finished beam_hypotheses.</p>
</li>
<li>
<p><strong>next_beam_indices</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size * num_beams)</code>) \u2014 Beam indices
indicating to which beam the next tokens shall be added.</p>
</li>
</ul>
`,returnType:`
<p><code>UserDict</code></p>
`}}),Nn=new T({props:{name:"finalize",anchor:"transformers.ConstrainedBeamSearchScorer.finalize",parameters:[{name:"input_ids",val:": LongTensor"},{name:"final_beam_scores",val:": FloatTensor"},{name:"final_beam_tokens",val:": LongTensor"},{name:"final_beam_indices",val:": LongTensor"},{name:"max_length",val:": int"},{name:"pad_token_id",val:": typing.Optional[int] = None"},{name:"eos_token_id",val:": typing.Union[int, typing.List[int], NoneType] = None"},{name:"beam_indices",val:": typing.Optional[torch.LongTensor] = None"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/beam_search.py#L798"}}),An=new be({}),On=new T({props:{name:"transformers.top_k_top_p_filtering",anchor:"transformers.top_k_top_p_filtering",parameters:[{name:"logits",val:": FloatTensor"},{name:"top_k",val:": int = 0"},{name:"top_p",val:": float = 1.0"},{name:"filter_value",val:": float = -inf"},{name:"min_tokens_to_keep",val:": int = 1"}],parametersDescription:[{anchor:"transformers.top_k_top_p_filtering.top_k",description:`<strong>top_k</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
If &gt; 0, only keep the top k tokens with highest probability (top-k filtering)`,name:"top_k"},{anchor:"transformers.top_k_top_p_filtering.top_p",description:`<strong>top_p</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
If &lt; 1.0, only keep the top tokens with cumulative probability &gt;= top_p (nucleus filtering). Nucleus
filtering is described in Holtzman et al. (<a href="http://arxiv.org/abs/1904.09751" rel="nofollow">http://arxiv.org/abs/1904.09751</a>)`,name:"top_p"},{anchor:"transformers.top_k_top_p_filtering.min_tokens_to_keep",description:`<strong>min_tokens_to_keep</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Minimumber of tokens we keep per batch example in the output.`,name:"min_tokens_to_keep"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/utils.py#L4690"}}),Qn=new T({props:{name:"transformers.tf_top_k_top_p_filtering",anchor:"transformers.tf_top_k_top_p_filtering",parameters:[{name:"logits",val:""},{name:"top_k",val:" = 0"},{name:"top_p",val:" = 1.0"},{name:"filter_value",val:" = -inf"},{name:"min_tokens_to_keep",val:" = 1"}],parametersDescription:[{anchor:"transformers.tf_top_k_top_p_filtering.top_k",description:`<strong>top_k</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
If &gt; 0, only keep the top k tokens with highest probability (top-k filtering)`,name:"top_k"},{anchor:"transformers.tf_top_k_top_p_filtering.top_p",description:`<strong>top_p</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
If &lt; 1.0, only keep the top tokens with cumulative probability &gt;= top_p (nucleus filtering). Nucleus
filtering is described in Holtzman et al. (<a href="http://arxiv.org/abs/1904.09751" rel="nofollow">http://arxiv.org/abs/1904.09751</a>)`,name:"top_p"},{anchor:"transformers.tf_top_k_top_p_filtering.min_tokens_to_keep",description:`<strong>min_tokens_to_keep</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Minimumber of tokens we keep per batch example in the output.`,name:"min_tokens_to_keep"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/tf_utils.py#L3059"}}),Kn=new be({}),ea=new T({props:{name:"class transformers.TextStreamer",anchor:"transformers.TextStreamer",parameters:[{name:"tokenizer",val:": AutoTokenizer"},{name:"skip_prompt",val:": bool = False"},{name:"**decode_kwargs",val:""}],parametersDescription:[{anchor:"transformers.TextStreamer.tokenizer",description:`<strong>tokenizer</strong> (<code>AutoTokenizer</code>) &#x2014;
The tokenized used to decode the tokens.`,name:"tokenizer"},{anchor:"transformers.TextStreamer.skip_prompt",description:`<strong>skip_prompt</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to skip the prompt to <code>.generate()</code> or not. Useful e.g. for chatbots.`,name:"skip_prompt"},{anchor:"transformers.TextStreamer.decode_kwargs",description:`<strong>decode_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Additional keyword arguments to pass to the tokenizer&#x2019;s <code>decode</code> method.`,name:"decode_kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/streamers.py#L38"}}),Cr=new jl({props:{warning:!0,$$slots:{default:[px]},$$scope:{ctx:E}}}),Nr=new Tt({props:{anchor:"transformers.TextStreamer.example",$$slots:{default:[mx]},$$scope:{ctx:E}}}),ta=new T({props:{name:"end",anchor:"transformers.TextStreamer.end",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/streamers.py#L116"}}),ra=new T({props:{name:"on_finalized_text",anchor:"transformers.TextStreamer.on_finalized_text",parameters:[{name:"text",val:": str"},{name:"stream_end",val:": bool = False"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/streamers.py#L130"}}),sa=new T({props:{name:"put",anchor:"transformers.TextStreamer.put",parameters:[{name:"value",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/streamers.py#L82"}}),oa=new T({props:{name:"class transformers.TextIteratorStreamer",anchor:"transformers.TextIteratorStreamer",parameters:[{name:"tokenizer",val:": AutoTokenizer"},{name:"skip_prompt",val:": bool = False"},{name:"timeout",val:": typing.Optional[float] = None"},{name:"**decode_kwargs",val:""}],parametersDescription:[{anchor:"transformers.TextIteratorStreamer.tokenizer",description:`<strong>tokenizer</strong> (<code>AutoTokenizer</code>) &#x2014;
The tokenized used to decode the tokens.`,name:"tokenizer"},{anchor:"transformers.TextIteratorStreamer.skip_prompt",description:`<strong>skip_prompt</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to skip the prompt to <code>.generate()</code> or not. Useful e.g. for chatbots.`,name:"skip_prompt"},{anchor:"transformers.TextIteratorStreamer.timeout",description:`<strong>timeout</strong> (<code>float</code>, <em>optional</em>) &#x2014;
The timeout for the text queue. If <code>None</code>, the queue will block indefinitely. Useful to handle exceptions
in <code>.generate()</code>, when it is called in a separate thread.`,name:"timeout"},{anchor:"transformers.TextIteratorStreamer.decode_kwargs",description:`<strong>decode_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Additional keyword arguments to pass to the tokenizer&#x2019;s <code>decode</code> method.`,name:"decode_kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/streamers.py#L159"}}),Qr=new jl({props:{warning:!0,$$slots:{default:[hx]},$$scope:{ctx:E}}}),Yr=new Tt({props:{anchor:"transformers.TextIteratorStreamer.example",$$slots:{default:[gx]},$$scope:{ctx:E}}}),na=new T({props:{name:"on_finalized_text",anchor:"transformers.TextIteratorStreamer.on_finalized_text",parameters:[{name:"text",val:": str"},{name:"stream_end",val:": bool = False"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/generation/streamers.py#L213"}}),{c(){v=s("meta"),M=c(),k=s("h1"),w=s("a"),x=s("span"),g(h.$$.fragment),$=c(),V=s("span"),z=a("Utilities for Generation"),U=c(),F=s("p"),Z=a("This page lists all the utility functions used by "),H=s("a"),ve=a("generate()"),W=a(`,
`),Q=s("a"),Te=a("greedy_search()"),X=a(`,
`),j=s("a"),kt=a("contrastive_search()"),$t=a(`,
`),me=s("a"),Mt=a("sample()"),xt=a(`,
`),da=s("a"),Bg=a("beam_search()"),Zg=a(`,
`),pa=s("a"),Sg=a("beam_sample()"),Vg=a(`,
`),ma=s("a"),Pg=a("group_beam_search()"),Dg=a(`, and
`),ha=s("a"),qg=a("constrained_beam_search()"),Gg=a("."),om=c(),ga=s("p"),Xg=a("Most of those are only useful if you are studying the code of the generate methods in the library."),nm=c(),jt=s("h2"),Kt=s("a"),El=s("span"),g(ls.$$.fragment),Rg=c(),Fl=s("span"),Cg=a("Generate Outputs"),am=c(),he=s("p"),Ng=a("The output of "),fa=s("a"),Ag=a("generate()"),Og=a(` is an instance of a subclass of
`),ua=s("a"),Hg=a("ModelOutput"),Qg=a(`. This output is a data structure containing all the information returned
by `),_a=s("a"),Yg=a("generate()"),Kg=a(", but that can also be used as tuple or dictionary."),im=c(),ba=s("p"),ef=a("Here\u2019s an example:"),cm=c(),g(ds.$$.fragment),lm=c(),ct=s("p"),tf=a("The "),Ll=s("code"),rf=a("generation_output"),sf=a(" object is a "),ya=s("a"),of=a("GreedySearchDecoderOnlyOutput"),nf=a(`, as we can
see in the documentation of that class below, it means it has the following attributes:`),dm=c(),ge=s("ul"),va=s("li"),Jl=s("code"),af=a("sequences"),cf=a(": the generated sequences of tokens"),lf=c(),Ta=s("li"),zl=s("code"),df=a("scores"),pf=a(" (optional): the prediction scores of the language modelling head, for each generation step"),mf=c(),wa=s("li"),Ul=s("code"),hf=a("hidden_states"),gf=a(" (optional): the hidden states of the model, for each generation step"),ff=c(),ka=s("li"),Il=s("code"),uf=a("attentions"),_f=a(" (optional): the attention weights of the model, for each generation step"),pm=c(),S=s("p"),bf=a("Here we have the "),Wl=s("code"),yf=a("scores"),vf=a(" since we passed along "),Bl=s("code"),Tf=a("output_scores=True"),wf=a(", but we don\u2019t have "),Zl=s("code"),kf=a("hidden_states"),$f=a(` and
`),Sl=s("code"),Mf=a("attentions"),xf=a(" because we didn\u2019t pass "),Vl=s("code"),jf=a("output_hidden_states=True"),Ef=a(" or "),Pl=s("code"),Ff=a("output_attentions=True"),Lf=a("."),mm=c(),Y=s("p"),Jf=a(`You can access each attribute as you would usually do, and if that attribute has not been returned by the model, you
will get `),Dl=s("code"),zf=a("None"),Uf=a(". Here for instance "),ql=s("code"),If=a("generation_output.scores"),Wf=a(` are all the generated prediction scores of the
language modeling head, and `),Gl=s("code"),Bf=a("generation_output.attentions"),Zf=a(" is "),Xl=s("code"),Sf=a("None"),Vf=a("."),hm=c(),K=s("p"),Pf=a("When using our "),Rl=s("code"),Df=a("generation_output"),qf=a(" object as a tuple, it only keeps the attributes that don\u2019t have "),Cl=s("code"),Gf=a("None"),Xf=a(` values.
Here, for instance, it has two elements, `),Nl=s("code"),Rf=a("loss"),Cf=a(" then "),Al=s("code"),Nf=a("logits"),Af=a(", so"),gm=c(),g(ps.$$.fragment),fm=c(),er=s("p"),Of=a("will return the tuple "),Ol=s("code"),Hf=a("(generation_output.sequences, generation_output.scores)"),Qf=a(" for instance."),um=c(),ee=s("p"),Yf=a("When using our "),Hl=s("code"),Kf=a("generation_output"),eu=a(" object as a dictionary, it only keeps the attributes that don\u2019t have "),Ql=s("code"),tu=a("None"),ru=a(`
values. Here, for instance, it has two keys that are `),Yl=s("code"),su=a("sequences"),ou=a(" and "),Kl=s("code"),nu=a("scores"),au=a("."),_m=c(),$a=s("p"),iu=a("We document here all output types."),bm=c(),Et=s("h3"),tr=s("a"),ed=s("span"),g(ms.$$.fragment),cu=c(),td=s("span"),lu=a("GreedySearchOutput"),ym=c(),Ft=s("div"),g(hs.$$.fragment),du=c(),rd=s("p"),pu=a("Base class for outputs of decoder-only generation models using greedy search."),vm=c(),Lt=s("div"),g(gs.$$.fragment),mu=c(),sd=s("p"),hu=a(`Base class for outputs of encoder-decoder generation models using greedy search. Hidden states and attention
weights of the decoder (respectively the encoder) can be accessed via the encoder_attentions and the
encoder_hidden_states attributes (respectively the decoder_attentions and the decoder_hidden_states attributes)`),Tm=c(),we=s("div"),g(fs.$$.fragment),gu=c(),od=s("p"),fu=a("Flax Base class for outputs of decoder-only generation models using greedy search."),uu=c(),rr=s("div"),g(us.$$.fragment),_u=c(),nd=s("p"),bu=a("\u201CReturns a new object replacing the specified fields with new values."),wm=c(),Jt=s("h3"),sr=s("a"),ad=s("span"),g(_s.$$.fragment),yu=c(),id=s("span"),vu=a("SampleOutput"),km=c(),zt=s("div"),g(bs.$$.fragment),Tu=c(),cd=s("p"),wu=a("Base class for outputs of decoder-only generation models using sampling."),$m=c(),Ut=s("div"),g(ys.$$.fragment),ku=c(),ld=s("p"),$u=a(`Base class for outputs of encoder-decoder generation models using sampling. Hidden states and attention weights of
the decoder (respectively the encoder) can be accessed via the encoder_attentions and the encoder_hidden_states
attributes (respectively the decoder_attentions and the decoder_hidden_states attributes)`),Mm=c(),ke=s("div"),g(vs.$$.fragment),Mu=c(),dd=s("p"),xu=a("Flax Base class for outputs of decoder-only generation models using sampling."),ju=c(),or=s("div"),g(Ts.$$.fragment),Eu=c(),pd=s("p"),Fu=a("\u201CReturns a new object replacing the specified fields with new values."),xm=c(),It=s("h3"),nr=s("a"),md=s("span"),g(ws.$$.fragment),Lu=c(),hd=s("span"),Ju=a("BeamSearchOutput"),jm=c(),Wt=s("div"),g(ks.$$.fragment),zu=c(),gd=s("p"),Uu=a("Base class for outputs of decoder-only generation models using beam search."),Em=c(),Bt=s("div"),g($s.$$.fragment),Iu=c(),fd=s("p"),Wu=a(`Base class for outputs of encoder-decoder generation models using beam search. Hidden states and attention weights
of the decoder (respectively the encoder) can be accessed via the encoder_attentions and the encoder_hidden_states
attributes (respectively the decoder_attentions and the decoder_hidden_states attributes)`),Fm=c(),Zt=s("h3"),ar=s("a"),ud=s("span"),g(Ms.$$.fragment),Bu=c(),_d=s("span"),Zu=a("BeamSampleOutput"),Lm=c(),St=s("div"),g(xs.$$.fragment),Su=c(),bd=s("p"),Vu=a("Base class for outputs of decoder-only generation models using beam sample."),Jm=c(),Vt=s("div"),g(js.$$.fragment),Pu=c(),yd=s("p"),Du=a(`Base class for outputs of encoder-decoder generation models using beam sampling. Hidden states and attention
weights of the decoder (respectively the encoder) can be accessed via the encoder_attentions and the
encoder_hidden_states attributes (respectively the decoder_attentions and the decoder_hidden_states attributes)`),zm=c(),Pt=s("h2"),ir=s("a"),vd=s("span"),g(Es.$$.fragment),qu=c(),Td=s("span"),Gu=a("LogitsProcessor"),Um=c(),cr=s("p"),Xu=a("A "),Ma=s("a"),Ru=a("LogitsProcessor"),Cu=a(` can be used to modify the prediction scores of a language model head for
generation.`),Im=c(),$e=s("div"),g(Fs.$$.fragment),Nu=c(),wd=s("p"),Au=a("Abstract base class for all logit processors that can be applied during generation."),Ou=c(),xa=s("div"),g(Ls.$$.fragment),Wm=c(),Me=s("div"),g(Js.$$.fragment),Hu=c(),P=s("p"),Qu=a("This class can be used to create a list of "),ja=s("a"),Yu=a("LogitsProcessor"),Ku=a(" or "),Ea=s("a"),e_=a("LogitsWarper"),t_=a(` to subsequently process a
`),kd=s("code"),r_=a("scores"),s_=a(" input tensor. This class inherits from list and adds a specific "),$d=s("em"),Md=s("strong"),o_=a("call"),n_=a(` method to apply each
`),Fa=s("a"),a_=a("LogitsProcessor"),i_=a(" or "),La=s("a"),c_=a("LogitsWarper"),l_=a(" to the inputs."),d_=c(),Ja=s("div"),g(zs.$$.fragment),Bm=c(),xe=s("div"),g(Us.$$.fragment),p_=c(),xd=s("p"),m_=a("Abstract base class for all logit warpers that can be applied during generation with multinomial sampling."),h_=c(),za=s("div"),g(Is.$$.fragment),Zm=c(),je=s("div"),g(Ws.$$.fragment),g_=c(),Ua=s("p"),Ia=s("a"),f_=a("LogitsProcessor"),u_=a(" enforcing a min-length by setting EOS probability to 0."),__=c(),Wa=s("div"),g(Bs.$$.fragment),Sm=c(),ne=s("div"),g(Zs.$$.fragment),b_=c(),fe=s("p"),Ba=s("a"),y_=a("LogitsProcessor"),v_=a(` enforcing a min-length of new tokens by setting EOS (End-Of-Sequence) token probability to 0.
Note that for decoder-only models, such as Llama2, `),jd=s("code"),T_=a("min_length"),w_=a(" will compute the length of "),Ed=s("code"),k_=a("prompt + newly generated tokens"),$_=a(" whereas for other models it will behave as "),Fd=s("code"),M_=a("min_new_tokens"),x_=a(`, that is, taking only into account
the newly generated ones.`),j_=c(),g(lr.$$.fragment),E_=c(),Za=s("div"),g(Ss.$$.fragment),Vm=c(),R=s("div"),g(Vs.$$.fragment),F_=c(),Sa=s("p"),Va=s("a"),L_=a("LogitsWarper"),J_=a(` for temperature (exponential scaling output probability distribution), which effectively means
that it can control the randomness of the predicted tokens.`),z_=c(),g(dr.$$.fragment),U_=c(),g(pr.$$.fragment),I_=c(),Pa=s("div"),g(Ps.$$.fragment),Pm=c(),ae=s("div"),g(Ds.$$.fragment),W_=c(),mr=s("p"),Da=s("a"),B_=a("LogitsProcessor"),Z_=a(` that prevents the repetition of previous tokens through an exponential penalty. This technique
shares some similarities with coverage mechanisms and other aimed at reducing repetition. During the text
generation process, the probability distribution for the next token is determined using a formula that incorporates
token scores based on their occurrence in the generated sequence. Tokens with higher scores are less likely to be
selected. The formula can be seen in the original `),qs=s("a"),S_=a("paper"),V_=a(`. According to the
paper a penalty of around 1.2 yields a good balance between truthful generation and lack of repetition.`),P_=c(),g(hr.$$.fragment),D_=c(),qa=s("div"),g(Gs.$$.fragment),Dm=c(),ie=s("div"),g(Xs.$$.fragment),q_=c(),Ga=s("p"),Xa=s("a"),G_=a("LogitsWarper"),X_=a(" that performs top-p, i.e. restricting to top tokens summing to prob_cut_off <= prob_cut_off."),R_=c(),g(gr.$$.fragment),C_=c(),Ra=s("div"),g(Rs.$$.fragment),qm=c(),Ee=s("div"),g(Cs.$$.fragment),N_=c(),Ca=s("p"),Na=s("a"),A_=a("LogitsWarper"),O_=a(" that performs top-k, i.e. restricting to the k highest probability elements."),H_=c(),Aa=s("div"),g(Ns.$$.fragment),Gm=c(),Fe=s("div"),g(As.$$.fragment),Q_=c(),fr=s("p"),Oa=s("a"),Y_=a("LogitsWarper"),K_=a(" that performs typical decoding. See "),Os=s("a"),eb=a(`Typical Decoding for Natural Language
Generation`),tb=a(" for more information."),rb=c(),Ha=s("div"),g(Hs.$$.fragment),Xm=c(),C=s("div"),g(Qs.$$.fragment),sb=c(),Dt=s("p"),ob=a(`N-grams are groups of \u201Cn\u201D consecutive words, characters, or tokens taken from a sequence of text. Given the
sentence: \u201CShe runs fast\u201D, the bi-grams (n=2) would be (\u201Cshe\u201D, \u201Cruns\u201D) and (\u201Cruns\u201D, \u201Cfast\u201D). In text generation,
avoiding repetitions of word sequences provides a more diverse output. This `),Qa=s("a"),nb=a("LogitsProcessor"),ab=a(` enforces no
repetition of n-grams by setting the scores of banned tokens to negative infinity which eliminates those tokens
from consideration when further processing the scores.
`),Ys=s("a"),ib=a("Fairseq"),cb=a("."),lb=c(),g(ur.$$.fragment),db=c(),g(_r.$$.fragment),pb=c(),Ya=s("div"),g(Ks.$$.fragment),Rm=c(),N=s("div"),g(eo.$$.fragment),mb=c(),Ka=s("p"),ei=s("a"),hb=a("LogitsProcessor"),gb=a(` that applies an additive bias on sequences. The bias is applied to the last token of a sequence
when the next generated token can complete it. Consequently, to take the most of biasing sequences with more than
one token, consider using beam methods (to gracefully work around partially completed sequences that have a
negative bias) and applying the bias to their prefixes (to ensure the bias is applied earlier).`),fb=c(),g(br.$$.fragment),ub=c(),g(yr.$$.fragment),_b=c(),ti=s("div"),g(to.$$.fragment),Cm=c(),A=s("div"),g(ro.$$.fragment),bb=c(),ri=s("p"),si=s("a"),yb=a("LogitsProcessor"),vb=a(" that enforces that specified sequences will never be selected."),Tb=c(),g(vr.$$.fragment),wb=c(),g(Tr.$$.fragment),kb=c(),oi=s("div"),g(so.$$.fragment),Nm=c(),Le=s("div"),g(oo.$$.fragment),$b=c(),wr=s("p"),ni=s("a"),Mb=a("LogitsProcessor"),xb=a(` that enforces constrained generation and is useful for prefix-conditioned constrained
generation. See `),no=s("a"),jb=a("Autoregressive Entity Retrieval"),Eb=a(" for more information."),Fb=c(),ai=s("div"),g(ao.$$.fragment),Am=c(),Je=s("div"),g(io.$$.fragment),Lb=c(),lt=s("p"),ii=s("a"),Jb=a("LogitsProcessor"),zb=a(` that enforces diverse beam search. Note that this logits processor is only effective for
`),ci=s("a"),Ub=a("PreTrainedModel.group_beam_search()"),Ib=a(". See "),co=s("a"),Wb=a(`Diverse Beam Search: Decoding Diverse Solutions from Neural Sequence
Models`),Bb=a(" for more details."),Zb=c(),li=s("div"),g(lo.$$.fragment),Om=c(),ze=s("div"),g(po.$$.fragment),Sb=c(),di=s("p"),pi=s("a"),Vb=a("LogitsProcessor"),Pb=a(" that enforces the specified token as the first generated token."),Db=c(),mi=s("div"),g(mo.$$.fragment),Hm=c(),Ue=s("div"),g(ho.$$.fragment),qb=c(),kr=s("p"),hi=s("a"),Gb=a("LogitsProcessor"),Xb=a(" that enforces the specified token as the last generated token when "),Ld=s("code"),Rb=a("max_length"),Cb=a(" is reached."),Nb=c(),gi=s("div"),g(go.$$.fragment),Qm=c(),Ie=s("div"),g(fo.$$.fragment),Ab=c(),dt=s("p"),fi=s("a"),Ob=a("LogitsProcessor"),Hb=a(" that removes all "),Jd=s("code"),Qb=a("nan"),Yb=a(" and "),zd=s("code"),Kb=a("inf"),ey=a(` values to avoid the generation method to fail. Note that using
the logits processor should only be used if necessary since it can slow down the generation method.`),ty=c(),ui=s("div"),g(uo.$$.fragment),Ym=c(),We=s("div"),g(_o.$$.fragment),ry=c(),Ud=s("p"),sy=a("Abstract base class for all logit processors that can be applied during generation."),oy=c(),$r=s("div"),g(bo.$$.fragment),ny=c(),Id=s("p"),ay=a("TF method for processing logits."),Km=c(),Be=s("div"),g(yo.$$.fragment),iy=c(),ce=s("p"),cy=a("This class can be used to create a list of "),_i=s("a"),ly=a("TFLogitsProcessor"),dy=a(" to subsequently process a "),Wd=s("code"),py=a("scores"),my=a(` input tensor.
This class inherits from list and adds a specific `),Bd=s("em"),Zd=s("strong"),hy=a("call"),gy=a(" method to apply each "),bi=s("a"),fy=a("TFLogitsProcessor"),uy=a(` to the
inputs.`),_y=c(),yi=s("div"),g(vo.$$.fragment),eh=c(),Ze=s("div"),g(To.$$.fragment),by=c(),Sd=s("p"),yy=a("Abstract base class for all logit warpers that can be applied during generation with multinomial sampling."),vy=c(),Mr=s("div"),g(wo.$$.fragment),Ty=c(),Vd=s("p"),wy=a("TF method for warping logits."),th=c(),Se=s("div"),g(ko.$$.fragment),ky=c(),vi=s("p"),Ti=s("a"),$y=a("TFLogitsWarper"),My=a(" for temperature (exponential scaling output probability distribution)."),xy=c(),wi=s("div"),g($o.$$.fragment),rh=c(),Ve=s("div"),g(Mo.$$.fragment),jy=c(),ki=s("p"),$i=s("a"),Ey=a("TFLogitsWarper"),Fy=a(" that performs top-p, i.e. restricting to top tokens summing to <= prob_cut_off."),Ly=c(),Mi=s("div"),g(xo.$$.fragment),sh=c(),Pe=s("div"),g(jo.$$.fragment),Jy=c(),xi=s("p"),ji=s("a"),zy=a("TFLogitsWarper"),Uy=a(" that performs top-k, i.e. restricting to the k highest probability elements."),Iy=c(),Ei=s("div"),g(Eo.$$.fragment),oh=c(),De=s("div"),g(Fo.$$.fragment),Wy=c(),Fi=s("p"),Li=s("a"),By=a("TFLogitsProcessor"),Zy=a(" enforcing a min-length by setting EOS probability to 0."),Sy=c(),Ji=s("div"),g(Lo.$$.fragment),nh=c(),qe=s("div"),g(Jo.$$.fragment),Vy=c(),zi=s("p"),Ui=s("a"),Py=a("TFLogitsProcessor"),Dy=a(" that enforces that specified sequences will never be sampled."),qy=c(),Ii=s("div"),g(zo.$$.fragment),ah=c(),Ge=s("div"),g(Uo.$$.fragment),Gy=c(),xr=s("p"),Wi=s("a"),Xy=a("TFLogitsProcessor"),Ry=a(` that enforces no repetition of n-grams. See
`),Io=s("a"),Cy=a("Fairseq"),Ny=a("."),Ay=c(),Bi=s("div"),g(Wo.$$.fragment),ih=c(),Xe=s("div"),g(Bo.$$.fragment),Oy=c(),Zi=s("p"),Si=s("a"),Hy=a("TFLogitsProcessor"),Qy=a(" enforcing an exponential penalty on repeated sequences."),Yy=c(),Vi=s("div"),g(Zo.$$.fragment),ch=c(),Re=s("div"),g(So.$$.fragment),Ky=c(),Pi=s("p"),Di=s("a"),ev=a("TFLogitsProcessor"),tv=a(" that enforces the specified token as the first generated token."),rv=c(),qi=s("div"),g(Vo.$$.fragment),lh=c(),Ce=s("div"),g(Po.$$.fragment),sv=c(),jr=s("p"),Gi=s("a"),ov=a("TFLogitsProcessor"),nv=a(" that enforces the specified token as the last generated token when "),Pd=s("code"),av=a("max_length"),iv=a(" is reached."),cv=c(),Xi=s("div"),g(Do.$$.fragment),dh=c(),Ne=s("div"),g(qo.$$.fragment),lv=c(),Dd=s("p"),dv=a("Abstract base class for all logit processors that can be applied during generation."),pv=c(),Er=s("div"),g(Go.$$.fragment),mv=c(),qd=s("p"),hv=a("Flax method for processing logits."),ph=c(),Ae=s("div"),g(Xo.$$.fragment),gv=c(),D=s("p"),fv=a("This class can be used to create a list of "),Ri=s("a"),uv=a("FlaxLogitsProcessor"),_v=a(" or "),Ci=s("a"),bv=a("FlaxLogitsWarper"),yv=a(` to subsequently process
a `),Gd=s("code"),vv=a("scores"),Tv=a(" input tensor. This class inherits from list and adds a specific "),Xd=s("em"),Rd=s("strong"),wv=a("call"),kv=a(` method to apply each
`),Ni=s("a"),$v=a("FlaxLogitsProcessor"),Mv=a(" or "),Ai=s("a"),xv=a("FlaxLogitsWarper"),jv=a(" to the inputs."),Ev=c(),Oi=s("div"),g(Ro.$$.fragment),mh=c(),Oe=s("div"),g(Co.$$.fragment),Fv=c(),Cd=s("p"),Lv=a("Abstract base class for all logit warpers that can be applied during generation with multinomial sampling."),Jv=c(),Fr=s("div"),g(No.$$.fragment),zv=c(),Nd=s("p"),Uv=a("Flax method for warping logits."),hh=c(),He=s("div"),g(Ao.$$.fragment),Iv=c(),Hi=s("p"),Qi=s("a"),Wv=a("FlaxLogitsWarper"),Bv=a(" for temperature (exponential scaling output probability distribution)."),Zv=c(),Yi=s("div"),g(Oo.$$.fragment),gh=c(),Qe=s("div"),g(Ho.$$.fragment),Sv=c(),Ki=s("p"),ec=s("a"),Vv=a("FlaxLogitsWarper"),Pv=a(" that performs top-p, i.e. restricting to top tokens summing to prob_cut_off <= prob_cut_off."),Dv=c(),tc=s("div"),g(Qo.$$.fragment),fh=c(),Ye=s("div"),g(Yo.$$.fragment),qv=c(),rc=s("p"),sc=s("a"),Gv=a("FlaxLogitsWarper"),Xv=a(" that performs top-k, i.e. restricting to the k highest probability elements."),Rv=c(),oc=s("div"),g(Ko.$$.fragment),uh=c(),Ke=s("div"),g(en.$$.fragment),Cv=c(),nc=s("p"),ac=s("a"),Nv=a("FlaxLogitsProcessor"),Av=a(" that enforces the specified token as the first generated token."),Ov=c(),ic=s("div"),g(tn.$$.fragment),_h=c(),et=s("div"),g(rn.$$.fragment),Hv=c(),Lr=s("p"),cc=s("a"),Qv=a("FlaxLogitsProcessor"),Yv=a(" that enforces the specified token as the last generated token when "),Ad=s("code"),Kv=a("max_length"),eT=a(" is reached."),tT=c(),lc=s("div"),g(sn.$$.fragment),bh=c(),tt=s("div"),g(on.$$.fragment),rT=c(),dc=s("p"),pc=s("a"),sT=a("FlaxLogitsProcessor"),oT=a(" enforcing a min-length by setting EOS probability to 0."),nT=c(),mc=s("div"),g(nn.$$.fragment),yh=c(),qt=s("h2"),Jr=s("a"),Od=s("span"),g(an.$$.fragment),aT=c(),Hd=s("span"),iT=a("StoppingCriteria"),vh=c(),zr=s("p"),cT=a("A "),hc=s("a"),lT=a("StoppingCriteria"),dT=a(" can be used to change when to stop generation (other than EOS token)."),Th=c(),rt=s("div"),g(cn.$$.fragment),pT=c(),Qd=s("p"),mT=a("Abstract base class for all stopping criteria that can be applied during generation."),hT=c(),gc=s("div"),g(ln.$$.fragment),wh=c(),Gt=s("div"),g(dn.$$.fragment),gT=c(),fc=s("div"),g(pn.$$.fragment),kh=c(),st=s("div"),g(mn.$$.fragment),fT=c(),hn=s("p"),uT=a("This class can be used to stop generation whenever the full generated number of tokens exceeds "),Yd=s("code"),_T=a("max_length"),bT=a(`. Keep
in mind for decoder-only type of transformers, this will include the initial prompted tokens.`),yT=c(),uc=s("div"),g(gn.$$.fragment),$h=c(),ot=s("div"),g(fn.$$.fragment),vT=c(),un=s("p"),TT=a(`This class can be used to stop generation whenever the full generation exceeds some amount of time. By default, the
time will start being counted when you initialize this function. You can override this by passing an
`),Kd=s("code"),wT=a("initial_time"),kT=a("."),$T=c(),_c=s("div"),g(_n.$$.fragment),Mh=c(),Xt=s("h2"),Ur=s("a"),ep=s("span"),g(bn.$$.fragment),MT=c(),tp=s("span"),xT=a("Constraints"),xh=c(),Ir=s("p"),jT=a("A "),bc=s("a"),ET=a("Constraint"),FT=a(" can be used to force the generation to include specific tokens or sequences in the output."),jh=c(),L=s("div"),g(yn.$$.fragment),LT=c(),rp=s("p"),JT=a(`Abstract base class for all constraints that can be applied during generation.
It must define how the constraint can be satisfied.`),zT=c(),sp=s("p"),UT=a("All classes that inherit Constraint must follow the requirement that"),IT=c(),g(Wr.$$.fragment),WT=c(),op=s("p"),BT=a("will always terminate (halt)."),ZT=c(),Br=s("div"),g(vn.$$.fragment),ST=c(),np=s("p"),VT=a("When called, returns the token that would take this constraint one step closer to being fulfilled."),PT=c(),Zr=s("div"),g(Tn.$$.fragment),DT=c(),ap=s("p"),qT=a("Creates a new instance of this constraint."),GT=c(),Sr=s("div"),g(wn.$$.fragment),XT=c(),ip=s("p"),RT=a("Reads in a token and returns whether it creates progress."),CT=c(),Vr=s("div"),g(kn.$$.fragment),NT=c(),$n=s("p"),AT=a("Returns the number of remaining steps of "),cp=s("code"),OT=a("advance()"),HT=a(" in order to complete this constraint."),QT=c(),Pr=s("div"),g(Mn.$$.fragment),YT=c(),lp=s("p"),KT=a(`Resets the state of this constraint to its initialization. We would call this in cases where the fulfillment of
a constraint is abrupted by an unwanted token.`),e2=c(),Dr=s("div"),g(xn.$$.fragment),t2=c(),dp=s("p"),r2=a("Tests whether this constraint has been properly defined."),s2=c(),pt=s("div"),g(jn.$$.fragment),o2=c(),En=s("p"),n2=a(`Reads in a token and returns booleans that indicate the progress made by it. This function will update the
state of this object unlikes `),pp=s("code"),a2=a("does_advance(self, token_id: int)"),i2=a("."),c2=c(),mp=s("p"),l2=a(`This isn\u2019t to test whether a certain token will advance the progress; it\u2019s to update its state as if it has
been generated. This becomes important if token_id != desired token (refer to else statement in
PhrasalConstraint)`),Eh=c(),Rt=s("div"),g(Fn.$$.fragment),d2=c(),yc=s("p"),vc=s("a"),p2=a("Constraint"),m2=a(" enforcing that an ordered sequence of tokens is included in the output."),Fh=c(),Ct=s("div"),g(Ln.$$.fragment),h2=c(),Jn=s("p"),g2=a("A special "),Tc=s("a"),f2=a("Constraint"),u2=a(" that is fulfilled by fulfilling just one of several constraints."),Lh=c(),le=s("div"),g(zn.$$.fragment),_2=c(),hp=s("p"),b2=a("A class for beam scorers to track its progress through a list of constraints."),y2=c(),G=s("div"),g(Un.$$.fragment),v2=c(),gp=s("p"),T2=a(`The list of tokens to generate such that we can make progress.
By \u201Clist\u201D we don\u2019t mean the list of token that will fully fulfill a constraint.`),w2=c(),Nt=s("p"),k2=a("Given constraints "),fp=s("code"),$2=a("c_i = {t_ij | j == # of tokens}"),M2=a(`, If we\u2019re not in the middle of progressing through a
specific constraint `),up=s("code"),x2=a("c_i"),j2=a(", we return:"),E2=c(),_p=s("p"),bp=s("code"),F2=a("[t_k1 for k in indices of unfulfilled constraints]"),L2=c(),nt=s("p"),J2=a(`If we are in the middle of a constraint, then we return:
`),yp=s("code"),z2=a("[t_ij]"),U2=a(", where "),vp=s("code"),I2=a("i"),W2=a(" is the index of the inprogress constraint, "),Tp=s("code"),B2=a("j"),Z2=a(" is the next step for the constraint."),S2=c(),wp=s("p"),V2=a(`Though we don\u2019t care which constraint is fulfilled first, if we are in the progress of fulfilling a constraint,
that\u2019s the only one we\u2019ll return.`),P2=c(),qr=s("div"),g(In.$$.fragment),D2=c(),kp=s("p"),q2=a("token_ids: the tokens generated thus far to reset the state of the progress through constraints."),Jh=c(),At=s("h2"),Gr=s("a"),$p=s("span"),g(Wn.$$.fragment),G2=c(),Mp=s("span"),X2=a("BeamSearch"),zh=c(),de=s("div"),g(Bn.$$.fragment),R2=c(),Ot=s("p"),C2=a("Abstract base class for all beam scorers that are used for "),wc=s("a"),N2=a("beam_search()"),A2=a(` and
`),kc=s("a"),O2=a("beam_sample()"),H2=a("."),Q2=c(),$c=s("div"),g(Zn.$$.fragment),Y2=c(),Mc=s("div"),g(Sn.$$.fragment),Uh=c(),q=s("div"),g(Vn.$$.fragment),K2=c(),xc=s("p"),jc=s("a"),ew=a("BeamScorer"),tw=a(" implementing standard beam search decoding."),rw=c(),Pn=s("p"),sw=a("Adapted in part from "),Dn=s("a"),ow=a(`Facebook\u2019s XLM beam search
code`),nw=a("."),aw=c(),Ec=s("p"),iw=a("Reference for the diverse beam search algorithm and implementation "),qn=s("a"),cw=a(`Ashwin Kalyan\u2019s DBS
implementation`),lw=c(),Fc=s("div"),g(Gn.$$.fragment),dw=c(),Lc=s("div"),g(Xn.$$.fragment),Ih=c(),pe=s("div"),g(Rn.$$.fragment),pw=c(),Jc=s("p"),zc=s("a"),mw=a("BeamScorer"),hw=a(" implementing constrained beam search decoding."),gw=c(),Uc=s("div"),g(Cn.$$.fragment),fw=c(),Ic=s("div"),g(Nn.$$.fragment),Wh=c(),Ht=s("h2"),Xr=s("a"),xp=s("span"),g(An.$$.fragment),uw=c(),jp=s("span"),_w=a("Utilities"),Bh=c(),at=s("div"),g(On.$$.fragment),bw=c(),Ep=s("p"),yw=a("Filter a distribution of logits using top-k and/or nucleus (top-p) filtering"),vw=c(),Wc=s("p"),Tw=a("From: "),Hn=s("a"),ww=a("https://gist.github.com/thomwolf/1a5a29f6962089e871b94cbd09daf317"),Zh=c(),it=s("div"),g(Qn.$$.fragment),kw=c(),Fp=s("p"),$w=a("Filter a distribution of logits using top-k and/or nucleus (top-p) filtering"),Mw=c(),Bc=s("p"),xw=a("From: "),Yn=s("a"),jw=a("https://gist.github.com/thomwolf/1a5a29f6962089e871b94cbd09daf317"),Sh=c(),Qt=s("h2"),Rr=s("a"),Lp=s("span"),g(Kn.$$.fragment),Ew=c(),Jp=s("span"),Fw=a("Streamers"),Vh=c(),B=s("div"),g(ea.$$.fragment),Lw=c(),zp=s("p"),Jw=a("Simple text streamer that prints the token(s) to stdout as soon as entire words are formed."),zw=c(),g(Cr.$$.fragment),Uw=c(),g(Nr.$$.fragment),Iw=c(),Ar=s("div"),g(ta.$$.fragment),Ww=c(),Up=s("p"),Bw=a("Flushes any remaining cache and prints a newline to stdout."),Zw=c(),Or=s("div"),g(ra.$$.fragment),Sw=c(),Ip=s("p"),Vw=a("Prints the new text to stdout. If the stream is ending, also prints a newline."),Pw=c(),Hr=s("div"),g(sa.$$.fragment),Dw=c(),Wp=s("p"),qw=a("Receives tokens, decodes them, and prints them to stdout as soon as they form entire words."),Ph=c(),O=s("div"),g(oa.$$.fragment),Gw=c(),Bp=s("p"),Xw=a(`Streamer that stores print-ready text in a queue, to be used by a downstream application as an iterator. This is
useful for applications that benefit from acessing the generated text in a non-blocking way (e.g. in an interactive
Gradio demo).`),Rw=c(),g(Qr.$$.fragment),Cw=c(),g(Yr.$$.fragment),Nw=c(),Kr=s("div"),g(na.$$.fragment),Aw=c(),Zp=s("p"),Ow=a("Put the new text in the queue. If the stream is ending, also put a stop signal in the queue."),this.h()},l(e){const p=QM('[data-svelte="svelte-1phssyn"]',document.head);v=o(p,"META",{name:!0,content:!0}),p.forEach(r),M=l(e),k=o(e,"H1",{class:!0});var aa=n(k);w=o(aa,"A",{id:!0,class:!0,href:!0});var Sp=n(w);x=o(Sp,"SPAN",{});var Vp=n(x);f(h.$$.fragment,Vp),Vp.forEach(r),Sp.forEach(r),$=l(aa),V=o(aa,"SPAN",{});var Pp=n(V);z=i(Pp,"Utilities for Generation"),Pp.forEach(r),aa.forEach(r),U=l(e),F=o(e,"P",{});var I=n(F);Z=i(I,"This page lists all the utility functions used by "),H=o(I,"A",{href:!0});var Dp=n(H);ve=i(Dp,"generate()"),Dp.forEach(r),W=i(I,`,
`),Q=o(I,"A",{href:!0});var qp=n(Q);Te=i(qp,"greedy_search()"),qp.forEach(r),X=i(I,`,
`),j=o(I,"A",{href:!0});var Gp=n(j);kt=i(Gp,"contrastive_search()"),Gp.forEach(r),$t=i(I,`,
`),me=o(I,"A",{href:!0});var Xp=n(me);Mt=i(Xp,"sample()"),Xp.forEach(r),xt=i(I,`,
`),da=o(I,"A",{href:!0});var Rp=n(da);Bg=i(Rp,"beam_search()"),Rp.forEach(r),Zg=i(I,`,
`),pa=o(I,"A",{href:!0});var Cp=n(pa);Sg=i(Cp,"beam_sample()"),Cp.forEach(r),Vg=i(I,`,
`),ma=o(I,"A",{href:!0});var Np=n(ma);Pg=i(Np,"group_beam_search()"),Np.forEach(r),Dg=i(I,`, and
`),ha=o(I,"A",{href:!0});var Ap=n(ha);qg=i(Ap,"constrained_beam_search()"),Ap.forEach(r),Gg=i(I,"."),I.forEach(r),om=l(e),ga=o(e,"P",{});var Op=n(ga);Xg=i(Op,"Most of those are only useful if you are studying the code of the generate methods in the library."),Op.forEach(r),nm=l(e),jt=o(e,"H2",{class:!0});var ia=n(jt);Kt=o(ia,"A",{id:!0,class:!0,href:!0});var Hp=n(Kt);El=o(Hp,"SPAN",{});var Mk=n(El);f(ls.$$.fragment,Mk),Mk.forEach(r),Hp.forEach(r),Rg=l(ia),Fl=o(ia,"SPAN",{});var xk=n(Fl);Cg=i(xk,"Generate Outputs"),xk.forEach(r),ia.forEach(r),am=l(e),he=o(e,"P",{});var es=n(he);Ng=i(es,"The output of "),fa=o(es,"A",{href:!0});var jk=n(fa);Ag=i(jk,"generate()"),jk.forEach(r),Og=i(es,` is an instance of a subclass of
`),ua=o(es,"A",{href:!0});var Ek=n(ua);Hg=i(Ek,"ModelOutput"),Ek.forEach(r),Qg=i(es,`. This output is a data structure containing all the information returned
by `),_a=o(es,"A",{href:!0});var Fk=n(_a);Yg=i(Fk,"generate()"),Fk.forEach(r),Kg=i(es,", but that can also be used as tuple or dictionary."),es.forEach(r),im=l(e),ba=o(e,"P",{});var Lk=n(ba);ef=i(Lk,"Here\u2019s an example:"),Lk.forEach(r),cm=l(e),f(ds.$$.fragment,e),lm=l(e),ct=o(e,"P",{});var Zc=n(ct);tf=i(Zc,"The "),Ll=o(Zc,"CODE",{});var Jk=n(Ll);rf=i(Jk,"generation_output"),Jk.forEach(r),sf=i(Zc," object is a "),ya=o(Zc,"A",{href:!0});var zk=n(ya);of=i(zk,"GreedySearchDecoderOnlyOutput"),zk.forEach(r),nf=i(Zc,`, as we can
see in the documentation of that class below, it means it has the following attributes:`),Zc.forEach(r),dm=l(e),ge=o(e,"UL",{});var ts=n(ge);va=o(ts,"LI",{});var Hw=n(va);Jl=o(Hw,"CODE",{});var Uk=n(Jl);af=i(Uk,"sequences"),Uk.forEach(r),cf=i(Hw,": the generated sequences of tokens"),Hw.forEach(r),lf=l(ts),Ta=o(ts,"LI",{});var Qw=n(Ta);zl=o(Qw,"CODE",{});var Ik=n(zl);df=i(Ik,"scores"),Ik.forEach(r),pf=i(Qw," (optional): the prediction scores of the language modelling head, for each generation step"),Qw.forEach(r),mf=l(ts),wa=o(ts,"LI",{});var Yw=n(wa);Ul=o(Yw,"CODE",{});var Wk=n(Ul);hf=i(Wk,"hidden_states"),Wk.forEach(r),gf=i(Yw," (optional): the hidden states of the model, for each generation step"),Yw.forEach(r),ff=l(ts),ka=o(ts,"LI",{});var Kw=n(ka);Il=o(Kw,"CODE",{});var Bk=n(Il);uf=i(Bk,"attentions"),Bk.forEach(r),_f=i(Kw," (optional): the attention weights of the model, for each generation step"),Kw.forEach(r),ts.forEach(r),pm=l(e),S=o(e,"P",{});var te=n(S);bf=i(te,"Here we have the "),Wl=o(te,"CODE",{});var Zk=n(Wl);yf=i(Zk,"scores"),Zk.forEach(r),vf=i(te," since we passed along "),Bl=o(te,"CODE",{});var Sk=n(Bl);Tf=i(Sk,"output_scores=True"),Sk.forEach(r),wf=i(te,", but we don\u2019t have "),Zl=o(te,"CODE",{});var Vk=n(Zl);kf=i(Vk,"hidden_states"),Vk.forEach(r),$f=i(te,` and
`),Sl=o(te,"CODE",{});var Pk=n(Sl);Mf=i(Pk,"attentions"),Pk.forEach(r),xf=i(te," because we didn\u2019t pass "),Vl=o(te,"CODE",{});var Dk=n(Vl);jf=i(Dk,"output_hidden_states=True"),Dk.forEach(r),Ef=i(te," or "),Pl=o(te,"CODE",{});var qk=n(Pl);Ff=i(qk,"output_attentions=True"),qk.forEach(r),Lf=i(te,"."),te.forEach(r),mm=l(e),Y=o(e,"P",{});var mt=n(Y);Jf=i(mt,`You can access each attribute as you would usually do, and if that attribute has not been returned by the model, you
will get `),Dl=o(mt,"CODE",{});var Gk=n(Dl);zf=i(Gk,"None"),Gk.forEach(r),Uf=i(mt,". Here for instance "),ql=o(mt,"CODE",{});var Xk=n(ql);If=i(Xk,"generation_output.scores"),Xk.forEach(r),Wf=i(mt,` are all the generated prediction scores of the
language modeling head, and `),Gl=o(mt,"CODE",{});var Rk=n(Gl);Bf=i(Rk,"generation_output.attentions"),Rk.forEach(r),Zf=i(mt," is "),Xl=o(mt,"CODE",{});var Ck=n(Xl);Sf=i(Ck,"None"),Ck.forEach(r),Vf=i(mt,"."),mt.forEach(r),hm=l(e),K=o(e,"P",{});var ht=n(K);Pf=i(ht,"When using our "),Rl=o(ht,"CODE",{});var Nk=n(Rl);Df=i(Nk,"generation_output"),Nk.forEach(r),qf=i(ht," object as a tuple, it only keeps the attributes that don\u2019t have "),Cl=o(ht,"CODE",{});var Ak=n(Cl);Gf=i(Ak,"None"),Ak.forEach(r),Xf=i(ht,` values.
Here, for instance, it has two elements, `),Nl=o(ht,"CODE",{});var Ok=n(Nl);Rf=i(Ok,"loss"),Ok.forEach(r),Cf=i(ht," then "),Al=o(ht,"CODE",{});var Hk=n(Al);Nf=i(Hk,"logits"),Hk.forEach(r),Af=i(ht,", so"),ht.forEach(r),gm=l(e),f(ps.$$.fragment,e),fm=l(e),er=o(e,"P",{});var qh=n(er);Of=i(qh,"will return the tuple "),Ol=o(qh,"CODE",{});var Qk=n(Ol);Hf=i(Qk,"(generation_output.sequences, generation_output.scores)"),Qk.forEach(r),Qf=i(qh," for instance."),qh.forEach(r),um=l(e),ee=o(e,"P",{});var gt=n(ee);Yf=i(gt,"When using our "),Hl=o(gt,"CODE",{});var Yk=n(Hl);Kf=i(Yk,"generation_output"),Yk.forEach(r),eu=i(gt," object as a dictionary, it only keeps the attributes that don\u2019t have "),Ql=o(gt,"CODE",{});var Kk=n(Ql);tu=i(Kk,"None"),Kk.forEach(r),ru=i(gt,`
values. Here, for instance, it has two keys that are `),Yl=o(gt,"CODE",{});var e$=n(Yl);su=i(e$,"sequences"),e$.forEach(r),ou=i(gt," and "),Kl=o(gt,"CODE",{});var t$=n(Kl);nu=i(t$,"scores"),t$.forEach(r),au=i(gt,"."),gt.forEach(r),_m=l(e),$a=o(e,"P",{});var r$=n($a);iu=i(r$,"We document here all output types."),r$.forEach(r),bm=l(e),Et=o(e,"H3",{class:!0});var Gh=n(Et);tr=o(Gh,"A",{id:!0,class:!0,href:!0});var s$=n(tr);ed=o(s$,"SPAN",{});var o$=n(ed);f(ms.$$.fragment,o$),o$.forEach(r),s$.forEach(r),cu=l(Gh),td=o(Gh,"SPAN",{});var n$=n(td);lu=i(n$,"GreedySearchOutput"),n$.forEach(r),Gh.forEach(r),ym=l(e),Ft=o(e,"DIV",{class:!0});var Xh=n(Ft);f(hs.$$.fragment,Xh),du=l(Xh),rd=o(Xh,"P",{});var a$=n(rd);pu=i(a$,"Base class for outputs of decoder-only generation models using greedy search."),a$.forEach(r),Xh.forEach(r),vm=l(e),Lt=o(e,"DIV",{class:!0});var Rh=n(Lt);f(gs.$$.fragment,Rh),mu=l(Rh),sd=o(Rh,"P",{});var i$=n(sd);hu=i(i$,`Base class for outputs of encoder-decoder generation models using greedy search. Hidden states and attention
weights of the decoder (respectively the encoder) can be accessed via the encoder_attentions and the
encoder_hidden_states attributes (respectively the decoder_attentions and the decoder_hidden_states attributes)`),i$.forEach(r),Rh.forEach(r),Tm=l(e),we=o(e,"DIV",{class:!0});var Sc=n(we);f(fs.$$.fragment,Sc),gu=l(Sc),od=o(Sc,"P",{});var c$=n(od);fu=i(c$,"Flax Base class for outputs of decoder-only generation models using greedy search."),c$.forEach(r),uu=l(Sc),rr=o(Sc,"DIV",{class:!0});var Ch=n(rr);f(us.$$.fragment,Ch),_u=l(Ch),nd=o(Ch,"P",{});var l$=n(nd);bu=i(l$,"\u201CReturns a new object replacing the specified fields with new values."),l$.forEach(r),Ch.forEach(r),Sc.forEach(r),wm=l(e),Jt=o(e,"H3",{class:!0});var Nh=n(Jt);sr=o(Nh,"A",{id:!0,class:!0,href:!0});var d$=n(sr);ad=o(d$,"SPAN",{});var p$=n(ad);f(_s.$$.fragment,p$),p$.forEach(r),d$.forEach(r),yu=l(Nh),id=o(Nh,"SPAN",{});var m$=n(id);vu=i(m$,"SampleOutput"),m$.forEach(r),Nh.forEach(r),km=l(e),zt=o(e,"DIV",{class:!0});var Ah=n(zt);f(bs.$$.fragment,Ah),Tu=l(Ah),cd=o(Ah,"P",{});var h$=n(cd);wu=i(h$,"Base class for outputs of decoder-only generation models using sampling."),h$.forEach(r),Ah.forEach(r),$m=l(e),Ut=o(e,"DIV",{class:!0});var Oh=n(Ut);f(ys.$$.fragment,Oh),ku=l(Oh),ld=o(Oh,"P",{});var g$=n(ld);$u=i(g$,`Base class for outputs of encoder-decoder generation models using sampling. Hidden states and attention weights of
the decoder (respectively the encoder) can be accessed via the encoder_attentions and the encoder_hidden_states
attributes (respectively the decoder_attentions and the decoder_hidden_states attributes)`),g$.forEach(r),Oh.forEach(r),Mm=l(e),ke=o(e,"DIV",{class:!0});var Vc=n(ke);f(vs.$$.fragment,Vc),Mu=l(Vc),dd=o(Vc,"P",{});var f$=n(dd);xu=i(f$,"Flax Base class for outputs of decoder-only generation models using sampling."),f$.forEach(r),ju=l(Vc),or=o(Vc,"DIV",{class:!0});var Hh=n(or);f(Ts.$$.fragment,Hh),Eu=l(Hh),pd=o(Hh,"P",{});var u$=n(pd);Fu=i(u$,"\u201CReturns a new object replacing the specified fields with new values."),u$.forEach(r),Hh.forEach(r),Vc.forEach(r),xm=l(e),It=o(e,"H3",{class:!0});var Qh=n(It);nr=o(Qh,"A",{id:!0,class:!0,href:!0});var _$=n(nr);md=o(_$,"SPAN",{});var b$=n(md);f(ws.$$.fragment,b$),b$.forEach(r),_$.forEach(r),Lu=l(Qh),hd=o(Qh,"SPAN",{});var y$=n(hd);Ju=i(y$,"BeamSearchOutput"),y$.forEach(r),Qh.forEach(r),jm=l(e),Wt=o(e,"DIV",{class:!0});var Yh=n(Wt);f(ks.$$.fragment,Yh),zu=l(Yh),gd=o(Yh,"P",{});var v$=n(gd);Uu=i(v$,"Base class for outputs of decoder-only generation models using beam search."),v$.forEach(r),Yh.forEach(r),Em=l(e),Bt=o(e,"DIV",{class:!0});var Kh=n(Bt);f($s.$$.fragment,Kh),Iu=l(Kh),fd=o(Kh,"P",{});var T$=n(fd);Wu=i(T$,`Base class for outputs of encoder-decoder generation models using beam search. Hidden states and attention weights
of the decoder (respectively the encoder) can be accessed via the encoder_attentions and the encoder_hidden_states
attributes (respectively the decoder_attentions and the decoder_hidden_states attributes)`),T$.forEach(r),Kh.forEach(r),Fm=l(e),Zt=o(e,"H3",{class:!0});var eg=n(Zt);ar=o(eg,"A",{id:!0,class:!0,href:!0});var w$=n(ar);ud=o(w$,"SPAN",{});var k$=n(ud);f(Ms.$$.fragment,k$),k$.forEach(r),w$.forEach(r),Bu=l(eg),_d=o(eg,"SPAN",{});var $$=n(_d);Zu=i($$,"BeamSampleOutput"),$$.forEach(r),eg.forEach(r),Lm=l(e),St=o(e,"DIV",{class:!0});var tg=n(St);f(xs.$$.fragment,tg),Su=l(tg),bd=o(tg,"P",{});var M$=n(bd);Vu=i(M$,"Base class for outputs of decoder-only generation models using beam sample."),M$.forEach(r),tg.forEach(r),Jm=l(e),Vt=o(e,"DIV",{class:!0});var rg=n(Vt);f(js.$$.fragment,rg),Pu=l(rg),yd=o(rg,"P",{});var x$=n(yd);Du=i(x$,`Base class for outputs of encoder-decoder generation models using beam sampling. Hidden states and attention
weights of the decoder (respectively the encoder) can be accessed via the encoder_attentions and the
encoder_hidden_states attributes (respectively the decoder_attentions and the decoder_hidden_states attributes)`),x$.forEach(r),rg.forEach(r),zm=l(e),Pt=o(e,"H2",{class:!0});var sg=n(Pt);ir=o(sg,"A",{id:!0,class:!0,href:!0});var j$=n(ir);vd=o(j$,"SPAN",{});var E$=n(vd);f(Es.$$.fragment,E$),E$.forEach(r),j$.forEach(r),qu=l(sg),Td=o(sg,"SPAN",{});var F$=n(Td);Gu=i(F$,"LogitsProcessor"),F$.forEach(r),sg.forEach(r),Um=l(e),cr=o(e,"P",{});var og=n(cr);Xu=i(og,"A "),Ma=o(og,"A",{href:!0});var L$=n(Ma);Ru=i(L$,"LogitsProcessor"),L$.forEach(r),Cu=i(og,` can be used to modify the prediction scores of a language model head for
generation.`),og.forEach(r),Im=l(e),$e=o(e,"DIV",{class:!0});var Pc=n($e);f(Fs.$$.fragment,Pc),Nu=l(Pc),wd=o(Pc,"P",{});var J$=n(wd);Au=i(J$,"Abstract base class for all logit processors that can be applied during generation."),J$.forEach(r),Ou=l(Pc),xa=o(Pc,"DIV",{class:!0});var z$=n(xa);f(Ls.$$.fragment,z$),z$.forEach(r),Pc.forEach(r),Wm=l(e),Me=o(e,"DIV",{class:!0});var Dc=n(Me);f(Js.$$.fragment,Dc),Hu=l(Dc),P=o(Dc,"P",{});var re=n(P);Qu=i(re,"This class can be used to create a list of "),ja=o(re,"A",{href:!0});var U$=n(ja);Yu=i(U$,"LogitsProcessor"),U$.forEach(r),Ku=i(re," or "),Ea=o(re,"A",{href:!0});var I$=n(Ea);e_=i(I$,"LogitsWarper"),I$.forEach(r),t_=i(re,` to subsequently process a
`),kd=o(re,"CODE",{});var W$=n(kd);r_=i(W$,"scores"),W$.forEach(r),s_=i(re," input tensor. This class inherits from list and adds a specific "),$d=o(re,"EM",{});var B$=n($d);Md=o(B$,"STRONG",{});var Z$=n(Md);o_=i(Z$,"call"),Z$.forEach(r),B$.forEach(r),n_=i(re,` method to apply each
`),Fa=o(re,"A",{href:!0});var S$=n(Fa);a_=i(S$,"LogitsProcessor"),S$.forEach(r),i_=i(re," or "),La=o(re,"A",{href:!0});var V$=n(La);c_=i(V$,"LogitsWarper"),V$.forEach(r),l_=i(re," to the inputs."),re.forEach(r),d_=l(Dc),Ja=o(Dc,"DIV",{class:!0});var P$=n(Ja);f(zs.$$.fragment,P$),P$.forEach(r),Dc.forEach(r),Bm=l(e),xe=o(e,"DIV",{class:!0});var qc=n(xe);f(Us.$$.fragment,qc),p_=l(qc),xd=o(qc,"P",{});var D$=n(xd);m_=i(D$,"Abstract base class for all logit warpers that can be applied during generation with multinomial sampling."),D$.forEach(r),h_=l(qc),za=o(qc,"DIV",{class:!0});var q$=n(za);f(Is.$$.fragment,q$),q$.forEach(r),qc.forEach(r),Zm=l(e),je=o(e,"DIV",{class:!0});var Gc=n(je);f(Ws.$$.fragment,Gc),g_=l(Gc),Ua=o(Gc,"P",{});var ek=n(Ua);Ia=o(ek,"A",{href:!0});var G$=n(Ia);f_=i(G$,"LogitsProcessor"),G$.forEach(r),u_=i(ek," enforcing a min-length by setting EOS probability to 0."),ek.forEach(r),__=l(Gc),Wa=o(Gc,"DIV",{class:!0});var X$=n(Wa);f(Bs.$$.fragment,X$),X$.forEach(r),Gc.forEach(r),Sm=l(e),ne=o(e,"DIV",{class:!0});var rs=n(ne);f(Zs.$$.fragment,rs),b_=l(rs),fe=o(rs,"P",{});var Yt=n(fe);Ba=o(Yt,"A",{href:!0});var R$=n(Ba);y_=i(R$,"LogitsProcessor"),R$.forEach(r),v_=i(Yt,` enforcing a min-length of new tokens by setting EOS (End-Of-Sequence) token probability to 0.
Note that for decoder-only models, such as Llama2, `),jd=o(Yt,"CODE",{});var C$=n(jd);T_=i(C$,"min_length"),C$.forEach(r),w_=i(Yt," will compute the length of "),Ed=o(Yt,"CODE",{});var N$=n(Ed);k_=i(N$,"prompt + newly generated tokens"),N$.forEach(r),$_=i(Yt," whereas for other models it will behave as "),Fd=o(Yt,"CODE",{});var A$=n(Fd);M_=i(A$,"min_new_tokens"),A$.forEach(r),x_=i(Yt,`, that is, taking only into account
the newly generated ones.`),Yt.forEach(r),j_=l(rs),f(lr.$$.fragment,rs),E_=l(rs),Za=o(rs,"DIV",{class:!0});var O$=n(Za);f(Ss.$$.fragment,O$),O$.forEach(r),rs.forEach(r),Vm=l(e),R=o(e,"DIV",{class:!0});var ft=n(R);f(Vs.$$.fragment,ft),F_=l(ft),Sa=o(ft,"P",{});var tk=n(Sa);Va=o(tk,"A",{href:!0});var H$=n(Va);L_=i(H$,"LogitsWarper"),H$.forEach(r),J_=i(tk,` for temperature (exponential scaling output probability distribution), which effectively means
that it can control the randomness of the predicted tokens.`),tk.forEach(r),z_=l(ft),f(dr.$$.fragment,ft),U_=l(ft),f(pr.$$.fragment,ft),I_=l(ft),Pa=o(ft,"DIV",{class:!0});var Q$=n(Pa);f(Ps.$$.fragment,Q$),Q$.forEach(r),ft.forEach(r),Pm=l(e),ae=o(e,"DIV",{class:!0});var ss=n(ae);f(Ds.$$.fragment,ss),W_=l(ss),mr=o(ss,"P",{});var Qp=n(mr);Da=o(Qp,"A",{href:!0});var Y$=n(Da);B_=i(Y$,"LogitsProcessor"),Y$.forEach(r),Z_=i(Qp,` that prevents the repetition of previous tokens through an exponential penalty. This technique
shares some similarities with coverage mechanisms and other aimed at reducing repetition. During the text
generation process, the probability distribution for the next token is determined using a formula that incorporates
token scores based on their occurrence in the generated sequence. Tokens with higher scores are less likely to be
selected. The formula can be seen in the original `),qs=o(Qp,"A",{href:!0,rel:!0});var K$=n(qs);S_=i(K$,"paper"),K$.forEach(r),V_=i(Qp,`. According to the
paper a penalty of around 1.2 yields a good balance between truthful generation and lack of repetition.`),Qp.forEach(r),P_=l(ss),f(hr.$$.fragment,ss),D_=l(ss),qa=o(ss,"DIV",{class:!0});var e1=n(qa);f(Gs.$$.fragment,e1),e1.forEach(r),ss.forEach(r),Dm=l(e),ie=o(e,"DIV",{class:!0});var os=n(ie);f(Xs.$$.fragment,os),q_=l(os),Ga=o(os,"P",{});var rk=n(Ga);Xa=o(rk,"A",{href:!0});var t1=n(Xa);G_=i(t1,"LogitsWarper"),t1.forEach(r),X_=i(rk," that performs top-p, i.e. restricting to top tokens summing to prob_cut_off <= prob_cut_off."),rk.forEach(r),R_=l(os),f(gr.$$.fragment,os),C_=l(os),Ra=o(os,"DIV",{class:!0});var r1=n(Ra);f(Rs.$$.fragment,r1),r1.forEach(r),os.forEach(r),qm=l(e),Ee=o(e,"DIV",{class:!0});var Xc=n(Ee);f(Cs.$$.fragment,Xc),N_=l(Xc),Ca=o(Xc,"P",{});var sk=n(Ca);Na=o(sk,"A",{href:!0});var s1=n(Na);A_=i(s1,"LogitsWarper"),s1.forEach(r),O_=i(sk," that performs top-k, i.e. restricting to the k highest probability elements."),sk.forEach(r),H_=l(Xc),Aa=o(Xc,"DIV",{class:!0});var o1=n(Aa);f(Ns.$$.fragment,o1),o1.forEach(r),Xc.forEach(r),Gm=l(e),Fe=o(e,"DIV",{class:!0});var Rc=n(Fe);f(As.$$.fragment,Rc),Q_=l(Rc),fr=o(Rc,"P",{});var Yp=n(fr);Oa=o(Yp,"A",{href:!0});var n1=n(Oa);Y_=i(n1,"LogitsWarper"),n1.forEach(r),K_=i(Yp," that performs typical decoding. See "),Os=o(Yp,"A",{href:!0,rel:!0});var a1=n(Os);eb=i(a1,`Typical Decoding for Natural Language
Generation`),a1.forEach(r),tb=i(Yp," for more information."),Yp.forEach(r),rb=l(Rc),Ha=o(Rc,"DIV",{class:!0});var i1=n(Ha);f(Hs.$$.fragment,i1),i1.forEach(r),Rc.forEach(r),Xm=l(e),C=o(e,"DIV",{class:!0});var ut=n(C);f(Qs.$$.fragment,ut),sb=l(ut),Dt=o(ut,"P",{});var Cc=n(Dt);ob=i(Cc,`N-grams are groups of \u201Cn\u201D consecutive words, characters, or tokens taken from a sequence of text. Given the
sentence: \u201CShe runs fast\u201D, the bi-grams (n=2) would be (\u201Cshe\u201D, \u201Cruns\u201D) and (\u201Cruns\u201D, \u201Cfast\u201D). In text generation,
avoiding repetitions of word sequences provides a more diverse output. This `),Qa=o(Cc,"A",{href:!0});var c1=n(Qa);nb=i(c1,"LogitsProcessor"),c1.forEach(r),ab=i(Cc,` enforces no
repetition of n-grams by setting the scores of banned tokens to negative infinity which eliminates those tokens
from consideration when further processing the scores.
`),Ys=o(Cc,"A",{href:!0,rel:!0});var l1=n(Ys);ib=i(l1,"Fairseq"),l1.forEach(r),cb=i(Cc,"."),Cc.forEach(r),lb=l(ut),f(ur.$$.fragment,ut),db=l(ut),f(_r.$$.fragment,ut),pb=l(ut),Ya=o(ut,"DIV",{class:!0});var d1=n(Ya);f(Ks.$$.fragment,d1),d1.forEach(r),ut.forEach(r),Rm=l(e),N=o(e,"DIV",{class:!0});var _t=n(N);f(eo.$$.fragment,_t),mb=l(_t),Ka=o(_t,"P",{});var ok=n(Ka);ei=o(ok,"A",{href:!0});var p1=n(ei);hb=i(p1,"LogitsProcessor"),p1.forEach(r),gb=i(ok,` that applies an additive bias on sequences. The bias is applied to the last token of a sequence
when the next generated token can complete it. Consequently, to take the most of biasing sequences with more than
one token, consider using beam methods (to gracefully work around partially completed sequences that have a
negative bias) and applying the bias to their prefixes (to ensure the bias is applied earlier).`),ok.forEach(r),fb=l(_t),f(br.$$.fragment,_t),ub=l(_t),f(yr.$$.fragment,_t),_b=l(_t),ti=o(_t,"DIV",{class:!0});var m1=n(ti);f(to.$$.fragment,m1),m1.forEach(r),_t.forEach(r),Cm=l(e),A=o(e,"DIV",{class:!0});var bt=n(A);f(ro.$$.fragment,bt),bb=l(bt),ri=o(bt,"P",{});var nk=n(ri);si=o(nk,"A",{href:!0});var h1=n(si);yb=i(h1,"LogitsProcessor"),h1.forEach(r),vb=i(nk," that enforces that specified sequences will never be selected."),nk.forEach(r),Tb=l(bt),f(vr.$$.fragment,bt),wb=l(bt),f(Tr.$$.fragment,bt),kb=l(bt),oi=o(bt,"DIV",{class:!0});var g1=n(oi);f(so.$$.fragment,g1),g1.forEach(r),bt.forEach(r),Nm=l(e),Le=o(e,"DIV",{class:!0});var Nc=n(Le);f(oo.$$.fragment,Nc),$b=l(Nc),wr=o(Nc,"P",{});var Kp=n(wr);ni=o(Kp,"A",{href:!0});var f1=n(ni);Mb=i(f1,"LogitsProcessor"),f1.forEach(r),xb=i(Kp,` that enforces constrained generation and is useful for prefix-conditioned constrained
generation. See `),no=o(Kp,"A",{href:!0,rel:!0});var u1=n(no);jb=i(u1,"Autoregressive Entity Retrieval"),u1.forEach(r),Eb=i(Kp," for more information."),Kp.forEach(r),Fb=l(Nc),ai=o(Nc,"DIV",{class:!0});var _1=n(ai);f(ao.$$.fragment,_1),_1.forEach(r),Nc.forEach(r),Am=l(e),Je=o(e,"DIV",{class:!0});var Ac=n(Je);f(io.$$.fragment,Ac),Lb=l(Ac),lt=o(Ac,"P",{});var ca=n(lt);ii=o(ca,"A",{href:!0});var b1=n(ii);Jb=i(b1,"LogitsProcessor"),b1.forEach(r),zb=i(ca,` that enforces diverse beam search. Note that this logits processor is only effective for
`),ci=o(ca,"A",{href:!0});var y1=n(ci);Ub=i(y1,"PreTrainedModel.group_beam_search()"),y1.forEach(r),Ib=i(ca,". See "),co=o(ca,"A",{href:!0,rel:!0});var v1=n(co);Wb=i(v1,`Diverse Beam Search: Decoding Diverse Solutions from Neural Sequence
Models`),v1.forEach(r),Bb=i(ca," for more details."),ca.forEach(r),Zb=l(Ac),li=o(Ac,"DIV",{class:!0});var T1=n(li);f(lo.$$.fragment,T1),T1.forEach(r),Ac.forEach(r),Om=l(e),ze=o(e,"DIV",{class:!0});var Oc=n(ze);f(po.$$.fragment,Oc),Sb=l(Oc),di=o(Oc,"P",{});var ak=n(di);pi=o(ak,"A",{href:!0});var w1=n(pi);Vb=i(w1,"LogitsProcessor"),w1.forEach(r),Pb=i(ak," that enforces the specified token as the first generated token."),ak.forEach(r),Db=l(Oc),mi=o(Oc,"DIV",{class:!0});var k1=n(mi);f(mo.$$.fragment,k1),k1.forEach(r),Oc.forEach(r),Hm=l(e),Ue=o(e,"DIV",{class:!0});var Hc=n(Ue);f(ho.$$.fragment,Hc),qb=l(Hc),kr=o(Hc,"P",{});var em=n(kr);hi=o(em,"A",{href:!0});var $1=n(hi);Gb=i($1,"LogitsProcessor"),$1.forEach(r),Xb=i(em," that enforces the specified token as the last generated token when "),Ld=o(em,"CODE",{});var M1=n(Ld);Rb=i(M1,"max_length"),M1.forEach(r),Cb=i(em," is reached."),em.forEach(r),Nb=l(Hc),gi=o(Hc,"DIV",{class:!0});var x1=n(gi);f(go.$$.fragment,x1),x1.forEach(r),Hc.forEach(r),Qm=l(e),Ie=o(e,"DIV",{class:!0});var Qc=n(Ie);f(fo.$$.fragment,Qc),Ab=l(Qc),dt=o(Qc,"P",{});var la=n(dt);fi=o(la,"A",{href:!0});var j1=n(fi);Ob=i(j1,"LogitsProcessor"),j1.forEach(r),Hb=i(la," that removes all "),Jd=o(la,"CODE",{});var E1=n(Jd);Qb=i(E1,"nan"),E1.forEach(r),Yb=i(la," and "),zd=o(la,"CODE",{});var F1=n(zd);Kb=i(F1,"inf"),F1.forEach(r),ey=i(la,` values to avoid the generation method to fail. Note that using
the logits processor should only be used if necessary since it can slow down the generation method.`),la.forEach(r),ty=l(Qc),ui=o(Qc,"DIV",{class:!0});var L1=n(ui);f(uo.$$.fragment,L1),L1.forEach(r),Qc.forEach(r),Ym=l(e),We=o(e,"DIV",{class:!0});var Yc=n(We);f(_o.$$.fragment,Yc),ry=l(Yc),Ud=o(Yc,"P",{});var J1=n(Ud);sy=i(J1,"Abstract base class for all logit processors that can be applied during generation."),J1.forEach(r),oy=l(Yc),$r=o(Yc,"DIV",{class:!0});var ng=n($r);f(bo.$$.fragment,ng),ny=l(ng),Id=o(ng,"P",{});var z1=n(Id);ay=i(z1,"TF method for processing logits."),z1.forEach(r),ng.forEach(r),Yc.forEach(r),Km=l(e),Be=o(e,"DIV",{class:!0});var Kc=n(Be);f(yo.$$.fragment,Kc),iy=l(Kc),ce=o(Kc,"P",{});var yt=n(ce);cy=i(yt,"This class can be used to create a list of "),_i=o(yt,"A",{href:!0});var U1=n(_i);ly=i(U1,"TFLogitsProcessor"),U1.forEach(r),dy=i(yt," to subsequently process a "),Wd=o(yt,"CODE",{});var I1=n(Wd);py=i(I1,"scores"),I1.forEach(r),my=i(yt,` input tensor.
This class inherits from list and adds a specific `),Bd=o(yt,"EM",{});var W1=n(Bd);Zd=o(W1,"STRONG",{});var B1=n(Zd);hy=i(B1,"call"),B1.forEach(r),W1.forEach(r),gy=i(yt," method to apply each "),bi=o(yt,"A",{href:!0});var Z1=n(bi);fy=i(Z1,"TFLogitsProcessor"),Z1.forEach(r),uy=i(yt,` to the
inputs.`),yt.forEach(r),_y=l(Kc),yi=o(Kc,"DIV",{class:!0});var S1=n(yi);f(vo.$$.fragment,S1),S1.forEach(r),Kc.forEach(r),eh=l(e),Ze=o(e,"DIV",{class:!0});var el=n(Ze);f(To.$$.fragment,el),by=l(el),Sd=o(el,"P",{});var V1=n(Sd);yy=i(V1,"Abstract base class for all logit warpers that can be applied during generation with multinomial sampling."),V1.forEach(r),vy=l(el),Mr=o(el,"DIV",{class:!0});var ag=n(Mr);f(wo.$$.fragment,ag),Ty=l(ag),Vd=o(ag,"P",{});var P1=n(Vd);wy=i(P1,"TF method for warping logits."),P1.forEach(r),ag.forEach(r),el.forEach(r),th=l(e),Se=o(e,"DIV",{class:!0});var tl=n(Se);f(ko.$$.fragment,tl),ky=l(tl),vi=o(tl,"P",{});var ik=n(vi);Ti=o(ik,"A",{href:!0});var D1=n(Ti);$y=i(D1,"TFLogitsWarper"),D1.forEach(r),My=i(ik," for temperature (exponential scaling output probability distribution)."),ik.forEach(r),xy=l(tl),wi=o(tl,"DIV",{class:!0});var q1=n(wi);f($o.$$.fragment,q1),q1.forEach(r),tl.forEach(r),rh=l(e),Ve=o(e,"DIV",{class:!0});var rl=n(Ve);f(Mo.$$.fragment,rl),jy=l(rl),ki=o(rl,"P",{});var ck=n(ki);$i=o(ck,"A",{href:!0});var G1=n($i);Ey=i(G1,"TFLogitsWarper"),G1.forEach(r),Fy=i(ck," that performs top-p, i.e. restricting to top tokens summing to <= prob_cut_off."),ck.forEach(r),Ly=l(rl),Mi=o(rl,"DIV",{class:!0});var X1=n(Mi);f(xo.$$.fragment,X1),X1.forEach(r),rl.forEach(r),sh=l(e),Pe=o(e,"DIV",{class:!0});var sl=n(Pe);f(jo.$$.fragment,sl),Jy=l(sl),xi=o(sl,"P",{});var lk=n(xi);ji=o(lk,"A",{href:!0});var R1=n(ji);zy=i(R1,"TFLogitsWarper"),R1.forEach(r),Uy=i(lk," that performs top-k, i.e. restricting to the k highest probability elements."),lk.forEach(r),Iy=l(sl),Ei=o(sl,"DIV",{class:!0});var C1=n(Ei);f(Eo.$$.fragment,C1),C1.forEach(r),sl.forEach(r),oh=l(e),De=o(e,"DIV",{class:!0});var ol=n(De);f(Fo.$$.fragment,ol),Wy=l(ol),Fi=o(ol,"P",{});var dk=n(Fi);Li=o(dk,"A",{href:!0});var N1=n(Li);By=i(N1,"TFLogitsProcessor"),N1.forEach(r),Zy=i(dk," enforcing a min-length by setting EOS probability to 0."),dk.forEach(r),Sy=l(ol),Ji=o(ol,"DIV",{class:!0});var A1=n(Ji);f(Lo.$$.fragment,A1),A1.forEach(r),ol.forEach(r),nh=l(e),qe=o(e,"DIV",{class:!0});var nl=n(qe);f(Jo.$$.fragment,nl),Vy=l(nl),zi=o(nl,"P",{});var pk=n(zi);Ui=o(pk,"A",{href:!0});var O1=n(Ui);Py=i(O1,"TFLogitsProcessor"),O1.forEach(r),Dy=i(pk," that enforces that specified sequences will never be sampled."),pk.forEach(r),qy=l(nl),Ii=o(nl,"DIV",{class:!0});var H1=n(Ii);f(zo.$$.fragment,H1),H1.forEach(r),nl.forEach(r),ah=l(e),Ge=o(e,"DIV",{class:!0});var al=n(Ge);f(Uo.$$.fragment,al),Gy=l(al),xr=o(al,"P",{});var tm=n(xr);Wi=o(tm,"A",{href:!0});var Q1=n(Wi);Xy=i(Q1,"TFLogitsProcessor"),Q1.forEach(r),Ry=i(tm,` that enforces no repetition of n-grams. See
`),Io=o(tm,"A",{href:!0,rel:!0});var Y1=n(Io);Cy=i(Y1,"Fairseq"),Y1.forEach(r),Ny=i(tm,"."),tm.forEach(r),Ay=l(al),Bi=o(al,"DIV",{class:!0});var K1=n(Bi);f(Wo.$$.fragment,K1),K1.forEach(r),al.forEach(r),ih=l(e),Xe=o(e,"DIV",{class:!0});var il=n(Xe);f(Bo.$$.fragment,il),Oy=l(il),Zi=o(il,"P",{});var mk=n(Zi);Si=o(mk,"A",{href:!0});var e0=n(Si);Hy=i(e0,"TFLogitsProcessor"),e0.forEach(r),Qy=i(mk," enforcing an exponential penalty on repeated sequences."),mk.forEach(r),Yy=l(il),Vi=o(il,"DIV",{class:!0});var t0=n(Vi);f(Zo.$$.fragment,t0),t0.forEach(r),il.forEach(r),ch=l(e),Re=o(e,"DIV",{class:!0});var cl=n(Re);f(So.$$.fragment,cl),Ky=l(cl),Pi=o(cl,"P",{});var hk=n(Pi);Di=o(hk,"A",{href:!0});var r0=n(Di);ev=i(r0,"TFLogitsProcessor"),r0.forEach(r),tv=i(hk," that enforces the specified token as the first generated token."),hk.forEach(r),rv=l(cl),qi=o(cl,"DIV",{class:!0});var s0=n(qi);f(Vo.$$.fragment,s0),s0.forEach(r),cl.forEach(r),lh=l(e),Ce=o(e,"DIV",{class:!0});var ll=n(Ce);f(Po.$$.fragment,ll),sv=l(ll),jr=o(ll,"P",{});var rm=n(jr);Gi=o(rm,"A",{href:!0});var o0=n(Gi);ov=i(o0,"TFLogitsProcessor"),o0.forEach(r),nv=i(rm," that enforces the specified token as the last generated token when "),Pd=o(rm,"CODE",{});var n0=n(Pd);av=i(n0,"max_length"),n0.forEach(r),iv=i(rm," is reached."),rm.forEach(r),cv=l(ll),Xi=o(ll,"DIV",{class:!0});var a0=n(Xi);f(Do.$$.fragment,a0),a0.forEach(r),ll.forEach(r),dh=l(e),Ne=o(e,"DIV",{class:!0});var dl=n(Ne);f(qo.$$.fragment,dl),lv=l(dl),Dd=o(dl,"P",{});var i0=n(Dd);dv=i(i0,"Abstract base class for all logit processors that can be applied during generation."),i0.forEach(r),pv=l(dl),Er=o(dl,"DIV",{class:!0});var ig=n(Er);f(Go.$$.fragment,ig),mv=l(ig),qd=o(ig,"P",{});var c0=n(qd);hv=i(c0,"Flax method for processing logits."),c0.forEach(r),ig.forEach(r),dl.forEach(r),ph=l(e),Ae=o(e,"DIV",{class:!0});var pl=n(Ae);f(Xo.$$.fragment,pl),gv=l(pl),D=o(pl,"P",{});var se=n(D);fv=i(se,"This class can be used to create a list of "),Ri=o(se,"A",{href:!0});var l0=n(Ri);uv=i(l0,"FlaxLogitsProcessor"),l0.forEach(r),_v=i(se," or "),Ci=o(se,"A",{href:!0});var d0=n(Ci);bv=i(d0,"FlaxLogitsWarper"),d0.forEach(r),yv=i(se,` to subsequently process
a `),Gd=o(se,"CODE",{});var p0=n(Gd);vv=i(p0,"scores"),p0.forEach(r),Tv=i(se," input tensor. This class inherits from list and adds a specific "),Xd=o(se,"EM",{});var m0=n(Xd);Rd=o(m0,"STRONG",{});var h0=n(Rd);wv=i(h0,"call"),h0.forEach(r),m0.forEach(r),kv=i(se,` method to apply each
`),Ni=o(se,"A",{href:!0});var g0=n(Ni);$v=i(g0,"FlaxLogitsProcessor"),g0.forEach(r),Mv=i(se," or "),Ai=o(se,"A",{href:!0});var f0=n(Ai);xv=i(f0,"FlaxLogitsWarper"),f0.forEach(r),jv=i(se," to the inputs."),se.forEach(r),Ev=l(pl),Oi=o(pl,"DIV",{class:!0});var u0=n(Oi);f(Ro.$$.fragment,u0),u0.forEach(r),pl.forEach(r),mh=l(e),Oe=o(e,"DIV",{class:!0});var ml=n(Oe);f(Co.$$.fragment,ml),Fv=l(ml),Cd=o(ml,"P",{});var _0=n(Cd);Lv=i(_0,"Abstract base class for all logit warpers that can be applied during generation with multinomial sampling."),_0.forEach(r),Jv=l(ml),Fr=o(ml,"DIV",{class:!0});var cg=n(Fr);f(No.$$.fragment,cg),zv=l(cg),Nd=o(cg,"P",{});var b0=n(Nd);Uv=i(b0,"Flax method for warping logits."),b0.forEach(r),cg.forEach(r),ml.forEach(r),hh=l(e),He=o(e,"DIV",{class:!0});var hl=n(He);f(Ao.$$.fragment,hl),Iv=l(hl),Hi=o(hl,"P",{});var gk=n(Hi);Qi=o(gk,"A",{href:!0});var y0=n(Qi);Wv=i(y0,"FlaxLogitsWarper"),y0.forEach(r),Bv=i(gk," for temperature (exponential scaling output probability distribution)."),gk.forEach(r),Zv=l(hl),Yi=o(hl,"DIV",{class:!0});var v0=n(Yi);f(Oo.$$.fragment,v0),v0.forEach(r),hl.forEach(r),gh=l(e),Qe=o(e,"DIV",{class:!0});var gl=n(Qe);f(Ho.$$.fragment,gl),Sv=l(gl),Ki=o(gl,"P",{});var fk=n(Ki);ec=o(fk,"A",{href:!0});var T0=n(ec);Vv=i(T0,"FlaxLogitsWarper"),T0.forEach(r),Pv=i(fk," that performs top-p, i.e. restricting to top tokens summing to prob_cut_off <= prob_cut_off."),fk.forEach(r),Dv=l(gl),tc=o(gl,"DIV",{class:!0});var w0=n(tc);f(Qo.$$.fragment,w0),w0.forEach(r),gl.forEach(r),fh=l(e),Ye=o(e,"DIV",{class:!0});var fl=n(Ye);f(Yo.$$.fragment,fl),qv=l(fl),rc=o(fl,"P",{});var uk=n(rc);sc=o(uk,"A",{href:!0});var k0=n(sc);Gv=i(k0,"FlaxLogitsWarper"),k0.forEach(r),Xv=i(uk," that performs top-k, i.e. restricting to the k highest probability elements."),uk.forEach(r),Rv=l(fl),oc=o(fl,"DIV",{class:!0});var $0=n(oc);f(Ko.$$.fragment,$0),$0.forEach(r),fl.forEach(r),uh=l(e),Ke=o(e,"DIV",{class:!0});var ul=n(Ke);f(en.$$.fragment,ul),Cv=l(ul),nc=o(ul,"P",{});var _k=n(nc);ac=o(_k,"A",{href:!0});var M0=n(ac);Nv=i(M0,"FlaxLogitsProcessor"),M0.forEach(r),Av=i(_k," that enforces the specified token as the first generated token."),_k.forEach(r),Ov=l(ul),ic=o(ul,"DIV",{class:!0});var x0=n(ic);f(tn.$$.fragment,x0),x0.forEach(r),ul.forEach(r),_h=l(e),et=o(e,"DIV",{class:!0});var _l=n(et);f(rn.$$.fragment,_l),Hv=l(_l),Lr=o(_l,"P",{});var sm=n(Lr);cc=o(sm,"A",{href:!0});var j0=n(cc);Qv=i(j0,"FlaxLogitsProcessor"),j0.forEach(r),Yv=i(sm," that enforces the specified token as the last generated token when "),Ad=o(sm,"CODE",{});var E0=n(Ad);Kv=i(E0,"max_length"),E0.forEach(r),eT=i(sm," is reached."),sm.forEach(r),tT=l(_l),lc=o(_l,"DIV",{class:!0});var F0=n(lc);f(sn.$$.fragment,F0),F0.forEach(r),_l.forEach(r),bh=l(e),tt=o(e,"DIV",{class:!0});var bl=n(tt);f(on.$$.fragment,bl),rT=l(bl),dc=o(bl,"P",{});var bk=n(dc);pc=o(bk,"A",{href:!0});var L0=n(pc);sT=i(L0,"FlaxLogitsProcessor"),L0.forEach(r),oT=i(bk," enforcing a min-length by setting EOS probability to 0."),bk.forEach(r),nT=l(bl),mc=o(bl,"DIV",{class:!0});var J0=n(mc);f(nn.$$.fragment,J0),J0.forEach(r),bl.forEach(r),yh=l(e),qt=o(e,"H2",{class:!0});var lg=n(qt);Jr=o(lg,"A",{id:!0,class:!0,href:!0});var z0=n(Jr);Od=o(z0,"SPAN",{});var U0=n(Od);f(an.$$.fragment,U0),U0.forEach(r),z0.forEach(r),aT=l(lg),Hd=o(lg,"SPAN",{});var I0=n(Hd);iT=i(I0,"StoppingCriteria"),I0.forEach(r),lg.forEach(r),vh=l(e),zr=o(e,"P",{});var dg=n(zr);cT=i(dg,"A "),hc=o(dg,"A",{href:!0});var W0=n(hc);lT=i(W0,"StoppingCriteria"),W0.forEach(r),dT=i(dg," can be used to change when to stop generation (other than EOS token)."),dg.forEach(r),Th=l(e),rt=o(e,"DIV",{class:!0});var yl=n(rt);f(cn.$$.fragment,yl),pT=l(yl),Qd=o(yl,"P",{});var B0=n(Qd);mT=i(B0,"Abstract base class for all stopping criteria that can be applied during generation."),B0.forEach(r),hT=l(yl),gc=o(yl,"DIV",{class:!0});var Z0=n(gc);f(ln.$$.fragment,Z0),Z0.forEach(r),yl.forEach(r),wh=l(e),Gt=o(e,"DIV",{class:!0});var pg=n(Gt);f(dn.$$.fragment,pg),gT=l(pg),fc=o(pg,"DIV",{class:!0});var S0=n(fc);f(pn.$$.fragment,S0),S0.forEach(r),pg.forEach(r),kh=l(e),st=o(e,"DIV",{class:!0});var vl=n(st);f(mn.$$.fragment,vl),fT=l(vl),hn=o(vl,"P",{});var mg=n(hn);uT=i(mg,"This class can be used to stop generation whenever the full generated number of tokens exceeds "),Yd=o(mg,"CODE",{});var V0=n(Yd);_T=i(V0,"max_length"),V0.forEach(r),bT=i(mg,`. Keep
in mind for decoder-only type of transformers, this will include the initial prompted tokens.`),mg.forEach(r),yT=l(vl),uc=o(vl,"DIV",{class:!0});var P0=n(uc);f(gn.$$.fragment,P0),P0.forEach(r),vl.forEach(r),$h=l(e),ot=o(e,"DIV",{class:!0});var Tl=n(ot);f(fn.$$.fragment,Tl),vT=l(Tl),un=o(Tl,"P",{});var hg=n(un);TT=i(hg,`This class can be used to stop generation whenever the full generation exceeds some amount of time. By default, the
time will start being counted when you initialize this function. You can override this by passing an
`),Kd=o(hg,"CODE",{});var D0=n(Kd);wT=i(D0,"initial_time"),D0.forEach(r),kT=i(hg,"."),hg.forEach(r),$T=l(Tl),_c=o(Tl,"DIV",{class:!0});var q0=n(_c);f(_n.$$.fragment,q0),q0.forEach(r),Tl.forEach(r),Mh=l(e),Xt=o(e,"H2",{class:!0});var gg=n(Xt);Ur=o(gg,"A",{id:!0,class:!0,href:!0});var G0=n(Ur);ep=o(G0,"SPAN",{});var X0=n(ep);f(bn.$$.fragment,X0),X0.forEach(r),G0.forEach(r),MT=l(gg),tp=o(gg,"SPAN",{});var R0=n(tp);xT=i(R0,"Constraints"),R0.forEach(r),gg.forEach(r),xh=l(e),Ir=o(e,"P",{});var fg=n(Ir);jT=i(fg,"A "),bc=o(fg,"A",{href:!0});var C0=n(bc);ET=i(C0,"Constraint"),C0.forEach(r),FT=i(fg," can be used to force the generation to include specific tokens or sequences in the output."),fg.forEach(r),jh=l(e),L=o(e,"DIV",{class:!0});var J=n(L);f(yn.$$.fragment,J),LT=l(J),rp=o(J,"P",{});var N0=n(rp);JT=i(N0,`Abstract base class for all constraints that can be applied during generation.
It must define how the constraint can be satisfied.`),N0.forEach(r),zT=l(J),sp=o(J,"P",{});var A0=n(sp);UT=i(A0,"All classes that inherit Constraint must follow the requirement that"),A0.forEach(r),IT=l(J),f(Wr.$$.fragment,J),WT=l(J),op=o(J,"P",{});var O0=n(op);BT=i(O0,"will always terminate (halt)."),O0.forEach(r),ZT=l(J),Br=o(J,"DIV",{class:!0});var ug=n(Br);f(vn.$$.fragment,ug),ST=l(ug),np=o(ug,"P",{});var H0=n(np);VT=i(H0,"When called, returns the token that would take this constraint one step closer to being fulfilled."),H0.forEach(r),ug.forEach(r),PT=l(J),Zr=o(J,"DIV",{class:!0});var _g=n(Zr);f(Tn.$$.fragment,_g),DT=l(_g),ap=o(_g,"P",{});var Q0=n(ap);qT=i(Q0,"Creates a new instance of this constraint."),Q0.forEach(r),_g.forEach(r),GT=l(J),Sr=o(J,"DIV",{class:!0});var bg=n(Sr);f(wn.$$.fragment,bg),XT=l(bg),ip=o(bg,"P",{});var Y0=n(ip);RT=i(Y0,"Reads in a token and returns whether it creates progress."),Y0.forEach(r),bg.forEach(r),CT=l(J),Vr=o(J,"DIV",{class:!0});var yg=n(Vr);f(kn.$$.fragment,yg),NT=l(yg),$n=o(yg,"P",{});var vg=n($n);AT=i(vg,"Returns the number of remaining steps of "),cp=o(vg,"CODE",{});var K0=n(cp);OT=i(K0,"advance()"),K0.forEach(r),HT=i(vg," in order to complete this constraint."),vg.forEach(r),yg.forEach(r),QT=l(J),Pr=o(J,"DIV",{class:!0});var Tg=n(Pr);f(Mn.$$.fragment,Tg),YT=l(Tg),lp=o(Tg,"P",{});var eM=n(lp);KT=i(eM,`Resets the state of this constraint to its initialization. We would call this in cases where the fulfillment of
a constraint is abrupted by an unwanted token.`),eM.forEach(r),Tg.forEach(r),e2=l(J),Dr=o(J,"DIV",{class:!0});var wg=n(Dr);f(xn.$$.fragment,wg),t2=l(wg),dp=o(wg,"P",{});var tM=n(dp);r2=i(tM,"Tests whether this constraint has been properly defined."),tM.forEach(r),wg.forEach(r),s2=l(J),pt=o(J,"DIV",{class:!0});var wl=n(pt);f(jn.$$.fragment,wl),o2=l(wl),En=o(wl,"P",{});var kg=n(En);n2=i(kg,`Reads in a token and returns booleans that indicate the progress made by it. This function will update the
state of this object unlikes `),pp=o(kg,"CODE",{});var rM=n(pp);a2=i(rM,"does_advance(self, token_id: int)"),rM.forEach(r),i2=i(kg,"."),kg.forEach(r),c2=l(wl),mp=o(wl,"P",{});var sM=n(mp);l2=i(sM,`This isn\u2019t to test whether a certain token will advance the progress; it\u2019s to update its state as if it has
been generated. This becomes important if token_id != desired token (refer to else statement in
PhrasalConstraint)`),sM.forEach(r),wl.forEach(r),J.forEach(r),Eh=l(e),Rt=o(e,"DIV",{class:!0});var $g=n(Rt);f(Fn.$$.fragment,$g),d2=l($g),yc=o($g,"P",{});var yk=n(yc);vc=o(yk,"A",{href:!0});var oM=n(vc);p2=i(oM,"Constraint"),oM.forEach(r),m2=i(yk," enforcing that an ordered sequence of tokens is included in the output."),yk.forEach(r),$g.forEach(r),Fh=l(e),Ct=o(e,"DIV",{class:!0});var Mg=n(Ct);f(Ln.$$.fragment,Mg),h2=l(Mg),Jn=o(Mg,"P",{});var xg=n(Jn);g2=i(xg,"A special "),Tc=o(xg,"A",{href:!0});var nM=n(Tc);f2=i(nM,"Constraint"),nM.forEach(r),u2=i(xg," that is fulfilled by fulfilling just one of several constraints."),xg.forEach(r),Mg.forEach(r),Lh=l(e),le=o(e,"DIV",{class:!0});var ns=n(le);f(zn.$$.fragment,ns),_2=l(ns),hp=o(ns,"P",{});var aM=n(hp);b2=i(aM,"A class for beam scorers to track its progress through a list of constraints."),aM.forEach(r),y2=l(ns),G=o(ns,"DIV",{class:!0});var ue=n(G);f(Un.$$.fragment,ue),v2=l(ue),gp=o(ue,"P",{});var iM=n(gp);T2=i(iM,`The list of tokens to generate such that we can make progress.
By \u201Clist\u201D we don\u2019t mean the list of token that will fully fulfill a constraint.`),iM.forEach(r),w2=l(ue),Nt=o(ue,"P",{});var kl=n(Nt);k2=i(kl,"Given constraints "),fp=o(kl,"CODE",{});var cM=n(fp);$2=i(cM,"c_i = {t_ij | j == # of tokens}"),cM.forEach(r),M2=i(kl,`, If we\u2019re not in the middle of progressing through a
specific constraint `),up=o(kl,"CODE",{});var lM=n(up);x2=i(lM,"c_i"),lM.forEach(r),j2=i(kl,", we return:"),kl.forEach(r),E2=l(ue),_p=o(ue,"P",{});var dM=n(_p);bp=o(dM,"CODE",{});var pM=n(bp);F2=i(pM,"[t_k1 for k in indices of unfulfilled constraints]"),pM.forEach(r),dM.forEach(r),L2=l(ue),nt=o(ue,"P",{});var as=n(nt);J2=i(as,`If we are in the middle of a constraint, then we return:
`),yp=o(as,"CODE",{});var mM=n(yp);z2=i(mM,"[t_ij]"),mM.forEach(r),U2=i(as,", where "),vp=o(as,"CODE",{});var hM=n(vp);I2=i(hM,"i"),hM.forEach(r),W2=i(as," is the index of the inprogress constraint, "),Tp=o(as,"CODE",{});var gM=n(Tp);B2=i(gM,"j"),gM.forEach(r),Z2=i(as," is the next step for the constraint."),as.forEach(r),S2=l(ue),wp=o(ue,"P",{});var fM=n(wp);V2=i(fM,`Though we don\u2019t care which constraint is fulfilled first, if we are in the progress of fulfilling a constraint,
that\u2019s the only one we\u2019ll return.`),fM.forEach(r),ue.forEach(r),P2=l(ns),qr=o(ns,"DIV",{class:!0});var jg=n(qr);f(In.$$.fragment,jg),D2=l(jg),kp=o(jg,"P",{});var uM=n(kp);q2=i(uM,"token_ids: the tokens generated thus far to reset the state of the progress through constraints."),uM.forEach(r),jg.forEach(r),ns.forEach(r),Jh=l(e),At=o(e,"H2",{class:!0});var Eg=n(At);Gr=o(Eg,"A",{id:!0,class:!0,href:!0});var _M=n(Gr);$p=o(_M,"SPAN",{});var bM=n($p);f(Wn.$$.fragment,bM),bM.forEach(r),_M.forEach(r),G2=l(Eg),Mp=o(Eg,"SPAN",{});var yM=n(Mp);X2=i(yM,"BeamSearch"),yM.forEach(r),Eg.forEach(r),zh=l(e),de=o(e,"DIV",{class:!0});var is=n(de);f(Bn.$$.fragment,is),R2=l(is),Ot=o(is,"P",{});var $l=n(Ot);C2=i($l,"Abstract base class for all beam scorers that are used for "),wc=o($l,"A",{href:!0});var vM=n(wc);N2=i(vM,"beam_search()"),vM.forEach(r),A2=i($l,` and
`),kc=o($l,"A",{href:!0});var TM=n(kc);O2=i(TM,"beam_sample()"),TM.forEach(r),H2=i($l,"."),$l.forEach(r),Q2=l(is),$c=o(is,"DIV",{class:!0});var wM=n($c);f(Zn.$$.fragment,wM),wM.forEach(r),Y2=l(is),Mc=o(is,"DIV",{class:!0});var kM=n(Mc);f(Sn.$$.fragment,kM),kM.forEach(r),is.forEach(r),Uh=l(e),q=o(e,"DIV",{class:!0});var _e=n(q);f(Vn.$$.fragment,_e),K2=l(_e),xc=o(_e,"P",{});var vk=n(xc);jc=o(vk,"A",{href:!0});var $M=n(jc);ew=i($M,"BeamScorer"),$M.forEach(r),tw=i(vk," implementing standard beam search decoding."),vk.forEach(r),rw=l(_e),Pn=o(_e,"P",{});var Fg=n(Pn);sw=i(Fg,"Adapted in part from "),Dn=o(Fg,"A",{href:!0,rel:!0});var MM=n(Dn);ow=i(MM,`Facebook\u2019s XLM beam search
code`),MM.forEach(r),nw=i(Fg,"."),Fg.forEach(r),aw=l(_e),Ec=o(_e,"P",{});var Tk=n(Ec);iw=i(Tk,"Reference for the diverse beam search algorithm and implementation "),qn=o(Tk,"A",{href:!0,rel:!0});var xM=n(qn);cw=i(xM,`Ashwin Kalyan\u2019s DBS
implementation`),xM.forEach(r),Tk.forEach(r),lw=l(_e),Fc=o(_e,"DIV",{class:!0});var jM=n(Fc);f(Gn.$$.fragment,jM),jM.forEach(r),dw=l(_e),Lc=o(_e,"DIV",{class:!0});var EM=n(Lc);f(Xn.$$.fragment,EM),EM.forEach(r),_e.forEach(r),Ih=l(e),pe=o(e,"DIV",{class:!0});var cs=n(pe);f(Rn.$$.fragment,cs),pw=l(cs),Jc=o(cs,"P",{});var wk=n(Jc);zc=o(wk,"A",{href:!0});var FM=n(zc);mw=i(FM,"BeamScorer"),FM.forEach(r),hw=i(wk," implementing constrained beam search decoding."),wk.forEach(r),gw=l(cs),Uc=o(cs,"DIV",{class:!0});var LM=n(Uc);f(Cn.$$.fragment,LM),LM.forEach(r),fw=l(cs),Ic=o(cs,"DIV",{class:!0});var JM=n(Ic);f(Nn.$$.fragment,JM),JM.forEach(r),cs.forEach(r),Wh=l(e),Ht=o(e,"H2",{class:!0});var Lg=n(Ht);Xr=o(Lg,"A",{id:!0,class:!0,href:!0});var zM=n(Xr);xp=o(zM,"SPAN",{});var UM=n(xp);f(An.$$.fragment,UM),UM.forEach(r),zM.forEach(r),uw=l(Lg),jp=o(Lg,"SPAN",{});var IM=n(jp);_w=i(IM,"Utilities"),IM.forEach(r),Lg.forEach(r),Bh=l(e),at=o(e,"DIV",{class:!0});var Ml=n(at);f(On.$$.fragment,Ml),bw=l(Ml),Ep=o(Ml,"P",{});var WM=n(Ep);yw=i(WM,"Filter a distribution of logits using top-k and/or nucleus (top-p) filtering"),WM.forEach(r),vw=l(Ml),Wc=o(Ml,"P",{});var kk=n(Wc);Tw=i(kk,"From: "),Hn=o(kk,"A",{href:!0,rel:!0});var BM=n(Hn);ww=i(BM,"https://gist.github.com/thomwolf/1a5a29f6962089e871b94cbd09daf317"),BM.forEach(r),kk.forEach(r),Ml.forEach(r),Zh=l(e),it=o(e,"DIV",{class:!0});var xl=n(it);f(Qn.$$.fragment,xl),kw=l(xl),Fp=o(xl,"P",{});var ZM=n(Fp);$w=i(ZM,"Filter a distribution of logits using top-k and/or nucleus (top-p) filtering"),ZM.forEach(r),Mw=l(xl),Bc=o(xl,"P",{});var $k=n(Bc);xw=i($k,"From: "),Yn=o($k,"A",{href:!0,rel:!0});var SM=n(Yn);jw=i(SM,"https://gist.github.com/thomwolf/1a5a29f6962089e871b94cbd09daf317"),SM.forEach(r),$k.forEach(r),xl.forEach(r),Sh=l(e),Qt=o(e,"H2",{class:!0});var Jg=n(Qt);Rr=o(Jg,"A",{id:!0,class:!0,href:!0});var VM=n(Rr);Lp=o(VM,"SPAN",{});var PM=n(Lp);f(Kn.$$.fragment,PM),PM.forEach(r),VM.forEach(r),Ew=l(Jg),Jp=o(Jg,"SPAN",{});var DM=n(Jp);Fw=i(DM,"Streamers"),DM.forEach(r),Jg.forEach(r),Vh=l(e),B=o(e,"DIV",{class:!0});var oe=n(B);f(ea.$$.fragment,oe),Lw=l(oe),zp=o(oe,"P",{});var qM=n(zp);Jw=i(qM,"Simple text streamer that prints the token(s) to stdout as soon as entire words are formed."),qM.forEach(r),zw=l(oe),f(Cr.$$.fragment,oe),Uw=l(oe),f(Nr.$$.fragment,oe),Iw=l(oe),Ar=o(oe,"DIV",{class:!0});var zg=n(Ar);f(ta.$$.fragment,zg),Ww=l(zg),Up=o(zg,"P",{});var GM=n(Up);Bw=i(GM,"Flushes any remaining cache and prints a newline to stdout."),GM.forEach(r),zg.forEach(r),Zw=l(oe),Or=o(oe,"DIV",{class:!0});var Ug=n(Or);f(ra.$$.fragment,Ug),Sw=l(Ug),Ip=o(Ug,"P",{});var XM=n(Ip);Vw=i(XM,"Prints the new text to stdout. If the stream is ending, also prints a newline."),XM.forEach(r),Ug.forEach(r),Pw=l(oe),Hr=o(oe,"DIV",{class:!0});var Ig=n(Hr);f(sa.$$.fragment,Ig),Dw=l(Ig),Wp=o(Ig,"P",{});var RM=n(Wp);qw=i(RM,"Receives tokens, decodes them, and prints them to stdout as soon as they form entire words."),RM.forEach(r),Ig.forEach(r),oe.forEach(r),Ph=l(e),O=o(e,"DIV",{class:!0});var vt=n(O);f(oa.$$.fragment,vt),Gw=l(vt),Bp=o(vt,"P",{});var CM=n(Bp);Xw=i(CM,`Streamer that stores print-ready text in a queue, to be used by a downstream application as an iterator. This is
useful for applications that benefit from acessing the generated text in a non-blocking way (e.g. in an interactive
Gradio demo).`),CM.forEach(r),Rw=l(vt),f(Qr.$$.fragment,vt),Cw=l(vt),f(Yr.$$.fragment,vt),Nw=l(vt),Kr=o(vt,"DIV",{class:!0});var Wg=n(Kr);f(na.$$.fragment,Wg),Aw=l(Wg),Zp=o(Wg,"P",{});var NM=n(Zp);Ow=i(NM,"Put the new text in the queue. If the stream is ending, also put a stop signal in the queue."),NM.forEach(r),Wg.forEach(r),vt.forEach(r),this.h()},h(){d(v,"name","hf:doc:metadata"),d(v,"content",JSON.stringify(ux)),d(w,"id","utilities-for-generation"),d(w,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(w,"href","#utilities-for-generation"),d(k,"class","relative group"),d(H,"href","/docs/transformers/main/en/main_classes/text_generation#transformers.GenerationMixin.generate"),d(Q,"href","/docs/transformers/main/en/main_classes/text_generation#transformers.GenerationMixin.greedy_search"),d(j,"href","/docs/transformers/main/en/main_classes/text_generation#transformers.GenerationMixin.contrastive_search"),d(me,"href","/docs/transformers/main/en/main_classes/text_generation#transformers.GenerationMixin.sample"),d(da,"href","/docs/transformers/main/en/main_classes/text_generation#transformers.GenerationMixin.beam_search"),d(pa,"href","/docs/transformers/main/en/main_classes/text_generation#transformers.GenerationMixin.beam_sample"),d(ma,"href","/docs/transformers/main/en/main_classes/text_generation#transformers.GenerationMixin.group_beam_search"),d(ha,"href","/docs/transformers/main/en/main_classes/text_generation#transformers.GenerationMixin.constrained_beam_search"),d(Kt,"id","generate-outputs"),d(Kt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Kt,"href","#generate-outputs"),d(jt,"class","relative group"),d(fa,"href","/docs/transformers/main/en/main_classes/text_generation#transformers.GenerationMixin.generate"),d(ua,"href","/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput"),d(_a,"href","/docs/transformers/main/en/main_classes/text_generation#transformers.GenerationMixin.generate"),d(ya,"href","/docs/transformers/main/en/internal/generation_utils#transformers.generation.GreedySearchDecoderOnlyOutput"),d(tr,"id","transformers.generation.GreedySearchDecoderOnlyOutput"),d(tr,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(tr,"href","#transformers.generation.GreedySearchDecoderOnlyOutput"),d(Et,"class","relative group"),d(Ft,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Lt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(rr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(we,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(sr,"id","transformers.generation.SampleDecoderOnlyOutput"),d(sr,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(sr,"href","#transformers.generation.SampleDecoderOnlyOutput"),d(Jt,"class","relative group"),d(zt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ut,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(or,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ke,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(nr,"id","transformers.generation.BeamSearchDecoderOnlyOutput"),d(nr,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(nr,"href","#transformers.generation.BeamSearchDecoderOnlyOutput"),d(It,"class","relative group"),d(Wt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Bt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ar,"id","transformers.generation.BeamSampleDecoderOnlyOutput"),d(ar,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ar,"href","#transformers.generation.BeamSampleDecoderOnlyOutput"),d(Zt,"class","relative group"),d(St,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Vt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ir,"id","transformers.LogitsProcessor"),d(ir,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ir,"href","#transformers.LogitsProcessor"),d(Pt,"class","relative group"),d(Ma,"href","/docs/transformers/main/en/internal/generation_utils#transformers.LogitsProcessor"),d(xa,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d($e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ja,"href","/docs/transformers/main/en/internal/generation_utils#transformers.LogitsProcessor"),d(Ea,"href","/docs/transformers/main/en/internal/generation_utils#transformers.LogitsWarper"),d(Fa,"href","/docs/transformers/main/en/internal/generation_utils#transformers.LogitsProcessor"),d(La,"href","/docs/transformers/main/en/internal/generation_utils#transformers.LogitsWarper"),d(Ja,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(za,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(xe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ia,"href","/docs/transformers/main/en/internal/generation_utils#transformers.LogitsProcessor"),d(Wa,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ba,"href","/docs/transformers/main/en/internal/generation_utils#transformers.LogitsProcessor"),d(Za,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Va,"href","/docs/transformers/main/en/internal/generation_utils#transformers.LogitsWarper"),d(Pa,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Da,"href","/docs/transformers/main/en/internal/generation_utils#transformers.LogitsProcessor"),d(qs,"href","https://arxiv.org/pdf/1909.05858.pdf"),d(qs,"rel","nofollow"),d(qa,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Xa,"href","/docs/transformers/main/en/internal/generation_utils#transformers.LogitsWarper"),d(Ra,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Na,"href","/docs/transformers/main/en/internal/generation_utils#transformers.LogitsWarper"),d(Aa,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Oa,"href","/docs/transformers/main/en/internal/generation_utils#transformers.LogitsWarper"),d(Os,"href","https://arxiv.org/abs/2202.00666"),d(Os,"rel","nofollow"),d(Ha,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Qa,"href","/docs/transformers/main/en/internal/generation_utils#transformers.LogitsProcessor"),d(Ys,"href","https://github.com/pytorch/fairseq/blob/a07cb6f40480928c9e0548b737aadd36ee66ac76/fairseq/sequence_generator.py#L345"),d(Ys,"rel","nofollow"),d(Ya,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ei,"href","/docs/transformers/main/en/internal/generation_utils#transformers.LogitsProcessor"),d(ti,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(si,"href","/docs/transformers/main/en/internal/generation_utils#transformers.LogitsProcessor"),d(oi,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ni,"href","/docs/transformers/main/en/internal/generation_utils#transformers.LogitsProcessor"),d(no,"href","https://arxiv.org/abs/2010.00904"),d(no,"rel","nofollow"),d(ai,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ii,"href","/docs/transformers/main/en/internal/generation_utils#transformers.LogitsProcessor"),d(ci,"href","/docs/transformers/main/en/main_classes/text_generation#transformers.GenerationMixin.group_beam_search"),d(co,"href","https://arxiv.org/pdf/1610.02424.pdf"),d(co,"rel","nofollow"),d(li,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(pi,"href","/docs/transformers/main/en/internal/generation_utils#transformers.LogitsProcessor"),d(mi,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(hi,"href","/docs/transformers/main/en/internal/generation_utils#transformers.LogitsProcessor"),d(gi,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(fi,"href","/docs/transformers/main/en/internal/generation_utils#transformers.LogitsProcessor"),d(ui,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d($r,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(We,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(_i,"href","/docs/transformers/main/en/internal/generation_utils#transformers.TFLogitsProcessor"),d(bi,"href","/docs/transformers/main/en/internal/generation_utils#transformers.TFLogitsProcessor"),d(yi,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Mr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ti,"href","/docs/transformers/main/en/internal/generation_utils#transformers.TFLogitsWarper"),d(wi,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d($i,"href","/docs/transformers/main/en/internal/generation_utils#transformers.TFLogitsWarper"),d(Mi,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ji,"href","/docs/transformers/main/en/internal/generation_utils#transformers.TFLogitsWarper"),d(Ei,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Li,"href","/docs/transformers/main/en/internal/generation_utils#transformers.TFLogitsProcessor"),d(Ji,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(De,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ui,"href","/docs/transformers/main/en/internal/generation_utils#transformers.TFLogitsProcessor"),d(Ii,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(qe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Wi,"href","/docs/transformers/main/en/internal/generation_utils#transformers.TFLogitsProcessor"),d(Io,"href","https://github.com/pytorch/fairseq/blob/a07cb6f40480928c9e0548b737aadd36ee66ac76/fairseq/sequence_generator.py#L345"),d(Io,"rel","nofollow"),d(Bi,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Si,"href","/docs/transformers/main/en/internal/generation_utils#transformers.TFLogitsProcessor"),d(Vi,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Xe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Di,"href","/docs/transformers/main/en/internal/generation_utils#transformers.TFLogitsProcessor"),d(qi,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Gi,"href","/docs/transformers/main/en/internal/generation_utils#transformers.TFLogitsProcessor"),d(Xi,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Er,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ri,"href","/docs/transformers/main/en/internal/generation_utils#transformers.FlaxLogitsProcessor"),d(Ci,"href","/docs/transformers/main/en/internal/generation_utils#transformers.FlaxLogitsWarper"),d(Ni,"href","/docs/transformers/main/en/internal/generation_utils#transformers.FlaxLogitsProcessor"),d(Ai,"href","/docs/transformers/main/en/internal/generation_utils#transformers.FlaxLogitsWarper"),d(Oi,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Fr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Qi,"href","/docs/transformers/main/en/internal/generation_utils#transformers.FlaxLogitsWarper"),d(Yi,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(He,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ec,"href","/docs/transformers/main/en/internal/generation_utils#transformers.FlaxLogitsWarper"),d(tc,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Qe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(sc,"href","/docs/transformers/main/en/internal/generation_utils#transformers.FlaxLogitsWarper"),d(oc,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ac,"href","/docs/transformers/main/en/internal/generation_utils#transformers.FlaxLogitsProcessor"),d(ic,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ke,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(cc,"href","/docs/transformers/main/en/internal/generation_utils#transformers.FlaxLogitsProcessor"),d(lc,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(et,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(pc,"href","/docs/transformers/main/en/internal/generation_utils#transformers.FlaxLogitsProcessor"),d(mc,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(tt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Jr,"id","transformers.StoppingCriteria"),d(Jr,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Jr,"href","#transformers.StoppingCriteria"),d(qt,"class","relative group"),d(hc,"href","/docs/transformers/main/en/internal/generation_utils#transformers.StoppingCriteria"),d(gc,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(rt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(fc,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Gt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(uc,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(st,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(_c,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ot,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ur,"id","transformers.Constraint"),d(Ur,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Ur,"href","#transformers.Constraint"),d(Xt,"class","relative group"),d(bc,"href","/docs/transformers/main/en/internal/generation_utils#transformers.Constraint"),d(Br,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Zr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Sr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Vr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Pr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Dr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(pt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(vc,"href","/docs/transformers/main/en/internal/generation_utils#transformers.Constraint"),d(Rt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Tc,"href","/docs/transformers/main/en/internal/generation_utils#transformers.Constraint"),d(Ct,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(qr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Gr,"id","transformers.BeamScorer"),d(Gr,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Gr,"href","#transformers.BeamScorer"),d(At,"class","relative group"),d(wc,"href","/docs/transformers/main/en/main_classes/text_generation#transformers.GenerationMixin.beam_search"),d(kc,"href","/docs/transformers/main/en/main_classes/text_generation#transformers.GenerationMixin.beam_sample"),d($c,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Mc,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(jc,"href","/docs/transformers/main/en/internal/generation_utils#transformers.BeamScorer"),d(Dn,"href","https://github.com/facebookresearch/XLM/blob/9e6f6814d17be4fe5b15f2e6c43eb2b2d76daeb4/src/model/transformer.py#L529"),d(Dn,"rel","nofollow"),d(qn,"href","https://github.com/ashwinkalyan/dbs/blob/master/dbs/beam_utils.lua"),d(qn,"rel","nofollow"),d(Fc,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Lc,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(zc,"href","/docs/transformers/main/en/internal/generation_utils#transformers.BeamScorer"),d(Uc,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Ic,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Xr,"id","transformers.top_k_top_p_filtering"),d(Xr,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Xr,"href","#transformers.top_k_top_p_filtering"),d(Ht,"class","relative group"),d(Hn,"href","https://gist.github.com/thomwolf/1a5a29f6962089e871b94cbd09daf317"),d(Hn,"rel","nofollow"),d(at,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Yn,"href","https://gist.github.com/thomwolf/1a5a29f6962089e871b94cbd09daf317"),d(Yn,"rel","nofollow"),d(it,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Rr,"id","transformers.TextStreamer"),d(Rr,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Rr,"href","#transformers.TextStreamer"),d(Qt,"class","relative group"),d(Ar,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Or,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Hr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Kr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(O,"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,p){t(document.head,v),m(e,M,p),m(e,k,p),t(k,w),t(w,x),u(h,x,null),t(k,$),t(k,V),t(V,z),m(e,U,p),m(e,F,p),t(F,Z),t(F,H),t(H,ve),t(F,W),t(F,Q),t(Q,Te),t(F,X),t(F,j),t(j,kt),t(F,$t),t(F,me),t(me,Mt),t(F,xt),t(F,da),t(da,Bg),t(F,Zg),t(F,pa),t(pa,Sg),t(F,Vg),t(F,ma),t(ma,Pg),t(F,Dg),t(F,ha),t(ha,qg),t(F,Gg),m(e,om,p),m(e,ga,p),t(ga,Xg),m(e,nm,p),m(e,jt,p),t(jt,Kt),t(Kt,El),u(ls,El,null),t(jt,Rg),t(jt,Fl),t(Fl,Cg),m(e,am,p),m(e,he,p),t(he,Ng),t(he,fa),t(fa,Ag),t(he,Og),t(he,ua),t(ua,Hg),t(he,Qg),t(he,_a),t(_a,Yg),t(he,Kg),m(e,im,p),m(e,ba,p),t(ba,ef),m(e,cm,p),u(ds,e,p),m(e,lm,p),m(e,ct,p),t(ct,tf),t(ct,Ll),t(Ll,rf),t(ct,sf),t(ct,ya),t(ya,of),t(ct,nf),m(e,dm,p),m(e,ge,p),t(ge,va),t(va,Jl),t(Jl,af),t(va,cf),t(ge,lf),t(ge,Ta),t(Ta,zl),t(zl,df),t(Ta,pf),t(ge,mf),t(ge,wa),t(wa,Ul),t(Ul,hf),t(wa,gf),t(ge,ff),t(ge,ka),t(ka,Il),t(Il,uf),t(ka,_f),m(e,pm,p),m(e,S,p),t(S,bf),t(S,Wl),t(Wl,yf),t(S,vf),t(S,Bl),t(Bl,Tf),t(S,wf),t(S,Zl),t(Zl,kf),t(S,$f),t(S,Sl),t(Sl,Mf),t(S,xf),t(S,Vl),t(Vl,jf),t(S,Ef),t(S,Pl),t(Pl,Ff),t(S,Lf),m(e,mm,p),m(e,Y,p),t(Y,Jf),t(Y,Dl),t(Dl,zf),t(Y,Uf),t(Y,ql),t(ql,If),t(Y,Wf),t(Y,Gl),t(Gl,Bf),t(Y,Zf),t(Y,Xl),t(Xl,Sf),t(Y,Vf),m(e,hm,p),m(e,K,p),t(K,Pf),t(K,Rl),t(Rl,Df),t(K,qf),t(K,Cl),t(Cl,Gf),t(K,Xf),t(K,Nl),t(Nl,Rf),t(K,Cf),t(K,Al),t(Al,Nf),t(K,Af),m(e,gm,p),u(ps,e,p),m(e,fm,p),m(e,er,p),t(er,Of),t(er,Ol),t(Ol,Hf),t(er,Qf),m(e,um,p),m(e,ee,p),t(ee,Yf),t(ee,Hl),t(Hl,Kf),t(ee,eu),t(ee,Ql),t(Ql,tu),t(ee,ru),t(ee,Yl),t(Yl,su),t(ee,ou),t(ee,Kl),t(Kl,nu),t(ee,au),m(e,_m,p),m(e,$a,p),t($a,iu),m(e,bm,p),m(e,Et,p),t(Et,tr),t(tr,ed),u(ms,ed,null),t(Et,cu),t(Et,td),t(td,lu),m(e,ym,p),m(e,Ft,p),u(hs,Ft,null),t(Ft,du),t(Ft,rd),t(rd,pu),m(e,vm,p),m(e,Lt,p),u(gs,Lt,null),t(Lt,mu),t(Lt,sd),t(sd,hu),m(e,Tm,p),m(e,we,p),u(fs,we,null),t(we,gu),t(we,od),t(od,fu),t(we,uu),t(we,rr),u(us,rr,null),t(rr,_u),t(rr,nd),t(nd,bu),m(e,wm,p),m(e,Jt,p),t(Jt,sr),t(sr,ad),u(_s,ad,null),t(Jt,yu),t(Jt,id),t(id,vu),m(e,km,p),m(e,zt,p),u(bs,zt,null),t(zt,Tu),t(zt,cd),t(cd,wu),m(e,$m,p),m(e,Ut,p),u(ys,Ut,null),t(Ut,ku),t(Ut,ld),t(ld,$u),m(e,Mm,p),m(e,ke,p),u(vs,ke,null),t(ke,Mu),t(ke,dd),t(dd,xu),t(ke,ju),t(ke,or),u(Ts,or,null),t(or,Eu),t(or,pd),t(pd,Fu),m(e,xm,p),m(e,It,p),t(It,nr),t(nr,md),u(ws,md,null),t(It,Lu),t(It,hd),t(hd,Ju),m(e,jm,p),m(e,Wt,p),u(ks,Wt,null),t(Wt,zu),t(Wt,gd),t(gd,Uu),m(e,Em,p),m(e,Bt,p),u($s,Bt,null),t(Bt,Iu),t(Bt,fd),t(fd,Wu),m(e,Fm,p),m(e,Zt,p),t(Zt,ar),t(ar,ud),u(Ms,ud,null),t(Zt,Bu),t(Zt,_d),t(_d,Zu),m(e,Lm,p),m(e,St,p),u(xs,St,null),t(St,Su),t(St,bd),t(bd,Vu),m(e,Jm,p),m(e,Vt,p),u(js,Vt,null),t(Vt,Pu),t(Vt,yd),t(yd,Du),m(e,zm,p),m(e,Pt,p),t(Pt,ir),t(ir,vd),u(Es,vd,null),t(Pt,qu),t(Pt,Td),t(Td,Gu),m(e,Um,p),m(e,cr,p),t(cr,Xu),t(cr,Ma),t(Ma,Ru),t(cr,Cu),m(e,Im,p),m(e,$e,p),u(Fs,$e,null),t($e,Nu),t($e,wd),t(wd,Au),t($e,Ou),t($e,xa),u(Ls,xa,null),m(e,Wm,p),m(e,Me,p),u(Js,Me,null),t(Me,Hu),t(Me,P),t(P,Qu),t(P,ja),t(ja,Yu),t(P,Ku),t(P,Ea),t(Ea,e_),t(P,t_),t(P,kd),t(kd,r_),t(P,s_),t(P,$d),t($d,Md),t(Md,o_),t(P,n_),t(P,Fa),t(Fa,a_),t(P,i_),t(P,La),t(La,c_),t(P,l_),t(Me,d_),t(Me,Ja),u(zs,Ja,null),m(e,Bm,p),m(e,xe,p),u(Us,xe,null),t(xe,p_),t(xe,xd),t(xd,m_),t(xe,h_),t(xe,za),u(Is,za,null),m(e,Zm,p),m(e,je,p),u(Ws,je,null),t(je,g_),t(je,Ua),t(Ua,Ia),t(Ia,f_),t(Ua,u_),t(je,__),t(je,Wa),u(Bs,Wa,null),m(e,Sm,p),m(e,ne,p),u(Zs,ne,null),t(ne,b_),t(ne,fe),t(fe,Ba),t(Ba,y_),t(fe,v_),t(fe,jd),t(jd,T_),t(fe,w_),t(fe,Ed),t(Ed,k_),t(fe,$_),t(fe,Fd),t(Fd,M_),t(fe,x_),t(ne,j_),u(lr,ne,null),t(ne,E_),t(ne,Za),u(Ss,Za,null),m(e,Vm,p),m(e,R,p),u(Vs,R,null),t(R,F_),t(R,Sa),t(Sa,Va),t(Va,L_),t(Sa,J_),t(R,z_),u(dr,R,null),t(R,U_),u(pr,R,null),t(R,I_),t(R,Pa),u(Ps,Pa,null),m(e,Pm,p),m(e,ae,p),u(Ds,ae,null),t(ae,W_),t(ae,mr),t(mr,Da),t(Da,B_),t(mr,Z_),t(mr,qs),t(qs,S_),t(mr,V_),t(ae,P_),u(hr,ae,null),t(ae,D_),t(ae,qa),u(Gs,qa,null),m(e,Dm,p),m(e,ie,p),u(Xs,ie,null),t(ie,q_),t(ie,Ga),t(Ga,Xa),t(Xa,G_),t(Ga,X_),t(ie,R_),u(gr,ie,null),t(ie,C_),t(ie,Ra),u(Rs,Ra,null),m(e,qm,p),m(e,Ee,p),u(Cs,Ee,null),t(Ee,N_),t(Ee,Ca),t(Ca,Na),t(Na,A_),t(Ca,O_),t(Ee,H_),t(Ee,Aa),u(Ns,Aa,null),m(e,Gm,p),m(e,Fe,p),u(As,Fe,null),t(Fe,Q_),t(Fe,fr),t(fr,Oa),t(Oa,Y_),t(fr,K_),t(fr,Os),t(Os,eb),t(fr,tb),t(Fe,rb),t(Fe,Ha),u(Hs,Ha,null),m(e,Xm,p),m(e,C,p),u(Qs,C,null),t(C,sb),t(C,Dt),t(Dt,ob),t(Dt,Qa),t(Qa,nb),t(Dt,ab),t(Dt,Ys),t(Ys,ib),t(Dt,cb),t(C,lb),u(ur,C,null),t(C,db),u(_r,C,null),t(C,pb),t(C,Ya),u(Ks,Ya,null),m(e,Rm,p),m(e,N,p),u(eo,N,null),t(N,mb),t(N,Ka),t(Ka,ei),t(ei,hb),t(Ka,gb),t(N,fb),u(br,N,null),t(N,ub),u(yr,N,null),t(N,_b),t(N,ti),u(to,ti,null),m(e,Cm,p),m(e,A,p),u(ro,A,null),t(A,bb),t(A,ri),t(ri,si),t(si,yb),t(ri,vb),t(A,Tb),u(vr,A,null),t(A,wb),u(Tr,A,null),t(A,kb),t(A,oi),u(so,oi,null),m(e,Nm,p),m(e,Le,p),u(oo,Le,null),t(Le,$b),t(Le,wr),t(wr,ni),t(ni,Mb),t(wr,xb),t(wr,no),t(no,jb),t(wr,Eb),t(Le,Fb),t(Le,ai),u(ao,ai,null),m(e,Am,p),m(e,Je,p),u(io,Je,null),t(Je,Lb),t(Je,lt),t(lt,ii),t(ii,Jb),t(lt,zb),t(lt,ci),t(ci,Ub),t(lt,Ib),t(lt,co),t(co,Wb),t(lt,Bb),t(Je,Zb),t(Je,li),u(lo,li,null),m(e,Om,p),m(e,ze,p),u(po,ze,null),t(ze,Sb),t(ze,di),t(di,pi),t(pi,Vb),t(di,Pb),t(ze,Db),t(ze,mi),u(mo,mi,null),m(e,Hm,p),m(e,Ue,p),u(ho,Ue,null),t(Ue,qb),t(Ue,kr),t(kr,hi),t(hi,Gb),t(kr,Xb),t(kr,Ld),t(Ld,Rb),t(kr,Cb),t(Ue,Nb),t(Ue,gi),u(go,gi,null),m(e,Qm,p),m(e,Ie,p),u(fo,Ie,null),t(Ie,Ab),t(Ie,dt),t(dt,fi),t(fi,Ob),t(dt,Hb),t(dt,Jd),t(Jd,Qb),t(dt,Yb),t(dt,zd),t(zd,Kb),t(dt,ey),t(Ie,ty),t(Ie,ui),u(uo,ui,null),m(e,Ym,p),m(e,We,p),u(_o,We,null),t(We,ry),t(We,Ud),t(Ud,sy),t(We,oy),t(We,$r),u(bo,$r,null),t($r,ny),t($r,Id),t(Id,ay),m(e,Km,p),m(e,Be,p),u(yo,Be,null),t(Be,iy),t(Be,ce),t(ce,cy),t(ce,_i),t(_i,ly),t(ce,dy),t(ce,Wd),t(Wd,py),t(ce,my),t(ce,Bd),t(Bd,Zd),t(Zd,hy),t(ce,gy),t(ce,bi),t(bi,fy),t(ce,uy),t(Be,_y),t(Be,yi),u(vo,yi,null),m(e,eh,p),m(e,Ze,p),u(To,Ze,null),t(Ze,by),t(Ze,Sd),t(Sd,yy),t(Ze,vy),t(Ze,Mr),u(wo,Mr,null),t(Mr,Ty),t(Mr,Vd),t(Vd,wy),m(e,th,p),m(e,Se,p),u(ko,Se,null),t(Se,ky),t(Se,vi),t(vi,Ti),t(Ti,$y),t(vi,My),t(Se,xy),t(Se,wi),u($o,wi,null),m(e,rh,p),m(e,Ve,p),u(Mo,Ve,null),t(Ve,jy),t(Ve,ki),t(ki,$i),t($i,Ey),t(ki,Fy),t(Ve,Ly),t(Ve,Mi),u(xo,Mi,null),m(e,sh,p),m(e,Pe,p),u(jo,Pe,null),t(Pe,Jy),t(Pe,xi),t(xi,ji),t(ji,zy),t(xi,Uy),t(Pe,Iy),t(Pe,Ei),u(Eo,Ei,null),m(e,oh,p),m(e,De,p),u(Fo,De,null),t(De,Wy),t(De,Fi),t(Fi,Li),t(Li,By),t(Fi,Zy),t(De,Sy),t(De,Ji),u(Lo,Ji,null),m(e,nh,p),m(e,qe,p),u(Jo,qe,null),t(qe,Vy),t(qe,zi),t(zi,Ui),t(Ui,Py),t(zi,Dy),t(qe,qy),t(qe,Ii),u(zo,Ii,null),m(e,ah,p),m(e,Ge,p),u(Uo,Ge,null),t(Ge,Gy),t(Ge,xr),t(xr,Wi),t(Wi,Xy),t(xr,Ry),t(xr,Io),t(Io,Cy),t(xr,Ny),t(Ge,Ay),t(Ge,Bi),u(Wo,Bi,null),m(e,ih,p),m(e,Xe,p),u(Bo,Xe,null),t(Xe,Oy),t(Xe,Zi),t(Zi,Si),t(Si,Hy),t(Zi,Qy),t(Xe,Yy),t(Xe,Vi),u(Zo,Vi,null),m(e,ch,p),m(e,Re,p),u(So,Re,null),t(Re,Ky),t(Re,Pi),t(Pi,Di),t(Di,ev),t(Pi,tv),t(Re,rv),t(Re,qi),u(Vo,qi,null),m(e,lh,p),m(e,Ce,p),u(Po,Ce,null),t(Ce,sv),t(Ce,jr),t(jr,Gi),t(Gi,ov),t(jr,nv),t(jr,Pd),t(Pd,av),t(jr,iv),t(Ce,cv),t(Ce,Xi),u(Do,Xi,null),m(e,dh,p),m(e,Ne,p),u(qo,Ne,null),t(Ne,lv),t(Ne,Dd),t(Dd,dv),t(Ne,pv),t(Ne,Er),u(Go,Er,null),t(Er,mv),t(Er,qd),t(qd,hv),m(e,ph,p),m(e,Ae,p),u(Xo,Ae,null),t(Ae,gv),t(Ae,D),t(D,fv),t(D,Ri),t(Ri,uv),t(D,_v),t(D,Ci),t(Ci,bv),t(D,yv),t(D,Gd),t(Gd,vv),t(D,Tv),t(D,Xd),t(Xd,Rd),t(Rd,wv),t(D,kv),t(D,Ni),t(Ni,$v),t(D,Mv),t(D,Ai),t(Ai,xv),t(D,jv),t(Ae,Ev),t(Ae,Oi),u(Ro,Oi,null),m(e,mh,p),m(e,Oe,p),u(Co,Oe,null),t(Oe,Fv),t(Oe,Cd),t(Cd,Lv),t(Oe,Jv),t(Oe,Fr),u(No,Fr,null),t(Fr,zv),t(Fr,Nd),t(Nd,Uv),m(e,hh,p),m(e,He,p),u(Ao,He,null),t(He,Iv),t(He,Hi),t(Hi,Qi),t(Qi,Wv),t(Hi,Bv),t(He,Zv),t(He,Yi),u(Oo,Yi,null),m(e,gh,p),m(e,Qe,p),u(Ho,Qe,null),t(Qe,Sv),t(Qe,Ki),t(Ki,ec),t(ec,Vv),t(Ki,Pv),t(Qe,Dv),t(Qe,tc),u(Qo,tc,null),m(e,fh,p),m(e,Ye,p),u(Yo,Ye,null),t(Ye,qv),t(Ye,rc),t(rc,sc),t(sc,Gv),t(rc,Xv),t(Ye,Rv),t(Ye,oc),u(Ko,oc,null),m(e,uh,p),m(e,Ke,p),u(en,Ke,null),t(Ke,Cv),t(Ke,nc),t(nc,ac),t(ac,Nv),t(nc,Av),t(Ke,Ov),t(Ke,ic),u(tn,ic,null),m(e,_h,p),m(e,et,p),u(rn,et,null),t(et,Hv),t(et,Lr),t(Lr,cc),t(cc,Qv),t(Lr,Yv),t(Lr,Ad),t(Ad,Kv),t(Lr,eT),t(et,tT),t(et,lc),u(sn,lc,null),m(e,bh,p),m(e,tt,p),u(on,tt,null),t(tt,rT),t(tt,dc),t(dc,pc),t(pc,sT),t(dc,oT),t(tt,nT),t(tt,mc),u(nn,mc,null),m(e,yh,p),m(e,qt,p),t(qt,Jr),t(Jr,Od),u(an,Od,null),t(qt,aT),t(qt,Hd),t(Hd,iT),m(e,vh,p),m(e,zr,p),t(zr,cT),t(zr,hc),t(hc,lT),t(zr,dT),m(e,Th,p),m(e,rt,p),u(cn,rt,null),t(rt,pT),t(rt,Qd),t(Qd,mT),t(rt,hT),t(rt,gc),u(ln,gc,null),m(e,wh,p),m(e,Gt,p),u(dn,Gt,null),t(Gt,gT),t(Gt,fc),u(pn,fc,null),m(e,kh,p),m(e,st,p),u(mn,st,null),t(st,fT),t(st,hn),t(hn,uT),t(hn,Yd),t(Yd,_T),t(hn,bT),t(st,yT),t(st,uc),u(gn,uc,null),m(e,$h,p),m(e,ot,p),u(fn,ot,null),t(ot,vT),t(ot,un),t(un,TT),t(un,Kd),t(Kd,wT),t(un,kT),t(ot,$T),t(ot,_c),u(_n,_c,null),m(e,Mh,p),m(e,Xt,p),t(Xt,Ur),t(Ur,ep),u(bn,ep,null),t(Xt,MT),t(Xt,tp),t(tp,xT),m(e,xh,p),m(e,Ir,p),t(Ir,jT),t(Ir,bc),t(bc,ET),t(Ir,FT),m(e,jh,p),m(e,L,p),u(yn,L,null),t(L,LT),t(L,rp),t(rp,JT),t(L,zT),t(L,sp),t(sp,UT),t(L,IT),u(Wr,L,null),t(L,WT),t(L,op),t(op,BT),t(L,ZT),t(L,Br),u(vn,Br,null),t(Br,ST),t(Br,np),t(np,VT),t(L,PT),t(L,Zr),u(Tn,Zr,null),t(Zr,DT),t(Zr,ap),t(ap,qT),t(L,GT),t(L,Sr),u(wn,Sr,null),t(Sr,XT),t(Sr,ip),t(ip,RT),t(L,CT),t(L,Vr),u(kn,Vr,null),t(Vr,NT),t(Vr,$n),t($n,AT),t($n,cp),t(cp,OT),t($n,HT),t(L,QT),t(L,Pr),u(Mn,Pr,null),t(Pr,YT),t(Pr,lp),t(lp,KT),t(L,e2),t(L,Dr),u(xn,Dr,null),t(Dr,t2),t(Dr,dp),t(dp,r2),t(L,s2),t(L,pt),u(jn,pt,null),t(pt,o2),t(pt,En),t(En,n2),t(En,pp),t(pp,a2),t(En,i2),t(pt,c2),t(pt,mp),t(mp,l2),m(e,Eh,p),m(e,Rt,p),u(Fn,Rt,null),t(Rt,d2),t(Rt,yc),t(yc,vc),t(vc,p2),t(yc,m2),m(e,Fh,p),m(e,Ct,p),u(Ln,Ct,null),t(Ct,h2),t(Ct,Jn),t(Jn,g2),t(Jn,Tc),t(Tc,f2),t(Jn,u2),m(e,Lh,p),m(e,le,p),u(zn,le,null),t(le,_2),t(le,hp),t(hp,b2),t(le,y2),t(le,G),u(Un,G,null),t(G,v2),t(G,gp),t(gp,T2),t(G,w2),t(G,Nt),t(Nt,k2),t(Nt,fp),t(fp,$2),t(Nt,M2),t(Nt,up),t(up,x2),t(Nt,j2),t(G,E2),t(G,_p),t(_p,bp),t(bp,F2),t(G,L2),t(G,nt),t(nt,J2),t(nt,yp),t(yp,z2),t(nt,U2),t(nt,vp),t(vp,I2),t(nt,W2),t(nt,Tp),t(Tp,B2),t(nt,Z2),t(G,S2),t(G,wp),t(wp,V2),t(le,P2),t(le,qr),u(In,qr,null),t(qr,D2),t(qr,kp),t(kp,q2),m(e,Jh,p),m(e,At,p),t(At,Gr),t(Gr,$p),u(Wn,$p,null),t(At,G2),t(At,Mp),t(Mp,X2),m(e,zh,p),m(e,de,p),u(Bn,de,null),t(de,R2),t(de,Ot),t(Ot,C2),t(Ot,wc),t(wc,N2),t(Ot,A2),t(Ot,kc),t(kc,O2),t(Ot,H2),t(de,Q2),t(de,$c),u(Zn,$c,null),t(de,Y2),t(de,Mc),u(Sn,Mc,null),m(e,Uh,p),m(e,q,p),u(Vn,q,null),t(q,K2),t(q,xc),t(xc,jc),t(jc,ew),t(xc,tw),t(q,rw),t(q,Pn),t(Pn,sw),t(Pn,Dn),t(Dn,ow),t(Pn,nw),t(q,aw),t(q,Ec),t(Ec,iw),t(Ec,qn),t(qn,cw),t(q,lw),t(q,Fc),u(Gn,Fc,null),t(q,dw),t(q,Lc),u(Xn,Lc,null),m(e,Ih,p),m(e,pe,p),u(Rn,pe,null),t(pe,pw),t(pe,Jc),t(Jc,zc),t(zc,mw),t(Jc,hw),t(pe,gw),t(pe,Uc),u(Cn,Uc,null),t(pe,fw),t(pe,Ic),u(Nn,Ic,null),m(e,Wh,p),m(e,Ht,p),t(Ht,Xr),t(Xr,xp),u(An,xp,null),t(Ht,uw),t(Ht,jp),t(jp,_w),m(e,Bh,p),m(e,at,p),u(On,at,null),t(at,bw),t(at,Ep),t(Ep,yw),t(at,vw),t(at,Wc),t(Wc,Tw),t(Wc,Hn),t(Hn,ww),m(e,Zh,p),m(e,it,p),u(Qn,it,null),t(it,kw),t(it,Fp),t(Fp,$w),t(it,Mw),t(it,Bc),t(Bc,xw),t(Bc,Yn),t(Yn,jw),m(e,Sh,p),m(e,Qt,p),t(Qt,Rr),t(Rr,Lp),u(Kn,Lp,null),t(Qt,Ew),t(Qt,Jp),t(Jp,Fw),m(e,Vh,p),m(e,B,p),u(ea,B,null),t(B,Lw),t(B,zp),t(zp,Jw),t(B,zw),u(Cr,B,null),t(B,Uw),u(Nr,B,null),t(B,Iw),t(B,Ar),u(ta,Ar,null),t(Ar,Ww),t(Ar,Up),t(Up,Bw),t(B,Zw),t(B,Or),u(ra,Or,null),t(Or,Sw),t(Or,Ip),t(Ip,Vw),t(B,Pw),t(B,Hr),u(sa,Hr,null),t(Hr,Dw),t(Hr,Wp),t(Wp,qw),m(e,Ph,p),m(e,O,p),u(oa,O,null),t(O,Gw),t(O,Bp),t(Bp,Xw),t(O,Rw),u(Qr,O,null),t(O,Cw),u(Yr,O,null),t(O,Nw),t(O,Kr),u(na,Kr,null),t(Kr,Aw),t(Kr,Zp),t(Zp,Ow),Dh=!0},p(e,[p]){const aa={};p&2&&(aa.$$scope={dirty:p,ctx:e}),lr.$set(aa);const Sp={};p&2&&(Sp.$$scope={dirty:p,ctx:e}),dr.$set(Sp);const Vp={};p&2&&(Vp.$$scope={dirty:p,ctx:e}),pr.$set(Vp);const Pp={};p&2&&(Pp.$$scope={dirty:p,ctx:e}),hr.$set(Pp);const I={};p&2&&(I.$$scope={dirty:p,ctx:e}),gr.$set(I);const Dp={};p&2&&(Dp.$$scope={dirty:p,ctx:e}),ur.$set(Dp);const qp={};p&2&&(qp.$$scope={dirty:p,ctx:e}),_r.$set(qp);const Gp={};p&2&&(Gp.$$scope={dirty:p,ctx:e}),br.$set(Gp);const Xp={};p&2&&(Xp.$$scope={dirty:p,ctx:e}),yr.$set(Xp);const Rp={};p&2&&(Rp.$$scope={dirty:p,ctx:e}),vr.$set(Rp);const Cp={};p&2&&(Cp.$$scope={dirty:p,ctx:e}),Tr.$set(Cp);const Np={};p&2&&(Np.$$scope={dirty:p,ctx:e}),Wr.$set(Np);const Ap={};p&2&&(Ap.$$scope={dirty:p,ctx:e}),Cr.$set(Ap);const Op={};p&2&&(Op.$$scope={dirty:p,ctx:e}),Nr.$set(Op);const ia={};p&2&&(ia.$$scope={dirty:p,ctx:e}),Qr.$set(ia);const Hp={};p&2&&(Hp.$$scope={dirty:p,ctx:e}),Yr.$set(Hp)},i(e){Dh||(_(h.$$.fragment,e),_(ls.$$.fragment,e),_(ds.$$.fragment,e),_(ps.$$.fragment,e),_(ms.$$.fragment,e),_(hs.$$.fragment,e),_(gs.$$.fragment,e),_(fs.$$.fragment,e),_(us.$$.fragment,e),_(_s.$$.fragment,e),_(bs.$$.fragment,e),_(ys.$$.fragment,e),_(vs.$$.fragment,e),_(Ts.$$.fragment,e),_(ws.$$.fragment,e),_(ks.$$.fragment,e),_($s.$$.fragment,e),_(Ms.$$.fragment,e),_(xs.$$.fragment,e),_(js.$$.fragment,e),_(Es.$$.fragment,e),_(Fs.$$.fragment,e),_(Ls.$$.fragment,e),_(Js.$$.fragment,e),_(zs.$$.fragment,e),_(Us.$$.fragment,e),_(Is.$$.fragment,e),_(Ws.$$.fragment,e),_(Bs.$$.fragment,e),_(Zs.$$.fragment,e),_(lr.$$.fragment,e),_(Ss.$$.fragment,e),_(Vs.$$.fragment,e),_(dr.$$.fragment,e),_(pr.$$.fragment,e),_(Ps.$$.fragment,e),_(Ds.$$.fragment,e),_(hr.$$.fragment,e),_(Gs.$$.fragment,e),_(Xs.$$.fragment,e),_(gr.$$.fragment,e),_(Rs.$$.fragment,e),_(Cs.$$.fragment,e),_(Ns.$$.fragment,e),_(As.$$.fragment,e),_(Hs.$$.fragment,e),_(Qs.$$.fragment,e),_(ur.$$.fragment,e),_(_r.$$.fragment,e),_(Ks.$$.fragment,e),_(eo.$$.fragment,e),_(br.$$.fragment,e),_(yr.$$.fragment,e),_(to.$$.fragment,e),_(ro.$$.fragment,e),_(vr.$$.fragment,e),_(Tr.$$.fragment,e),_(so.$$.fragment,e),_(oo.$$.fragment,e),_(ao.$$.fragment,e),_(io.$$.fragment,e),_(lo.$$.fragment,e),_(po.$$.fragment,e),_(mo.$$.fragment,e),_(ho.$$.fragment,e),_(go.$$.fragment,e),_(fo.$$.fragment,e),_(uo.$$.fragment,e),_(_o.$$.fragment,e),_(bo.$$.fragment,e),_(yo.$$.fragment,e),_(vo.$$.fragment,e),_(To.$$.fragment,e),_(wo.$$.fragment,e),_(ko.$$.fragment,e),_($o.$$.fragment,e),_(Mo.$$.fragment,e),_(xo.$$.fragment,e),_(jo.$$.fragment,e),_(Eo.$$.fragment,e),_(Fo.$$.fragment,e),_(Lo.$$.fragment,e),_(Jo.$$.fragment,e),_(zo.$$.fragment,e),_(Uo.$$.fragment,e),_(Wo.$$.fragment,e),_(Bo.$$.fragment,e),_(Zo.$$.fragment,e),_(So.$$.fragment,e),_(Vo.$$.fragment,e),_(Po.$$.fragment,e),_(Do.$$.fragment,e),_(qo.$$.fragment,e),_(Go.$$.fragment,e),_(Xo.$$.fragment,e),_(Ro.$$.fragment,e),_(Co.$$.fragment,e),_(No.$$.fragment,e),_(Ao.$$.fragment,e),_(Oo.$$.fragment,e),_(Ho.$$.fragment,e),_(Qo.$$.fragment,e),_(Yo.$$.fragment,e),_(Ko.$$.fragment,e),_(en.$$.fragment,e),_(tn.$$.fragment,e),_(rn.$$.fragment,e),_(sn.$$.fragment,e),_(on.$$.fragment,e),_(nn.$$.fragment,e),_(an.$$.fragment,e),_(cn.$$.fragment,e),_(ln.$$.fragment,e),_(dn.$$.fragment,e),_(pn.$$.fragment,e),_(mn.$$.fragment,e),_(gn.$$.fragment,e),_(fn.$$.fragment,e),_(_n.$$.fragment,e),_(bn.$$.fragment,e),_(yn.$$.fragment,e),_(Wr.$$.fragment,e),_(vn.$$.fragment,e),_(Tn.$$.fragment,e),_(wn.$$.fragment,e),_(kn.$$.fragment,e),_(Mn.$$.fragment,e),_(xn.$$.fragment,e),_(jn.$$.fragment,e),_(Fn.$$.fragment,e),_(Ln.$$.fragment,e),_(zn.$$.fragment,e),_(Un.$$.fragment,e),_(In.$$.fragment,e),_(Wn.$$.fragment,e),_(Bn.$$.fragment,e),_(Zn.$$.fragment,e),_(Sn.$$.fragment,e),_(Vn.$$.fragment,e),_(Gn.$$.fragment,e),_(Xn.$$.fragment,e),_(Rn.$$.fragment,e),_(Cn.$$.fragment,e),_(Nn.$$.fragment,e),_(An.$$.fragment,e),_(On.$$.fragment,e),_(Qn.$$.fragment,e),_(Kn.$$.fragment,e),_(ea.$$.fragment,e),_(Cr.$$.fragment,e),_(Nr.$$.fragment,e),_(ta.$$.fragment,e),_(ra.$$.fragment,e),_(sa.$$.fragment,e),_(oa.$$.fragment,e),_(Qr.$$.fragment,e),_(Yr.$$.fragment,e),_(na.$$.fragment,e),Dh=!0)},o(e){b(h.$$.fragment,e),b(ls.$$.fragment,e),b(ds.$$.fragment,e),b(ps.$$.fragment,e),b(ms.$$.fragment,e),b(hs.$$.fragment,e),b(gs.$$.fragment,e),b(fs.$$.fragment,e),b(us.$$.fragment,e),b(_s.$$.fragment,e),b(bs.$$.fragment,e),b(ys.$$.fragment,e),b(vs.$$.fragment,e),b(Ts.$$.fragment,e),b(ws.$$.fragment,e),b(ks.$$.fragment,e),b($s.$$.fragment,e),b(Ms.$$.fragment,e),b(xs.$$.fragment,e),b(js.$$.fragment,e),b(Es.$$.fragment,e),b(Fs.$$.fragment,e),b(Ls.$$.fragment,e),b(Js.$$.fragment,e),b(zs.$$.fragment,e),b(Us.$$.fragment,e),b(Is.$$.fragment,e),b(Ws.$$.fragment,e),b(Bs.$$.fragment,e),b(Zs.$$.fragment,e),b(lr.$$.fragment,e),b(Ss.$$.fragment,e),b(Vs.$$.fragment,e),b(dr.$$.fragment,e),b(pr.$$.fragment,e),b(Ps.$$.fragment,e),b(Ds.$$.fragment,e),b(hr.$$.fragment,e),b(Gs.$$.fragment,e),b(Xs.$$.fragment,e),b(gr.$$.fragment,e),b(Rs.$$.fragment,e),b(Cs.$$.fragment,e),b(Ns.$$.fragment,e),b(As.$$.fragment,e),b(Hs.$$.fragment,e),b(Qs.$$.fragment,e),b(ur.$$.fragment,e),b(_r.$$.fragment,e),b(Ks.$$.fragment,e),b(eo.$$.fragment,e),b(br.$$.fragment,e),b(yr.$$.fragment,e),b(to.$$.fragment,e),b(ro.$$.fragment,e),b(vr.$$.fragment,e),b(Tr.$$.fragment,e),b(so.$$.fragment,e),b(oo.$$.fragment,e),b(ao.$$.fragment,e),b(io.$$.fragment,e),b(lo.$$.fragment,e),b(po.$$.fragment,e),b(mo.$$.fragment,e),b(ho.$$.fragment,e),b(go.$$.fragment,e),b(fo.$$.fragment,e),b(uo.$$.fragment,e),b(_o.$$.fragment,e),b(bo.$$.fragment,e),b(yo.$$.fragment,e),b(vo.$$.fragment,e),b(To.$$.fragment,e),b(wo.$$.fragment,e),b(ko.$$.fragment,e),b($o.$$.fragment,e),b(Mo.$$.fragment,e),b(xo.$$.fragment,e),b(jo.$$.fragment,e),b(Eo.$$.fragment,e),b(Fo.$$.fragment,e),b(Lo.$$.fragment,e),b(Jo.$$.fragment,e),b(zo.$$.fragment,e),b(Uo.$$.fragment,e),b(Wo.$$.fragment,e),b(Bo.$$.fragment,e),b(Zo.$$.fragment,e),b(So.$$.fragment,e),b(Vo.$$.fragment,e),b(Po.$$.fragment,e),b(Do.$$.fragment,e),b(qo.$$.fragment,e),b(Go.$$.fragment,e),b(Xo.$$.fragment,e),b(Ro.$$.fragment,e),b(Co.$$.fragment,e),b(No.$$.fragment,e),b(Ao.$$.fragment,e),b(Oo.$$.fragment,e),b(Ho.$$.fragment,e),b(Qo.$$.fragment,e),b(Yo.$$.fragment,e),b(Ko.$$.fragment,e),b(en.$$.fragment,e),b(tn.$$.fragment,e),b(rn.$$.fragment,e),b(sn.$$.fragment,e),b(on.$$.fragment,e),b(nn.$$.fragment,e),b(an.$$.fragment,e),b(cn.$$.fragment,e),b(ln.$$.fragment,e),b(dn.$$.fragment,e),b(pn.$$.fragment,e),b(mn.$$.fragment,e),b(gn.$$.fragment,e),b(fn.$$.fragment,e),b(_n.$$.fragment,e),b(bn.$$.fragment,e),b(yn.$$.fragment,e),b(Wr.$$.fragment,e),b(vn.$$.fragment,e),b(Tn.$$.fragment,e),b(wn.$$.fragment,e),b(kn.$$.fragment,e),b(Mn.$$.fragment,e),b(xn.$$.fragment,e),b(jn.$$.fragment,e),b(Fn.$$.fragment,e),b(Ln.$$.fragment,e),b(zn.$$.fragment,e),b(Un.$$.fragment,e),b(In.$$.fragment,e),b(Wn.$$.fragment,e),b(Bn.$$.fragment,e),b(Zn.$$.fragment,e),b(Sn.$$.fragment,e),b(Vn.$$.fragment,e),b(Gn.$$.fragment,e),b(Xn.$$.fragment,e),b(Rn.$$.fragment,e),b(Cn.$$.fragment,e),b(Nn.$$.fragment,e),b(An.$$.fragment,e),b(On.$$.fragment,e),b(Qn.$$.fragment,e),b(Kn.$$.fragment,e),b(ea.$$.fragment,e),b(Cr.$$.fragment,e),b(Nr.$$.fragment,e),b(ta.$$.fragment,e),b(ra.$$.fragment,e),b(sa.$$.fragment,e),b(oa.$$.fragment,e),b(Qr.$$.fragment,e),b(Yr.$$.fragment,e),b(na.$$.fragment,e),Dh=!1},d(e){r(v),e&&r(M),e&&r(k),y(h),e&&r(U),e&&r(F),e&&r(om),e&&r(ga),e&&r(nm),e&&r(jt),y(ls),e&&r(am),e&&r(he),e&&r(im),e&&r(ba),e&&r(cm),y(ds,e),e&&r(lm),e&&r(ct),e&&r(dm),e&&r(ge),e&&r(pm),e&&r(S),e&&r(mm),e&&r(Y),e&&r(hm),e&&r(K),e&&r(gm),y(ps,e),e&&r(fm),e&&r(er),e&&r(um),e&&r(ee),e&&r(_m),e&&r($a),e&&r(bm),e&&r(Et),y(ms),e&&r(ym),e&&r(Ft),y(hs),e&&r(vm),e&&r(Lt),y(gs),e&&r(Tm),e&&r(we),y(fs),y(us),e&&r(wm),e&&r(Jt),y(_s),e&&r(km),e&&r(zt),y(bs),e&&r($m),e&&r(Ut),y(ys),e&&r(Mm),e&&r(ke),y(vs),y(Ts),e&&r(xm),e&&r(It),y(ws),e&&r(jm),e&&r(Wt),y(ks),e&&r(Em),e&&r(Bt),y($s),e&&r(Fm),e&&r(Zt),y(Ms),e&&r(Lm),e&&r(St),y(xs),e&&r(Jm),e&&r(Vt),y(js),e&&r(zm),e&&r(Pt),y(Es),e&&r(Um),e&&r(cr),e&&r(Im),e&&r($e),y(Fs),y(Ls),e&&r(Wm),e&&r(Me),y(Js),y(zs),e&&r(Bm),e&&r(xe),y(Us),y(Is),e&&r(Zm),e&&r(je),y(Ws),y(Bs),e&&r(Sm),e&&r(ne),y(Zs),y(lr),y(Ss),e&&r(Vm),e&&r(R),y(Vs),y(dr),y(pr),y(Ps),e&&r(Pm),e&&r(ae),y(Ds),y(hr),y(Gs),e&&r(Dm),e&&r(ie),y(Xs),y(gr),y(Rs),e&&r(qm),e&&r(Ee),y(Cs),y(Ns),e&&r(Gm),e&&r(Fe),y(As),y(Hs),e&&r(Xm),e&&r(C),y(Qs),y(ur),y(_r),y(Ks),e&&r(Rm),e&&r(N),y(eo),y(br),y(yr),y(to),e&&r(Cm),e&&r(A),y(ro),y(vr),y(Tr),y(so),e&&r(Nm),e&&r(Le),y(oo),y(ao),e&&r(Am),e&&r(Je),y(io),y(lo),e&&r(Om),e&&r(ze),y(po),y(mo),e&&r(Hm),e&&r(Ue),y(ho),y(go),e&&r(Qm),e&&r(Ie),y(fo),y(uo),e&&r(Ym),e&&r(We),y(_o),y(bo),e&&r(Km),e&&r(Be),y(yo),y(vo),e&&r(eh),e&&r(Ze),y(To),y(wo),e&&r(th),e&&r(Se),y(ko),y($o),e&&r(rh),e&&r(Ve),y(Mo),y(xo),e&&r(sh),e&&r(Pe),y(jo),y(Eo),e&&r(oh),e&&r(De),y(Fo),y(Lo),e&&r(nh),e&&r(qe),y(Jo),y(zo),e&&r(ah),e&&r(Ge),y(Uo),y(Wo),e&&r(ih),e&&r(Xe),y(Bo),y(Zo),e&&r(ch),e&&r(Re),y(So),y(Vo),e&&r(lh),e&&r(Ce),y(Po),y(Do),e&&r(dh),e&&r(Ne),y(qo),y(Go),e&&r(ph),e&&r(Ae),y(Xo),y(Ro),e&&r(mh),e&&r(Oe),y(Co),y(No),e&&r(hh),e&&r(He),y(Ao),y(Oo),e&&r(gh),e&&r(Qe),y(Ho),y(Qo),e&&r(fh),e&&r(Ye),y(Yo),y(Ko),e&&r(uh),e&&r(Ke),y(en),y(tn),e&&r(_h),e&&r(et),y(rn),y(sn),e&&r(bh),e&&r(tt),y(on),y(nn),e&&r(yh),e&&r(qt),y(an),e&&r(vh),e&&r(zr),e&&r(Th),e&&r(rt),y(cn),y(ln),e&&r(wh),e&&r(Gt),y(dn),y(pn),e&&r(kh),e&&r(st),y(mn),y(gn),e&&r($h),e&&r(ot),y(fn),y(_n),e&&r(Mh),e&&r(Xt),y(bn),e&&r(xh),e&&r(Ir),e&&r(jh),e&&r(L),y(yn),y(Wr),y(vn),y(Tn),y(wn),y(kn),y(Mn),y(xn),y(jn),e&&r(Eh),e&&r(Rt),y(Fn),e&&r(Fh),e&&r(Ct),y(Ln),e&&r(Lh),e&&r(le),y(zn),y(Un),y(In),e&&r(Jh),e&&r(At),y(Wn),e&&r(zh),e&&r(de),y(Bn),y(Zn),y(Sn),e&&r(Uh),e&&r(q),y(Vn),y(Gn),y(Xn),e&&r(Ih),e&&r(pe),y(Rn),y(Cn),y(Nn),e&&r(Wh),e&&r(Ht),y(An),e&&r(Bh),e&&r(at),y(On),e&&r(Zh),e&&r(it),y(Qn),e&&r(Sh),e&&r(Qt),y(Kn),e&&r(Vh),e&&r(B),y(ea),y(Cr),y(Nr),y(ta),y(ra),y(sa),e&&r(Ph),e&&r(O),y(oa),y(Qr),y(Yr),y(na)}}}const ux={local:"utilities-for-generation",sections:[{local:"generate-outputs",sections:[{local:"transformers.generation.GreedySearchDecoderOnlyOutput",title:"GreedySearchOutput"},{local:"transformers.generation.SampleDecoderOnlyOutput",title:"SampleOutput"},{local:"transformers.generation.BeamSearchDecoderOnlyOutput",title:"BeamSearchOutput"},{local:"transformers.generation.BeamSampleDecoderOnlyOutput",title:"BeamSampleOutput"}],title:"Generate Outputs"},{local:"transformers.LogitsProcessor",title:"LogitsProcessor"},{local:"transformers.StoppingCriteria",title:"StoppingCriteria"},{local:"transformers.Constraint",title:"Constraints"},{local:"transformers.BeamScorer",title:"BeamSearch"},{local:"transformers.top_k_top_p_filtering",title:"Utilities"},{local:"transformers.TextStreamer",title:"Streamers"}],title:"Utilities for Generation"};function _x(E){return YM(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class $x extends AM{constructor(v){super();OM(this,v,_x,fx,HM,{})}}export{$x as default,ux as metadata};
