Skip to main content

tkitAutoMask

自动构建掩码

pip install tkitAutoMask


from tkitAutoMask import autoMask
from transformers import BertTokenizer
tokenizer = BertTokenizer.from_pretrained("uer/chinese_roberta_L-2_H-128") 
# dir(tokenizer)
tomask = autoMask(
    # transformer,
    mask_token_id = tokenizer.mask_token_id,          # the token id reserved for masking
    pad_token_id = tokenizer.pad_token_id,           # the token id for padding
    mask_prob = 0.05,           # masking probability for masked language modeling
    replace_prob = 0.90,        # ~10% probability that token will not be masked, but included in loss, as detailed in the epaper
    mask_ignore_token_ids = [tokenizer.cls_token_id,tokenizer.eos_token_id]  # other tokens to exclude from masking, include the [cls] and [sep] here
)

详细参考

dev.md

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tkitAutoMask-0.0.0.116337015.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tkitAutoMask-0.0.0.116337015-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file tkitAutoMask-0.0.0.116337015.tar.gz.

File metadata

  • Download URL: tkitAutoMask-0.0.0.116337015.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for tkitAutoMask-0.0.0.116337015.tar.gz
Algorithm Hash digest
SHA256 1008c04254af13614e529d8d0bd3b67c09e08d453829e9edba80a5240f6eff32
MD5 c180369b391b7433b2e8913dfc0128ba
BLAKE2b-256 d3cf83ec6655c7df0090f07cbe74c612ea4f2454323eb6ea2551304fee597f02

See more details on using hashes here.

File details

Details for the file tkitAutoMask-0.0.0.116337015-py3-none-any.whl.

File metadata

  • Download URL: tkitAutoMask-0.0.0.116337015-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for tkitAutoMask-0.0.0.116337015-py3-none-any.whl
Algorithm Hash digest
SHA256 e788d55ee683397fa80d5e3091332e263ddf6ba9cab68e6b2fa0e21cdc5d48b3
MD5 2ea1da6e3f1e98355b34dfd45d6f4b3a
BLAKE2b-256 a22bb63ee729bf3a6e074a9a8deed7f4985b17c0434ab5c83bd28e7011a8132a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.0.116337015 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page