Wakong: An appropriate and robust masking algorithm for generating the training objective of text infilling.
Project description
The Wakong Algorithm and Its Python Implementation
Wakong: An appropriate and robust masking algorithm for generating the training objective of text infilling
Motivation
TODO
Installation
Wakong supports Python 3.10 and above:
pip install wakong
Usage
from random import Random
from wakong import generate_mask_scheme, pretty_print_mask_scheme
seed = 42
rng = Random(seed)
for _ in range(5):
seq_len = 60
mask_scheme = generate_mask_scheme(rng, seq_len)
pretty_print_mask_scheme(seq_len, mask_scheme)
Output:
..(xx)..(xxx)....(xx).........(x)...................................
..............(xxxx)...............(xxxxx)......................
..........().....(xxx)....................................(xxxxxx)
........(xx)..................(xxxxxx)...........(xx).............
............(xxxxx).........................(xxxxx).............
.
stands for non-masked tokens, while (xxx)
stands for substituting 3 tokens to a single mask token.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wakong-1.0.0.tar.gz
(10.8 kB
view hashes)
Built Distribution
Close
Hashes for wakong-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae25afa802e25da5f8849adde704fc4be49d3308aab75e747706e5d69d21cc8e |
|
MD5 | 154d5953184275850ef9db8eda8074f0 |
|
BLAKE2b-256 | dfc7592fe9507ca63d918dbb6e7ea1e34d834dd69565af510fe1005a81765f49 |