Buckets:

download
raw
137 kB
<meta charset="utf-8" /><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;generation/logits_process&quot;,&quot;local&quot;:&quot;generationlogitsprocess&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;generation/logits_process.LogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocesslogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;logitsProcessor._call(input_ids, logits)&quot;,&quot;local&quot;:&quot;logitsprocessorcallinputids-logits&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.LogitsWarper&quot;,&quot;local&quot;:&quot;generationlogitsprocesslogitswarper&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;logitsWarper._call(input_ids, logits)&quot;,&quot;local&quot;:&quot;logitswarpercallinputids-logits&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.LogitsProcessorList&quot;,&quot;local&quot;:&quot;generationlogitsprocesslogitsprocessorlist&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new LogitsProcessorList()&quot;,&quot;local&quot;:&quot;new-logitsprocessorlist&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;logitsProcessorList.push(item)&quot;,&quot;local&quot;:&quot;logitsprocessorlistpushitem&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;logitsProcessorList.extend(items)&quot;,&quot;local&quot;:&quot;logitsprocessorlistextenditems&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;logitsProcessorList._call(input_ids, logits)&quot;,&quot;local&quot;:&quot;logitsprocessorlistcallinputids-logits&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.ForcedBOSTokenLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocessforcedbostokenlogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ForcedBOSTokenLogitsProcessor(bos_token_id)&quot;,&quot;local&quot;:&quot;new-forcedbostokenlogitsprocessorbostokenid&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;forcedBOSTokenLogitsProcessor._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;forcedbostokenlogitsprocessorcallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.ForcedEOSTokenLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocessforcedeostokenlogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ForcedEOSTokenLogitsProcessor(max_length, eos_token_id)&quot;,&quot;local&quot;:&quot;new-forcedeostokenlogitsprocessormaxlength-eostokenid&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;forcedEOSTokenLogitsProcessor._call(input_ids, logits)&quot;,&quot;local&quot;:&quot;forcedeostokenlogitsprocessorcallinputids-logits&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.SuppressTokensLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocesssuppresstokenslogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new SuppressTokensLogitsProcessor(suppress_tokens)&quot;,&quot;local&quot;:&quot;new-suppresstokenslogitsprocessorsuppresstokens&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;suppressTokensLogitsProcessor._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;suppresstokenslogitsprocessorcallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.SuppressTokensAtBeginLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocesssuppresstokensatbeginlogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new SuppressTokensAtBeginLogitsProcessor(begin_suppress_tokens, begin_index)&quot;,&quot;local&quot;:&quot;new-suppresstokensatbeginlogitsprocessorbeginsuppresstokens-beginindex&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;suppressTokensAtBeginLogitsProcessor._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;suppresstokensatbeginlogitsprocessorcallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.WhisperTimeStampLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocesswhispertimestamplogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new WhisperTimeStampLogitsProcessor(generate_config, init_tokens)&quot;,&quot;local&quot;:&quot;new-whispertimestamplogitsprocessorgenerateconfig-inittokens&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;whisperTimeStampLogitsProcessor._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;whispertimestamplogitsprocessorcallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.NoRepeatNGramLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocessnorepeatngramlogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new NoRepeatNGramLogitsProcessor(no_repeat_ngram_size)&quot;,&quot;local&quot;:&quot;new-norepeatngramlogitsprocessornorepeatngramsize&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;noRepeatNGramLogitsProcessor.getNgrams(prevInputIds) ⇒ Map. < string, Array >&quot;,&quot;local&quot;:&quot;norepeatngramlogitsprocessorgetngramsprevinputids--map--string-array-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;noRepeatNGramLogitsProcessor.getGeneratedNgrams(bannedNgrams, prevInputIds) ⇒ Array&quot;,&quot;local&quot;:&quot;norepeatngramlogitsprocessorgetgeneratedngramsbannedngrams-previnputids--array&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;noRepeatNGramLogitsProcessor.calcBannedNgramTokens(prevInputIds) ⇒ Array&quot;,&quot;local&quot;:&quot;norepeatngramlogitsprocessorcalcbannedngramtokensprevinputids--array&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;noRepeatNGramLogitsProcessor._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;norepeatngramlogitsprocessorcallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.RepetitionPenaltyLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocessrepetitionpenaltylogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new RepetitionPenaltyLogitsProcessor(penalty)&quot;,&quot;local&quot;:&quot;new-repetitionpenaltylogitsprocessorpenalty&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;repetitionPenaltyLogitsProcessor._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;repetitionpenaltylogitsprocessorcallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.MinLengthLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocessminlengthlogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new MinLengthLogitsProcessor(min_length, eos_token_id)&quot;,&quot;local&quot;:&quot;new-minlengthlogitsprocessorminlength-eostokenid&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;minLengthLogitsProcessor._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;minlengthlogitsprocessorcallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.MinNewTokensLengthLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocessminnewtokenslengthlogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new MinNewTokensLengthLogitsProcessor(prompt_length_to_skip, min_new_tokens, eos_token_id)&quot;,&quot;local&quot;:&quot;new-minnewtokenslengthlogitsprocessorpromptlengthtoskip-minnewtokens-eostokenid&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;minNewTokensLengthLogitsProcessor._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;minnewtokenslengthlogitsprocessorcallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.NoBadWordsLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocessnobadwordslogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new NoBadWordsLogitsProcessor(bad_words_ids, eos_token_id)&quot;,&quot;local&quot;:&quot;new-nobadwordslogitsprocessorbadwordsids-eostokenid&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;noBadWordsLogitsProcessor._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;nobadwordslogitsprocessorcallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.ClassifierFreeGuidanceLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocessclassifierfreeguidancelogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ClassifierFreeGuidanceLogitsProcessor(guidance_scale)&quot;,&quot;local&quot;:&quot;new-classifierfreeguidancelogitsprocessorguidancescale&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;classifierFreeGuidanceLogitsProcessor._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;classifierfreeguidancelogitsprocessorcallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.TemperatureLogitsWarper&quot;,&quot;local&quot;:&quot;generationlogitsprocesstemperaturelogitswarper&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new TemperatureLogitsWarper(temperature)&quot;,&quot;local&quot;:&quot;new-temperaturelogitswarpertemperature&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;temperatureLogitsWarper._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;temperaturelogitswarpercallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.TopPLogitsWarper&quot;,&quot;local&quot;:&quot;generationlogitsprocesstopplogitswarper&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new TopPLogitsWarper(top_p, options)&quot;,&quot;local&quot;:&quot;new-topplogitswarpertopp-options&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.TopKLogitsWarper&quot;,&quot;local&quot;:&quot;generationlogitsprocesstopklogitswarper&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new TopKLogitsWarper(top_k, options)&quot;,&quot;local&quot;:&quot;new-topklogitswarpertopk-options&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2}],&quot;depth&quot;:1}">
<link href="/docs/transformers.js/pr_1649/en/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/entry/start.5f753a22.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/chunks/scheduler.6efaaf90.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/chunks/singletons.c0807d75.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/chunks/paths.c5938264.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/entry/app.db3dfcb7.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/chunks/preload-helper.1d8e1e5d.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/chunks/index.eb3e1f0f.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/nodes/0.1b727385.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/chunks/each.e59479a4.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/nodes/6.60b2a626.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1649/en/_app/immutable/chunks/MermaidChart.svelte_svelte_type_style_lang.16f13047.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;generation/logits_process&quot;,&quot;local&quot;:&quot;generationlogitsprocess&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;generation/logits_process.LogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocesslogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;logitsProcessor._call(input_ids, logits)&quot;,&quot;local&quot;:&quot;logitsprocessorcallinputids-logits&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.LogitsWarper&quot;,&quot;local&quot;:&quot;generationlogitsprocesslogitswarper&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;logitsWarper._call(input_ids, logits)&quot;,&quot;local&quot;:&quot;logitswarpercallinputids-logits&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.LogitsProcessorList&quot;,&quot;local&quot;:&quot;generationlogitsprocesslogitsprocessorlist&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new LogitsProcessorList()&quot;,&quot;local&quot;:&quot;new-logitsprocessorlist&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;logitsProcessorList.push(item)&quot;,&quot;local&quot;:&quot;logitsprocessorlistpushitem&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;logitsProcessorList.extend(items)&quot;,&quot;local&quot;:&quot;logitsprocessorlistextenditems&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;logitsProcessorList._call(input_ids, logits)&quot;,&quot;local&quot;:&quot;logitsprocessorlistcallinputids-logits&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.ForcedBOSTokenLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocessforcedbostokenlogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ForcedBOSTokenLogitsProcessor(bos_token_id)&quot;,&quot;local&quot;:&quot;new-forcedbostokenlogitsprocessorbostokenid&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;forcedBOSTokenLogitsProcessor._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;forcedbostokenlogitsprocessorcallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.ForcedEOSTokenLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocessforcedeostokenlogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ForcedEOSTokenLogitsProcessor(max_length, eos_token_id)&quot;,&quot;local&quot;:&quot;new-forcedeostokenlogitsprocessormaxlength-eostokenid&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;forcedEOSTokenLogitsProcessor._call(input_ids, logits)&quot;,&quot;local&quot;:&quot;forcedeostokenlogitsprocessorcallinputids-logits&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.SuppressTokensLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocesssuppresstokenslogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new SuppressTokensLogitsProcessor(suppress_tokens)&quot;,&quot;local&quot;:&quot;new-suppresstokenslogitsprocessorsuppresstokens&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;suppressTokensLogitsProcessor._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;suppresstokenslogitsprocessorcallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.SuppressTokensAtBeginLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocesssuppresstokensatbeginlogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new SuppressTokensAtBeginLogitsProcessor(begin_suppress_tokens, begin_index)&quot;,&quot;local&quot;:&quot;new-suppresstokensatbeginlogitsprocessorbeginsuppresstokens-beginindex&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;suppressTokensAtBeginLogitsProcessor._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;suppresstokensatbeginlogitsprocessorcallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.WhisperTimeStampLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocesswhispertimestamplogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new WhisperTimeStampLogitsProcessor(generate_config, init_tokens)&quot;,&quot;local&quot;:&quot;new-whispertimestamplogitsprocessorgenerateconfig-inittokens&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;whisperTimeStampLogitsProcessor._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;whispertimestamplogitsprocessorcallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.NoRepeatNGramLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocessnorepeatngramlogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new NoRepeatNGramLogitsProcessor(no_repeat_ngram_size)&quot;,&quot;local&quot;:&quot;new-norepeatngramlogitsprocessornorepeatngramsize&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;noRepeatNGramLogitsProcessor.getNgrams(prevInputIds) ⇒ Map. < string, Array >&quot;,&quot;local&quot;:&quot;norepeatngramlogitsprocessorgetngramsprevinputids--map--string-array-&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;noRepeatNGramLogitsProcessor.getGeneratedNgrams(bannedNgrams, prevInputIds) ⇒ Array&quot;,&quot;local&quot;:&quot;norepeatngramlogitsprocessorgetgeneratedngramsbannedngrams-previnputids--array&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;noRepeatNGramLogitsProcessor.calcBannedNgramTokens(prevInputIds) ⇒ Array&quot;,&quot;local&quot;:&quot;norepeatngramlogitsprocessorcalcbannedngramtokensprevinputids--array&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;noRepeatNGramLogitsProcessor._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;norepeatngramlogitsprocessorcallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.RepetitionPenaltyLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocessrepetitionpenaltylogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new RepetitionPenaltyLogitsProcessor(penalty)&quot;,&quot;local&quot;:&quot;new-repetitionpenaltylogitsprocessorpenalty&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;repetitionPenaltyLogitsProcessor._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;repetitionpenaltylogitsprocessorcallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.MinLengthLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocessminlengthlogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new MinLengthLogitsProcessor(min_length, eos_token_id)&quot;,&quot;local&quot;:&quot;new-minlengthlogitsprocessorminlength-eostokenid&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;minLengthLogitsProcessor._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;minlengthlogitsprocessorcallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.MinNewTokensLengthLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocessminnewtokenslengthlogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new MinNewTokensLengthLogitsProcessor(prompt_length_to_skip, min_new_tokens, eos_token_id)&quot;,&quot;local&quot;:&quot;new-minnewtokenslengthlogitsprocessorpromptlengthtoskip-minnewtokens-eostokenid&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;minNewTokensLengthLogitsProcessor._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;minnewtokenslengthlogitsprocessorcallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.NoBadWordsLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocessnobadwordslogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new NoBadWordsLogitsProcessor(bad_words_ids, eos_token_id)&quot;,&quot;local&quot;:&quot;new-nobadwordslogitsprocessorbadwordsids-eostokenid&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;noBadWordsLogitsProcessor._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;nobadwordslogitsprocessorcallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.ClassifierFreeGuidanceLogitsProcessor&quot;,&quot;local&quot;:&quot;generationlogitsprocessclassifierfreeguidancelogitsprocessor&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ClassifierFreeGuidanceLogitsProcessor(guidance_scale)&quot;,&quot;local&quot;:&quot;new-classifierfreeguidancelogitsprocessorguidancescale&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;classifierFreeGuidanceLogitsProcessor._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;classifierfreeguidancelogitsprocessorcallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.TemperatureLogitsWarper&quot;,&quot;local&quot;:&quot;generationlogitsprocesstemperaturelogitswarper&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new TemperatureLogitsWarper(temperature)&quot;,&quot;local&quot;:&quot;new-temperaturelogitswarpertemperature&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;temperatureLogitsWarper._call(input_ids, logits) ⇒ Tensor&quot;,&quot;local&quot;:&quot;temperaturelogitswarpercallinputids-logits--tensor&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.TopPLogitsWarper&quot;,&quot;local&quot;:&quot;generationlogitsprocesstopplogitswarper&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new TopPLogitsWarper(top_p, options)&quot;,&quot;local&quot;:&quot;new-topplogitswarpertopp-options&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;generation/logits_process.TopKLogitsWarper&quot;,&quot;local&quot;:&quot;generationlogitsprocesstopklogitswarper&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new TopKLogitsWarper(top_k, options)&quot;,&quot;local&quot;:&quot;new-topklogitswarpertopk-options&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2}],&quot;depth&quot;:1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <a id="module_generation/logits_process" class="group"></a> <div class="items-center shrink-0 min-w-[100px] max-sm:min-w-[50px] justify-end ml-auto flex" style="float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"><div class="inline-flex rounded-md max-sm:rounded-sm"><button class="inline-flex items-center gap-1 h-7 max-sm:h-7 px-2 max-sm:px-1.5 text-sm font-medium text-gray-800 border border-r-0 rounded-l-md max-sm:rounded-l-sm border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-live="polite"><span class="inline-flex items-center justify-center rounded-md p-0.5 max-sm:p-0 hover:text-gray-800 dark:hover:text-gray-200"><svg class="sm:size-3.5 size-3" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg></span> <span>Copy page</span></button> <button class="inline-flex items-center justify-center w-6 max-sm:w-5 h-7 max-sm:h-7 disabled:pointer-events-none text-sm text-gray-500 hover:text-gray-700 dark:hover:text-white rounded-r-md max-sm:rounded-r-sm border border-l transition border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-haspopup="menu" aria-expanded="false" aria-label="Open copy menu"><svg class="transition-transform text-gray-400 overflow-visible sm:size-3.5 size-3 rotate-0" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg></button></div> </div> <h1 class="relative group"><a id="generationlogitsprocess" 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="#generationlogitsprocess"><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>generation/logits_process</span></h1> <ul data-svelte-h="svelte-pettja"><li><a href="#module_generation/logits_process">generation/logits_process</a> <ul><li><a href="#module_generation/logits_process.LogitsProcessor">.LogitsProcessor</a> <ul><li><em><a href="#module_generation/logits_process.LogitsProcessor+_call"><code>._call(input_ids, logits)</code></a></em></li></ul></li> <li><a href="#module_generation/logits_process.LogitsWarper">.LogitsWarper</a> <ul><li><em><a href="#module_generation/logits_process.LogitsWarper+_call"><code>._call(input_ids, logits)</code></a></em></li></ul></li> <li><a href="#module_generation/logits_process.LogitsProcessorList">.LogitsProcessorList</a> <ul><li><a href="#new_module_generation/logits_process.LogitsProcessorList_new"><code>new LogitsProcessorList()</code></a></li> <li><a href="#module_generation/logits_process.LogitsProcessorList+push"><code>.push(item)</code></a></li> <li><a href="#module_generation/logits_process.LogitsProcessorList+extend"><code>.extend(items)</code></a></li> <li><a href="#module_generation/logits_process.LogitsProcessorList+_call"><code>._call(input_ids, logits)</code></a></li></ul></li> <li><a href="#module_generation/logits_process.ForcedBOSTokenLogitsProcessor">.ForcedBOSTokenLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.ForcedBOSTokenLogitsProcessor_new"><code>new ForcedBOSTokenLogitsProcessor(bos_token_id)</code></a></li> <li><a href="#module_generation/logits_process.ForcedBOSTokenLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li> <li><a href="#module_generation/logits_process.ForcedEOSTokenLogitsProcessor">.ForcedEOSTokenLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.ForcedEOSTokenLogitsProcessor_new"><code>new ForcedEOSTokenLogitsProcessor(max_length, eos_token_id)</code></a></li> <li><a href="#module_generation/logits_process.ForcedEOSTokenLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a></li></ul></li> <li><a href="#module_generation/logits_process.SuppressTokensLogitsProcessor">.SuppressTokensLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.SuppressTokensLogitsProcessor_new"><code>new SuppressTokensLogitsProcessor(suppress_tokens)</code></a></li> <li><a href="#module_generation/logits_process.SuppressTokensLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li> <li><a href="#module_generation/logits_process.SuppressTokensAtBeginLogitsProcessor">.SuppressTokensAtBeginLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.SuppressTokensAtBeginLogitsProcessor_new"><code>new SuppressTokensAtBeginLogitsProcessor(begin_suppress_tokens, begin_index)</code></a></li> <li><a href="#module_generation/logits_process.SuppressTokensAtBeginLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li> <li><a href="#module_generation/logits_process.WhisperTimeStampLogitsProcessor">.WhisperTimeStampLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.WhisperTimeStampLogitsProcessor_new"><code>new WhisperTimeStampLogitsProcessor(generate_config, init_tokens)</code></a></li> <li><a href="#module_generation/logits_process.WhisperTimeStampLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li> <li><a href="#module_generation/logits_process.NoRepeatNGramLogitsProcessor">.NoRepeatNGramLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.NoRepeatNGramLogitsProcessor_new"><code>new NoRepeatNGramLogitsProcessor(no_repeat_ngram_size)</code></a></li> <li><a href="#module_generation/logits_process.NoRepeatNGramLogitsProcessor+getNgrams"><code>.getNgrams(prevInputIds)</code></a><code>Map.&lt;string, Array&gt;</code></li> <li><a href="#module_generation/logits_process.NoRepeatNGramLogitsProcessor+getGeneratedNgrams"><code>.getGeneratedNgrams(bannedNgrams, prevInputIds)</code></a><code>Array</code></li> <li><a href="#module_generation/logits_process.NoRepeatNGramLogitsProcessor+calcBannedNgramTokens"><code>.calcBannedNgramTokens(prevInputIds)</code></a><code>Array</code></li> <li><a href="#module_generation/logits_process.NoRepeatNGramLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li> <li><a href="#module_generation/logits_process.RepetitionPenaltyLogitsProcessor">.RepetitionPenaltyLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.RepetitionPenaltyLogitsProcessor_new"><code>new RepetitionPenaltyLogitsProcessor(penalty)</code></a></li> <li><a href="#module_generation/logits_process.RepetitionPenaltyLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li> <li><a href="#module_generation/logits_process.MinLengthLogitsProcessor">.MinLengthLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.MinLengthLogitsProcessor_new"><code>new MinLengthLogitsProcessor(min_length, eos_token_id)</code></a></li> <li><a href="#module_generation/logits_process.MinLengthLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li> <li><a href="#module_generation/logits_process.MinNewTokensLengthLogitsProcessor">.MinNewTokensLengthLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.MinNewTokensLengthLogitsProcessor_new"><code>new MinNewTokensLengthLogitsProcessor(prompt_length_to_skip, min_new_tokens, eos_token_id)</code></a></li> <li><a href="#module_generation/logits_process.MinNewTokensLengthLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li> <li><a href="#module_generation/logits_process.NoBadWordsLogitsProcessor">.NoBadWordsLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.NoBadWordsLogitsProcessor_new"><code>new NoBadWordsLogitsProcessor(bad_words_ids, eos_token_id)</code></a></li> <li><a href="#module_generation/logits_process.NoBadWordsLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li> <li><a href="#module_generation/logits_process.ClassifierFreeGuidanceLogitsProcessor">.ClassifierFreeGuidanceLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.ClassifierFreeGuidanceLogitsProcessor_new"><code>new ClassifierFreeGuidanceLogitsProcessor(guidance_scale)</code></a></li> <li><a href="#module_generation/logits_process.ClassifierFreeGuidanceLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li> <li><a href="#module_generation/logits_process.TemperatureLogitsWarper">.TemperatureLogitsWarper</a> <ul><li><a href="#new_module_generation/logits_process.TemperatureLogitsWarper_new"><code>new TemperatureLogitsWarper(temperature)</code></a></li> <li><a href="#module_generation/logits_process.TemperatureLogitsWarper+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li> <li><a href="#module_generation/logits_process.TopPLogitsWarper">.TopPLogitsWarper</a> <ul><li><a href="#new_module_generation/logits_process.TopPLogitsWarper_new"><code>new TopPLogitsWarper(top_p, options)</code></a></li></ul></li> <li><a href="#module_generation/logits_process.TopKLogitsWarper">.TopKLogitsWarper</a> <ul><li><a href="#new_module_generation/logits_process.TopKLogitsWarper_new"><code>new TopKLogitsWarper(top_k, options)</code></a></li></ul></li></ul></li></ul> <hr> <a id="module_generation/logits_process.LogitsProcessor" class="group"></a> <h2 class="relative group"><a id="generationlogitsprocesslogitsprocessor" 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="#generationlogitsprocesslogitsprocessor"><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>generation/logits_process.LogitsProcessor</span></h2> <p data-svelte-h="svelte-y1kta5">Abstract base class for all logit processors that can be applied during generation.</p> <p data-svelte-h="svelte-mqjmj0"><strong>Kind</strong>: static class of <a href="#module_generation/logits_process"><code>generation/logits_process</code></a></p> <hr> <a id="module_generation/logits_process.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-o5pwel"><strong>Kind</strong>: instance abstract method of <a href="#module_generation/logits_process.LogitsProcessor"><code>LogitsProcessor</code></a><br> <strong>Throws</strong>:</p> <ul data-svelte-h="svelte-p3bxrf"><li><code>Error</code> Throws an error if `_call` is not implemented in the subclass.</li></ul> <table data-svelte-h="svelte-1pv02l5"><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><a href="#Tensor">Tensor</a></code></td><td><p>The logits to process.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.LogitsWarper" class="group"></a> <h2 class="relative group"><a id="generationlogitsprocesslogitswarper" 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="#generationlogitsprocesslogitswarper"><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>generation/logits_process.LogitsWarper</span></h2> <p data-svelte-h="svelte-th82mu">Abstract base class for all logit warpers that can be applied during generation with multinomial sampling.</p> <p data-svelte-h="svelte-mqjmj0"><strong>Kind</strong>: static class of <a href="#module_generation/logits_process"><code>generation/logits_process</code></a></p> <hr> <a id="module_generation/logits_process.LogitsWarper+_call" class="group"></a> <h3 class="relative group"><a id="logitswarpercallinputids-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="#logitswarpercallinputids-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>logitsWarper._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-kni7th"><strong>Kind</strong>: instance abstract method of <a href="#module_generation/logits_process.LogitsWarper"><code>LogitsWarper</code></a><br> <strong>Throws</strong>:</p> <ul data-svelte-h="svelte-p3bxrf"><li><code>Error</code> Throws an error if `_call` is not implemented in the subclass.</li></ul> <table data-svelte-h="svelte-1pv02l5"><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><a href="#Tensor">Tensor</a></code></td><td><p>The logits to process.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.LogitsProcessorList" class="group"></a> <h2 class="relative group"><a id="generationlogitsprocesslogitsprocessorlist" 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="#generationlogitsprocesslogitsprocessorlist"><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>generation/logits_process.LogitsProcessorList</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-mqjmj0"><strong>Kind</strong>: static class of <a href="#module_generation/logits_process"><code>generation/logits_process</code></a></p> <ul data-svelte-h="svelte-14lwc35"><li><a href="#module_generation/logits_process.LogitsProcessorList">.LogitsProcessorList</a> <ul><li><a href="#new_module_generation/logits_process.LogitsProcessorList_new"><code>new LogitsProcessorList()</code></a></li> <li><a href="#module_generation/logits_process.LogitsProcessorList+push"><code>.push(item)</code></a></li> <li><a href="#module_generation/logits_process.LogitsProcessorList+extend"><code>.extend(items)</code></a></li> <li><a href="#module_generation/logits_process.LogitsProcessorList+_call"><code>._call(input_ids, logits)</code></a></li></ul></li></ul> <hr> <a id="new_module_generation/logits_process.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_generation/logits_process.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-1hr791t"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_process.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_generation/logits_process.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-1hr791t"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_process.LogitsProcessorList"><code>LogitsProcessorList</code></a></p> <table data-svelte-h="svelte-1duuy46"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>items</td><td><code>Array</code></td><td><p>The logits processor functions to add.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.LogitsProcessorList+_call" class="group"></a> <h3 class="relative group"><a id="logitsprocessorlistcallinputids-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="#logitsprocessorlistcallinputids-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>logitsProcessorList._call(input_ids, logits)</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-1hr791t"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_process.LogitsProcessorList"><code>LogitsProcessorList</code></a></p> <table data-svelte-h="svelte-1tcd2u2"><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 for the language model.</p></td> </tr><tr><td>logits</td><td><code><a href="#Tensor">Tensor</a></code></td><td></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.ForcedBOSTokenLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="generationlogitsprocessforcedbostokenlogitsprocessor" 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="#generationlogitsprocessforcedbostokenlogitsprocessor"><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>generation/logits_process.ForcedBOSTokenLogitsProcessor</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-mqjmj0"><strong>Kind</strong>: static class of <a href="#module_generation/logits_process"><code>generation/logits_process</code></a></p> <ul data-svelte-h="svelte-gp5vcb"><li><a href="#module_generation/logits_process.ForcedBOSTokenLogitsProcessor">.ForcedBOSTokenLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.ForcedBOSTokenLogitsProcessor_new"><code>new ForcedBOSTokenLogitsProcessor(bos_token_id)</code></a></li> <li><a href="#module_generation/logits_process.ForcedBOSTokenLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li></ul> <hr> <a id="new_module_generation/logits_process.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_generation/logits_process.ForcedBOSTokenLogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="forcedbostokenlogitsprocessorcallinputids-logits--tensor" 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--tensor"><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) ⇒ Tensor</span></h3> <p data-svelte-h="svelte-uhajj6">Apply the BOS token forcing to the logits.</p> <p data-svelte-h="svelte-1wfko75"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_process.ForcedBOSTokenLogitsProcessor"><code>ForcedBOSTokenLogitsProcessor</code></a><br> <strong>Returns</strong>: <a href="#Tensor"><code>Tensor</code></a> - The logits with BOS token forcing.</p> <table data-svelte-h="svelte-jckrqp"><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><a href="#Tensor">Tensor</a></code></td><td><p>The logits.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.ForcedEOSTokenLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="generationlogitsprocessforcedeostokenlogitsprocessor" 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="#generationlogitsprocessforcedeostokenlogitsprocessor"><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>generation/logits_process.ForcedEOSTokenLogitsProcessor</span></h2> <p data-svelte-h="svelte-1rc3pks">A logits processor that enforces the specified token as the last generated token when <code>max_length</code> is reached.</p> <p data-svelte-h="svelte-mqjmj0"><strong>Kind</strong>: static class of <a href="#module_generation/logits_process"><code>generation/logits_process</code></a></p> <ul data-svelte-h="svelte-16eet6t"><li><a href="#module_generation/logits_process.ForcedEOSTokenLogitsProcessor">.ForcedEOSTokenLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.ForcedEOSTokenLogitsProcessor_new"><code>new ForcedEOSTokenLogitsProcessor(max_length, eos_token_id)</code></a></li> <li><a href="#module_generation/logits_process.ForcedEOSTokenLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a></li></ul></li></ul> <hr> <a id="new_module_generation/logits_process.ForcedEOSTokenLogitsProcessor_new" class="group"></a> <h3 class="relative group"><a id="new-forcedeostokenlogitsprocessormaxlength-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-forcedeostokenlogitsprocessormaxlength-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 ForcedEOSTokenLogitsProcessor(max_length, eos_token_id)</span></h3> <p data-svelte-h="svelte-16ugs6s">Create a ForcedEOSTokenLogitsProcessor.</p> <table data-svelte-h="svelte-177sy4b"><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>The maximum length of the sequence to be generated.</p></td> </tr><tr><td>eos_token_id</td><td><code>number</code> | <code>Array</code></td><td><p>The id(s) of the <em>end-of-sequence</em> token.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.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-6yq7w5"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_process.ForcedEOSTokenLogitsProcessor"><code>ForcedEOSTokenLogitsProcessor</code></a></p> <table data-svelte-h="svelte-1t2bvr6"><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><a href="#Tensor">Tensor</a></code></td><td><p>The logits tensor.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.SuppressTokensLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="generationlogitsprocesssuppresstokenslogitsprocessor" 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="#generationlogitsprocesssuppresstokenslogitsprocessor"><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>generation/logits_process.SuppressTokensLogitsProcessor</span></h2> <p data-svelte-h="svelte-27vuhg">A LogitsProcessor that suppresses a list of tokens throughout generation.
Sets their log probs to <code>-inf</code> so that they are not generated.</p> <p data-svelte-h="svelte-mqjmj0"><strong>Kind</strong>: static class of <a href="#module_generation/logits_process"><code>generation/logits_process</code></a></p> <ul data-svelte-h="svelte-vx2kwi"><li><a href="#module_generation/logits_process.SuppressTokensLogitsProcessor">.SuppressTokensLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.SuppressTokensLogitsProcessor_new"><code>new SuppressTokensLogitsProcessor(suppress_tokens)</code></a></li> <li><a href="#module_generation/logits_process.SuppressTokensLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li></ul> <hr> <a id="new_module_generation/logits_process.SuppressTokensLogitsProcessor_new" class="group"></a> <h3 class="relative group"><a id="new-suppresstokenslogitsprocessorsuppresstokens" 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-suppresstokenslogitsprocessorsuppresstokens"><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 SuppressTokensLogitsProcessor(suppress_tokens)</span></h3> <p data-svelte-h="svelte-97gw62">Create a SuppressTokensLogitsProcessor.</p> <table data-svelte-h="svelte-1439pr7"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>suppress_tokens</td><td><code>Array</code></td><td><p>The IDs of the tokens to suppress.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.SuppressTokensLogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="suppresstokenslogitsprocessorcallinputids-logits--tensor" 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="#suppresstokenslogitsprocessorcallinputids-logits--tensor"><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>suppressTokensLogitsProcessor._call(input_ids, logits) ⇒ Tensor</span></h3> <p data-svelte-h="svelte-12tcusf">Suppress the specified tokens by setting their logits to -Infinity.</p> <p data-svelte-h="svelte-cghh1t"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_process.SuppressTokensLogitsProcessor"><code>SuppressTokensLogitsProcessor</code></a><br> <strong>Returns</strong>: <a href="#Tensor"><code>Tensor</code></a> - The modified logits.</p> <table data-svelte-h="svelte-jckrqp"><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><a href="#Tensor">Tensor</a></code></td><td><p>The logits.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.SuppressTokensAtBeginLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="generationlogitsprocesssuppresstokensatbeginlogitsprocessor" 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="#generationlogitsprocesssuppresstokensatbeginlogitsprocessor"><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>generation/logits_process.SuppressTokensAtBeginLogitsProcessor</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-mqjmj0"><strong>Kind</strong>: static class of <a href="#module_generation/logits_process"><code>generation/logits_process</code></a></p> <ul data-svelte-h="svelte-1dj3x5i"><li><a href="#module_generation/logits_process.SuppressTokensAtBeginLogitsProcessor">.SuppressTokensAtBeginLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.SuppressTokensAtBeginLogitsProcessor_new"><code>new SuppressTokensAtBeginLogitsProcessor(begin_suppress_tokens, begin_index)</code></a></li> <li><a href="#module_generation/logits_process.SuppressTokensAtBeginLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li></ul> <hr> <a id="new_module_generation/logits_process.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-3y0u7p"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>begin_suppress_tokens</td><td><code>Array</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_generation/logits_process.SuppressTokensAtBeginLogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="suppresstokensatbeginlogitsprocessorcallinputids-logits--tensor" 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--tensor"><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) ⇒ Tensor</span></h3> <p data-svelte-h="svelte-uhajj6">Apply the BOS token forcing to the logits.</p> <p data-svelte-h="svelte-1n8t4n1"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_process.SuppressTokensAtBeginLogitsProcessor"><code>SuppressTokensAtBeginLogitsProcessor</code></a><br> <strong>Returns</strong>: <a href="#Tensor"><code>Tensor</code></a> - The logits with BOS token forcing.</p> <table data-svelte-h="svelte-jckrqp"><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><a href="#Tensor">Tensor</a></code></td><td><p>The logits.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.WhisperTimeStampLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="generationlogitsprocesswhispertimestamplogitsprocessor" 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="#generationlogitsprocesswhispertimestamplogitsprocessor"><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>generation/logits_process.WhisperTimeStampLogitsProcessor</span></h2> <p data-svelte-h="svelte-7cf1c8">A LogitsProcessor that handles adding timestamps to generated text.</p> <p data-svelte-h="svelte-mqjmj0"><strong>Kind</strong>: static class of <a href="#module_generation/logits_process"><code>generation/logits_process</code></a></p> <ul data-svelte-h="svelte-gmdq4a"><li><a href="#module_generation/logits_process.WhisperTimeStampLogitsProcessor">.WhisperTimeStampLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.WhisperTimeStampLogitsProcessor_new"><code>new WhisperTimeStampLogitsProcessor(generate_config, init_tokens)</code></a></li> <li><a href="#module_generation/logits_process.WhisperTimeStampLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li></ul> <hr> <a id="new_module_generation/logits_process.WhisperTimeStampLogitsProcessor_new" class="group"></a> <h3 class="relative group"><a id="new-whispertimestamplogitsprocessorgenerateconfig-inittokens" 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-inittokens"><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, init_tokens)</span></h3> <p data-svelte-h="svelte-h97ofl">Constructs a new WhisperTimeStampLogitsProcessor.</p> <table data-svelte-h="svelte-di8ns9"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>generate_config</td><td><code>WhisperGenerationConfig</code></td><td><p>The config object passed to the <code>generate()</code> method of a transformer model.</p></td> </tr><tr><td>init_tokens</td><td><code>Array</code></td><td><p>The initial tokens of the input sequence.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.WhisperTimeStampLogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="whispertimestamplogitsprocessorcallinputids-logits--tensor" 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--tensor"><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) ⇒ Tensor</span></h3> <p data-svelte-h="svelte-t6pj9i">Modify the logits to handle timestamp tokens.</p> <p data-svelte-h="svelte-eqp931"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_process.WhisperTimeStampLogitsProcessor"><code>WhisperTimeStampLogitsProcessor</code></a><br> <strong>Returns</strong>: <a href="#Tensor"><code>Tensor</code></a> - The modified logits.</p> <table data-svelte-h="svelte-x02cjd"><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><a href="#Tensor">Tensor</a></code></td><td><p>The logits output by the model.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.NoRepeatNGramLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="generationlogitsprocessnorepeatngramlogitsprocessor" 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="#generationlogitsprocessnorepeatngramlogitsprocessor"><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>generation/logits_process.NoRepeatNGramLogitsProcessor</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-mqjmj0"><strong>Kind</strong>: static class of <a href="#module_generation/logits_process"><code>generation/logits_process</code></a></p> <ul data-svelte-h="svelte-1vp2awc"><li><a href="#module_generation/logits_process.NoRepeatNGramLogitsProcessor">.NoRepeatNGramLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.NoRepeatNGramLogitsProcessor_new"><code>new NoRepeatNGramLogitsProcessor(no_repeat_ngram_size)</code></a></li> <li><a href="#module_generation/logits_process.NoRepeatNGramLogitsProcessor+getNgrams"><code>.getNgrams(prevInputIds)</code></a><code>Map.&lt;string, Array&gt;</code></li> <li><a href="#module_generation/logits_process.NoRepeatNGramLogitsProcessor+getGeneratedNgrams"><code>.getGeneratedNgrams(bannedNgrams, prevInputIds)</code></a><code>Array</code></li> <li><a href="#module_generation/logits_process.NoRepeatNGramLogitsProcessor+calcBannedNgramTokens"><code>.calcBannedNgramTokens(prevInputIds)</code></a><code>Array</code></li> <li><a href="#module_generation/logits_process.NoRepeatNGramLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li></ul> <hr> <a id="new_module_generation/logits_process.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_generation/logits_process.NoRepeatNGramLogitsProcessor+getNgrams" class="group"></a> <h3 class="relative group"><a id="norepeatngramlogitsprocessorgetngramsprevinputids--map--string-array-" 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--map--string-array-"><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) ⇒ Map. &lt; string, Array ></span></h3> <p data-svelte-h="svelte-kezmb4">Generate n-grams from a sequence of token ids.</p> <p data-svelte-h="svelte-1xt9h1i"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_process.NoRepeatNGramLogitsProcessor"><code>NoRepeatNGramLogitsProcessor</code></a><br> <strong>Returns</strong>: <code>Map.&lt;string, Array&gt;</code> - Map of generated n-grams</p> <table data-svelte-h="svelte-1nw29t3"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>prevInputIds</td><td><code>Array</code></td><td><p>List of previous input ids</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.NoRepeatNGramLogitsProcessor+getGeneratedNgrams" class="group"></a> <h3 class="relative group"><a id="norepeatngramlogitsprocessorgetgeneratedngramsbannedngrams-previnputids--array" 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--array"><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) ⇒ Array</span></h3> <p data-svelte-h="svelte-kezmb4">Generate n-grams from a sequence of token ids.</p> <p data-svelte-h="svelte-dd9d7t"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_process.NoRepeatNGramLogitsProcessor"><code>NoRepeatNGramLogitsProcessor</code></a><br> <strong>Returns</strong>: <code>Array</code> - Map of generated n-grams</p> <table data-svelte-h="svelte-botduq"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>bannedNgrams</td><td><code>Map.&lt;string, Array&gt;</code></td><td><p>Map of banned n-grams</p></td> </tr><tr><td>prevInputIds</td><td><code>Array</code></td><td><p>List of previous input ids</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.NoRepeatNGramLogitsProcessor+calcBannedNgramTokens" class="group"></a> <h3 class="relative group"><a id="norepeatngramlogitsprocessorcalcbannedngramtokensprevinputids--array" 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--array"><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) ⇒ Array</span></h3> <p data-svelte-h="svelte-i6fmo8">Calculate banned n-gram tokens</p> <p data-svelte-h="svelte-dd9d7t"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_process.NoRepeatNGramLogitsProcessor"><code>NoRepeatNGramLogitsProcessor</code></a><br> <strong>Returns</strong>: <code>Array</code> - Map of generated n-grams</p> <table data-svelte-h="svelte-1nw29t3"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>prevInputIds</td><td><code>Array</code></td><td><p>List of previous input ids</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.NoRepeatNGramLogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="norepeatngramlogitsprocessorcallinputids-logits--tensor" 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--tensor"><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) ⇒ Tensor</span></h3> <p data-svelte-h="svelte-ns64he">Apply the no-repeat-ngram processor to the logits.</p> <p data-svelte-h="svelte-lk53qs"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_process.NoRepeatNGramLogitsProcessor"><code>NoRepeatNGramLogitsProcessor</code></a><br> <strong>Returns</strong>: <a href="#Tensor"><code>Tensor</code></a> - The logits with no-repeat-ngram processing.</p> <table data-svelte-h="svelte-jckrqp"><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><a href="#Tensor">Tensor</a></code></td><td><p>The logits.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.RepetitionPenaltyLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="generationlogitsprocessrepetitionpenaltylogitsprocessor" 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="#generationlogitsprocessrepetitionpenaltylogitsprocessor"><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>generation/logits_process.RepetitionPenaltyLogitsProcessor</span></h2> <p data-svelte-h="svelte-1yl5uai">A logits processor that prevents the repetition of previous tokens through a penalty.
This penalty is applied at most once per token. Note that, for decoder-only models like most LLMs,
the considered tokens include the prompt.</p> <p data-svelte-h="svelte-dbr7yx">In the original <a href="https://huggingface.co/papers/1909.05858" rel="nofollow">paper</a>, the authors suggest the use of a
penalty of around 1.2 to achieve a good balance between truthful generation and lack of repetition.
To penalize and reduce repetition, use <code>penalty</code> values above 1.0, where a higher value penalizes
more strongly. To reward and encourage repetition, use <code>penalty</code> values between 0.0 and 1.0, where
a lower value rewards more strongly.</p> <p data-svelte-h="svelte-mqjmj0"><strong>Kind</strong>: static class of <a href="#module_generation/logits_process"><code>generation/logits_process</code></a></p> <ul data-svelte-h="svelte-1ys27nw"><li><a href="#module_generation/logits_process.RepetitionPenaltyLogitsProcessor">.RepetitionPenaltyLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.RepetitionPenaltyLogitsProcessor_new"><code>new RepetitionPenaltyLogitsProcessor(penalty)</code></a></li> <li><a href="#module_generation/logits_process.RepetitionPenaltyLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li></ul> <hr> <a id="new_module_generation/logits_process.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-ffbcwf"><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 parameter for repetition penalty.</p> <ul><li>1.0 means no penalty. Above 1.0 penalizes previously generated tokens.</li> <li>Between 0.0 and 1.0 rewards previously generated tokens.</li></ul></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.RepetitionPenaltyLogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="repetitionpenaltylogitsprocessorcallinputids-logits--tensor" 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--tensor"><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) ⇒ Tensor</span></h3> <p data-svelte-h="svelte-ttelh1">Apply the repetition penalty to the logits.</p> <p data-svelte-h="svelte-1j34bff"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_process.RepetitionPenaltyLogitsProcessor"><code>RepetitionPenaltyLogitsProcessor</code></a><br> <strong>Returns</strong>: <a href="#Tensor"><code>Tensor</code></a> - The logits with repetition penalty processing.</p> <table data-svelte-h="svelte-jckrqp"><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><a href="#Tensor">Tensor</a></code></td><td><p>The logits.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.MinLengthLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="generationlogitsprocessminlengthlogitsprocessor" 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="#generationlogitsprocessminlengthlogitsprocessor"><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>generation/logits_process.MinLengthLogitsProcessor</span></h2> <p data-svelte-h="svelte-9c4wc0">A logits processor that enforces a minimum number of tokens.</p> <p data-svelte-h="svelte-mqjmj0"><strong>Kind</strong>: static class of <a href="#module_generation/logits_process"><code>generation/logits_process</code></a></p> <ul data-svelte-h="svelte-5910lj"><li><a href="#module_generation/logits_process.MinLengthLogitsProcessor">.MinLengthLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.MinLengthLogitsProcessor_new"><code>new MinLengthLogitsProcessor(min_length, eos_token_id)</code></a></li> <li><a href="#module_generation/logits_process.MinLengthLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li></ul> <hr> <a id="new_module_generation/logits_process.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-ijk6iz"><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</code></td><td><p>The ID/IDs of the end-of-sequence token.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.MinLengthLogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="minlengthlogitsprocessorcallinputids-logits--tensor" 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--tensor"><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) ⇒ Tensor</span></h3> <p data-svelte-h="svelte-uo9cbt">Apply logit processor.</p> <p data-svelte-h="svelte-1pfponm"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_process.MinLengthLogitsProcessor"><code>MinLengthLogitsProcessor</code></a><br> <strong>Returns</strong>: <a href="#Tensor"><code>Tensor</code></a> - The processed logits.</p> <table data-svelte-h="svelte-jckrqp"><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><a href="#Tensor">Tensor</a></code></td><td><p>The logits.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.MinNewTokensLengthLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="generationlogitsprocessminnewtokenslengthlogitsprocessor" 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="#generationlogitsprocessminnewtokenslengthlogitsprocessor"><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>generation/logits_process.MinNewTokensLengthLogitsProcessor</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-mqjmj0"><strong>Kind</strong>: static class of <a href="#module_generation/logits_process"><code>generation/logits_process</code></a></p> <ul data-svelte-h="svelte-1v6iukd"><li><a href="#module_generation/logits_process.MinNewTokensLengthLogitsProcessor">.MinNewTokensLengthLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.MinNewTokensLengthLogitsProcessor_new"><code>new MinNewTokensLengthLogitsProcessor(prompt_length_to_skip, min_new_tokens, eos_token_id)</code></a></li> <li><a href="#module_generation/logits_process.MinNewTokensLengthLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li></ul> <hr> <a id="new_module_generation/logits_process.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-rsbll8"><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</code></td><td><p>The ID/IDs of the end-of-sequence token.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.MinNewTokensLengthLogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="minnewtokenslengthlogitsprocessorcallinputids-logits--tensor" 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--tensor"><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) ⇒ Tensor</span></h3> <p data-svelte-h="svelte-uo9cbt">Apply logit processor.</p> <p data-svelte-h="svelte-18znaj4"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_process.MinNewTokensLengthLogitsProcessor"><code>MinNewTokensLengthLogitsProcessor</code></a><br> <strong>Returns</strong>: <a href="#Tensor"><code>Tensor</code></a> - The processed logits.</p> <table data-svelte-h="svelte-jckrqp"><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><a href="#Tensor">Tensor</a></code></td><td><p>The logits.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.NoBadWordsLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="generationlogitsprocessnobadwordslogitsprocessor" 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="#generationlogitsprocessnobadwordslogitsprocessor"><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>generation/logits_process.NoBadWordsLogitsProcessor</span></h2> <p data-svelte-h="svelte-mqjmj0"><strong>Kind</strong>: static class of <a href="#module_generation/logits_process"><code>generation/logits_process</code></a></p> <ul data-svelte-h="svelte-13b54qf"><li><a href="#module_generation/logits_process.NoBadWordsLogitsProcessor">.NoBadWordsLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.NoBadWordsLogitsProcessor_new"><code>new NoBadWordsLogitsProcessor(bad_words_ids, eos_token_id)</code></a></li> <li><a href="#module_generation/logits_process.NoBadWordsLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li></ul> <hr> <a id="new_module_generation/logits_process.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-13zq6l"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>bad_words_ids</td><td><code>Array</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</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_generation/logits_process.NoBadWordsLogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="nobadwordslogitsprocessorcallinputids-logits--tensor" 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--tensor"><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) ⇒ Tensor</span></h3> <p data-svelte-h="svelte-uo9cbt">Apply logit processor.</p> <p data-svelte-h="svelte-1xq9wok"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_process.NoBadWordsLogitsProcessor"><code>NoBadWordsLogitsProcessor</code></a><br> <strong>Returns</strong>: <a href="#Tensor"><code>Tensor</code></a> - The processed logits.</p> <table data-svelte-h="svelte-jckrqp"><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><a href="#Tensor">Tensor</a></code></td><td><p>The logits.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.ClassifierFreeGuidanceLogitsProcessor" class="group"></a> <h2 class="relative group"><a id="generationlogitsprocessclassifierfreeguidancelogitsprocessor" 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="#generationlogitsprocessclassifierfreeguidancelogitsprocessor"><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>generation/logits_process.ClassifierFreeGuidanceLogitsProcessor</span></h2> <p data-svelte-h="svelte-8fcn2y">[<code>LogitsProcessor</code>] for classifier free guidance (CFG). The scores are split over the batch dimension,
where the first half correspond to the conditional logits (predicted from the input prompt) and the second half
correspond to the unconditional logits (predicted from an empty or ‘null’ prompt). The processor computes a
weighted average across the conditional and unconditional logits, parameterised by the <code>guidance_scale</code>.</p> <p data-svelte-h="svelte-mhcm8x">See <a href="https://huggingface.co/papers/2306.05284" rel="nofollow">the paper</a> for more information.</p> <p data-svelte-h="svelte-mqjmj0"><strong>Kind</strong>: static class of <a href="#module_generation/logits_process"><code>generation/logits_process</code></a></p> <ul data-svelte-h="svelte-1ur2o2f"><li><a href="#module_generation/logits_process.ClassifierFreeGuidanceLogitsProcessor">.ClassifierFreeGuidanceLogitsProcessor</a> <ul><li><a href="#new_module_generation/logits_process.ClassifierFreeGuidanceLogitsProcessor_new"><code>new ClassifierFreeGuidanceLogitsProcessor(guidance_scale)</code></a></li> <li><a href="#module_generation/logits_process.ClassifierFreeGuidanceLogitsProcessor+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li></ul> <hr> <a id="new_module_generation/logits_process.ClassifierFreeGuidanceLogitsProcessor_new" class="group"></a> <h3 class="relative group"><a id="new-classifierfreeguidancelogitsprocessorguidancescale" 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-classifierfreeguidancelogitsprocessorguidancescale"><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 ClassifierFreeGuidanceLogitsProcessor(guidance_scale)</span></h3> <p data-svelte-h="svelte-1ryo8zx">Create a <code>ClassifierFreeGuidanceLogitsProcessor</code>.</p> <table data-svelte-h="svelte-8zvigw"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>guidance_scale</td><td><code>number</code></td><td><p>The guidance scale for classifier free guidance (CFG). CFG is enabled by setting <code>guidance_scale &gt; 1</code>.
Higher guidance scale encourages the model to generate samples that are more closely linked to the input
prompt, usually at the expense of poorer quality.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.ClassifierFreeGuidanceLogitsProcessor+_call" class="group"></a> <h3 class="relative group"><a id="classifierfreeguidancelogitsprocessorcallinputids-logits--tensor" 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="#classifierfreeguidancelogitsprocessorcallinputids-logits--tensor"><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>classifierFreeGuidanceLogitsProcessor._call(input_ids, logits) ⇒ Tensor</span></h3> <p data-svelte-h="svelte-uo9cbt">Apply logit processor.</p> <p data-svelte-h="svelte-1btqodc"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_process.ClassifierFreeGuidanceLogitsProcessor"><code>ClassifierFreeGuidanceLogitsProcessor</code></a><br> <strong>Returns</strong>: <a href="#Tensor"><code>Tensor</code></a> - The processed logits.</p> <table data-svelte-h="svelte-jckrqp"><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><a href="#Tensor">Tensor</a></code></td><td><p>The logits.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.TemperatureLogitsWarper" class="group"></a> <h2 class="relative group"><a id="generationlogitsprocesstemperaturelogitswarper" 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="#generationlogitsprocesstemperaturelogitswarper"><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>generation/logits_process.TemperatureLogitsWarper</span></h2> <p data-svelte-h="svelte-f4v7do">[<code>LogitsWarper</code>] for temperature (exponential scaling output probability distribution), which effectively means
that it can control the randomness of the predicted tokens. Often used together with [<code>TopPLogitsWarper</code>] and [<code>TopKLogitsWarper</code>].</p> <p data-svelte-h="svelte-mqjmj0"><strong>Kind</strong>: static class of <a href="#module_generation/logits_process"><code>generation/logits_process</code></a></p> <ul data-svelte-h="svelte-q6ulgg"><li><a href="#module_generation/logits_process.TemperatureLogitsWarper">.TemperatureLogitsWarper</a> <ul><li><a href="#new_module_generation/logits_process.TemperatureLogitsWarper_new"><code>new TemperatureLogitsWarper(temperature)</code></a></li> <li><a href="#module_generation/logits_process.TemperatureLogitsWarper+_call"><code>._call(input_ids, logits)</code></a><a href="#Tensor"><code>Tensor</code></a></li></ul></li></ul> <hr> <a id="new_module_generation/logits_process.TemperatureLogitsWarper_new" class="group"></a> <h3 class="relative group"><a id="new-temperaturelogitswarpertemperature" 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-temperaturelogitswarpertemperature"><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 TemperatureLogitsWarper(temperature)</span></h3> <p data-svelte-h="svelte-14o1n6t">Create a <code>TemperatureLogitsWarper</code>.</p> <table data-svelte-h="svelte-dn0c5z"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>temperature</td><td><code>number</code></td><td><p>Strictly positive float value used to modulate the logits distribution.
A value smaller than <code>1</code> decreases randomness (and vice versa), with <code>0</code> being equivalent to shifting
all probability mass to the most likely token.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.TemperatureLogitsWarper+_call" class="group"></a> <h3 class="relative group"><a id="temperaturelogitswarpercallinputids-logits--tensor" 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="#temperaturelogitswarpercallinputids-logits--tensor"><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>temperatureLogitsWarper._call(input_ids, logits) ⇒ Tensor</span></h3> <p data-svelte-h="svelte-1sq2o6e">Apply logit warper.</p> <p data-svelte-h="svelte-11xaj34"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_process.TemperatureLogitsWarper"><code>TemperatureLogitsWarper</code></a><br> <strong>Returns</strong>: <a href="#Tensor"><code>Tensor</code></a> - The processed logits.</p> <table data-svelte-h="svelte-jckrqp"><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><a href="#Tensor">Tensor</a></code></td><td><p>The logits.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.TopPLogitsWarper" class="group"></a> <h2 class="relative group"><a id="generationlogitsprocesstopplogitswarper" 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="#generationlogitsprocesstopplogitswarper"><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>generation/logits_process.TopPLogitsWarper</span></h2> <p data-svelte-h="svelte-1hibozh">[<code>LogitsWarper</code>] that performs top-p, i.e. restricting to top tokens summing to prob_cut_off &lt;= prob_cut_off.
Often used together with [<code>TemperatureLogitsWarper</code>] and [<code>TopKLogitsWarper</code>].</p> <p data-svelte-h="svelte-mqjmj0"><strong>Kind</strong>: static class of <a href="#module_generation/logits_process"><code>generation/logits_process</code></a></p> <hr> <a id="new_module_generation/logits_process.TopPLogitsWarper_new" class="group"></a> <h3 class="relative group"><a id="new-topplogitswarpertopp-options" 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-topplogitswarpertopp-options"><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 TopPLogitsWarper(top_p, options)</span></h3> <p data-svelte-h="svelte-y3riw0">Create a <code>TopPLogitsWarper</code>.</p> <table data-svelte-h="svelte-181jr71"><thead><tr><th>Param</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>top_p</td><td><code>number</code></td><td></td><td><p>If set to &lt; 1, only the smallest set of most probable tokens with
probabilities that add up to <code>top_p</code> or higher are kept for generation.</p></td> </tr><tr><td>options</td><td><code>Object</code></td><td></td><td><p>Additional options for the top-p sampling.</p></td> </tr><tr><td>[options.filter_value]</td><td><code>number</code></td><td><code>-Infinity</code></td><td><p>All filtered values will be set to this float value.</p></td> </tr><tr><td>[options.min_tokens_to_keep]</td><td><code>number</code></td><td><code>1</code></td><td><p>Minimum number of tokens that cannot be filtered.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_process.TopKLogitsWarper" class="group"></a> <h2 class="relative group"><a id="generationlogitsprocesstopklogitswarper" 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="#generationlogitsprocesstopklogitswarper"><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>generation/logits_process.TopKLogitsWarper</span></h2> <p data-svelte-h="svelte-ocet9o">[<code>LogitsWarper</code>] that performs top-k, i.e. restricting to the k highest probability elements.
Often used together with [<code>TemperatureLogitsWarper</code>] and [<code>TopPLogitsWarper</code>].</p> <p data-svelte-h="svelte-mqjmj0"><strong>Kind</strong>: static class of <a href="#module_generation/logits_process"><code>generation/logits_process</code></a></p> <hr> <a id="new_module_generation/logits_process.TopKLogitsWarper_new" class="group"></a> <h3 class="relative group"><a id="new-topklogitswarpertopk-options" 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-topklogitswarpertopk-options"><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 TopKLogitsWarper(top_k, options)</span></h3> <p data-svelte-h="svelte-1jc4089">Create a <code>TopKLogitsWarper</code>.</p> <table data-svelte-h="svelte-cvem3q"><thead><tr><th>Param</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>top_k</td><td><code>number</code></td><td></td><td><p>If set to &gt; 0, only the top <code>top_k</code> tokens are kept for generation.</p></td> </tr><tr><td>options</td><td><code>Object</code></td><td></td><td><p>Additional options for the top-k sampling.</p></td> </tr><tr><td>[options.filter_value]</td><td><code>number</code></td><td><code>-Infinity</code></td><td><p>All filtered values will be set to this float value.</p></td> </tr><tr><td>[options.min_tokens_to_keep]</td><td><code>number</code></td><td><code>1</code></td><td><p>Minimum number of tokens that cannot be filtered.</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/huggingface/transformers.js/blob/main/packages/transformers/docs/source/api/generation/logits_process.md" target="_blank"><svg class="mr-1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M31,16l-7,7l-1.41-1.41L28.17,16l-5.58-5.59L24,9l7,7z"></path><path d="M1,16l7-7l1.41,1.41L3.83,16l5.58,5.59L8,23l-7-7z"></path><path d="M12.419,25.484L17.639,6.552l1.932,0.518L14.351,26.002z"></path></svg> <span data-svelte-h="svelte-zjs2n5"><span class="underline">Update</span> on GitHub</span></a> <p></p>
<script>
{
__sveltekit_rvrl7f = {
assets: "/docs/transformers.js/pr_1649/en",
base: "/docs/transformers.js/pr_1649/en",
env: {}
};
const element = document.currentScript.parentElement;
const data = [null,null];
Promise.all([
import("/docs/transformers.js/pr_1649/en/_app/immutable/entry/start.5f753a22.js"),
import("/docs/transformers.js/pr_1649/en/_app/immutable/entry/app.db3dfcb7.js")
]).then(([kit, app]) => {
kit.start(app, element, {
node_ids: [0, 6],
data,
form: null,
error: null
});
});
}
</script>

Xet Storage Details

Size:
137 kB
·
Xet hash:
de789c0bc0f16c794b778696d90dfa52f28eaefd729c72b30305afd0dbb1b07f

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