Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"utils/generation","local":"utilsgeneration","sections":[{"title":"utils/generation.LogitsProcessorList ⇐ <code> Callable </code>","local":"utilsgenerationlogitsprocessorlist--code-callable-code","sections":[{"title":"new LogitsProcessorList()","local":"new-logitsprocessorlist","sections":[],"depth":3},{"title":"logitsProcessorList.push(item)","local":"logitsprocessorlistpushitem","sections":[],"depth":3},{"title":"logitsProcessorList.extend(items)","local":"logitsprocessorlistextenditems","sections":[],"depth":3},{"title":"logitsProcessorList._call(input_ids, batchedLogits)","local":"logitsprocessorlistcallinputids-batchedlogits","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.LogitsProcessor ⇐ <code> Callable </code>","local":"utilsgenerationlogitsprocessor--code-callable-code","sections":[{"title":"logitsProcessor._call(input_ids, logits)","local":"logitsprocessorcallinputids-logits","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.ForceTokensLogitsProcessor ⇐ <code> LogitsProcessor </code>","local":"utilsgenerationforcetokenslogitsprocessor--code-logitsprocessor-code","sections":[{"title":"new ForceTokensLogitsProcessor(forced_decoder_ids)","local":"new-forcetokenslogitsprocessorforceddecoderids","sections":[],"depth":3},{"title":"forceTokensLogitsProcessor._call(input_ids, logits) ⇒ <code> Tensor </code>","local":"forcetokenslogitsprocessorcallinputids-logits--code-tensor-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.ForcedBOSTokenLogitsProcessor ⇐ <code> LogitsProcessor </code>","local":"utilsgenerationforcedbostokenlogitsprocessor--code-logitsprocessor-code","sections":[{"title":"new ForcedBOSTokenLogitsProcessor(bos_token_id)","local":"new-forcedbostokenlogitsprocessorbostokenid","sections":[],"depth":3},{"title":"forcedBOSTokenLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code>","local":"forcedbostokenlogitsprocessorcallinputids-logits--code-object-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.ForcedEOSTokenLogitsProcessor ⇐ <code> LogitsProcessor </code>","local":"utilsgenerationforcedeostokenlogitsprocessor--code-logitsprocessor-code","sections":[{"title":"new ForcedEOSTokenLogitsProcessor(max_length, forced_eos_token_id)","local":"new-forcedeostokenlogitsprocessormaxlength-forcedeostokenid","sections":[],"depth":3},{"title":"forcedEOSTokenLogitsProcessor._call(input_ids, logits)","local":"forcedeostokenlogitsprocessorcallinputids-logits","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.SuppressTokensAtBeginLogitsProcessor ⇐ <code> LogitsProcessor </code>","local":"utilsgenerationsuppresstokensatbeginlogitsprocessor--code-logitsprocessor-code","sections":[{"title":"new SuppressTokensAtBeginLogitsProcessor(begin_suppress_tokens, begin_index)","local":"new-suppresstokensatbeginlogitsprocessorbeginsuppresstokens-beginindex","sections":[],"depth":3},{"title":"suppressTokensAtBeginLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code>","local":"suppresstokensatbeginlogitsprocessorcallinputids-logits--code-object-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.WhisperTimeStampLogitsProcessor ⇐ <code> LogitsProcessor </code>","local":"utilsgenerationwhispertimestamplogitsprocessor--code-logitsprocessor-code","sections":[{"title":"new WhisperTimeStampLogitsProcessor(generate_config)","local":"new-whispertimestamplogitsprocessorgenerateconfig","sections":[],"depth":3},{"title":"whisperTimeStampLogitsProcessor._call(input_ids, logits) ⇒ <code> Tensor </code>","local":"whispertimestamplogitsprocessorcallinputids-logits--code-tensor-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.NoRepeatNGramLogitsProcessor ⇐ <code> LogitsProcessor </code>","local":"utilsgenerationnorepeatngramlogitsprocessor--code-logitsprocessor-code","sections":[{"title":"new NoRepeatNGramLogitsProcessor(no_repeat_ngram_size)","local":"new-norepeatngramlogitsprocessornorepeatngramsize","sections":[],"depth":3},{"title":"noRepeatNGramLogitsProcessor.getNgrams(prevInputIds) ⇒ <code> Map. < string, Array < number > > </code>","local":"norepeatngramlogitsprocessorgetngramsprevinputids--code-map--string-array--number---code","sections":[],"depth":3},{"title":"noRepeatNGramLogitsProcessor.getGeneratedNgrams(bannedNgrams, prevInputIds) ⇒ <code> Array. < number > </code>","local":"norepeatngramlogitsprocessorgetgeneratedngramsbannedngrams-previnputids--code-array--number--code","sections":[],"depth":3},{"title":"noRepeatNGramLogitsProcessor.calcBannedNgramTokens(prevInputIds) ⇒ <code> Array. < number > </code>","local":"norepeatngramlogitsprocessorcalcbannedngramtokensprevinputids--code-array--number--code","sections":[],"depth":3},{"title":"noRepeatNGramLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code>","local":"norepeatngramlogitsprocessorcallinputids-logits--code-object-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.RepetitionPenaltyLogitsProcessor ⇐ <code> LogitsProcessor </code>","local":"utilsgenerationrepetitionpenaltylogitsprocessor--code-logitsprocessor-code","sections":[{"title":"new RepetitionPenaltyLogitsProcessor(penalty)","local":"new-repetitionpenaltylogitsprocessorpenalty","sections":[],"depth":3},{"title":"repetitionPenaltyLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code>","local":"repetitionpenaltylogitsprocessorcallinputids-logits--code-object-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.MinLengthLogitsProcessor ⇐ <code> LogitsProcessor </code>","local":"utilsgenerationminlengthlogitsprocessor--code-logitsprocessor-code","sections":[{"title":"new MinLengthLogitsProcessor(min_length, eos_token_id)","local":"new-minlengthlogitsprocessorminlength-eostokenid","sections":[],"depth":3},{"title":"minLengthLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code>","local":"minlengthlogitsprocessorcallinputids-logits--code-object-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.MinNewTokensLengthLogitsProcessor ⇐ <code> LogitsProcessor </code>","local":"utilsgenerationminnewtokenslengthlogitsprocessor--code-logitsprocessor-code","sections":[{"title":"new MinNewTokensLengthLogitsProcessor(prompt_length_to_skip, min_new_tokens, eos_token_id)","local":"new-minnewtokenslengthlogitsprocessorpromptlengthtoskip-minnewtokens-eostokenid","sections":[],"depth":3},{"title":"minNewTokensLengthLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code>","local":"minnewtokenslengthlogitsprocessorcallinputids-logits--code-object-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.NoBadWordsLogitsProcessor","local":"utilsgenerationnobadwordslogitsprocessor","sections":[{"title":"new NoBadWordsLogitsProcessor(bad_words_ids, eos_token_id)","local":"new-nobadwordslogitsprocessorbadwordsids-eostokenid","sections":[],"depth":3},{"title":"noBadWordsLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code>","local":"nobadwordslogitsprocessorcallinputids-logits--code-object-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.Sampler","local":"utilsgenerationsampler","sections":[{"title":"new Sampler(generation_config)","local":"new-samplergenerationconfig","sections":[],"depth":3},{"title":"sampler._call(logits, index) ⇒ <code> void </code>","local":"samplercalllogits-index--code-void-code","sections":[],"depth":3},{"title":"sampler.sample(logits, index)","local":"samplersamplelogits-index","sections":[],"depth":3},{"title":"sampler.getLogits(logits, index) ⇒ <code> Float32Array </code>","local":"samplergetlogitslogits-index--code-float32array-code","sections":[],"depth":3},{"title":"sampler.randomSelect(probabilities) ⇒ <code> number </code>","local":"samplerrandomselectprobabilities--code-number-code","sections":[],"depth":3},{"title":"Sampler.getSampler(generation_config) ⇒ <code> Sampler </code>","local":"samplergetsamplergenerationconfig--code-sampler-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.GenerationConfig : <code> * </code>","local":"utilsgenerationgenerationconfig--code--code","sections":[],"depth":2},{"title":"utils/generation~GenerationConfig","local":"utilsgenerationgenerationconfig","sections":[{"title":"new GenerationConfig(kwargs)","local":"new-generationconfigkwargs","sections":[],"depth":3}],"depth":2},{"title":"utils/generation~GreedySampler ⇐ <code> Sampler </code>","local":"utilsgenerationgreedysampler--code-sampler-code","sections":[{"title":"greedySampler.sample(logits, [index]) ⇒ <code> Array </code>","local":"greedysamplersamplelogits-index--code-array-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation~MultinomialSampler ⇐ <code> Sampler </code>","local":"utilsgenerationmultinomialsampler--code-sampler-code","sections":[{"title":"multinomialSampler.sample(logits, index) ⇒ <code> Array </code>","local":"multinomialsamplersamplelogits-index--code-array-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation~BeamSearchSampler ⇐ <code> Sampler </code>","local":"utilsgenerationbeamsearchsampler--code-sampler-code","sections":[{"title":"beamSearchSampler.sample(logits, index) ⇒ <code> Array </code>","local":"beamsearchsamplersamplelogits-index--code-array-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation~GenerationConfigType : <code> Object </code>","local":"utilsgenerationgenerationconfigtype--code-object-code","sections":[],"depth":2}],"depth":1}"> | |
| <link href="/docs/transformers.js/main/en/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload"> | |
| <link rel="modulepreload" href="/docs/transformers.js/main/en/_app/immutable/entry/start.a2f7fcea.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/main/en/_app/immutable/chunks/scheduler.b108d059.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/main/en/_app/immutable/chunks/singletons.32d98b57.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/main/en/_app/immutable/chunks/paths.74343e0a.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/main/en/_app/immutable/entry/app.7b630de5.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/main/en/_app/immutable/chunks/index.008de539.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/main/en/_app/immutable/nodes/0.0c5369ee.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/main/en/_app/immutable/nodes/13.0aae2f52.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/main/en/_app/immutable/chunks/EditOnGithub.d1c48e3d.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{"title":"utils/generation","local":"utilsgeneration","sections":[{"title":"utils/generation.LogitsProcessorList ⇐ <code> Callable </code>","local":"utilsgenerationlogitsprocessorlist--code-callable-code","sections":[{"title":"new LogitsProcessorList()","local":"new-logitsprocessorlist","sections":[],"depth":3},{"title":"logitsProcessorList.push(item)","local":"logitsprocessorlistpushitem","sections":[],"depth":3},{"title":"logitsProcessorList.extend(items)","local":"logitsprocessorlistextenditems","sections":[],"depth":3},{"title":"logitsProcessorList._call(input_ids, batchedLogits)","local":"logitsprocessorlistcallinputids-batchedlogits","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.LogitsProcessor ⇐ <code> Callable </code>","local":"utilsgenerationlogitsprocessor--code-callable-code","sections":[{"title":"logitsProcessor._call(input_ids, logits)","local":"logitsprocessorcallinputids-logits","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.ForceTokensLogitsProcessor ⇐ <code> LogitsProcessor </code>","local":"utilsgenerationforcetokenslogitsprocessor--code-logitsprocessor-code","sections":[{"title":"new ForceTokensLogitsProcessor(forced_decoder_ids)","local":"new-forcetokenslogitsprocessorforceddecoderids","sections":[],"depth":3},{"title":"forceTokensLogitsProcessor._call(input_ids, logits) ⇒ <code> Tensor </code>","local":"forcetokenslogitsprocessorcallinputids-logits--code-tensor-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.ForcedBOSTokenLogitsProcessor ⇐ <code> LogitsProcessor </code>","local":"utilsgenerationforcedbostokenlogitsprocessor--code-logitsprocessor-code","sections":[{"title":"new ForcedBOSTokenLogitsProcessor(bos_token_id)","local":"new-forcedbostokenlogitsprocessorbostokenid","sections":[],"depth":3},{"title":"forcedBOSTokenLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code>","local":"forcedbostokenlogitsprocessorcallinputids-logits--code-object-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.ForcedEOSTokenLogitsProcessor ⇐ <code> LogitsProcessor </code>","local":"utilsgenerationforcedeostokenlogitsprocessor--code-logitsprocessor-code","sections":[{"title":"new ForcedEOSTokenLogitsProcessor(max_length, forced_eos_token_id)","local":"new-forcedeostokenlogitsprocessormaxlength-forcedeostokenid","sections":[],"depth":3},{"title":"forcedEOSTokenLogitsProcessor._call(input_ids, logits)","local":"forcedeostokenlogitsprocessorcallinputids-logits","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.SuppressTokensAtBeginLogitsProcessor ⇐ <code> LogitsProcessor </code>","local":"utilsgenerationsuppresstokensatbeginlogitsprocessor--code-logitsprocessor-code","sections":[{"title":"new SuppressTokensAtBeginLogitsProcessor(begin_suppress_tokens, begin_index)","local":"new-suppresstokensatbeginlogitsprocessorbeginsuppresstokens-beginindex","sections":[],"depth":3},{"title":"suppressTokensAtBeginLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code>","local":"suppresstokensatbeginlogitsprocessorcallinputids-logits--code-object-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.WhisperTimeStampLogitsProcessor ⇐ <code> LogitsProcessor </code>","local":"utilsgenerationwhispertimestamplogitsprocessor--code-logitsprocessor-code","sections":[{"title":"new WhisperTimeStampLogitsProcessor(generate_config)","local":"new-whispertimestamplogitsprocessorgenerateconfig","sections":[],"depth":3},{"title":"whisperTimeStampLogitsProcessor._call(input_ids, logits) ⇒ <code> Tensor </code>","local":"whispertimestamplogitsprocessorcallinputids-logits--code-tensor-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.NoRepeatNGramLogitsProcessor ⇐ <code> LogitsProcessor </code>","local":"utilsgenerationnorepeatngramlogitsprocessor--code-logitsprocessor-code","sections":[{"title":"new NoRepeatNGramLogitsProcessor(no_repeat_ngram_size)","local":"new-norepeatngramlogitsprocessornorepeatngramsize","sections":[],"depth":3},{"title":"noRepeatNGramLogitsProcessor.getNgrams(prevInputIds) ⇒ <code> Map. < string, Array < number > > </code>","local":"norepeatngramlogitsprocessorgetngramsprevinputids--code-map--string-array--number---code","sections":[],"depth":3},{"title":"noRepeatNGramLogitsProcessor.getGeneratedNgrams(bannedNgrams, prevInputIds) ⇒ <code> Array. < number > </code>","local":"norepeatngramlogitsprocessorgetgeneratedngramsbannedngrams-previnputids--code-array--number--code","sections":[],"depth":3},{"title":"noRepeatNGramLogitsProcessor.calcBannedNgramTokens(prevInputIds) ⇒ <code> Array. < number > </code>","local":"norepeatngramlogitsprocessorcalcbannedngramtokensprevinputids--code-array--number--code","sections":[],"depth":3},{"title":"noRepeatNGramLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code>","local":"norepeatngramlogitsprocessorcallinputids-logits--code-object-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.RepetitionPenaltyLogitsProcessor ⇐ <code> LogitsProcessor </code>","local":"utilsgenerationrepetitionpenaltylogitsprocessor--code-logitsprocessor-code","sections":[{"title":"new RepetitionPenaltyLogitsProcessor(penalty)","local":"new-repetitionpenaltylogitsprocessorpenalty","sections":[],"depth":3},{"title":"repetitionPenaltyLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code>","local":"repetitionpenaltylogitsprocessorcallinputids-logits--code-object-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.MinLengthLogitsProcessor ⇐ <code> LogitsProcessor </code>","local":"utilsgenerationminlengthlogitsprocessor--code-logitsprocessor-code","sections":[{"title":"new MinLengthLogitsProcessor(min_length, eos_token_id)","local":"new-minlengthlogitsprocessorminlength-eostokenid","sections":[],"depth":3},{"title":"minLengthLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code>","local":"minlengthlogitsprocessorcallinputids-logits--code-object-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.MinNewTokensLengthLogitsProcessor ⇐ <code> LogitsProcessor </code>","local":"utilsgenerationminnewtokenslengthlogitsprocessor--code-logitsprocessor-code","sections":[{"title":"new MinNewTokensLengthLogitsProcessor(prompt_length_to_skip, min_new_tokens, eos_token_id)","local":"new-minnewtokenslengthlogitsprocessorpromptlengthtoskip-minnewtokens-eostokenid","sections":[],"depth":3},{"title":"minNewTokensLengthLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code>","local":"minnewtokenslengthlogitsprocessorcallinputids-logits--code-object-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.NoBadWordsLogitsProcessor","local":"utilsgenerationnobadwordslogitsprocessor","sections":[{"title":"new NoBadWordsLogitsProcessor(bad_words_ids, eos_token_id)","local":"new-nobadwordslogitsprocessorbadwordsids-eostokenid","sections":[],"depth":3},{"title":"noBadWordsLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code>","local":"nobadwordslogitsprocessorcallinputids-logits--code-object-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.Sampler","local":"utilsgenerationsampler","sections":[{"title":"new Sampler(generation_config)","local":"new-samplergenerationconfig","sections":[],"depth":3},{"title":"sampler._call(logits, index) ⇒ <code> void </code>","local":"samplercalllogits-index--code-void-code","sections":[],"depth":3},{"title":"sampler.sample(logits, index)","local":"samplersamplelogits-index","sections":[],"depth":3},{"title":"sampler.getLogits(logits, index) ⇒ <code> Float32Array </code>","local":"samplergetlogitslogits-index--code-float32array-code","sections":[],"depth":3},{"title":"sampler.randomSelect(probabilities) ⇒ <code> number </code>","local":"samplerrandomselectprobabilities--code-number-code","sections":[],"depth":3},{"title":"Sampler.getSampler(generation_config) ⇒ <code> Sampler </code>","local":"samplergetsamplergenerationconfig--code-sampler-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation.GenerationConfig : <code> * </code>","local":"utilsgenerationgenerationconfig--code--code","sections":[],"depth":2},{"title":"utils/generation~GenerationConfig","local":"utilsgenerationgenerationconfig","sections":[{"title":"new GenerationConfig(kwargs)","local":"new-generationconfigkwargs","sections":[],"depth":3}],"depth":2},{"title":"utils/generation~GreedySampler ⇐ <code> Sampler </code>","local":"utilsgenerationgreedysampler--code-sampler-code","sections":[{"title":"greedySampler.sample(logits, [index]) ⇒ <code> Array </code>","local":"greedysamplersamplelogits-index--code-array-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation~MultinomialSampler ⇐ <code> Sampler </code>","local":"utilsgenerationmultinomialsampler--code-sampler-code","sections":[{"title":"multinomialSampler.sample(logits, index) ⇒ <code> Array </code>","local":"multinomialsamplersamplelogits-index--code-array-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation~BeamSearchSampler ⇐ <code> Sampler </code>","local":"utilsgenerationbeamsearchsampler--code-sampler-code","sections":[{"title":"beamSearchSampler.sample(logits, index) ⇒ <code> Array </code>","local":"beamsearchsamplersamplelogits-index--code-array-code","sections":[],"depth":3}],"depth":2},{"title":"utils/generation~GenerationConfigType : <code> Object </code>","local":"utilsgenerationgenerationconfigtype--code-object-code","sections":[],"depth":2}],"depth":1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <a id="module_utils/generation" class="group"></a> <h1 class="relative group"><a id="utilsgeneration" 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" href="#utilsgeneration"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>utils/generation</span></h1> <p data-svelte-h="svelte-sqdsz9">Classes, functions, and utilities for generation.</p> <p data-svelte-h="svelte-1dx7r99"><strong>Todo</strong></p> <ul data-svelte-h="svelte-145ffvq"><li>Describe how to create a custom <code>GenerationConfig</code>.</li></ul> <ul data-svelte-h="svelte-14jwj4n"><li><a href="#module_utils/generation">utils/generation</a><ul><li><em>static</em><ul><li><a href="#module_utils/generation.LogitsProcessorList">.LogitsProcessorList</a> ⇐ <code>Callable</code><ul><li><a href="#new_module_utils/generation.LogitsProcessorList_new"><code>new LogitsProcessorList()</code></a></li> <li><a href="#module_utils/generation.LogitsProcessorList+push"><code>.push(item)</code></a></li> <li><a href="#module_utils/generation.LogitsProcessorList+extend"><code>.extend(items)</code></a></li> <li><a href="#module_utils/generation.LogitsProcessorList+_call"><code>._call(input_ids, batchedLogits)</code></a></li></ul></li> <li><a href="#module_utils/generation.LogitsProcessor">.LogitsProcessor</a> ⇐ <code>Callable</code><ul><li><em><a href="#module_utils/generation.LogitsProcessor+_call"><code>._call(input_ids, logits)</code></a></em></li></ul></li> <li><a href="#module_utils/generation.ForceTokensLogitsProcessor">.ForceTokensLogitsProcessor</a> ⇐ <code>LogitsProcessor</code><ul><li><a href="#new_module_utils/generation.ForceTokensLogitsProcessor_new"><code>new ForceTokensLogitsProcessor(forced_decoder_ids)</code></a></li> <li><a href="#module_utils/generation.ForceTokensLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a> ⇒ <code>Tensor</code></li></ul></li> <li><a href="#module_utils/generation.ForcedBOSTokenLogitsProcessor">.ForcedBOSTokenLogitsProcessor</a> ⇐ <code>LogitsProcessor</code><ul><li><a href="#new_module_utils/generation.ForcedBOSTokenLogitsProcessor_new"><code>new ForcedBOSTokenLogitsProcessor(bos_token_id)</code></a></li> <li><a href="#module_utils/generation.ForcedBOSTokenLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a> ⇒ <code>Object</code></li></ul></li> <li><a href="#module_utils/generation.ForcedEOSTokenLogitsProcessor">.ForcedEOSTokenLogitsProcessor</a> ⇐ <code>LogitsProcessor</code><ul><li><a href="#new_module_utils/generation.ForcedEOSTokenLogitsProcessor_new"><code>new ForcedEOSTokenLogitsProcessor(max_length, forced_eos_token_id)</code></a></li> <li><a href="#module_utils/generation.ForcedEOSTokenLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a></li></ul></li> <li><a href="#module_utils/generation.SuppressTokensAtBeginLogitsProcessor">.SuppressTokensAtBeginLogitsProcessor</a> ⇐ <code>LogitsProcessor</code><ul><li><a href="#new_module_utils/generation.SuppressTokensAtBeginLogitsProcessor_new"><code>new SuppressTokensAtBeginLogitsProcessor(begin_suppress_tokens, begin_index)</code></a></li> <li><a href="#module_utils/generation.SuppressTokensAtBeginLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a> ⇒ <code>Object</code></li></ul></li> <li><a href="#module_utils/generation.WhisperTimeStampLogitsProcessor">.WhisperTimeStampLogitsProcessor</a> ⇐ <code>LogitsProcessor</code><ul><li><a href="#new_module_utils/generation.WhisperTimeStampLogitsProcessor_new"><code>new WhisperTimeStampLogitsProcessor(generate_config)</code></a></li> <li><a href="#module_utils/generation.WhisperTimeStampLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a> ⇒ <code>Tensor</code></li></ul></li> <li><a href="#module_utils/generation.NoRepeatNGramLogitsProcessor">.NoRepeatNGramLogitsProcessor</a> ⇐ <code>LogitsProcessor</code><ul><li><a href="#new_module_utils/generation.NoRepeatNGramLogitsProcessor_new"><code>new NoRepeatNGramLogitsProcessor(no_repeat_ngram_size)</code></a></li> <li><a href="#module_utils/generation.NoRepeatNGramLogitsProcessor+getNgrams"><code>.getNgrams(prevInputIds)</code></a> ⇒ <code>Map.<string, Array<number>></code></li> <li><a href="#module_utils/generation.NoRepeatNGramLogitsProcessor+getGeneratedNgrams"><code>.getGeneratedNgrams(bannedNgrams, prevInputIds)</code></a> ⇒ <code>Array.<number></code></li> <li><a href="#module_utils/generation.NoRepeatNGramLogitsProcessor+calcBannedNgramTokens"><code>.calcBannedNgramTokens(prevInputIds)</code></a> ⇒ <code>Array.<number></code></li> <li><a href="#module_utils/generation.NoRepeatNGramLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a> ⇒ <code>Object</code></li></ul></li> <li><a href="#module_utils/generation.RepetitionPenaltyLogitsProcessor">.RepetitionPenaltyLogitsProcessor</a> ⇐ <code>LogitsProcessor</code><ul><li><a href="#new_module_utils/generation.RepetitionPenaltyLogitsProcessor_new"><code>new RepetitionPenaltyLogitsProcessor(penalty)</code></a></li> <li><a href="#module_utils/generation.RepetitionPenaltyLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a> ⇒ <code>Object</code></li></ul></li> <li><a href="#module_utils/generation.MinLengthLogitsProcessor">.MinLengthLogitsProcessor</a> ⇐ <code>LogitsProcessor</code><ul><li><a href="#new_module_utils/generation.MinLengthLogitsProcessor_new"><code>new MinLengthLogitsProcessor(min_length, eos_token_id)</code></a></li> <li><a href="#module_utils/generation.MinLengthLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a> ⇒ <code>Object</code></li></ul></li> <li><a href="#module_utils/generation.MinNewTokensLengthLogitsProcessor">.MinNewTokensLengthLogitsProcessor</a> ⇐ <code>LogitsProcessor</code><ul><li><a href="#new_module_utils/generation.MinNewTokensLengthLogitsProcessor_new"><code>new MinNewTokensLengthLogitsProcessor(prompt_length_to_skip, min_new_tokens, eos_token_id)</code></a></li> <li><a href="#module_utils/generation.MinNewTokensLengthLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a> ⇒ <code>Object</code></li></ul></li> <li><a href="#module_utils/generation.NoBadWordsLogitsProcessor">.NoBadWordsLogitsProcessor</a><ul><li><a href="#new_module_utils/generation.NoBadWordsLogitsProcessor_new"><code>new NoBadWordsLogitsProcessor(bad_words_ids, eos_token_id)</code></a></li> <li><a href="#module_utils/generation.NoBadWordsLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a> ⇒ <code>Object</code></li></ul></li> <li><a href="#module_utils/generation.Sampler">.Sampler</a><ul><li><a href="#new_module_utils/generation.Sampler_new"><code>new Sampler(generation_config)</code></a></li> <li><em>instance</em><ul><li><a href="#module_utils/generation.Sampler+_call"><code>._call(logits, index)</code></a> ⇒ <code>void</code></li> <li><a href="#module_utils/generation.Sampler+sample"><code>.sample(logits, index)</code></a></li> <li><a href="#module_utils/generation.Sampler+getLogits"><code>.getLogits(logits, index)</code></a> ⇒ <code>Float32Array</code></li> <li><a href="#module_utils/generation.Sampler+randomSelect"><code>.randomSelect(probabilities)</code></a> ⇒ <code>number</code></li></ul></li> <li><em>static</em><ul><li><a href="#module_utils/generation.Sampler.getSampler"><code>.getSampler(generation_config)</code></a> ⇒ <code>Sampler</code></li></ul></li></ul></li> <li><a href="#module_utils/generation.GenerationConfig"><code>.GenerationConfig</code></a> : <code>*</code></li></ul></li> <li><em>inner</em><ul><li><a href="#module_utils/generation..GenerationConfig">~GenerationConfig</a><ul><li><a href="#new_module_utils/generation..GenerationConfig_new"><code>new GenerationConfig(kwargs)</code></a></li></ul></li> <li><a href="#module_utils/generation..GreedySampler">~GreedySampler</a> ⇐ <code>Sampler</code><ul><li><a href="#module_utils/generation..GreedySampler+sample"><code>.sample(logits, [index])</code></a> ⇒ <code>Array</code></li></ul></li> <li><a href="#module_utils/generation..MultinomialSampler">~MultinomialSampler</a> ⇐ <code>Sampler</code><ul><li><a href="#module_utils/generation..MultinomialSampler+sample"><code>.sample(logits, index)</code></a> ⇒ <code>Array</code></li></ul></li> <li><a href="#module_utils/generation..BeamSearchSampler">~BeamSearchSampler</a> ⇐ <code>Sampler</code><ul><li><a href="#module_utils/generation..BeamSearchSampler+sample"><code>.sample(logits, index)</code></a> ⇒ <code>Array</code></li></ul></li> <li><a href="#module_utils/generation..GenerationConfigType"><code>~GenerationConfigType</code></a> : <code>Object</code></li></ul></li></ul></li></ul> <hr> <a id="module_utils/generation.LogitsProcessorList" class="group"></a> <h2 class="relative group"><a id="utilsgenerationlogitsprocessorlist--code-callable-code" 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" href="#utilsgenerationlogitsprocessorlist--code-callable-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>utils/generation.LogitsProcessorList ⇐ <code> Callable </code></span></h2> <p data-svelte-h="svelte-3s9f37">A class representing a list of logits processors. A logits processor is a function that modifies the logits | |
| output of a language model. This class provides methods for adding new processors and applying all processors to a | |
| batch of logits.</p> <p data-svelte-h="svelte-2xq34v"><strong>Kind</strong>: static class of <a href="#module_utils/generation"><code>utils/generation</code></a><br> <strong>Extends</strong>: <code>Callable</code></p> <ul data-svelte-h="svelte-a0tc84"><li><a href="#module_utils/generation.LogitsProcessorList">.LogitsProcessorList</a> ⇐ <code>Callable</code><ul><li><a href="#new_module_utils/generation.LogitsProcessorList_new"><code>new LogitsProcessorList()</code></a></li> <li><a href="#module_utils/generation.LogitsProcessorList+push"><code>.push(item)</code></a></li> <li><a href="#module_utils/generation.LogitsProcessorList+extend"><code>.extend(items)</code></a></li> <li><a href="#module_utils/generation.LogitsProcessorList+_call"><code>._call(input_ids, batchedLogits)</code></a></li></ul></li></ul> <hr> <a id="new_module_utils/generation.LogitsProcessorList_new" class="group"></a> <h3 class="relative group"><a id="new-logitsprocessorlist" 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" href="#new-logitsprocessorlist"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new LogitsProcessorList()</span></h3> <p data-svelte-h="svelte-7qo2qs">Constructs a new instance of <code>LogitsProcessorList</code>.</p> <hr> <a id="module_utils/generation.LogitsProcessorList+push" class="group"></a> <h3 class="relative group"><a id="logitsprocessorlistpushitem" 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" href="#logitsprocessorlistpushitem"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>logitsProcessorList.push(item)</span></h3> <p data-svelte-h="svelte-y2lyqr">Adds a new logits processor to the list.</p> <p data-svelte-h="svelte-ye1us2"><strong>Kind</strong>: instance method of <a href="#module_utils/generation.LogitsProcessorList"><code>LogitsProcessorList</code></a></p> <table data-svelte-h="svelte-wth0th"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>item</td><td><code>LogitsProcessor</code></td><td><p>The logits processor function to add.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.LogitsProcessorList+extend" class="group"></a> <h3 class="relative group"><a id="logitsprocessorlistextenditems" 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" href="#logitsprocessorlistextenditems"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>logitsProcessorList.extend(items)</span></h3> <p data-svelte-h="svelte-19ybhdd">Adds multiple logits processors to the list.</p> <p data-svelte-h="svelte-ye1us2"><strong>Kind</strong>: instance method of <a href="#module_utils/generation.LogitsProcessorList"><code>LogitsProcessorList</code></a></p> <table data-svelte-h="svelte-qfvccr"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>items</td><td><code>Array.<LogitsProcessor></code></td><td><p>The logits processor functions to add.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.LogitsProcessorList+_call" class="group"></a> <h3 class="relative group"><a id="logitsprocessorlistcallinputids-batchedlogits" 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" href="#logitsprocessorlistcallinputids-batchedlogits"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>logitsProcessorList._call(input_ids, batchedLogits)</span></h3> <p data-svelte-h="svelte-1a5adsy">Applies all logits processors in the list to a batch of logits, modifying them in-place.</p> <p data-svelte-h="svelte-ye1us2"><strong>Kind</strong>: instance method of <a href="#module_utils/generation.LogitsProcessorList"><code>LogitsProcessorList</code></a></p> <table data-svelte-h="svelte-afve8l"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>input_ids</td><td><code>Array.<number></code></td><td><p>The input IDs for the language model.</p></td> </tr><tr><td>batchedLogits</td><td><code>Array.<Array<number>></code></td><td><p>A 2D array of logits, where each row corresponds to a single | |
| input sequence in the batch.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.LogitsProcessor" class="group"></a> <h2 class="relative group"><a id="utilsgenerationlogitsprocessor--code-callable-code" 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" href="#utilsgenerationlogitsprocessor--code-callable-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>utils/generation.LogitsProcessor ⇐ <code> Callable </code></span></h2> <p data-svelte-h="svelte-1skhj6b">Base class for processing logits.</p> <p data-svelte-h="svelte-2xq34v"><strong>Kind</strong>: static class of <a href="#module_utils/generation"><code>utils/generation</code></a><br> <strong>Extends</strong>: <code>Callable</code></p> <hr> <a id="module_utils/generation.LogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="logitsprocessorcallinputids-logits" 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" href="#logitsprocessorcallinputids-logits"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>logitsProcessor._call(input_ids, logits)</span></h3> <p data-svelte-h="svelte-pof7bn">Apply the processor to the input logits.</p> <p data-svelte-h="svelte-1v7ihvu"><strong>Kind</strong>: instance abstract method of <a href="#module_utils/generation.LogitsProcessor"><code>LogitsProcessor</code></a><br> <strong>Throws</strong>:</p> <ul data-svelte-h="svelte-1881dk3"><li><code>Error</code> Throws an error if `_call` is not implemented in the subclass.</li></ul> <table data-svelte-h="svelte-znwo1g"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>input_ids</td><td><code>Array</code></td><td><p>The input ids.</p></td> </tr><tr><td>logits</td><td><code>Tensor</code></td><td><p>The logits to process.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.ForceTokensLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="utilsgenerationforcetokenslogitsprocessor--code-logitsprocessor-code" 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" href="#utilsgenerationforcetokenslogitsprocessor--code-logitsprocessor-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>utils/generation.ForceTokensLogitsProcessor ⇐ <code> LogitsProcessor </code></span></h2> <p data-svelte-h="svelte-1d43oth">A logits processor that forces a specific token to be generated by the decoder.</p> <p data-svelte-h="svelte-9hwh5b"><strong>Kind</strong>: static class of <a href="#module_utils/generation"><code>utils/generation</code></a><br> <strong>Extends</strong>: <code>LogitsProcessor</code></p> <ul data-svelte-h="svelte-8mww04"><li><a href="#module_utils/generation.ForceTokensLogitsProcessor">.ForceTokensLogitsProcessor</a> ⇐ <code>LogitsProcessor</code><ul><li><a href="#new_module_utils/generation.ForceTokensLogitsProcessor_new"><code>new ForceTokensLogitsProcessor(forced_decoder_ids)</code></a></li> <li><a href="#module_utils/generation.ForceTokensLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a> ⇒ <code>Tensor</code></li></ul></li></ul> <hr> <a id="new_module_utils/generation.ForceTokensLogitsProcessor_new" class="group"></a> <h3 class="relative group"><a id="new-forcetokenslogitsprocessorforceddecoderids" 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" href="#new-forcetokenslogitsprocessorforceddecoderids"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new ForceTokensLogitsProcessor(forced_decoder_ids)</span></h3> <p data-svelte-h="svelte-1shgsb3">Constructs a new instance of <code>ForceTokensLogitsProcessor</code>.</p> <table data-svelte-h="svelte-wcljf3"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>forced_decoder_ids</td><td><code>Array</code></td><td><p>The ids of tokens that should be forced.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.ForceTokensLogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="forcetokenslogitsprocessorcallinputids-logits--code-tensor-code" 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" href="#forcetokenslogitsprocessorcallinputids-logits--code-tensor-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>forceTokensLogitsProcessor._call(input_ids, logits) ⇒ <code> Tensor </code></span></h3> <p data-svelte-h="svelte-pof7bn">Apply the processor to the input logits.</p> <p data-svelte-h="svelte-1fawzos"><strong>Kind</strong>: instance method of <a href="#module_utils/generation.ForceTokensLogitsProcessor"><code>ForceTokensLogitsProcessor</code></a><br> <strong>Returns</strong>: <code>Tensor</code> - The processed logits.</p> <table data-svelte-h="svelte-znwo1g"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>input_ids</td><td><code>Array</code></td><td><p>The input ids.</p></td> </tr><tr><td>logits</td><td><code>Tensor</code></td><td><p>The logits to process.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.ForcedBOSTokenLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="utilsgenerationforcedbostokenlogitsprocessor--code-logitsprocessor-code" 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" href="#utilsgenerationforcedbostokenlogitsprocessor--code-logitsprocessor-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>utils/generation.ForcedBOSTokenLogitsProcessor ⇐ <code> LogitsProcessor </code></span></h2> <p data-svelte-h="svelte-o4hur7">A LogitsProcessor that forces a BOS token at the beginning of the generated sequence.</p> <p data-svelte-h="svelte-9hwh5b"><strong>Kind</strong>: static class of <a href="#module_utils/generation"><code>utils/generation</code></a><br> <strong>Extends</strong>: <code>LogitsProcessor</code></p> <ul data-svelte-h="svelte-1p5owii"><li><a href="#module_utils/generation.ForcedBOSTokenLogitsProcessor">.ForcedBOSTokenLogitsProcessor</a> ⇐ <code>LogitsProcessor</code><ul><li><a href="#new_module_utils/generation.ForcedBOSTokenLogitsProcessor_new"><code>new ForcedBOSTokenLogitsProcessor(bos_token_id)</code></a></li> <li><a href="#module_utils/generation.ForcedBOSTokenLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a> ⇒ <code>Object</code></li></ul></li></ul> <hr> <a id="new_module_utils/generation.ForcedBOSTokenLogitsProcessor_new" class="group"></a> <h3 class="relative group"><a id="new-forcedbostokenlogitsprocessorbostokenid" 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" href="#new-forcedbostokenlogitsprocessorbostokenid"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new ForcedBOSTokenLogitsProcessor(bos_token_id)</span></h3> <p data-svelte-h="svelte-1gtxb4f">Create a ForcedBOSTokenLogitsProcessor.</p> <table data-svelte-h="svelte-5i4wcj"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>bos_token_id</td><td><code>number</code></td><td><p>The ID of the beginning-of-sequence token to be forced.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.ForcedBOSTokenLogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="forcedbostokenlogitsprocessorcallinputids-logits--code-object-code" 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" href="#forcedbostokenlogitsprocessorcallinputids-logits--code-object-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>forcedBOSTokenLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code></span></h3> <p data-svelte-h="svelte-uhajj6">Apply the BOS token forcing to the logits.</p> <p data-svelte-h="svelte-1ljjg3x"><strong>Kind</strong>: instance method of <a href="#module_utils/generation.ForcedBOSTokenLogitsProcessor"><code>ForcedBOSTokenLogitsProcessor</code></a><br> <strong>Returns</strong>: <code>Object</code> - The logits with BOS token forcing.</p> <table data-svelte-h="svelte-aks9lu"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>input_ids</td><td><code>Array</code></td><td><p>The input IDs.</p></td> </tr><tr><td>logits</td><td><code>Object</code></td><td><p>The logits.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.ForcedEOSTokenLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="utilsgenerationforcedeostokenlogitsprocessor--code-logitsprocessor-code" 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" href="#utilsgenerationforcedeostokenlogitsprocessor--code-logitsprocessor-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>utils/generation.ForcedEOSTokenLogitsProcessor ⇐ <code> LogitsProcessor </code></span></h2> <p data-svelte-h="svelte-13qkt8b">A logits processor that forces end-of-sequence token probability to 1.</p> <p data-svelte-h="svelte-9hwh5b"><strong>Kind</strong>: static class of <a href="#module_utils/generation"><code>utils/generation</code></a><br> <strong>Extends</strong>: <code>LogitsProcessor</code></p> <ul data-svelte-h="svelte-1kyyz39"><li><a href="#module_utils/generation.ForcedEOSTokenLogitsProcessor">.ForcedEOSTokenLogitsProcessor</a> ⇐ <code>LogitsProcessor</code><ul><li><a href="#new_module_utils/generation.ForcedEOSTokenLogitsProcessor_new"><code>new ForcedEOSTokenLogitsProcessor(max_length, forced_eos_token_id)</code></a></li> <li><a href="#module_utils/generation.ForcedEOSTokenLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a></li></ul></li></ul> <hr> <a id="new_module_utils/generation.ForcedEOSTokenLogitsProcessor_new" class="group"></a> <h3 class="relative group"><a id="new-forcedeostokenlogitsprocessormaxlength-forcedeostokenid" 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" href="#new-forcedeostokenlogitsprocessormaxlength-forcedeostokenid"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new ForcedEOSTokenLogitsProcessor(max_length, forced_eos_token_id)</span></h3> <p data-svelte-h="svelte-16ugs6s">Create a ForcedEOSTokenLogitsProcessor.</p> <table data-svelte-h="svelte-ahgedn"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>max_length</td><td><code>number</code></td><td><p>Max length of the sequence.</p></td> </tr><tr><td>forced_eos_token_id</td><td><code>number</code> | <code>Array<number></code></td><td><p>The ID of the end-of-sequence token to be forced.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.ForcedEOSTokenLogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="forcedeostokenlogitsprocessorcallinputids-logits" 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" href="#forcedeostokenlogitsprocessorcallinputids-logits"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>forcedEOSTokenLogitsProcessor._call(input_ids, logits)</span></h3> <p data-svelte-h="svelte-2wlv12">Apply the processor to input_ids and logits.</p> <p data-svelte-h="svelte-9znmwc"><strong>Kind</strong>: instance method of <a href="#module_utils/generation.ForcedEOSTokenLogitsProcessor"><code>ForcedEOSTokenLogitsProcessor</code></a></p> <table data-svelte-h="svelte-je9vmv"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>input_ids</td><td><code>Array.<number></code></td><td><p>The input ids.</p></td> </tr><tr><td>logits</td><td><code>Tensor</code></td><td><p>The logits tensor.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.SuppressTokensAtBeginLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="utilsgenerationsuppresstokensatbeginlogitsprocessor--code-logitsprocessor-code" 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" href="#utilsgenerationsuppresstokensatbeginlogitsprocessor--code-logitsprocessor-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>utils/generation.SuppressTokensAtBeginLogitsProcessor ⇐ <code> LogitsProcessor </code></span></h2> <p data-svelte-h="svelte-5s9hr2">A LogitsProcessor that suppresses a list of tokens as soon as the <code>generate</code> function starts | |
| generating using <code>begin_index</code> tokens. This should ensure that the tokens defined by | |
| <code>begin_suppress_tokens</code> at not sampled at the begining of the generation.</p> <p data-svelte-h="svelte-9hwh5b"><strong>Kind</strong>: static class of <a href="#module_utils/generation"><code>utils/generation</code></a><br> <strong>Extends</strong>: <code>LogitsProcessor</code></p> <ul data-svelte-h="svelte-1otb2bz"><li><a href="#module_utils/generation.SuppressTokensAtBeginLogitsProcessor">.SuppressTokensAtBeginLogitsProcessor</a> ⇐ <code>LogitsProcessor</code><ul><li><a href="#new_module_utils/generation.SuppressTokensAtBeginLogitsProcessor_new"><code>new SuppressTokensAtBeginLogitsProcessor(begin_suppress_tokens, begin_index)</code></a></li> <li><a href="#module_utils/generation.SuppressTokensAtBeginLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a> ⇒ <code>Object</code></li></ul></li></ul> <hr> <a id="new_module_utils/generation.SuppressTokensAtBeginLogitsProcessor_new" class="group"></a> <h3 class="relative group"><a id="new-suppresstokensatbeginlogitsprocessorbeginsuppresstokens-beginindex" 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" href="#new-suppresstokensatbeginlogitsprocessorbeginsuppresstokens-beginindex"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new SuppressTokensAtBeginLogitsProcessor(begin_suppress_tokens, begin_index)</span></h3> <p data-svelte-h="svelte-459vk0">Create a SuppressTokensAtBeginLogitsProcessor.</p> <table data-svelte-h="svelte-rmc35r"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>begin_suppress_tokens</td><td><code>Array.<number></code></td><td><p>The IDs of the tokens to suppress.</p></td> </tr><tr><td>begin_index</td><td><code>number</code></td><td><p>The number of tokens to generate before suppressing tokens.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.SuppressTokensAtBeginLogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="suppresstokensatbeginlogitsprocessorcallinputids-logits--code-object-code" 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" href="#suppresstokensatbeginlogitsprocessorcallinputids-logits--code-object-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>suppressTokensAtBeginLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code></span></h3> <p data-svelte-h="svelte-uhajj6">Apply the BOS token forcing to the logits.</p> <p data-svelte-h="svelte-ysooxp"><strong>Kind</strong>: instance method of <a href="#module_utils/generation.SuppressTokensAtBeginLogitsProcessor"><code>SuppressTokensAtBeginLogitsProcessor</code></a><br> <strong>Returns</strong>: <code>Object</code> - The logits with BOS token forcing.</p> <table data-svelte-h="svelte-aks9lu"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>input_ids</td><td><code>Array</code></td><td><p>The input IDs.</p></td> </tr><tr><td>logits</td><td><code>Object</code></td><td><p>The logits.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.WhisperTimeStampLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="utilsgenerationwhispertimestamplogitsprocessor--code-logitsprocessor-code" 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" href="#utilsgenerationwhispertimestamplogitsprocessor--code-logitsprocessor-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>utils/generation.WhisperTimeStampLogitsProcessor ⇐ <code> LogitsProcessor </code></span></h2> <p data-svelte-h="svelte-7cf1c8">A LogitsProcessor that handles adding timestamps to generated text.</p> <p data-svelte-h="svelte-9hwh5b"><strong>Kind</strong>: static class of <a href="#module_utils/generation"><code>utils/generation</code></a><br> <strong>Extends</strong>: <code>LogitsProcessor</code></p> <ul data-svelte-h="svelte-1df9ntq"><li><a href="#module_utils/generation.WhisperTimeStampLogitsProcessor">.WhisperTimeStampLogitsProcessor</a> ⇐ <code>LogitsProcessor</code><ul><li><a href="#new_module_utils/generation.WhisperTimeStampLogitsProcessor_new"><code>new WhisperTimeStampLogitsProcessor(generate_config)</code></a></li> <li><a href="#module_utils/generation.WhisperTimeStampLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a> ⇒ <code>Tensor</code></li></ul></li></ul> <hr> <a id="new_module_utils/generation.WhisperTimeStampLogitsProcessor_new" class="group"></a> <h3 class="relative group"><a id="new-whispertimestamplogitsprocessorgenerateconfig" 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" href="#new-whispertimestamplogitsprocessorgenerateconfig"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new WhisperTimeStampLogitsProcessor(generate_config)</span></h3> <p data-svelte-h="svelte-h97ofl">Constructs a new WhisperTimeStampLogitsProcessor.</p> <table data-svelte-h="svelte-ouguny"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>generate_config</td><td><code>Object</code></td><td><p>The config object passed to the <code>generate()</code> method of a transformer model.</p></td> </tr><tr><td>generate_config.eos_token_id</td><td><code>number</code></td><td><p>The ID of the end-of-sequence token.</p></td> </tr><tr><td>generate_config.no_timestamps_token_id</td><td><code>number</code></td><td><p>The ID of the token used to indicate that a token should not have a timestamp.</p></td> </tr><tr><td>[generate_config.forced_decoder_ids]</td><td><code>Array.<Array<number>></code></td><td><p>An array of two-element arrays representing decoder IDs that are forced to appear in the output. The second element of each array indicates whether the token is a timestamp.</p></td> </tr><tr><td>[generate_config.max_initial_timestamp_index]</td><td><code>number</code></td><td><p>The maximum index at which an initial timestamp can appear.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.WhisperTimeStampLogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="whispertimestamplogitsprocessorcallinputids-logits--code-tensor-code" 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" href="#whispertimestamplogitsprocessorcallinputids-logits--code-tensor-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>whisperTimeStampLogitsProcessor._call(input_ids, logits) ⇒ <code> Tensor </code></span></h3> <p data-svelte-h="svelte-t6pj9i">Modify the logits to handle timestamp tokens.</p> <p data-svelte-h="svelte-1ba862j"><strong>Kind</strong>: instance method of <a href="#module_utils/generation.WhisperTimeStampLogitsProcessor"><code>WhisperTimeStampLogitsProcessor</code></a><br> <strong>Returns</strong>: <code>Tensor</code> - The modified logits.</p> <table data-svelte-h="svelte-1i9o6ca"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>input_ids</td><td><code>Array</code></td><td><p>The input sequence of tokens.</p></td> </tr><tr><td>logits</td><td><code>Tensor</code></td><td><p>The logits output by the model.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.NoRepeatNGramLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="utilsgenerationnorepeatngramlogitsprocessor--code-logitsprocessor-code" 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" href="#utilsgenerationnorepeatngramlogitsprocessor--code-logitsprocessor-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>utils/generation.NoRepeatNGramLogitsProcessor ⇐ <code> LogitsProcessor </code></span></h2> <p data-svelte-h="svelte-1nbhk1j">A logits processor that disallows ngrams of a certain size to be repeated.</p> <p data-svelte-h="svelte-9hwh5b"><strong>Kind</strong>: static class of <a href="#module_utils/generation"><code>utils/generation</code></a><br> <strong>Extends</strong>: <code>LogitsProcessor</code></p> <ul data-svelte-h="svelte-bbnk9b"><li><a href="#module_utils/generation.NoRepeatNGramLogitsProcessor">.NoRepeatNGramLogitsProcessor</a> ⇐ <code>LogitsProcessor</code><ul><li><a href="#new_module_utils/generation.NoRepeatNGramLogitsProcessor_new"><code>new NoRepeatNGramLogitsProcessor(no_repeat_ngram_size)</code></a></li> <li><a href="#module_utils/generation.NoRepeatNGramLogitsProcessor+getNgrams"><code>.getNgrams(prevInputIds)</code></a> ⇒ <code>Map.<string, Array<number>></code></li> <li><a href="#module_utils/generation.NoRepeatNGramLogitsProcessor+getGeneratedNgrams"><code>.getGeneratedNgrams(bannedNgrams, prevInputIds)</code></a> ⇒ <code>Array.<number></code></li> <li><a href="#module_utils/generation.NoRepeatNGramLogitsProcessor+calcBannedNgramTokens"><code>.calcBannedNgramTokens(prevInputIds)</code></a> ⇒ <code>Array.<number></code></li> <li><a href="#module_utils/generation.NoRepeatNGramLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a> ⇒ <code>Object</code></li></ul></li></ul> <hr> <a id="new_module_utils/generation.NoRepeatNGramLogitsProcessor_new" class="group"></a> <h3 class="relative group"><a id="new-norepeatngramlogitsprocessornorepeatngramsize" 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" href="#new-norepeatngramlogitsprocessornorepeatngramsize"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new NoRepeatNGramLogitsProcessor(no_repeat_ngram_size)</span></h3> <p data-svelte-h="svelte-ztp378">Create a NoRepeatNGramLogitsProcessor.</p> <table data-svelte-h="svelte-1oeknti"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>no_repeat_ngram_size</td><td><code>number</code></td><td><p>The no-repeat-ngram size. All ngrams of this size can only occur once.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.NoRepeatNGramLogitsProcessor+getNgrams" class="group"></a> <h3 class="relative group"><a id="norepeatngramlogitsprocessorgetngramsprevinputids--code-map--string-array--number---code" 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" href="#norepeatngramlogitsprocessorgetngramsprevinputids--code-map--string-array--number---code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>noRepeatNGramLogitsProcessor.getNgrams(prevInputIds) ⇒ <code> Map. < string, Array < number > > </code></span></h3> <p data-svelte-h="svelte-kezmb4">Generate n-grams from a sequence of token ids.</p> <p data-svelte-h="svelte-4618wm"><strong>Kind</strong>: instance method of <a href="#module_utils/generation.NoRepeatNGramLogitsProcessor"><code>NoRepeatNGramLogitsProcessor</code></a><br> <strong>Returns</strong>: <code>Map.<string, Array<number>></code> - Map of generated n-grams</p> <table data-svelte-h="svelte-7hcqif"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>prevInputIds</td><td><code>Array.<number></code></td><td><p>List of previous input ids</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.NoRepeatNGramLogitsProcessor+getGeneratedNgrams" class="group"></a> <h3 class="relative group"><a id="norepeatngramlogitsprocessorgetgeneratedngramsbannedngrams-previnputids--code-array--number--code" 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" href="#norepeatngramlogitsprocessorgetgeneratedngramsbannedngrams-previnputids--code-array--number--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>noRepeatNGramLogitsProcessor.getGeneratedNgrams(bannedNgrams, prevInputIds) ⇒ <code> Array. < number > </code></span></h3> <p data-svelte-h="svelte-kezmb4">Generate n-grams from a sequence of token ids.</p> <p data-svelte-h="svelte-56j6v5"><strong>Kind</strong>: instance method of <a href="#module_utils/generation.NoRepeatNGramLogitsProcessor"><code>NoRepeatNGramLogitsProcessor</code></a><br> <strong>Returns</strong>: <code>Array.<number></code> - Map of generated n-grams</p> <table data-svelte-h="svelte-12kqlqq"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>bannedNgrams</td><td><code>Map.<string, Array<number>></code></td><td><p>Map of banned n-grams</p></td> </tr><tr><td>prevInputIds</td><td><code>Array.<number></code></td><td><p>List of previous input ids</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.NoRepeatNGramLogitsProcessor+calcBannedNgramTokens" class="group"></a> <h3 class="relative group"><a id="norepeatngramlogitsprocessorcalcbannedngramtokensprevinputids--code-array--number--code" 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" href="#norepeatngramlogitsprocessorcalcbannedngramtokensprevinputids--code-array--number--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>noRepeatNGramLogitsProcessor.calcBannedNgramTokens(prevInputIds) ⇒ <code> Array. < number > </code></span></h3> <p data-svelte-h="svelte-i6fmo8">Calculate banned n-gram tokens</p> <p data-svelte-h="svelte-56j6v5"><strong>Kind</strong>: instance method of <a href="#module_utils/generation.NoRepeatNGramLogitsProcessor"><code>NoRepeatNGramLogitsProcessor</code></a><br> <strong>Returns</strong>: <code>Array.<number></code> - Map of generated n-grams</p> <table data-svelte-h="svelte-7hcqif"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>prevInputIds</td><td><code>Array.<number></code></td><td><p>List of previous input ids</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.NoRepeatNGramLogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="norepeatngramlogitsprocessorcallinputids-logits--code-object-code" 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" href="#norepeatngramlogitsprocessorcallinputids-logits--code-object-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>noRepeatNGramLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code></span></h3> <p data-svelte-h="svelte-ns64he">Apply the no-repeat-ngram processor to the logits.</p> <p data-svelte-h="svelte-eb379u"><strong>Kind</strong>: instance method of <a href="#module_utils/generation.NoRepeatNGramLogitsProcessor"><code>NoRepeatNGramLogitsProcessor</code></a><br> <strong>Returns</strong>: <code>Object</code> - The logits with no-repeat-ngram processing.</p> <table data-svelte-h="svelte-aks9lu"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>input_ids</td><td><code>Array</code></td><td><p>The input IDs.</p></td> </tr><tr><td>logits</td><td><code>Object</code></td><td><p>The logits.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.RepetitionPenaltyLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="utilsgenerationrepetitionpenaltylogitsprocessor--code-logitsprocessor-code" 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" href="#utilsgenerationrepetitionpenaltylogitsprocessor--code-logitsprocessor-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>utils/generation.RepetitionPenaltyLogitsProcessor ⇐ <code> LogitsProcessor </code></span></h2> <p data-svelte-h="svelte-1swjk5j">A logits processor that penalises repeated output tokens.</p> <p data-svelte-h="svelte-9hwh5b"><strong>Kind</strong>: static class of <a href="#module_utils/generation"><code>utils/generation</code></a><br> <strong>Extends</strong>: <code>LogitsProcessor</code></p> <ul data-svelte-h="svelte-8ptdd5"><li><a href="#module_utils/generation.RepetitionPenaltyLogitsProcessor">.RepetitionPenaltyLogitsProcessor</a> ⇐ <code>LogitsProcessor</code><ul><li><a href="#new_module_utils/generation.RepetitionPenaltyLogitsProcessor_new"><code>new RepetitionPenaltyLogitsProcessor(penalty)</code></a></li> <li><a href="#module_utils/generation.RepetitionPenaltyLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a> ⇒ <code>Object</code></li></ul></li></ul> <hr> <a id="new_module_utils/generation.RepetitionPenaltyLogitsProcessor_new" class="group"></a> <h3 class="relative group"><a id="new-repetitionpenaltylogitsprocessorpenalty" 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" href="#new-repetitionpenaltylogitsprocessorpenalty"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new RepetitionPenaltyLogitsProcessor(penalty)</span></h3> <p data-svelte-h="svelte-1miwk7z">Create a RepetitionPenaltyLogitsProcessor.</p> <table data-svelte-h="svelte-qogrf9"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>penalty</td><td><code>number</code></td><td><p>The penalty to apply for repeated tokens.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.RepetitionPenaltyLogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="repetitionpenaltylogitsprocessorcallinputids-logits--code-object-code" 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" href="#repetitionpenaltylogitsprocessorcallinputids-logits--code-object-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>repetitionPenaltyLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code></span></h3> <p data-svelte-h="svelte-ttelh1">Apply the repetition penalty to the logits.</p> <p data-svelte-h="svelte-1l9hzxj"><strong>Kind</strong>: instance method of <a href="#module_utils/generation.RepetitionPenaltyLogitsProcessor"><code>RepetitionPenaltyLogitsProcessor</code></a><br> <strong>Returns</strong>: <code>Object</code> - The logits with repetition penalty processing.</p> <table data-svelte-h="svelte-aks9lu"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>input_ids</td><td><code>Array</code></td><td><p>The input IDs.</p></td> </tr><tr><td>logits</td><td><code>Object</code></td><td><p>The logits.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.MinLengthLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="utilsgenerationminlengthlogitsprocessor--code-logitsprocessor-code" 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" href="#utilsgenerationminlengthlogitsprocessor--code-logitsprocessor-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>utils/generation.MinLengthLogitsProcessor ⇐ <code> LogitsProcessor </code></span></h2> <p data-svelte-h="svelte-9c4wc0">A logits processor that enforces a minimum number of tokens.</p> <p data-svelte-h="svelte-9hwh5b"><strong>Kind</strong>: static class of <a href="#module_utils/generation"><code>utils/generation</code></a><br> <strong>Extends</strong>: <code>LogitsProcessor</code></p> <ul data-svelte-h="svelte-5gysvm"><li><a href="#module_utils/generation.MinLengthLogitsProcessor">.MinLengthLogitsProcessor</a> ⇐ <code>LogitsProcessor</code><ul><li><a href="#new_module_utils/generation.MinLengthLogitsProcessor_new"><code>new MinLengthLogitsProcessor(min_length, eos_token_id)</code></a></li> <li><a href="#module_utils/generation.MinLengthLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a> ⇒ <code>Object</code></li></ul></li></ul> <hr> <a id="new_module_utils/generation.MinLengthLogitsProcessor_new" class="group"></a> <h3 class="relative group"><a id="new-minlengthlogitsprocessorminlength-eostokenid" 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" href="#new-minlengthlogitsprocessorminlength-eostokenid"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new MinLengthLogitsProcessor(min_length, eos_token_id)</span></h3> <p data-svelte-h="svelte-1m5mw53">Create a MinLengthLogitsProcessor.</p> <table data-svelte-h="svelte-1glhq7b"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>min_length</td><td><code>number</code></td><td><p>The minimum length below which the score of <code>eos_token_id</code> is set to negative infinity.</p></td> </tr><tr><td>eos_token_id</td><td><code>number</code> | <code>Array<number></code></td><td><p>The ID/IDs of the end-of-sequence token.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.MinLengthLogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="minlengthlogitsprocessorcallinputids-logits--code-object-code" 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" href="#minlengthlogitsprocessorcallinputids-logits--code-object-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>minLengthLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code></span></h3> <p data-svelte-h="svelte-uo9cbt">Apply logit processor.</p> <p data-svelte-h="svelte-r6npgs"><strong>Kind</strong>: instance method of <a href="#module_utils/generation.MinLengthLogitsProcessor"><code>MinLengthLogitsProcessor</code></a><br> <strong>Returns</strong>: <code>Object</code> - The processed logits.</p> <table data-svelte-h="svelte-aks9lu"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>input_ids</td><td><code>Array</code></td><td><p>The input IDs.</p></td> </tr><tr><td>logits</td><td><code>Object</code></td><td><p>The logits.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.MinNewTokensLengthLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="utilsgenerationminnewtokenslengthlogitsprocessor--code-logitsprocessor-code" 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" href="#utilsgenerationminnewtokenslengthlogitsprocessor--code-logitsprocessor-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>utils/generation.MinNewTokensLengthLogitsProcessor ⇐ <code> LogitsProcessor </code></span></h2> <p data-svelte-h="svelte-ozjzty">A logits processor that enforces a minimum number of new tokens.</p> <p data-svelte-h="svelte-9hwh5b"><strong>Kind</strong>: static class of <a href="#module_utils/generation"><code>utils/generation</code></a><br> <strong>Extends</strong>: <code>LogitsProcessor</code></p> <ul data-svelte-h="svelte-1ry7094"><li><a href="#module_utils/generation.MinNewTokensLengthLogitsProcessor">.MinNewTokensLengthLogitsProcessor</a> ⇐ <code>LogitsProcessor</code><ul><li><a href="#new_module_utils/generation.MinNewTokensLengthLogitsProcessor_new"><code>new MinNewTokensLengthLogitsProcessor(prompt_length_to_skip, min_new_tokens, eos_token_id)</code></a></li> <li><a href="#module_utils/generation.MinNewTokensLengthLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a> ⇒ <code>Object</code></li></ul></li></ul> <hr> <a id="new_module_utils/generation.MinNewTokensLengthLogitsProcessor_new" class="group"></a> <h3 class="relative group"><a id="new-minnewtokenslengthlogitsprocessorpromptlengthtoskip-minnewtokens-eostokenid" 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" href="#new-minnewtokenslengthlogitsprocessorpromptlengthtoskip-minnewtokens-eostokenid"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new MinNewTokensLengthLogitsProcessor(prompt_length_to_skip, min_new_tokens, eos_token_id)</span></h3> <p data-svelte-h="svelte-6z34lb">Create a MinNewTokensLengthLogitsProcessor.</p> <table data-svelte-h="svelte-1hv5g9s"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>prompt_length_to_skip</td><td><code>number</code></td><td><p>The input tokens length.</p></td> </tr><tr><td>min_new_tokens</td><td><code>number</code></td><td><p>The minimum <em>new</em> tokens length below which the score of <code>eos_token_id</code> is set to negative infinity.</p></td> </tr><tr><td>eos_token_id</td><td><code>number</code> | <code>Array<number></code></td><td><p>The ID/IDs of the end-of-sequence token.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.MinNewTokensLengthLogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="minnewtokenslengthlogitsprocessorcallinputids-logits--code-object-code" 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" href="#minnewtokenslengthlogitsprocessorcallinputids-logits--code-object-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>minNewTokensLengthLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code></span></h3> <p data-svelte-h="svelte-uo9cbt">Apply logit processor.</p> <p data-svelte-h="svelte-1o7er1i"><strong>Kind</strong>: instance method of <a href="#module_utils/generation.MinNewTokensLengthLogitsProcessor"><code>MinNewTokensLengthLogitsProcessor</code></a><br> <strong>Returns</strong>: <code>Object</code> - The processed logits.</p> <table data-svelte-h="svelte-aks9lu"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>input_ids</td><td><code>Array</code></td><td><p>The input IDs.</p></td> </tr><tr><td>logits</td><td><code>Object</code></td><td><p>The logits.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.NoBadWordsLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="utilsgenerationnobadwordslogitsprocessor" 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" href="#utilsgenerationnobadwordslogitsprocessor"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>utils/generation.NoBadWordsLogitsProcessor</span></h2> <p data-svelte-h="svelte-8k9dr4"><strong>Kind</strong>: static class of <a href="#module_utils/generation"><code>utils/generation</code></a></p> <ul data-svelte-h="svelte-3itsi1"><li><a href="#module_utils/generation.NoBadWordsLogitsProcessor">.NoBadWordsLogitsProcessor</a><ul><li><a href="#new_module_utils/generation.NoBadWordsLogitsProcessor_new"><code>new NoBadWordsLogitsProcessor(bad_words_ids, eos_token_id)</code></a></li> <li><a href="#module_utils/generation.NoBadWordsLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a> ⇒ <code>Object</code></li></ul></li></ul> <hr> <a id="new_module_utils/generation.NoBadWordsLogitsProcessor_new" class="group"></a> <h3 class="relative group"><a id="new-nobadwordslogitsprocessorbadwordsids-eostokenid" 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" href="#new-nobadwordslogitsprocessorbadwordsids-eostokenid"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new NoBadWordsLogitsProcessor(bad_words_ids, eos_token_id)</span></h3> <p data-svelte-h="svelte-1un5mwn">Create a <code>NoBadWordsLogitsProcessor</code>.</p> <table data-svelte-h="svelte-4hl4st"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>bad_words_ids</td><td><code>Array.<Array<number>></code></td><td><p>List of list of token ids that are not allowed to be generated.</p></td> </tr><tr><td>eos_token_id</td><td><code>number</code> | <code>Array<number></code></td><td><p>The id of the <em>end-of-sequence</em> token. Optionally, use a list to set multiple <em>end-of-sequence</em> tokens.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.NoBadWordsLogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="nobadwordslogitsprocessorcallinputids-logits--code-object-code" 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" href="#nobadwordslogitsprocessorcallinputids-logits--code-object-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>noBadWordsLogitsProcessor._call(input_ids, logits) ⇒ <code> Object </code></span></h3> <p data-svelte-h="svelte-uo9cbt">Apply logit processor.</p> <p data-svelte-h="svelte-1kfi162"><strong>Kind</strong>: instance method of <a href="#module_utils/generation.NoBadWordsLogitsProcessor"><code>NoBadWordsLogitsProcessor</code></a><br> <strong>Returns</strong>: <code>Object</code> - The processed logits.</p> <table data-svelte-h="svelte-aks9lu"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>input_ids</td><td><code>Array</code></td><td><p>The input IDs.</p></td> </tr><tr><td>logits</td><td><code>Object</code></td><td><p>The logits.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.Sampler" class="group"></a> <h2 class="relative group"><a id="utilsgenerationsampler" 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" href="#utilsgenerationsampler"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>utils/generation.Sampler</span></h2> <p data-svelte-h="svelte-p0jtpm">Sampler is a base class for all sampling methods used for text generation.</p> <p data-svelte-h="svelte-8k9dr4"><strong>Kind</strong>: static class of <a href="#module_utils/generation"><code>utils/generation</code></a></p> <ul data-svelte-h="svelte-bqzlxo"><li><a href="#module_utils/generation.Sampler">.Sampler</a><ul><li><a href="#new_module_utils/generation.Sampler_new"><code>new Sampler(generation_config)</code></a></li> <li><em>instance</em><ul><li><a href="#module_utils/generation.Sampler+_call"><code>._call(logits, index)</code></a> ⇒ <code>void</code></li> <li><a href="#module_utils/generation.Sampler+sample"><code>.sample(logits, index)</code></a></li> <li><a href="#module_utils/generation.Sampler+getLogits"><code>.getLogits(logits, index)</code></a> ⇒ <code>Float32Array</code></li> <li><a href="#module_utils/generation.Sampler+randomSelect"><code>.randomSelect(probabilities)</code></a> ⇒ <code>number</code></li></ul></li> <li><em>static</em><ul><li><a href="#module_utils/generation.Sampler.getSampler"><code>.getSampler(generation_config)</code></a> ⇒ <code>Sampler</code></li></ul></li></ul></li></ul> <hr> <a id="new_module_utils/generation.Sampler_new" class="group"></a> <h3 class="relative group"><a id="new-samplergenerationconfig" 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" href="#new-samplergenerationconfig"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new Sampler(generation_config)</span></h3> <p data-svelte-h="svelte-cx2gtq">Creates a new Sampler object with the specified generation config.</p> <table data-svelte-h="svelte-1i3f47n"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>generation_config</td><td><code>GenerationConfigType</code></td><td><p>The generation config.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.Sampler+_call" class="group"></a> <h3 class="relative group"><a id="samplercalllogits-index--code-void-code" 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" href="#samplercalllogits-index--code-void-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>sampler._call(logits, index) ⇒ <code> void </code></span></h3> <p data-svelte-h="svelte-18hhszu">Executes the sampler, using the specified logits.</p> <p data-svelte-h="svelte-1hkhr2u"><strong>Kind</strong>: instance method of <a href="#module_utils/generation.Sampler"><code>Sampler</code></a></p> <table data-svelte-h="svelte-1ks6oyq"><thead><tr><th>Param</th><th>Type</th></tr></thead> <tbody><tr><td>logits</td><td><code>Tensor</code></td> </tr><tr><td>index</td><td><code>number</code></td></tr></tbody></table> <hr> <a id="module_utils/generation.Sampler+sample" class="group"></a> <h3 class="relative group"><a id="samplersamplelogits-index" 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" href="#samplersamplelogits-index"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>sampler.sample(logits, index)</span></h3> <p data-svelte-h="svelte-mhsbvo">Abstract method for sampling the logits.</p> <p data-svelte-h="svelte-mok1bi"><strong>Kind</strong>: instance method of <a href="#module_utils/generation.Sampler"><code>Sampler</code></a><br> <strong>Throws</strong>:</p> <ul data-svelte-h="svelte-1ijvx2"><li><code>Error</code></li></ul> <table data-svelte-h="svelte-1ks6oyq"><thead><tr><th>Param</th><th>Type</th></tr></thead> <tbody><tr><td>logits</td><td><code>Tensor</code></td> </tr><tr><td>index</td><td><code>number</code></td></tr></tbody></table> <hr> <a id="module_utils/generation.Sampler+getLogits" class="group"></a> <h3 class="relative group"><a id="samplergetlogitslogits-index--code-float32array-code" 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" href="#samplergetlogitslogits-index--code-float32array-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>sampler.getLogits(logits, index) ⇒ <code> Float32Array </code></span></h3> <p data-svelte-h="svelte-1tthoub">Returns the specified logits as an array, with temperature applied.</p> <p data-svelte-h="svelte-1hkhr2u"><strong>Kind</strong>: instance method of <a href="#module_utils/generation.Sampler"><code>Sampler</code></a></p> <table data-svelte-h="svelte-1ks6oyq"><thead><tr><th>Param</th><th>Type</th></tr></thead> <tbody><tr><td>logits</td><td><code>Tensor</code></td> </tr><tr><td>index</td><td><code>number</code></td></tr></tbody></table> <hr> <a id="module_utils/generation.Sampler+randomSelect" class="group"></a> <h3 class="relative group"><a id="samplerrandomselectprobabilities--code-number-code" 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" href="#samplerrandomselectprobabilities--code-number-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>sampler.randomSelect(probabilities) ⇒ <code> number </code></span></h3> <p data-svelte-h="svelte-yywnzb">Selects an item randomly based on the specified probabilities.</p> <p data-svelte-h="svelte-1o7ozs"><strong>Kind</strong>: instance method of <a href="#module_utils/generation.Sampler"><code>Sampler</code></a><br> <strong>Returns</strong>: <code>number</code> - The index of the selected item.</p> <table data-svelte-h="svelte-415bxe"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>probabilities</td><td><code>Array</code></td><td><p>An array of probabilities to use for selection.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.Sampler.getSampler" class="group"></a> <h3 class="relative group"><a id="samplergetsamplergenerationconfig--code-sampler-code" 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" href="#samplergetsamplergenerationconfig--code-sampler-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Sampler.getSampler(generation_config) ⇒ <code> Sampler </code></span></h3> <p data-svelte-h="svelte-wl8u0w">Returns a Sampler object based on the specified options.</p> <p data-svelte-h="svelte-18j5rpb"><strong>Kind</strong>: static method of <a href="#module_utils/generation.Sampler"><code>Sampler</code></a><br> <strong>Returns</strong>: <code>Sampler</code> - A Sampler object.</p> <table data-svelte-h="svelte-2theuy"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>generation_config</td><td><code>GenerationConfigType</code></td><td><p>An object containing options for the sampler.</p></td></tr></tbody></table> <hr> <a id="module_utils/generation.GenerationConfig" class="group"></a> <h2 class="relative group"><a id="utilsgenerationgenerationconfig--code--code" 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" href="#utilsgenerationgenerationconfig--code--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>utils/generation.GenerationConfig : <code> * </code></span></h2> <p data-svelte-h="svelte-setd0x">Class that holds a configuration for a generation task.</p> <p data-svelte-h="svelte-zb4lr2"><strong>Kind</strong>: static constant of <a href="#module_utils/generation"><code>utils/generation</code></a></p> <hr> <a id="module_utils/generation..GenerationConfig" class="group"></a> <h2 class="relative group"><a id="utilsgenerationgenerationconfig" 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" href="#utilsgenerationgenerationconfig"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>utils/generation~GenerationConfig</span></h2> <p data-svelte-h="svelte-1az0pao"><strong>Kind</strong>: inner class of <a href="#module_utils/generation"><code>utils/generation</code></a></p> <hr> <a id="new_module_utils/generation..GenerationConfig_new" class="group"></a> <h3 class="relative group"><a id="new-generationconfigkwargs" 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" href="#new-generationconfigkwargs"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new GenerationConfig(kwargs)</span></h3> <p data-svelte-h="svelte-1yobo9c">Create a new GenerationConfig object.</p> <table data-svelte-h="svelte-1s66v"><thead><tr><th>Param</th><th>Type</th></tr></thead> <tbody><tr><td>kwargs</td><td><code>GenerationConfigType</code></td></tr></tbody></table> <hr> <a id="module_utils/generation..GreedySampler" class="group"></a> <h2 class="relative group"><a id="utilsgenerationgreedysampler--code-sampler-code" 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" href="#utilsgenerationgreedysampler--code-sampler-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>utils/generation~GreedySampler ⇐ <code> Sampler </code></span></h2> <p data-svelte-h="svelte-1pvj197">Class representing a Greedy Sampler.</p> <p data-svelte-h="svelte-1cm4lld"><strong>Kind</strong>: inner class of <a href="#module_utils/generation"><code>utils/generation</code></a><br> <strong>Extends</strong>: <code>Sampler</code></p> <hr> <a id="module_utils/generation..GreedySampler+sample" class="group"></a> <h3 class="relative group"><a id="greedysamplersamplelogits-index--code-array-code" 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" href="#greedysamplersamplelogits-index--code-array-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>greedySampler.sample(logits, [index]) ⇒ <code> Array </code></span></h3> <p data-svelte-h="svelte-1acvd9s">Sample the maximum probability of a given logits tensor.</p> <p data-svelte-h="svelte-dut2ci"><strong>Kind</strong>: instance method of <a href="#module_utils/generation..GreedySampler"><code>GreedySampler</code></a><br> <strong>Returns</strong>: <code>Array</code> - An array with a single tuple, containing the index of the maximum value and a meaningless score (since this is a greedy search).</p> <table data-svelte-h="svelte-tzng1p"><thead><tr><th>Param</th><th>Type</th><th>Default</th></tr></thead> <tbody><tr><td>logits</td><td><code>Tensor</code></td><td></td> </tr><tr><td>[index]</td><td><code>number</code></td><td><code>-1</code></td></tr></tbody></table> <hr> <a id="module_utils/generation..MultinomialSampler" class="group"></a> <h2 class="relative group"><a id="utilsgenerationmultinomialsampler--code-sampler-code" 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" href="#utilsgenerationmultinomialsampler--code-sampler-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>utils/generation~MultinomialSampler ⇐ <code> Sampler </code></span></h2> <p data-svelte-h="svelte-2u15u0">Class representing a MultinomialSampler.</p> <p data-svelte-h="svelte-1cm4lld"><strong>Kind</strong>: inner class of <a href="#module_utils/generation"><code>utils/generation</code></a><br> <strong>Extends</strong>: <code>Sampler</code></p> <hr> <a id="module_utils/generation..MultinomialSampler+sample" class="group"></a> <h3 class="relative group"><a id="multinomialsamplersamplelogits-index--code-array-code" 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" href="#multinomialsamplersamplelogits-index--code-array-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>multinomialSampler.sample(logits, index) ⇒ <code> Array </code></span></h3> <p data-svelte-h="svelte-1uart2f">Sample from the logits.</p> <p data-svelte-h="svelte-6rm4k"><strong>Kind</strong>: instance method of <a href="#module_utils/generation..MultinomialSampler"><code>MultinomialSampler</code></a></p> <table data-svelte-h="svelte-1ks6oyq"><thead><tr><th>Param</th><th>Type</th></tr></thead> <tbody><tr><td>logits</td><td><code>Tensor</code></td> </tr><tr><td>index</td><td><code>number</code></td></tr></tbody></table> <hr> <a id="module_utils/generation..BeamSearchSampler" class="group"></a> <h2 class="relative group"><a id="utilsgenerationbeamsearchsampler--code-sampler-code" 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" href="#utilsgenerationbeamsearchsampler--code-sampler-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>utils/generation~BeamSearchSampler ⇐ <code> Sampler </code></span></h2> <p data-svelte-h="svelte-tcl9v8">Class representing a BeamSearchSampler.</p> <p data-svelte-h="svelte-1cm4lld"><strong>Kind</strong>: inner class of <a href="#module_utils/generation"><code>utils/generation</code></a><br> <strong>Extends</strong>: <code>Sampler</code></p> <hr> <a id="module_utils/generation..BeamSearchSampler+sample" class="group"></a> <h3 class="relative group"><a id="beamsearchsamplersamplelogits-index--code-array-code" 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" href="#beamsearchsamplersamplelogits-index--code-array-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>beamSearchSampler.sample(logits, index) ⇒ <code> Array </code></span></h3> <p data-svelte-h="svelte-1uart2f">Sample from the logits.</p> <p data-svelte-h="svelte-18emm88"><strong>Kind</strong>: instance method of <a href="#module_utils/generation..BeamSearchSampler"><code>BeamSearchSampler</code></a></p> <table data-svelte-h="svelte-1ks6oyq"><thead><tr><th>Param</th><th>Type</th></tr></thead> <tbody><tr><td>logits</td><td><code>Tensor</code></td> </tr><tr><td>index</td><td><code>number</code></td></tr></tbody></table> <hr> <a id="module_utils/generation..GenerationConfigType" class="group"></a> <h2 class="relative group"><a id="utilsgenerationgenerationconfigtype--code-object-code" 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" href="#utilsgenerationgenerationconfigtype--code-object-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>utils/generation~GenerationConfigType : <code> Object </code></span></h2> <p data-svelte-h="svelte-2deze2">The default configuration parameters.</p> <p data-svelte-h="svelte-1m0y5lv"><strong>Kind</strong>: inner typedef of <a href="#module_utils/generation"><code>utils/generation</code></a><br> <strong>Properties</strong></p> <table data-svelte-h="svelte-1tb03me"><thead><tr><th>Name</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>[max_length]</td><td><code>number</code></td><td><code>20</code></td><td><p>The maximum length the generated tokens can have. Corresponds to the length of the input prompt + <code>max_new_tokens</code>. Its effect is overridden by <code>max_new_tokens</code>, if also set.</p></td> </tr><tr><td>[max_new_tokens]</td><td><code>number</code></td><td><code></code></td><td><p>The maximum numbers of tokens to generate, ignoring the number of tokens in the prompt.</p></td> </tr><tr><td>[min_length]</td><td><code>number</code></td><td><code>0</code></td><td><p>The minimum length of the sequence to be generated. Corresponds to the length of the input prompt + <code>min_new_tokens</code>. Its effect is overridden by <code>min_new_tokens</code>, if also set.</p></td> </tr><tr><td>[min_new_tokens]</td><td><code>number</code></td><td><code></code></td><td><p>The minimum numbers of tokens to generate, ignoring the number of tokens in the prompt.</p></td> </tr><tr><td>[early_stopping]</td><td><code>boolean</code> | <code>"never"</code></td><td><code>false</code></td><td><p>Controls the stopping condition for beam-based methods, like beam-search. It accepts the following values:</p> <ul><li><code>true</code>, where the generation stops as soon as there are <code>num_beams</code> complete candidates;</li> <li><code>false</code>, where an heuristic is applied and the generation stops when is it very unlikely to find better candidates;</li> <li><code>"never"</code>, where the beam search procedure only stops when there cannot be better candidates (canonical beam search algorithm).</li></ul></td> </tr><tr><td>[max_time]</td><td><code>number</code></td><td><code></code></td><td><p>The maximum amount of time you allow the computation to run for in seconds. Generation will still finish the current pass after allocated time has been passed.</p></td> </tr><tr><td>[do_sample]</td><td><code>boolean</code></td><td><code>false</code></td><td><p>Whether or not to use sampling; use greedy decoding otherwise.</p></td> </tr><tr><td>[num_beams]</td><td><code>number</code></td><td><code>1</code></td><td><p>Number of beams for beam search. 1 means no beam search.</p></td> </tr><tr><td>[num_beam_groups]</td><td><code>number</code></td><td><code>1</code></td><td><p>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">this paper</a> for more details.</p></td> </tr><tr><td>[penalty_alpha]</td><td><code>number</code></td><td><code></code></td><td><p>The values balance the model confidence and the degeneration penalty in contrastive search decoding.</p></td> </tr><tr><td>[use_cache]</td><td><code>boolean</code></td><td><code>true</code></td><td><p>Whether or not the model should use the past last key/values attentions (if applicable to the model) to speed up decoding.</p></td> </tr><tr><td>[temperature]</td><td><code>number</code></td><td><code>1.0</code></td><td><p>The value used to modulate the next token probabilities.</p></td> </tr><tr><td>[top_k]</td><td><code>number</code></td><td><code>50</code></td><td><p>The number of highest probability vocabulary tokens to keep for top-k-filtering.</p></td> </tr><tr><td>[top_p]</td><td><code>number</code></td><td><code>1.0</code></td><td><p>If set to float < 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.</p></td> </tr><tr><td>[typical_p]</td><td><code>number</code></td><td><code>1.0</code></td><td><p>Local typicality measures how similar the conditional probability of predicting a target token next is to the expected conditional probability of predicting a random token next, given the partial text already generated. If set to float < 1, the smallest set of the most locally typical tokens with probabilities that add up to <code>typical_p</code> or higher are kept for generation. See <a href="https://arxiv.org/pdf/2202.00666.pdf">this paper</a> for more details.</p></td> </tr><tr><td>[epsilon_cutoff]</td><td><code>number</code></td><td><code>0.0</code></td><td><p>If set to float strictly between 0 and 1, only tokens with a conditional probability greater than <code>epsilon_cutoff</code> will be sampled. In the paper, suggested values range from 3e-4 to 9e-4, depending on the size of the model. See <a href="https://arxiv.org/abs/2210.15191">Truncation Sampling as Language Model Desmoothing</a> for more details.</p></td> </tr><tr><td>[eta_cutoff]</td><td><code>number</code></td><td><code>0.0</code></td><td><p>Eta sampling is a hybrid of locally typical sampling and epsilon sampling. If set to float strictly between 0 and 1, a token is only considered if it is greater than either <code>eta_cutoff</code> or <code>sqrt(eta_cutoff) * exp(-entropy(softmax(next_token_logits)))</code>. The latter term is intuitively the expected next token probability, scaled by <code>sqrt(eta_cutoff)</code>. In the paper, suggested values range from 3e-4 to 2e-3, depending on the size of the model. See <a href="https://arxiv.org/abs/2210.15191">Truncation Sampling as Language Model Desmoothing</a> for more details.</p></td> </tr><tr><td>[diversity_penalty]</td><td><code>number</code></td><td><code>0.0</code></td><td><p>This value is subtracted from a beam'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.</p></td> </tr><tr><td>[repetition_penalty]</td><td><code>number</code></td><td><code>1.0</code></td><td><p>The parameter for repetition penalty. 1.0 means no penalty. See <a href="https://arxiv.org/pdf/1909.05858.pdf">this paper</a> for more details.</p></td> </tr><tr><td>[encoder_repetition_penalty]</td><td><code>number</code></td><td><code>1.0</code></td><td><p>The paramater for encoder_repetition_penalty. An exponential penalty on sequences that are not in the original input. 1.0 means no penalty.</p></td> </tr><tr><td>[length_penalty]</td><td><code>number</code></td><td><code>1.0</code></td><td><p>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> > 0.0 promotes longer sequences, while <code>length_penalty</code> < 0.0 encourages shorter sequences.</p></td> </tr><tr><td>[no_repeat_ngram_size]</td><td><code>number</code></td><td><code>0</code></td><td><p>If set to int > 0, all ngrams of that size can only occur once.</p></td> </tr><tr><td>[bad_words_ids]</td><td><code>Array.<Array<number>></code></td><td><code></code></td><td><p>List of token ids that are not allowed to be generated. In order to get the token ids of the words that should not appear in the generated text, use <code>(await tokenizer(bad_words, {add_prefix_space: true, add_special_tokens: false})).input_ids</code>.</p></td> </tr><tr><td>[force_words_ids]</td><td><code>Array<Array<number>></code> | <code>Array<Array<Array<number>>></code></td><td><code></code></td><td><p>List of token ids that must be generated. If given a <code>number[][]</code>, this is treated as a simple list of words that must be included, the opposite to <code>bad_words_ids</code>. If given <code>number[][][]</code>, this triggers a <a href="https://github.com/huggingface/transformers/issues/14081">disjunctive constraint</a>, where one can allow different forms of each word.</p></td> </tr><tr><td>[renormalize_logits]</td><td><code>boolean</code></td><td><code>false</code></td><td><p>Whether to renormalize the logits after applying all the logits processors or warpers (including the custom ones). It's highly recommended to set this flag to <code>true</code> as the search algorithms suppose the score logits are normalized but some logit processors or warpers break the normalization.</p></td> </tr><tr><td>[constraints]</td><td><code>Array.<Object></code></td><td><code></code></td><td><p>Custom constraints that can be added to the generation to ensure that the output will contain the use of certain tokens as defined by <code>Constraint</code> objects, in the most sensible way possible.</p></td> </tr><tr><td>[forced_bos_token_id]</td><td><code>number</code></td><td><code></code></td><td><p>The id of the token to force as the first generated token after the <code>decoder_start_token_id</code>. Useful for multilingual models like mBART where the first generated token needs to be the target language token.</p></td> </tr><tr><td>[forced_eos_token_id]</td><td><code>number</code> | <code>Array<number></code></td><td><code></code></td><td><p>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.</p></td> </tr><tr><td>[remove_invalid_values]</td><td><code>boolean</code></td><td><code>false</code></td><td><p>Whether to remove possible <em>nan</em> and <em>inf</em> outputs of the model to prevent the generation method to crash. Note that using <code>remove_invalid_values</code> can slow down generation.</p></td> </tr><tr><td>[exponential_decay_length_penalty]</td><td><code>Array.<number></code></td><td><code></code></td><td><p>This Tuple adds an exponentially increasing length penalty, after a certain amount of tokens have been generated. The tuple shall consist of: <code>(start_index, decay_factor)</code> where <code>start_index</code> indicates where penalty starts and <code>decay_factor</code> represents the factor of exponential decay.</p></td> </tr><tr><td>[suppress_tokens]</td><td><code>Array.<number></code></td><td><code></code></td><td><p>A list of tokens that will be suppressed at generation. The <code>SupressTokens</code> logit processor will set their log probs to <code>-inf</code> so that they are not sampled.</p></td> </tr><tr><td>[begin_suppress_tokens]</td><td><code>Array.<number></code></td><td><code></code></td><td><p>A list of tokens that will be suppressed at the beginning of the generation. The <code>SupressBeginTokens</code> logit processor will set their log probs to <code>-inf</code> so that they are not sampled.</p></td> </tr><tr><td>[forced_decoder_ids]</td><td><code>Array.<Array<number>></code></td><td><code></code></td><td><p>A list of pairs of integers which indicates a mapping from generation indices to token indices that will be forced before sampling. For example, <code>[[1, 123]]</code> means the second generated token will always be a token of index 123.</p></td> </tr><tr><td>[num_return_sequences]</td><td><code>number</code></td><td><code>1</code></td><td><p>The number of independently computed returned sequences for each element in the batch.</p></td> </tr><tr><td>[output_attentions]</td><td><code>boolean</code></td><td><code>false</code></td><td><p>Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned tensors for more details.</p></td> </tr><tr><td>[output_hidden_states]</td><td><code>boolean</code></td><td><code>false</code></td><td><p>Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for more details.</p></td> </tr><tr><td>[output_scores]</td><td><code>boolean</code></td><td><code>false</code></td><td><p>Whether or not to return the prediction scores. See <code>scores</code> under returned tensors for more details.</p></td> </tr><tr><td>[return_dict_in_generate]</td><td><code>boolean</code></td><td><code>false</code></td><td><p>Whether or not to return a <code>ModelOutput</code> instead of a plain tuple.</p></td> </tr><tr><td>[pad_token_id]</td><td><code>number</code></td><td><code></code></td><td><p>The id of the <em>padding</em> token.</p></td> </tr><tr><td>[bos_token_id]</td><td><code>number</code></td><td><code></code></td><td><p>The id of the <em>beginning-of-sequence</em> token.</p></td> </tr><tr><td>[eos_token_id]</td><td><code>number</code> | <code>Array<number></code></td><td><code></code></td><td><p>The id of the <em>end-of-sequence</em> token. Optionally, use a list to set multiple <em>end-of-sequence</em> tokens.</p></td> </tr><tr><td>[encoder_no_repeat_ngram_size]</td><td><code>number</code></td><td><code>0</code></td><td><p>If set to int > 0, all ngrams of that size that occur in the <code>encoder_input_ids</code> cannot occur in the <code>decoder_input_ids</code>.</p></td> </tr><tr><td>[decoder_start_token_id]</td><td><code>number</code></td><td><code></code></td><td><p>If an encoder-decoder model starts decoding with a different token than <em>bos</em>, the id of that token.</p></td> </tr><tr><td>[generation_kwargs]</td><td><code>Object</code></td><td><code>{}</code></td><td><p>Additional generation kwargs will be forwarded to the <code>generate</code> function of the model. Kwargs that are not present in <code>generate</code>'s signature will be used in the model forward pass.</p></td></tr></tbody></table> <hr> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/xenova/transformers.js/blob/main/docs/source/api/utils/generation.md" target="_blank"><span data-svelte-h="svelte-1kd6by1"><</span> <span data-svelte-h="svelte-x0xyl0">></span> <span data-svelte-h="svelte-1dajgef"><span class="underline ml-1.5">Update</span> on GitHub</span></a> <p></p> | |
| <script> | |
| { | |
| __sveltekit_1ifmi41 = { | |
| assets: "/docs/transformers.js/main/en", | |
| base: "/docs/transformers.js/main/en", | |
| env: {} | |
| }; | |
| const element = document.currentScript.parentElement; | |
| const data = [null,null]; | |
| Promise.all([ | |
| import("/docs/transformers.js/main/en/_app/immutable/entry/start.a2f7fcea.js"), | |
| import("/docs/transformers.js/main/en/_app/immutable/entry/app.7b630de5.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 13], | |
| data, | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 157 kB
- Xet hash:
- 2cc3890bc324ae0b39a6c1db1582c4093048f4a2d3b482b02134316521a0185f
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.