Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"generation/logits_process","local":"generationlogitsprocess","sections":[{"title":"On this page","local":"on-this-page","sections":[],"depth":2},{"title":"Classes","local":"classes","sections":[{"title":"LogitsProcessor","local":"logitsprocessor","sections":[{"title":"LogitsProcessor(input_ids, logits)","local":"logitsprocessorinputids-logits","sections":[],"depth":4}],"depth":3},{"title":"LogitsWarper","local":"logitswarper","sections":[{"title":"LogitsWarper(input_ids, logits)","local":"logitswarperinputids-logits","sections":[],"depth":4}],"depth":3},{"title":"LogitsProcessorList","local":"logitsprocessorlist","sections":[{"title":"LogitsProcessorList(input_ids, logits)","local":"logitsprocessorlistinputids-logits","sections":[],"depth":4},{"title":"LogitsProcessorList.constructor()","local":"logitsprocessorlistconstructor","sections":[],"depth":4},{"title":"LogitsProcessorList.push(item)","local":"logitsprocessorlistpushitem","sections":[],"depth":4},{"title":"LogitsProcessorList.extend(items)","local":"logitsprocessorlistextenditems","sections":[],"depth":4}],"depth":3},{"title":"ForcedBOSTokenLogitsProcessor","local":"forcedbostokenlogitsprocessor","sections":[{"title":"ForcedBOSTokenLogitsProcessor(input_ids, logits)","local":"forcedbostokenlogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"ForcedBOSTokenLogitsProcessor.constructor(bos_token_id)","local":"forcedbostokenlogitsprocessorconstructorbostokenid","sections":[],"depth":4}],"depth":3},{"title":"ForcedEOSTokenLogitsProcessor","local":"forcedeostokenlogitsprocessor","sections":[{"title":"ForcedEOSTokenLogitsProcessor(input_ids, logits)","local":"forcedeostokenlogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"ForcedEOSTokenLogitsProcessor.constructor(max_length, eos_token_id)","local":"forcedeostokenlogitsprocessorconstructormaxlength-eostokenid","sections":[],"depth":4}],"depth":3},{"title":"SuppressTokensLogitsProcessor","local":"suppresstokenslogitsprocessor","sections":[{"title":"SuppressTokensLogitsProcessor(input_ids, logits)","local":"suppresstokenslogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"SuppressTokensLogitsProcessor.constructor(suppress_tokens)","local":"suppresstokenslogitsprocessorconstructorsuppresstokens","sections":[],"depth":4}],"depth":3},{"title":"SuppressTokensAtBeginLogitsProcessor","local":"suppresstokensatbeginlogitsprocessor","sections":[{"title":"SuppressTokensAtBeginLogitsProcessor(input_ids, logits)","local":"suppresstokensatbeginlogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"SuppressTokensAtBeginLogitsProcessor.constructor(begin_suppress_tokens, begin_index)","local":"suppresstokensatbeginlogitsprocessorconstructorbeginsuppresstokens-beginindex","sections":[],"depth":4}],"depth":3},{"title":"WhisperTimeStampLogitsProcessor","local":"whispertimestamplogitsprocessor","sections":[{"title":"WhisperTimeStampLogitsProcessor(input_ids, logits)","local":"whispertimestamplogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"WhisperTimeStampLogitsProcessor.constructor(generate_config, init_tokens)","local":"whispertimestamplogitsprocessorconstructorgenerateconfig-inittokens","sections":[],"depth":4}],"depth":3},{"title":"NoRepeatNGramLogitsProcessor","local":"norepeatngramlogitsprocessor","sections":[{"title":"NoRepeatNGramLogitsProcessor(input_ids, logits)","local":"norepeatngramlogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"NoRepeatNGramLogitsProcessor.constructor(no_repeat_ngram_size)","local":"norepeatngramlogitsprocessorconstructornorepeatngramsize","sections":[],"depth":4},{"title":"NoRepeatNGramLogitsProcessor.getNgrams(prevInputIds)","local":"norepeatngramlogitsprocessorgetngramsprevinputids","sections":[],"depth":4},{"title":"NoRepeatNGramLogitsProcessor.getGeneratedNgrams(bannedNgrams, prevInputIds)","local":"norepeatngramlogitsprocessorgetgeneratedngramsbannedngrams-previnputids","sections":[],"depth":4},{"title":"NoRepeatNGramLogitsProcessor.calcBannedNgramTokens(prevInputIds)","local":"norepeatngramlogitsprocessorcalcbannedngramtokensprevinputids","sections":[],"depth":4}],"depth":3},{"title":"RepetitionPenaltyLogitsProcessor","local":"repetitionpenaltylogitsprocessor","sections":[{"title":"RepetitionPenaltyLogitsProcessor(input_ids, logits)","local":"repetitionpenaltylogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"RepetitionPenaltyLogitsProcessor.constructor(penalty)","local":"repetitionpenaltylogitsprocessorconstructorpenalty","sections":[],"depth":4}],"depth":3},{"title":"MinLengthLogitsProcessor","local":"minlengthlogitsprocessor","sections":[{"title":"MinLengthLogitsProcessor(input_ids, logits)","local":"minlengthlogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"MinLengthLogitsProcessor.constructor(min_length, eos_token_id)","local":"minlengthlogitsprocessorconstructorminlength-eostokenid","sections":[],"depth":4}],"depth":3},{"title":"MinNewTokensLengthLogitsProcessor","local":"minnewtokenslengthlogitsprocessor","sections":[{"title":"MinNewTokensLengthLogitsProcessor(input_ids, logits)","local":"minnewtokenslengthlogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"MinNewTokensLengthLogitsProcessor.constructor(prompt_length_to_skip, min_new_tokens, eos_token_id)","local":"minnewtokenslengthlogitsprocessorconstructorpromptlengthtoskip-minnewtokens-eostokenid","sections":[],"depth":4}],"depth":3},{"title":"NoBadWordsLogitsProcessor","local":"nobadwordslogitsprocessor","sections":[{"title":"NoBadWordsLogitsProcessor(input_ids, logits)","local":"nobadwordslogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"NoBadWordsLogitsProcessor.constructor(bad_words_ids, eos_token_id)","local":"nobadwordslogitsprocessorconstructorbadwordsids-eostokenid","sections":[],"depth":4}],"depth":3},{"title":"ClassifierFreeGuidanceLogitsProcessor","local":"classifierfreeguidancelogitsprocessor","sections":[{"title":"ClassifierFreeGuidanceLogitsProcessor(input_ids, logits)","local":"classifierfreeguidancelogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"ClassifierFreeGuidanceLogitsProcessor.constructor(guidance_scale)","local":"classifierfreeguidancelogitsprocessorconstructorguidancescale","sections":[],"depth":4}],"depth":3},{"title":"TemperatureLogitsWarper","local":"temperaturelogitswarper","sections":[{"title":"TemperatureLogitsWarper(input_ids, logits)","local":"temperaturelogitswarperinputids-logits","sections":[],"depth":4},{"title":"TemperatureLogitsWarper.constructor(temperature)","local":"temperaturelogitswarperconstructortemperature","sections":[],"depth":4}],"depth":3},{"title":"TopPLogitsWarper","local":"topplogitswarper","sections":[{"title":"TopPLogitsWarper.constructor(top_p, options)","local":"topplogitswarperconstructortopp-options","sections":[],"depth":4}],"depth":3},{"title":"TopKLogitsWarper","local":"topklogitswarper","sections":[{"title":"TopKLogitsWarper.constructor(top_k, options)","local":"topklogitswarperconstructortopk-options","sections":[],"depth":4}],"depth":3}],"depth":2}],"depth":1}"> | |
| <link href="/docs/transformers.js/pr_1665/en/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/entry/start.cb58eb6f.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/chunks/scheduler.6efaaf90.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/chunks/singletons.08239980.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/chunks/paths.611c3944.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/entry/app.9eafcf9d.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/chunks/preload-helper.4b821645.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/chunks/index.eb3e1f0f.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/nodes/0.d361a553.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/chunks/each.e59479a4.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/nodes/7.66b23c6b.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1665/en/_app/immutable/chunks/MermaidChart.svelte_svelte_type_style_lang.699f2734.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{"title":"generation/logits_process","local":"generationlogitsprocess","sections":[{"title":"On this page","local":"on-this-page","sections":[],"depth":2},{"title":"Classes","local":"classes","sections":[{"title":"LogitsProcessor","local":"logitsprocessor","sections":[{"title":"LogitsProcessor(input_ids, logits)","local":"logitsprocessorinputids-logits","sections":[],"depth":4}],"depth":3},{"title":"LogitsWarper","local":"logitswarper","sections":[{"title":"LogitsWarper(input_ids, logits)","local":"logitswarperinputids-logits","sections":[],"depth":4}],"depth":3},{"title":"LogitsProcessorList","local":"logitsprocessorlist","sections":[{"title":"LogitsProcessorList(input_ids, logits)","local":"logitsprocessorlistinputids-logits","sections":[],"depth":4},{"title":"LogitsProcessorList.constructor()","local":"logitsprocessorlistconstructor","sections":[],"depth":4},{"title":"LogitsProcessorList.push(item)","local":"logitsprocessorlistpushitem","sections":[],"depth":4},{"title":"LogitsProcessorList.extend(items)","local":"logitsprocessorlistextenditems","sections":[],"depth":4}],"depth":3},{"title":"ForcedBOSTokenLogitsProcessor","local":"forcedbostokenlogitsprocessor","sections":[{"title":"ForcedBOSTokenLogitsProcessor(input_ids, logits)","local":"forcedbostokenlogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"ForcedBOSTokenLogitsProcessor.constructor(bos_token_id)","local":"forcedbostokenlogitsprocessorconstructorbostokenid","sections":[],"depth":4}],"depth":3},{"title":"ForcedEOSTokenLogitsProcessor","local":"forcedeostokenlogitsprocessor","sections":[{"title":"ForcedEOSTokenLogitsProcessor(input_ids, logits)","local":"forcedeostokenlogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"ForcedEOSTokenLogitsProcessor.constructor(max_length, eos_token_id)","local":"forcedeostokenlogitsprocessorconstructormaxlength-eostokenid","sections":[],"depth":4}],"depth":3},{"title":"SuppressTokensLogitsProcessor","local":"suppresstokenslogitsprocessor","sections":[{"title":"SuppressTokensLogitsProcessor(input_ids, logits)","local":"suppresstokenslogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"SuppressTokensLogitsProcessor.constructor(suppress_tokens)","local":"suppresstokenslogitsprocessorconstructorsuppresstokens","sections":[],"depth":4}],"depth":3},{"title":"SuppressTokensAtBeginLogitsProcessor","local":"suppresstokensatbeginlogitsprocessor","sections":[{"title":"SuppressTokensAtBeginLogitsProcessor(input_ids, logits)","local":"suppresstokensatbeginlogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"SuppressTokensAtBeginLogitsProcessor.constructor(begin_suppress_tokens, begin_index)","local":"suppresstokensatbeginlogitsprocessorconstructorbeginsuppresstokens-beginindex","sections":[],"depth":4}],"depth":3},{"title":"WhisperTimeStampLogitsProcessor","local":"whispertimestamplogitsprocessor","sections":[{"title":"WhisperTimeStampLogitsProcessor(input_ids, logits)","local":"whispertimestamplogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"WhisperTimeStampLogitsProcessor.constructor(generate_config, init_tokens)","local":"whispertimestamplogitsprocessorconstructorgenerateconfig-inittokens","sections":[],"depth":4}],"depth":3},{"title":"NoRepeatNGramLogitsProcessor","local":"norepeatngramlogitsprocessor","sections":[{"title":"NoRepeatNGramLogitsProcessor(input_ids, logits)","local":"norepeatngramlogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"NoRepeatNGramLogitsProcessor.constructor(no_repeat_ngram_size)","local":"norepeatngramlogitsprocessorconstructornorepeatngramsize","sections":[],"depth":4},{"title":"NoRepeatNGramLogitsProcessor.getNgrams(prevInputIds)","local":"norepeatngramlogitsprocessorgetngramsprevinputids","sections":[],"depth":4},{"title":"NoRepeatNGramLogitsProcessor.getGeneratedNgrams(bannedNgrams, prevInputIds)","local":"norepeatngramlogitsprocessorgetgeneratedngramsbannedngrams-previnputids","sections":[],"depth":4},{"title":"NoRepeatNGramLogitsProcessor.calcBannedNgramTokens(prevInputIds)","local":"norepeatngramlogitsprocessorcalcbannedngramtokensprevinputids","sections":[],"depth":4}],"depth":3},{"title":"RepetitionPenaltyLogitsProcessor","local":"repetitionpenaltylogitsprocessor","sections":[{"title":"RepetitionPenaltyLogitsProcessor(input_ids, logits)","local":"repetitionpenaltylogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"RepetitionPenaltyLogitsProcessor.constructor(penalty)","local":"repetitionpenaltylogitsprocessorconstructorpenalty","sections":[],"depth":4}],"depth":3},{"title":"MinLengthLogitsProcessor","local":"minlengthlogitsprocessor","sections":[{"title":"MinLengthLogitsProcessor(input_ids, logits)","local":"minlengthlogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"MinLengthLogitsProcessor.constructor(min_length, eos_token_id)","local":"minlengthlogitsprocessorconstructorminlength-eostokenid","sections":[],"depth":4}],"depth":3},{"title":"MinNewTokensLengthLogitsProcessor","local":"minnewtokenslengthlogitsprocessor","sections":[{"title":"MinNewTokensLengthLogitsProcessor(input_ids, logits)","local":"minnewtokenslengthlogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"MinNewTokensLengthLogitsProcessor.constructor(prompt_length_to_skip, min_new_tokens, eos_token_id)","local":"minnewtokenslengthlogitsprocessorconstructorpromptlengthtoskip-minnewtokens-eostokenid","sections":[],"depth":4}],"depth":3},{"title":"NoBadWordsLogitsProcessor","local":"nobadwordslogitsprocessor","sections":[{"title":"NoBadWordsLogitsProcessor(input_ids, logits)","local":"nobadwordslogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"NoBadWordsLogitsProcessor.constructor(bad_words_ids, eos_token_id)","local":"nobadwordslogitsprocessorconstructorbadwordsids-eostokenid","sections":[],"depth":4}],"depth":3},{"title":"ClassifierFreeGuidanceLogitsProcessor","local":"classifierfreeguidancelogitsprocessor","sections":[{"title":"ClassifierFreeGuidanceLogitsProcessor(input_ids, logits)","local":"classifierfreeguidancelogitsprocessorinputids-logits","sections":[],"depth":4},{"title":"ClassifierFreeGuidanceLogitsProcessor.constructor(guidance_scale)","local":"classifierfreeguidancelogitsprocessorconstructorguidancescale","sections":[],"depth":4}],"depth":3},{"title":"TemperatureLogitsWarper","local":"temperaturelogitswarper","sections":[{"title":"TemperatureLogitsWarper(input_ids, logits)","local":"temperaturelogitswarperinputids-logits","sections":[],"depth":4},{"title":"TemperatureLogitsWarper.constructor(temperature)","local":"temperaturelogitswarperconstructortemperature","sections":[],"depth":4}],"depth":3},{"title":"TopPLogitsWarper","local":"topplogitswarper","sections":[{"title":"TopPLogitsWarper.constructor(top_p, options)","local":"topplogitswarperconstructortopp-options","sections":[],"depth":4}],"depth":3},{"title":"TopKLogitsWarper","local":"topklogitswarper","sections":[{"title":"TopKLogitsWarper.constructor(top_k, options)","local":"topklogitswarperconstructortopk-options","sections":[],"depth":4}],"depth":3}],"depth":2}],"depth":1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <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> <p data-svelte-h="svelte-1g08fjg">Logits processors applied during token generation.</p> <p data-svelte-h="svelte-qket3k">A <code>LogitsProcessor</code> rewrites the probability distribution over the next token — | |
| suppressing specific ids, forcing certain tokens at the start or end, | |
| penalising repetition, and so on. <code>LogitsProcessorList</code> composes many | |
| processors; pass one via the <code>logits_processor</code> argument of <code>generate()</code>.</p> <h2 class="relative group"><a id="on-this-page" 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="#on-this-page"><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>On this page</span></h2> <p data-svelte-h="svelte-1u5l6je"><strong>Classes</strong> — <a href="#module_generation/logits_process.LogitsProcessor"><code>LogitsProcessor</code></a> · <a href="#module_generation/logits_process.LogitsWarper"><code>LogitsWarper</code></a> · <a href="#module_generation/logits_process.LogitsProcessorList"><code>LogitsProcessorList</code></a> · <a href="#module_generation/logits_process.ForcedBOSTokenLogitsProcessor"><code>ForcedBOSTokenLogitsProcessor</code></a> · <a href="#module_generation/logits_process.ForcedEOSTokenLogitsProcessor"><code>ForcedEOSTokenLogitsProcessor</code></a> · <a href="#module_generation/logits_process.SuppressTokensLogitsProcessor"><code>SuppressTokensLogitsProcessor</code></a> · <a href="#module_generation/logits_process.SuppressTokensAtBeginLogitsProcessor"><code>SuppressTokensAtBeginLogitsProcessor</code></a> · <a href="#module_generation/logits_process.WhisperTimeStampLogitsProcessor"><code>WhisperTimeStampLogitsProcessor</code></a> · <a href="#module_generation/logits_process.NoRepeatNGramLogitsProcessor"><code>NoRepeatNGramLogitsProcessor</code></a> · <a href="#module_generation/logits_process.RepetitionPenaltyLogitsProcessor"><code>RepetitionPenaltyLogitsProcessor</code></a> · <a href="#module_generation/logits_process.MinLengthLogitsProcessor"><code>MinLengthLogitsProcessor</code></a> · <a href="#module_generation/logits_process.MinNewTokensLengthLogitsProcessor"><code>MinNewTokensLengthLogitsProcessor</code></a> · <a href="#module_generation/logits_process.NoBadWordsLogitsProcessor"><code>NoBadWordsLogitsProcessor</code></a> · <a href="#module_generation/logits_process.ClassifierFreeGuidanceLogitsProcessor"><code>ClassifierFreeGuidanceLogitsProcessor</code></a> · <a href="#module_generation/logits_process.TemperatureLogitsWarper"><code>TemperatureLogitsWarper</code></a> · <a href="#module_generation/logits_process.TopPLogitsWarper"><code>TopPLogitsWarper</code></a> · <a href="#module_generation/logits_process.TopKLogitsWarper"><code>TopKLogitsWarper</code></a></p> <h2 class="relative group"><a id="classes" 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="#classes"><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>Classes</span></h2> <a id="module_generation/logits_process.LogitsProcessor"></a> <h3 class="relative group"><a id="logitsprocessor" 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="#logitsprocessor"><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</span></h3> <p data-svelte-h="svelte-y1kta5">Abstract base class for all logit processors that can be applied during generation.</p> <a id="module_generation/logits_process.LogitsProcessor.call"></a> <h4 class="relative group"><a id="logitsprocessorinputids-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="#logitsprocessorinputids-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(input_ids, logits)</span></h4> <p data-svelte-h="svelte-pof7bn">Apply the processor to the input logits.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-15hbndi"><li><code>input_ids</code> (<code>bigint[][]</code>) — The input IDs.</li> <li><code>logits</code> (<a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a>) — The logits to process.</li></ul> <p data-svelte-h="svelte-sl4r8m"><strong>Throws</strong></p> <ul data-svelte-h="svelte-1krm3to"><li><code>Error</code> — Throws an error if <code>_call</code> is not implemented in the subclass.</li></ul> <a id="module_generation/logits_process.LogitsWarper"></a> <h3 class="relative group"><a id="logitswarper" 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="#logitswarper"><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</span></h3> <p data-svelte-h="svelte-th82mu">Abstract base class for all logit warpers that can be applied during generation with multinomial sampling.</p> <a id="module_generation/logits_process.LogitsWarper.call"></a> <h4 class="relative group"><a id="logitswarperinputids-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="#logitswarperinputids-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(input_ids, logits)</span></h4> <p data-svelte-h="svelte-pof7bn">Apply the processor to the input logits.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-15hbndi"><li><code>input_ids</code> (<code>bigint[][]</code>) — The input IDs.</li> <li><code>logits</code> (<a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a>) — The logits to process.</li></ul> <p data-svelte-h="svelte-sl4r8m"><strong>Throws</strong></p> <ul data-svelte-h="svelte-1krm3to"><li><code>Error</code> — Throws an error if <code>_call</code> is not implemented in the subclass.</li></ul> <a id="module_generation/logits_process.LogitsProcessorList"></a> <h3 class="relative group"><a id="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="#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>LogitsProcessorList</span></h3> <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> <a id="module_generation/logits_process.LogitsProcessorList.call"></a> <h4 class="relative group"><a id="logitsprocessorlistinputids-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="#logitsprocessorlistinputids-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(input_ids, logits)</span></h4> <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-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-gs7sc8"><li><code>input_ids</code> (<code>bigint[][]</code>) — The input IDs for the language model.</li> <li><code>logits</code> (<a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a>)</li></ul> <a id="module_generation/logits_process.LogitsProcessorList.constructor"></a> <h4 class="relative group"><a id="logitsprocessorlistconstructor" 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="#logitsprocessorlistconstructor"><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.constructor()</span></h4> <p data-svelte-h="svelte-7qo2qs">Constructs a new instance of <code>LogitsProcessorList</code>.</p> <a id="module_generation/logits_process.LogitsProcessorList.push"></a> <h4 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></h4> <p data-svelte-h="svelte-y2lyqr">Adds a new logits processor to the list.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-106gcgh"><li><code>item</code> (<a href="./logits_process#module_generation/logits_process.LogitsProcessor"><code>LogitsProcessor</code></a>) — The logits processor function to add.</li></ul> <a id="module_generation/logits_process.LogitsProcessorList.extend"></a> <h4 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></h4> <p data-svelte-h="svelte-19ybhdd">Adds multiple logits processors to the list.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-5d3153"><li><code>items</code> (<a href="./logits_process#module_generation/logits_process.LogitsProcessor"><code>LogitsProcessor</code></a>[]) — The logits processor functions to add.</li></ul> <a id="module_generation/logits_process.ForcedBOSTokenLogitsProcessor"></a> <h3 class="relative group"><a id="forcedbostokenlogitsprocessor" 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="#forcedbostokenlogitsprocessor"><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</span></h3> <p data-svelte-h="svelte-o4hur7">A LogitsProcessor that forces a BOS token at the beginning of the generated sequence.</p> <a id="module_generation/logits_process.ForcedBOSTokenLogitsProcessor.call"></a> <h4 class="relative group"><a id="forcedbostokenlogitsprocessorinputids-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="#forcedbostokenlogitsprocessorinputids-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>ForcedBOSTokenLogitsProcessor(input_ids, logits)</span></h4> <p data-svelte-h="svelte-uhajj6">Apply the BOS token forcing to the logits.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-itnglw"><li><code>input_ids</code> (<code>bigint[][]</code>) — The input IDs.</li> <li><code>logits</code> (<a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a>) — The logits.</li></ul> <p data-svelte-h="svelte-28na9"><strong>Returns:</strong> <a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a> — The logits with BOS token forcing.</p> <a id="module_generation/logits_process.ForcedBOSTokenLogitsProcessor.constructor"></a> <h4 class="relative group"><a id="forcedbostokenlogitsprocessorconstructorbostokenid" 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="#forcedbostokenlogitsprocessorconstructorbostokenid"><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.constructor(bos_token_id)</span></h4> <p data-svelte-h="svelte-1gtxb4f">Create a ForcedBOSTokenLogitsProcessor.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-1ubkrvw"><li><code>bos_token_id</code> (<code>number</code>) — The ID of the beginning-of-sequence token to be forced.</li></ul> <a id="module_generation/logits_process.ForcedEOSTokenLogitsProcessor"></a> <h3 class="relative group"><a id="forcedeostokenlogitsprocessor" 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="#forcedeostokenlogitsprocessor"><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</span></h3> <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> <a id="module_generation/logits_process.ForcedEOSTokenLogitsProcessor.call"></a> <h4 class="relative group"><a id="forcedeostokenlogitsprocessorinputids-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="#forcedeostokenlogitsprocessorinputids-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(input_ids, logits)</span></h4> <p data-svelte-h="svelte-2wlv12">Apply the processor to input_ids and logits.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-npjpyf"><li><code>input_ids</code> (<code>bigint[][]</code>) — The input IDs.</li> <li><code>logits</code> (<a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a>) — The logits tensor.</li></ul> <a id="module_generation/logits_process.ForcedEOSTokenLogitsProcessor.constructor"></a> <h4 class="relative group"><a id="forcedeostokenlogitsprocessorconstructormaxlength-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="#forcedeostokenlogitsprocessorconstructormaxlength-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>ForcedEOSTokenLogitsProcessor.constructor(max_length, eos_token_id)</span></h4> <p data-svelte-h="svelte-16ugs6s">Create a ForcedEOSTokenLogitsProcessor.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-69ep1o"><li><code>max_length</code> (<code>number</code>) — The maximum length of the sequence to be generated.</li> <li><code>eos_token_id</code> (<code>number[]?</code>) — The ID or IDs of the <em>end-of-sequence</em> token.</li></ul> <a id="module_generation/logits_process.SuppressTokensLogitsProcessor"></a> <h3 class="relative group"><a id="suppresstokenslogitsprocessor" 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="#suppresstokenslogitsprocessor"><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</span></h3> <p data-svelte-h="svelte-jq8cdd">A LogitsProcessor that suppresses a list of tokens throughout generation. | |
| Sets their log probabilities to <code>-inf</code> so that they are not generated.</p> <a id="module_generation/logits_process.SuppressTokensLogitsProcessor.call"></a> <h4 class="relative group"><a id="suppresstokenslogitsprocessorinputids-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="#suppresstokenslogitsprocessorinputids-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>SuppressTokensLogitsProcessor(input_ids, logits)</span></h4> <p data-svelte-h="svelte-12tcusf">Suppress the specified tokens by setting their logits to -Infinity.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-itnglw"><li><code>input_ids</code> (<code>bigint[][]</code>) — The input IDs.</li> <li><code>logits</code> (<a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a>) — The logits.</li></ul> <p data-svelte-h="svelte-jr1hch"><strong>Returns:</strong> <a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a> — The modified logits.</p> <a id="module_generation/logits_process.SuppressTokensLogitsProcessor.constructor"></a> <h4 class="relative group"><a id="suppresstokenslogitsprocessorconstructorsuppresstokens" 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="#suppresstokenslogitsprocessorconstructorsuppresstokens"><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.constructor(suppress_tokens)</span></h4> <p data-svelte-h="svelte-97gw62">Create a SuppressTokensLogitsProcessor.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-7huh8k"><li><code>suppress_tokens</code> (<code>number[]</code>) — The IDs of the tokens to suppress.</li></ul> <a id="module_generation/logits_process.SuppressTokensAtBeginLogitsProcessor"></a> <h3 class="relative group"><a id="suppresstokensatbeginlogitsprocessor" 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="#suppresstokensatbeginlogitsprocessor"><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</span></h3> <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> <a id="module_generation/logits_process.SuppressTokensAtBeginLogitsProcessor.call"></a> <h4 class="relative group"><a id="suppresstokensatbeginlogitsprocessorinputids-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="#suppresstokensatbeginlogitsprocessorinputids-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>SuppressTokensAtBeginLogitsProcessor(input_ids, logits)</span></h4> <p data-svelte-h="svelte-uhajj6">Apply the BOS token forcing to the logits.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-itnglw"><li><code>input_ids</code> (<code>bigint[][]</code>) — The input IDs.</li> <li><code>logits</code> (<a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a>) — The logits.</li></ul> <p data-svelte-h="svelte-28na9"><strong>Returns:</strong> <a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a> — The logits with BOS token forcing.</p> <a id="module_generation/logits_process.SuppressTokensAtBeginLogitsProcessor.constructor"></a> <h4 class="relative group"><a id="suppresstokensatbeginlogitsprocessorconstructorbeginsuppresstokens-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="#suppresstokensatbeginlogitsprocessorconstructorbeginsuppresstokens-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>SuppressTokensAtBeginLogitsProcessor.constructor(begin_suppress_tokens, begin_index)</span></h4> <p data-svelte-h="svelte-459vk0">Create a SuppressTokensAtBeginLogitsProcessor.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-z9usue"><li><code>begin_suppress_tokens</code> (<code>number[]</code>) — The IDs of the tokens to suppress.</li> <li><code>begin_index</code> (<code>number</code>) — The number of tokens to generate before suppressing tokens.</li></ul> <a id="module_generation/logits_process.WhisperTimeStampLogitsProcessor"></a> <h3 class="relative group"><a id="whispertimestamplogitsprocessor" 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="#whispertimestamplogitsprocessor"><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</span></h3> <p data-svelte-h="svelte-7cf1c8">A LogitsProcessor that handles adding timestamps to generated text.</p> <a id="module_generation/logits_process.WhisperTimeStampLogitsProcessor.call"></a> <h4 class="relative group"><a id="whispertimestamplogitsprocessorinputids-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="#whispertimestamplogitsprocessorinputids-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>WhisperTimeStampLogitsProcessor(input_ids, logits)</span></h4> <p data-svelte-h="svelte-t6pj9i">Modify the logits to handle timestamp tokens.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-1rmaldq"><li><code>input_ids</code> (<code>bigint[][]</code>) — The input sequence of tokens.</li> <li><code>logits</code> (<a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a>) — The logits output by the model.</li></ul> <p data-svelte-h="svelte-jr1hch"><strong>Returns:</strong> <a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a> — The modified logits.</p> <a id="module_generation/logits_process.WhisperTimeStampLogitsProcessor.constructor"></a> <h4 class="relative group"><a id="whispertimestamplogitsprocessorconstructorgenerateconfig-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="#whispertimestamplogitsprocessorconstructorgenerateconfig-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>WhisperTimeStampLogitsProcessor.constructor(generate_config, init_tokens)</span></h4> <p data-svelte-h="svelte-h97ofl">Constructs a new WhisperTimeStampLogitsProcessor.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-l7fj7y"><li><code>generate_config</code> (<code>WhisperGenerationConfig</code>) — The config object passed to the <code>generate()</code> method of a transformer model.</li> <li><code>init_tokens</code> (<code>number[]</code>) — The initial tokens of the input sequence.</li></ul> <a id="module_generation/logits_process.NoRepeatNGramLogitsProcessor"></a> <h3 class="relative group"><a id="norepeatngramlogitsprocessor" 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="#norepeatngramlogitsprocessor"><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</span></h3> <p data-svelte-h="svelte-1ta52e2">A logits processor that disallows repeated n-grams of a certain size.</p> <a id="module_generation/logits_process.NoRepeatNGramLogitsProcessor.call"></a> <h4 class="relative group"><a id="norepeatngramlogitsprocessorinputids-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="#norepeatngramlogitsprocessorinputids-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>NoRepeatNGramLogitsProcessor(input_ids, logits)</span></h4> <p data-svelte-h="svelte-jqj728">Apply the no-repeat n-gram processor to the logits.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-itnglw"><li><code>input_ids</code> (<code>bigint[][]</code>) — The input IDs.</li> <li><code>logits</code> (<a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a>) — The logits.</li></ul> <p data-svelte-h="svelte-1r54rxu"><strong>Returns:</strong> <a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a> — The logits with no-repeat n-gram processing.</p> <a id="module_generation/logits_process.NoRepeatNGramLogitsProcessor.constructor"></a> <h4 class="relative group"><a id="norepeatngramlogitsprocessorconstructornorepeatngramsize" 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="#norepeatngramlogitsprocessorconstructornorepeatngramsize"><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.constructor(no_repeat_ngram_size)</span></h4> <p data-svelte-h="svelte-ztp378">Create a NoRepeatNGramLogitsProcessor.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-72ga5u"><li><code>no_repeat_ngram_size</code> (<code>number</code>) — The no-repeat n-gram size. All n-grams of this size can only occur once.</li></ul> <a id="module_generation/logits_process.NoRepeatNGramLogitsProcessor.getNgrams"></a> <h4 class="relative group"><a id="norepeatngramlogitsprocessorgetngramsprevinputids" 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"><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)</span></h4> <p data-svelte-h="svelte-ajpnu8">Generate n-grams from a sequence of token IDs.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-1hubly8"><li><code>prevInputIds</code> (<code>bigint[]</code>) — List of previous input IDs.</li></ul> <p data-svelte-h="svelte-1or9vci"><strong>Returns:</strong> <code>Map</code><<code>string</code>, <code>number[]</code>> — Map of generated n-grams</p> <a id="module_generation/logits_process.NoRepeatNGramLogitsProcessor.getGeneratedNgrams"></a> <h4 class="relative group"><a id="norepeatngramlogitsprocessorgetgeneratedngramsbannedngrams-previnputids" 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"><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)</span></h4> <p data-svelte-h="svelte-ajpnu8">Generate n-grams from a sequence of token IDs.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-laclzu"><li><code>bannedNgrams</code> (<code>Map</code><<code>string</code>, <code>number[]</code>>) — Map of banned n-grams</li> <li><code>prevInputIds</code> (<code>bigint[]</code>) — List of previous input IDs.</li></ul> <p data-svelte-h="svelte-1ewso0p"><strong>Returns:</strong> <code>number[]</code> — Map of generated n-grams</p> <a id="module_generation/logits_process.NoRepeatNGramLogitsProcessor.calcBannedNgramTokens"></a> <h4 class="relative group"><a id="norepeatngramlogitsprocessorcalcbannedngramtokensprevinputids" 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"><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)</span></h4> <p data-svelte-h="svelte-i6fmo8">Calculate banned n-gram tokens</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-1hubly8"><li><code>prevInputIds</code> (<code>bigint[]</code>) — List of previous input IDs.</li></ul> <p data-svelte-h="svelte-1ewso0p"><strong>Returns:</strong> <code>number[]</code> — Map of generated n-grams</p> <a id="module_generation/logits_process.RepetitionPenaltyLogitsProcessor"></a> <h3 class="relative group"><a id="repetitionpenaltylogitsprocessor" 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="#repetitionpenaltylogitsprocessor"><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</span></h3> <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> <a id="module_generation/logits_process.RepetitionPenaltyLogitsProcessor.call"></a> <h4 class="relative group"><a id="repetitionpenaltylogitsprocessorinputids-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="#repetitionpenaltylogitsprocessorinputids-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>RepetitionPenaltyLogitsProcessor(input_ids, logits)</span></h4> <p data-svelte-h="svelte-ttelh1">Apply the repetition penalty to the logits.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-itnglw"><li><code>input_ids</code> (<code>bigint[][]</code>) — The input IDs.</li> <li><code>logits</code> (<a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a>) — The logits.</li></ul> <p data-svelte-h="svelte-18vxyd"><strong>Returns:</strong> <a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a> — The logits with repetition penalty processing.</p> <a id="module_generation/logits_process.RepetitionPenaltyLogitsProcessor.constructor"></a> <h4 class="relative group"><a id="repetitionpenaltylogitsprocessorconstructorpenalty" 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="#repetitionpenaltylogitsprocessorconstructorpenalty"><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.constructor(penalty)</span></h4> <p data-svelte-h="svelte-1miwk7z">Create a RepetitionPenaltyLogitsProcessor.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-11rsltm"><li><code>penalty</code> (<code>number</code>) — Penalty applied to repeated tokens. | |
| <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></li></ul> <a id="module_generation/logits_process.MinLengthLogitsProcessor"></a> <h3 class="relative group"><a id="minlengthlogitsprocessor" 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="#minlengthlogitsprocessor"><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</span></h3> <p data-svelte-h="svelte-9c4wc0">A logits processor that enforces a minimum number of tokens.</p> <a id="module_generation/logits_process.MinLengthLogitsProcessor.call"></a> <h4 class="relative group"><a id="minlengthlogitsprocessorinputids-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="#minlengthlogitsprocessorinputids-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>MinLengthLogitsProcessor(input_ids, logits)</span></h4> <p data-svelte-h="svelte-uo9cbt">Apply logit processor.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-itnglw"><li><code>input_ids</code> (<code>bigint[][]</code>) — The input IDs.</li> <li><code>logits</code> (<a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a>) — The logits.</li></ul> <p data-svelte-h="svelte-ndhb6q"><strong>Returns:</strong> <a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a> — The processed logits.</p> <a id="module_generation/logits_process.MinLengthLogitsProcessor.constructor"></a> <h4 class="relative group"><a id="minlengthlogitsprocessorconstructorminlength-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="#minlengthlogitsprocessorconstructorminlength-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>MinLengthLogitsProcessor.constructor(min_length, eos_token_id)</span></h4> <p data-svelte-h="svelte-1m5mw53">Create a MinLengthLogitsProcessor.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-lpv895"><li><code>min_length</code> (<code>number</code>) — The minimum length below which the score of <code>eos_token_id</code> is set to negative infinity.</li> <li><code>eos_token_id</code> (<code>number[]?</code>) — The ID or IDs of the end-of-sequence token.</li></ul> <a id="module_generation/logits_process.MinNewTokensLengthLogitsProcessor"></a> <h3 class="relative group"><a id="minnewtokenslengthlogitsprocessor" 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="#minnewtokenslengthlogitsprocessor"><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</span></h3> <p data-svelte-h="svelte-ozjzty">A logits processor that enforces a minimum number of new tokens.</p> <a id="module_generation/logits_process.MinNewTokensLengthLogitsProcessor.call"></a> <h4 class="relative group"><a id="minnewtokenslengthlogitsprocessorinputids-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="#minnewtokenslengthlogitsprocessorinputids-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>MinNewTokensLengthLogitsProcessor(input_ids, logits)</span></h4> <p data-svelte-h="svelte-uo9cbt">Apply logit processor.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-itnglw"><li><code>input_ids</code> (<code>bigint[][]</code>) — The input IDs.</li> <li><code>logits</code> (<a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a>) — The logits.</li></ul> <p data-svelte-h="svelte-ndhb6q"><strong>Returns:</strong> <a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a> — The processed logits.</p> <a id="module_generation/logits_process.MinNewTokensLengthLogitsProcessor.constructor"></a> <h4 class="relative group"><a id="minnewtokenslengthlogitsprocessorconstructorpromptlengthtoskip-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="#minnewtokenslengthlogitsprocessorconstructorpromptlengthtoskip-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>MinNewTokensLengthLogitsProcessor.constructor(prompt_length_to_skip, min_new_tokens, eos_token_id)</span></h4> <p data-svelte-h="svelte-6z34lb">Create a MinNewTokensLengthLogitsProcessor.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-1ypwm4e"><li><code>prompt_length_to_skip</code> (<code>number</code>) — The input tokens length.</li> <li><code>min_new_tokens</code> (<code>number</code>) — The minimum <em>new</em> tokens length below which the score of <code>eos_token_id</code> is set to negative infinity.</li> <li><code>eos_token_id</code> (<code>number[]?</code>) — The ID or IDs of the end-of-sequence token.</li></ul> <a id="module_generation/logits_process.NoBadWordsLogitsProcessor"></a> <h3 class="relative group"><a id="nobadwordslogitsprocessor" 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="#nobadwordslogitsprocessor"><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</span></h3> <p data-svelte-h="svelte-yg9c8x">LogitsProcessor that enforces that specified sequences will never be selected.</p> <a id="module_generation/logits_process.NoBadWordsLogitsProcessor.call"></a> <h4 class="relative group"><a id="nobadwordslogitsprocessorinputids-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="#nobadwordslogitsprocessorinputids-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>NoBadWordsLogitsProcessor(input_ids, logits)</span></h4> <p data-svelte-h="svelte-uo9cbt">Apply logit processor.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-itnglw"><li><code>input_ids</code> (<code>bigint[][]</code>) — The input IDs.</li> <li><code>logits</code> (<a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a>) — The logits.</li></ul> <p data-svelte-h="svelte-ndhb6q"><strong>Returns:</strong> <a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a> — The processed logits.</p> <a id="module_generation/logits_process.NoBadWordsLogitsProcessor.constructor"></a> <h4 class="relative group"><a id="nobadwordslogitsprocessorconstructorbadwordsids-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="#nobadwordslogitsprocessorconstructorbadwordsids-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>NoBadWordsLogitsProcessor.constructor(bad_words_ids, eos_token_id)</span></h4> <p data-svelte-h="svelte-1un5mwn">Create a <code>NoBadWordsLogitsProcessor</code>.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-gwt44t"><li><code>bad_words_ids</code> (<code>number[][]</code>) — List of token ID sequences that are not allowed to be generated.</li> <li><code>eos_token_id</code> (<code>number[]?</code>) — The ID of the <em>end-of-sequence</em> token. Optionally, use a list to set multiple <em>end-of-sequence</em> tokens.</li></ul> <a id="module_generation/logits_process.ClassifierFreeGuidanceLogitsProcessor"></a> <h3 class="relative group"><a id="classifierfreeguidancelogitsprocessor" 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="#classifierfreeguidancelogitsprocessor"><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</span></h3> <p data-svelte-h="svelte-p17bsk">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> <a id="module_generation/logits_process.ClassifierFreeGuidanceLogitsProcessor.call"></a> <h4 class="relative group"><a id="classifierfreeguidancelogitsprocessorinputids-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="#classifierfreeguidancelogitsprocessorinputids-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>ClassifierFreeGuidanceLogitsProcessor(input_ids, logits)</span></h4> <p data-svelte-h="svelte-uo9cbt">Apply logit processor.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-itnglw"><li><code>input_ids</code> (<code>bigint[][]</code>) — The input IDs.</li> <li><code>logits</code> (<a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a>) — The logits.</li></ul> <p data-svelte-h="svelte-ndhb6q"><strong>Returns:</strong> <a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a> — The processed logits.</p> <a id="module_generation/logits_process.ClassifierFreeGuidanceLogitsProcessor.constructor"></a> <h4 class="relative group"><a id="classifierfreeguidancelogitsprocessorconstructorguidancescale" 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="#classifierfreeguidancelogitsprocessorconstructorguidancescale"><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.constructor(guidance_scale)</span></h4> <p data-svelte-h="svelte-1ryo8zx">Create a <code>ClassifierFreeGuidanceLogitsProcessor</code>.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-mxku8n"><li><code>guidance_scale</code> (<code>number</code>) — The guidance scale for classifier-free guidance (CFG). CFG is enabled by setting <code>guidance_scale > 1</code>. | |
| Higher guidance scale encourages the model to generate samples that are more closely tied to the input | |
| prompt, usually at the expense of poorer quality.</li></ul> <a id="module_generation/logits_process.TemperatureLogitsWarper"></a> <h3 class="relative group"><a id="temperaturelogitswarper" 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="#temperaturelogitswarper"><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</span></h3> <p data-svelte-h="svelte-1qcplv3">for temperature (exponential scaling output probability distribution), which effectively means | |
| that it can control the randomness of the predicted tokens. Often used together with <a href="./logits_process#module_generation/logits_process.TopPLogitsWarper"><code>TopPLogitsWarper</code></a> and <a href="./logits_process#module_generation/logits_process.TopKLogitsWarper"><code>TopKLogitsWarper</code></a>.</p> <a id="module_generation/logits_process.TemperatureLogitsWarper.call"></a> <h4 class="relative group"><a id="temperaturelogitswarperinputids-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="#temperaturelogitswarperinputids-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>TemperatureLogitsWarper(input_ids, logits)</span></h4> <p data-svelte-h="svelte-1sq2o6e">Apply logit warper.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-itnglw"><li><code>input_ids</code> (<code>bigint[][]</code>) — The input IDs.</li> <li><code>logits</code> (<a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a>) — The logits.</li></ul> <p data-svelte-h="svelte-ndhb6q"><strong>Returns:</strong> <a href="../utils/tensor#module_utils/tensor.Tensor"><code>Tensor</code></a> — The processed logits.</p> <a id="module_generation/logits_process.TemperatureLogitsWarper.constructor"></a> <h4 class="relative group"><a id="temperaturelogitswarperconstructortemperature" 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="#temperaturelogitswarperconstructortemperature"><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.constructor(temperature)</span></h4> <p data-svelte-h="svelte-14o1n6t">Create a <code>TemperatureLogitsWarper</code>.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-14rnhim"><li><code>temperature</code> (<code>number</code>) — 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.</li></ul> <a id="module_generation/logits_process.TopPLogitsWarper"></a> <h3 class="relative group"><a id="topplogitswarper" 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="#topplogitswarper"><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>TopPLogitsWarper</span></h3> <p data-svelte-h="svelte-1hrk27h">that performs top-p, i.e. restricting to top tokens summing to prob_cut_off <= prob_cut_off. | |
| Often used together with <a href="./logits_process#module_generation/logits_process.TemperatureLogitsWarper"><code>TemperatureLogitsWarper</code></a> and <a href="./logits_process#module_generation/logits_process.TopKLogitsWarper"><code>TopKLogitsWarper</code></a>.</p> <a id="module_generation/logits_process.TopPLogitsWarper.constructor"></a> <h4 class="relative group"><a id="topplogitswarperconstructortopp-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="#topplogitswarperconstructortopp-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>TopPLogitsWarper.constructor(top_p, options)</span></h4> <p data-svelte-h="svelte-y3riw0">Create a <code>TopPLogitsWarper</code>.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-qt21l2"><li><code>top_p</code> (<code>number</code>) — If set to < 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.</li> <li><code>options</code> (<code>Object</code>) — Additional options for the top-p sampling. | |
| <ul><li><code>filter_value</code> (<code>number</code>) <em>optional</em> — defaults to <code>-Infinity</code> — All filtered values will be set to this float value.</li> <li><code>min_tokens_to_keep</code> (<code>number</code>) <em>optional</em> — defaults to <code>1</code> — Minimum number of tokens that cannot be filtered.</li></ul></li></ul> <a id="module_generation/logits_process.TopKLogitsWarper"></a> <h3 class="relative group"><a id="topklogitswarper" 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="#topklogitswarper"><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>TopKLogitsWarper</span></h3> <p data-svelte-h="svelte-1m21vgd">that performs top-k, i.e. restricting to the k highest probability elements. | |
| Often used together with <a href="./logits_process#module_generation/logits_process.TemperatureLogitsWarper"><code>TemperatureLogitsWarper</code></a> and <a href="./logits_process#module_generation/logits_process.TopPLogitsWarper"><code>TopPLogitsWarper</code></a>.</p> <a id="module_generation/logits_process.TopKLogitsWarper.constructor"></a> <h4 class="relative group"><a id="topklogitswarperconstructortopk-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="#topklogitswarperconstructortopk-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>TopKLogitsWarper.constructor(top_k, options)</span></h4> <p data-svelte-h="svelte-1jc4089">Create a <code>TopKLogitsWarper</code>.</p> <p data-svelte-h="svelte-11fqvcp"><strong>Parameters</strong></p> <ul data-svelte-h="svelte-1fjvzm6"><li><code>top_k</code> (<code>number</code>) — If set to > 0, only the top <code>top_k</code> tokens are kept for generation.</li> <li><code>options</code> (<code>Object</code>) — Additional options for the top-k sampling. | |
| <ul><li><code>filter_value</code> (<code>number</code>) <em>optional</em> — defaults to <code>-Infinity</code> — All filtered values will be set to this float value.</li> <li><code>min_tokens_to_keep</code> (<code>number</code>) <em>optional</em> — defaults to <code>1</code> — Minimum number of tokens that cannot be filtered.</li></ul></li></ul> <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_1t06csc = { | |
| assets: "/docs/transformers.js/pr_1665/en", | |
| base: "/docs/transformers.js/pr_1665/en", | |
| env: {} | |
| }; | |
| const element = document.currentScript.parentElement; | |
| const data = [null,null]; | |
| Promise.all([ | |
| import("/docs/transformers.js/pr_1665/en/_app/immutable/entry/start.cb58eb6f.js"), | |
| import("/docs/transformers.js/pr_1665/en/_app/immutable/entry/app.9eafcf9d.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 7], | |
| data, | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 116 kB
- Xet hash:
- 3be231152d468628b00453cfae12434de83169b7ce23b703bbcbac32c7c78a4b
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.