Samplings
=========
A collection of sampling methods for machine learning implemented on numpy.
Author: Sander Wood
Provides
- Gamma sampling for controllable generation
- Local temperature sampling with weights
- Nucleus sampling (top-p sampling)
- Top-k sampling
- Random sampling
How to use
As you probably know, sampling means randomly picking the next token according
to its conditional probability distribution. In other words, given the same
probability distribution, you may get a different result each time. If you
want to get rid of this uncertainty, you can set seed to a fixed value.
By default, all the functions in samplings return the index of the next token.
However, you can ask them to return the modified probability distribution by set
return_probs as True. Then, you can make further manipulations based on this
probability distribution.
In addition to the probability distribution, most sampling methods require other parameters for modifying the probability distribution to achieve desired results. Please refer to the docstring of each function for details.
About gamma sampling
Gamma sampling is a method of tuning probabilities of target tokens to achieve controlling specific properties of the generated sequence. The basic assumption is that some attributes of sequences are closely related to the frequencies of some tokens. As long as the controllable attribute can be defined at the token level, prior knowledge can be directly brought into the sampling process, allowing arbitrary models to support customisable and controllable generation.
Metadata
Release files for samplings 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| samplings-0.1.7.tar.gz | 6.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| samplings-0.1.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.4 kB
Release files / samplings-0.1.7.tar.gz
| Download URL | samplings-0.1.7.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
647f85b0bed5651b3717c05528e37f00b6c710e5679b641e129554eecc135d1c
|
|
BLAKE2b-256 checksum How to use checksums |
38cdd92f0ef943e7fd3208cf611fd06e945bea4ec37844616129da2a7bb20527
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.7.9
|
Release files / samplings-0.1.7-py3-none-any.whl
| Download URL | samplings-0.1.7-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e822913cf7498a5465027461a4b6986d19fb379c346492683236c77da98f8284
|
|
BLAKE2b-256 checksum How to use checksums |
00c9fb82c0010e855425537f5ddbecb8b8cd47277a2ca52d9cec687426f2ab37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.7.9
|