Buckets:
generation/logits_sampler
- generation/logits_sampler
- static
- .LogitsSampler
new LogitsSampler(generation_config)- instance
._call(logits)⇒*.sample(logits)⇒*.getLogits(logits, index)⇒Float32Array.randomSelect(probabilities)⇒number
- static
.getSampler(generation_config)⇒LogitsSampler
- .LogitsSampler
- inner
- static
generation/logits_sampler.LogitsSampler
Sampler is a base class for all sampling methods used for text generation.
Kind: static class of generation/logits_sampler
- .LogitsSampler
new LogitsSampler(generation_config)- instance
._call(logits)⇒*.sample(logits)⇒*.getLogits(logits, index)⇒Float32Array.randomSelect(probabilities)⇒number
- static
.getSampler(generation_config)⇒LogitsSampler
new LogitsSampler(generation_config)
Creates a new Sampler object with the specified generation config.
| Param | Type | Description |
|---|---|---|
| generation_config | GenerationConfig | The generation config. |
logitsSampler._call(logits) ⇒ *
Executes the sampler, using the specified logits.
Kind: instance method of LogitsSampler
| Param | Type |
|---|---|
| logits | Tensor |
logitsSampler.sample(logits) ⇒ *
Abstract method for sampling the logits.
Kind: instance method of LogitsSampler
Throws:
ErrorIf not implemented in subclass.
| Param | Type |
|---|---|
| logits | Tensor |
logitsSampler.getLogits(logits, index) ⇒ Float32Array
Returns the specified logits as an array, with temperature applied.
Kind: instance method of LogitsSampler
| Param | Type |
|---|---|
| logits | Tensor |
| index | number |
logitsSampler.randomSelect(probabilities) ⇒ number
Selects an item randomly based on the specified probabilities.
Kind: instance method of LogitsSampler
Returns: number - The index of the selected item.
| Param | Type | Description |
|---|---|---|
| probabilities | * | An array of probabilities to use for selection. |
LogitsSampler.getSampler(generation_config) ⇒ LogitsSampler
Returns a Sampler object based on the specified options.
Kind: static method of LogitsSampler
Returns: LogitsSampler - A Sampler object.
| Param | Type | Description |
|---|---|---|
| generation_config | GenerationConfig | An object containing options for the sampler. |
generation/logits_sampler~GreedySampler
Class representing a Greedy Sampler.
Kind: inner class of generation/logits_sampler
greedySampler.sample(logits) ⇒ *
Sample the maximum probability of a given logits tensor.
Kind: instance method of GreedySampler
Returns: * - An array with a single tuple, containing the index of the maximum value and a meaningless score (since this is a greedy search).
| Param | Type |
|---|---|
| logits | Tensor |
generation/logits_sampler~MultinomialSampler
Class representing a MultinomialSampler.
Kind: inner class of generation/logits_sampler
multinomialSampler.sample(logits) ⇒ *
Sample from the logits.
Kind: instance method of MultinomialSampler
| Param | Type |
|---|---|
| logits | Tensor |
generation/logits_sampler~BeamSearchSampler
Class representing a BeamSearchSampler.
Kind: inner class of generation/logits_sampler
beamSearchSampler.sample(logits) ⇒ *
Sample from the logits.
Kind: instance method of BeamSearchSampler
| Param | Type |
|---|---|
| logits | Tensor |
Xet Storage Details
- Size:
- 8.82 kB
- Xet hash:
- 103b74f41b13f9ba6d5a0292d2713c7bdb598575acfebcd780b839cfb4378a13
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.