Skip to main content

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


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)

Uploaded Source

Built Distribution

wakong-1.0.0-py2.py3-none-any.whl (7.6 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page