Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"generation/logits_sampler","local":"generationlogitssampler","sections":[{"title":"generation/logits_sampler.LogitsSampler","local":"generationlogitssamplerlogitssampler","sections":[{"title":"new LogitsSampler(generation_config)","local":"new-logitssamplergenerationconfig","sections":[],"depth":3},{"title":"logitsSampler._call(logits) ⇒ <code> * </code>","local":"logitssamplercalllogits--code--code","sections":[],"depth":3},{"title":"logitsSampler.sample(logits) ⇒ <code> * </code>","local":"logitssamplersamplelogits--code--code","sections":[],"depth":3},{"title":"logitsSampler.getLogits(logits, index) ⇒ <code> Float32Array </code>","local":"logitssamplergetlogitslogits-index--code-float32array-code","sections":[],"depth":3},{"title":"logitsSampler.randomSelect(probabilities) ⇒ <code> number </code>","local":"logitssamplerrandomselectprobabilities--code-number-code","sections":[],"depth":3},{"title":"LogitsSampler.getSampler(generation_config) ⇒ <code> LogitsSampler </code>","local":"logitssamplergetsamplergenerationconfig--code-logitssampler-code","sections":[],"depth":3}],"depth":2},{"title":"generation/logits_sampler~GreedySampler","local":"generationlogitssamplergreedysampler","sections":[{"title":"greedySampler.sample(logits) ⇒ <code> * </code>","local":"greedysamplersamplelogits--code--code","sections":[],"depth":3}],"depth":2},{"title":"generation/logits_sampler~MultinomialSampler","local":"generationlogitssamplermultinomialsampler","sections":[{"title":"multinomialSampler.sample(logits) ⇒ <code> * </code>","local":"multinomialsamplersamplelogits--code--code","sections":[],"depth":3}],"depth":2},{"title":"generation/logits_sampler~BeamSearchSampler","local":"generationlogitssamplerbeamsearchsampler","sections":[{"title":"beamSearchSampler.sample(logits) ⇒ <code> * </code>","local":"beamsearchsamplersamplelogits--code--code","sections":[],"depth":3}],"depth":2}],"depth":1}"> | |
| <link href="/docs/transformers.js/pr_1113/en/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/entry/start.88a6e140.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/chunks/scheduler.0219f8bd.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/chunks/singletons.c59c6d8d.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/chunks/paths.8e090985.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/entry/app.0003020d.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/chunks/index.f61edf3b.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/nodes/0.25c65ab2.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/nodes/7.6d907849.js"> | |
| <link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/chunks/EditOnGithub.48fa589f.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{"title":"generation/logits_sampler","local":"generationlogitssampler","sections":[{"title":"generation/logits_sampler.LogitsSampler","local":"generationlogitssamplerlogitssampler","sections":[{"title":"new LogitsSampler(generation_config)","local":"new-logitssamplergenerationconfig","sections":[],"depth":3},{"title":"logitsSampler._call(logits) ⇒ <code> * </code>","local":"logitssamplercalllogits--code--code","sections":[],"depth":3},{"title":"logitsSampler.sample(logits) ⇒ <code> * </code>","local":"logitssamplersamplelogits--code--code","sections":[],"depth":3},{"title":"logitsSampler.getLogits(logits, index) ⇒ <code> Float32Array </code>","local":"logitssamplergetlogitslogits-index--code-float32array-code","sections":[],"depth":3},{"title":"logitsSampler.randomSelect(probabilities) ⇒ <code> number </code>","local":"logitssamplerrandomselectprobabilities--code-number-code","sections":[],"depth":3},{"title":"LogitsSampler.getSampler(generation_config) ⇒ <code> LogitsSampler </code>","local":"logitssamplergetsamplergenerationconfig--code-logitssampler-code","sections":[],"depth":3}],"depth":2},{"title":"generation/logits_sampler~GreedySampler","local":"generationlogitssamplergreedysampler","sections":[{"title":"greedySampler.sample(logits) ⇒ <code> * </code>","local":"greedysamplersamplelogits--code--code","sections":[],"depth":3}],"depth":2},{"title":"generation/logits_sampler~MultinomialSampler","local":"generationlogitssamplermultinomialsampler","sections":[{"title":"multinomialSampler.sample(logits) ⇒ <code> * </code>","local":"multinomialsamplersamplelogits--code--code","sections":[],"depth":3}],"depth":2},{"title":"generation/logits_sampler~BeamSearchSampler","local":"generationlogitssamplerbeamsearchsampler","sections":[{"title":"beamSearchSampler.sample(logits) ⇒ <code> * </code>","local":"beamsearchsamplersamplelogits--code--code","sections":[],"depth":3}],"depth":2}],"depth":1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <a id="module_generation/logits_sampler" class="group"></a> <h1 class="relative group"><a id="generationlogitssampler" 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="#generationlogitssampler"><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_sampler</span></h1> <ul data-svelte-h="svelte-1n381yz"><li><a href="#module_generation/logits_sampler">generation/logits_sampler</a><ul><li><em>static</em><ul><li><a href="#module_generation/logits_sampler.LogitsSampler">.LogitsSampler</a><ul><li><a href="#new_module_generation/logits_sampler.LogitsSampler_new"><code>new LogitsSampler(generation_config)</code></a></li> <li><em>instance</em><ul><li><a href="#module_generation/logits_sampler.LogitsSampler+_call"><code>._call(logits)</code></a> ⇒ <code>*</code></li> <li><a href="#module_generation/logits_sampler.LogitsSampler+sample"><code>.sample(logits)</code></a> ⇒ <code>*</code></li> <li><a href="#module_generation/logits_sampler.LogitsSampler+getLogits"><code>.getLogits(logits, index)</code></a> ⇒ <code>Float32Array</code></li> <li><a href="#module_generation/logits_sampler.LogitsSampler+randomSelect"><code>.randomSelect(probabilities)</code></a> ⇒ <code>number</code></li></ul></li> <li><em>static</em><ul><li><a href="#module_generation/logits_sampler.LogitsSampler.getSampler"><code>.getSampler(generation_config)</code></a> ⇒ <code>LogitsSampler</code></li></ul></li></ul></li></ul></li> <li><em>inner</em><ul><li><a href="#module_generation/logits_sampler..GreedySampler">~GreedySampler</a><ul><li><a href="#module_generation/logits_sampler..GreedySampler+sample"><code>.sample(logits)</code></a> ⇒ <code>*</code></li></ul></li> <li><a href="#module_generation/logits_sampler..MultinomialSampler">~MultinomialSampler</a><ul><li><a href="#module_generation/logits_sampler..MultinomialSampler+sample"><code>.sample(logits)</code></a> ⇒ <code>*</code></li></ul></li> <li><a href="#module_generation/logits_sampler..BeamSearchSampler">~BeamSearchSampler</a><ul><li><a href="#module_generation/logits_sampler..BeamSearchSampler+sample"><code>.sample(logits)</code></a> ⇒ <code>*</code></li></ul></li></ul></li></ul></li></ul> <hr> <a id="module_generation/logits_sampler.LogitsSampler" class="group"></a> <h2 class="relative group"><a id="generationlogitssamplerlogitssampler" 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="#generationlogitssamplerlogitssampler"><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_sampler.LogitsSampler</span></h2> <p data-svelte-h="svelte-p0jtpm">Sampler is a base class for all sampling methods used for text generation.</p> <p data-svelte-h="svelte-irp316"><strong>Kind</strong>: static class of <a href="#module_generation/logits_sampler"><code>generation/logits_sampler</code></a></p> <ul data-svelte-h="svelte-i9u54l"><li><a href="#module_generation/logits_sampler.LogitsSampler">.LogitsSampler</a><ul><li><a href="#new_module_generation/logits_sampler.LogitsSampler_new"><code>new LogitsSampler(generation_config)</code></a></li> <li><em>instance</em><ul><li><a href="#module_generation/logits_sampler.LogitsSampler+_call"><code>._call(logits)</code></a> ⇒ <code>*</code></li> <li><a href="#module_generation/logits_sampler.LogitsSampler+sample"><code>.sample(logits)</code></a> ⇒ <code>*</code></li> <li><a href="#module_generation/logits_sampler.LogitsSampler+getLogits"><code>.getLogits(logits, index)</code></a> ⇒ <code>Float32Array</code></li> <li><a href="#module_generation/logits_sampler.LogitsSampler+randomSelect"><code>.randomSelect(probabilities)</code></a> ⇒ <code>number</code></li></ul></li> <li><em>static</em><ul><li><a href="#module_generation/logits_sampler.LogitsSampler.getSampler"><code>.getSampler(generation_config)</code></a> ⇒ <code>LogitsSampler</code></li></ul></li></ul></li></ul> <hr> <a id="new_module_generation/logits_sampler.LogitsSampler_new" class="group"></a> <h3 class="relative group"><a id="new-logitssamplergenerationconfig" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-logitssamplergenerationconfig"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new LogitsSampler(generation_config)</span></h3> <p data-svelte-h="svelte-cx2gtq">Creates a new Sampler object with the specified generation config.</p> <table data-svelte-h="svelte-i95exv"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>generation_config</td><td><code>GenerationConfig</code></td><td><p>The generation config.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_sampler.LogitsSampler+_call" class="group"></a> <h3 class="relative group"><a id="logitssamplercalllogits--code--code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#logitssamplercalllogits--code--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>logitsSampler._call(logits) ⇒ <code> * </code></span></h3> <p data-svelte-h="svelte-18hhszu">Executes the sampler, using the specified logits.</p> <p data-svelte-h="svelte-pfd0aw"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_sampler.LogitsSampler"><code>LogitsSampler</code></a></p> <table data-svelte-h="svelte-9qgcck"><thead><tr><th>Param</th><th>Type</th></tr></thead> <tbody><tr><td>logits</td><td><code><a href="#Tensor">Tensor</a></code></td></tr></tbody></table> <hr> <a id="module_generation/logits_sampler.LogitsSampler+sample" class="group"></a> <h3 class="relative group"><a id="logitssamplersamplelogits--code--code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#logitssamplersamplelogits--code--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>logitsSampler.sample(logits) ⇒ <code> * </code></span></h3> <p data-svelte-h="svelte-mhsbvo">Abstract method for sampling the logits.</p> <p data-svelte-h="svelte-1hoqfjk"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_sampler.LogitsSampler"><code>LogitsSampler</code></a><br> <strong>Throws</strong>:</p> <ul data-svelte-h="svelte-14cgj6z"><li><code>Error</code> If not implemented in subclass.</li></ul> <table data-svelte-h="svelte-9qgcck"><thead><tr><th>Param</th><th>Type</th></tr></thead> <tbody><tr><td>logits</td><td><code><a href="#Tensor">Tensor</a></code></td></tr></tbody></table> <hr> <a id="module_generation/logits_sampler.LogitsSampler+getLogits" class="group"></a> <h3 class="relative group"><a id="logitssamplergetlogitslogits-index--code-float32array-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#logitssamplergetlogitslogits-index--code-float32array-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>logitsSampler.getLogits(logits, index) ⇒ <code> Float32Array </code></span></h3> <p data-svelte-h="svelte-1tthoub">Returns the specified logits as an array, with temperature applied.</p> <p data-svelte-h="svelte-pfd0aw"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_sampler.LogitsSampler"><code>LogitsSampler</code></a></p> <table data-svelte-h="svelte-1rp30yt"><thead><tr><th>Param</th><th>Type</th></tr></thead> <tbody><tr><td>logits</td><td><code><a href="#Tensor">Tensor</a></code></td> </tr><tr><td>index</td><td><code>number</code></td></tr></tbody></table> <hr> <a id="module_generation/logits_sampler.LogitsSampler+randomSelect" class="group"></a> <h3 class="relative group"><a id="logitssamplerrandomselectprobabilities--code-number-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#logitssamplerrandomselectprobabilities--code-number-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>logitsSampler.randomSelect(probabilities) ⇒ <code> number </code></span></h3> <p data-svelte-h="svelte-yywnzb">Selects an item randomly based on the specified probabilities.</p> <p data-svelte-h="svelte-1c5ts62"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_sampler.LogitsSampler"><code>LogitsSampler</code></a><br> <strong>Returns</strong>: <code>number</code> - The index of the selected item.</p> <table data-svelte-h="svelte-541x4t"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>probabilities</td><td><code>*</code></td><td><p>An array of probabilities to use for selection.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_sampler.LogitsSampler.getSampler" class="group"></a> <h3 class="relative group"><a id="logitssamplergetsamplergenerationconfig--code-logitssampler-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#logitssamplergetsamplergenerationconfig--code-logitssampler-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>LogitsSampler.getSampler(generation_config) ⇒ <code> LogitsSampler </code></span></h3> <p data-svelte-h="svelte-wl8u0w">Returns a Sampler object based on the specified options.</p> <p data-svelte-h="svelte-u33ue9"><strong>Kind</strong>: static method of <a href="#module_generation/logits_sampler.LogitsSampler"><code>LogitsSampler</code></a><br> <strong>Returns</strong>: <code>LogitsSampler</code> - A Sampler object.</p> <table data-svelte-h="svelte-1vneufm"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>generation_config</td><td><code>GenerationConfig</code></td><td><p>An object containing options for the sampler.</p></td></tr></tbody></table> <hr> <a id="module_generation/logits_sampler..GreedySampler" class="group"></a> <h2 class="relative group"><a id="generationlogitssamplergreedysampler" 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="#generationlogitssamplergreedysampler"><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_sampler~GreedySampler</span></h2> <p data-svelte-h="svelte-1pvj197">Class representing a Greedy Sampler.</p> <p data-svelte-h="svelte-1jqqnai"><strong>Kind</strong>: inner class of <a href="#module_generation/logits_sampler"><code>generation/logits_sampler</code></a></p> <hr> <a id="module_generation/logits_sampler..GreedySampler+sample" class="group"></a> <h3 class="relative group"><a id="greedysamplersamplelogits--code--code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#greedysamplersamplelogits--code--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>greedySampler.sample(logits) ⇒ <code> * </code></span></h3> <p data-svelte-h="svelte-1acvd9s">Sample the maximum probability of a given logits tensor.</p> <p data-svelte-h="svelte-kjb7on"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_sampler..GreedySampler"><code>GreedySampler</code></a><br> <strong>Returns</strong>: <code>*</code> - An array with a single tuple, containing the index of the maximum value and a meaningless score (since this is a greedy search).</p> <table data-svelte-h="svelte-9qgcck"><thead><tr><th>Param</th><th>Type</th></tr></thead> <tbody><tr><td>logits</td><td><code><a href="#Tensor">Tensor</a></code></td></tr></tbody></table> <hr> <a id="module_generation/logits_sampler..MultinomialSampler" class="group"></a> <h2 class="relative group"><a id="generationlogitssamplermultinomialsampler" 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="#generationlogitssamplermultinomialsampler"><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_sampler~MultinomialSampler</span></h2> <p data-svelte-h="svelte-2u15u0">Class representing a MultinomialSampler.</p> <p data-svelte-h="svelte-1jqqnai"><strong>Kind</strong>: inner class of <a href="#module_generation/logits_sampler"><code>generation/logits_sampler</code></a></p> <hr> <a id="module_generation/logits_sampler..MultinomialSampler+sample" class="group"></a> <h3 class="relative group"><a id="multinomialsamplersamplelogits--code--code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#multinomialsamplersamplelogits--code--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>multinomialSampler.sample(logits) ⇒ <code> * </code></span></h3> <p data-svelte-h="svelte-1uart2f">Sample from the logits.</p> <p data-svelte-h="svelte-iej4fm"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_sampler..MultinomialSampler"><code>MultinomialSampler</code></a></p> <table data-svelte-h="svelte-9qgcck"><thead><tr><th>Param</th><th>Type</th></tr></thead> <tbody><tr><td>logits</td><td><code><a href="#Tensor">Tensor</a></code></td></tr></tbody></table> <hr> <a id="module_generation/logits_sampler..BeamSearchSampler" class="group"></a> <h2 class="relative group"><a id="generationlogitssamplerbeamsearchsampler" 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="#generationlogitssamplerbeamsearchsampler"><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_sampler~BeamSearchSampler</span></h2> <p data-svelte-h="svelte-tcl9v8">Class representing a BeamSearchSampler.</p> <p data-svelte-h="svelte-1jqqnai"><strong>Kind</strong>: inner class of <a href="#module_generation/logits_sampler"><code>generation/logits_sampler</code></a></p> <hr> <a id="module_generation/logits_sampler..BeamSearchSampler+sample" class="group"></a> <h3 class="relative group"><a id="beamsearchsamplersamplelogits--code--code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#beamsearchsamplersamplelogits--code--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>beamSearchSampler.sample(logits) ⇒ <code> * </code></span></h3> <p data-svelte-h="svelte-1uart2f">Sample from the logits.</p> <p data-svelte-h="svelte-1sn2942"><strong>Kind</strong>: instance method of <a href="#module_generation/logits_sampler..BeamSearchSampler"><code>BeamSearchSampler</code></a></p> <table data-svelte-h="svelte-9qgcck"><thead><tr><th>Param</th><th>Type</th></tr></thead> <tbody><tr><td>logits</td><td><code><a href="#Tensor">Tensor</a></code></td></tr></tbody></table> <hr> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/transformers.js/blob/main/docs/source/api/generation/logits_sampler.md" target="_blank"><span data-svelte-h="svelte-1kd6by1"><</span> <span data-svelte-h="svelte-x0xyl0">></span> <span data-svelte-h="svelte-1dajgef"><span class="underline ml-1.5">Update</span> on GitHub</span></a> <p></p> | |
| <script> | |
| { | |
| __sveltekit_kuyevp = { | |
| assets: "/docs/transformers.js/pr_1113/en", | |
| base: "/docs/transformers.js/pr_1113/en", | |
| env: {} | |
| }; | |
| const element = document.currentScript.parentElement; | |
| const data = [null,null]; | |
| Promise.all([ | |
| import("/docs/transformers.js/pr_1113/en/_app/immutable/entry/start.88a6e140.js"), | |
| import("/docs/transformers.js/pr_1113/en/_app/immutable/entry/app.0003020d.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 7], | |
| data, | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 33.5 kB
- Xet hash:
- 3f6e7e89568bbb6791361c27f9de70f967414c5d151140fd5f1a6c089bc084cf
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.