MyGit

huggingface/tokenizers

Fork: 660 Star: 7805 (更新于 1970-01-01 00:00:00)

license: Apache-2.0

Language: Rust .

💥 Fast State-of-the-Art Tokenizers optimized for Research and Production

最后发布版本: v0.15.0 ( 2023-11-15 03:06:30)

官方网址 GitHub网址



Build GitHub

Provides an implementation of today's most used tokenizers, with a focus on performance and versatility.

Main features:

  • Train new vocabularies and tokenize, using today's most used tokenizers.
  • Extremely fast (both training and tokenization), thanks to the Rust implementation. Takes less than 20 seconds to tokenize a GB of text on a server's CPU.
  • Easy to use, but also extremely versatile.
  • Designed for research and production.
  • Normalization comes with alignments tracking. It's always possible to get the part of the original sentence that corresponds to a given token.
  • Does all the pre-processing: Truncate, Pad, add the special tokens your model needs.

Bindings

We provide bindings to the following languages (more to come!):

Quick example using Python:

Choose your model between Byte-Pair Encoding, WordPiece or Unigram and instantiate a tokenizer:

from tokenizers import Tokenizer
from tokenizers.models import BPE

tokenizer = Tokenizer(BPE())

You can customize how pre-tokenization (e.g., splitting into words) is done:

from tokenizers.pre_tokenizers import Whitespace

tokenizer.pre_tokenizer = Whitespace()

Then training your tokenizer on a set of files just takes two lines of codes:

from tokenizers.trainers import BpeTrainer

trainer = BpeTrainer(special_tokens=["[UNK]", "[CLS]", "[SEP]", "[PAD]", "[MASK]"])
tokenizer.train(files=["wiki.train.raw", "wiki.valid.raw", "wiki.test.raw"], trainer=trainer)

Once your tokenizer is trained, encode any text with just one line:

output = tokenizer.encode("Hello, y'all! How are you 😁 ?")
print(output.tokens)
# ["Hello", ",", "y", "'", "all", "!", "How", "are", "you", "[UNK]", "?"]

Check the python documentation or the

python quicktour to learn more!

最近版本更新:(数据更新于 1970-01-01 00:00:00)

2023-11-15 03:06:30 v0.15.0

2023-10-06 19:10:29 v0.14.1

2023-10-05 21:56:09 v0.14.1rc1

2023-09-07 21:59:19 v0.14.0

2023-09-07 19:39:02 v0.14.0.rc1

2023-08-23 21:46:52 v0.13.4.rc3

2023-08-14 21:28:42 v0.13.4.rc2

2023-08-14 19:50:28 v0.13.4.rc1

2023-05-18 00:59:24 v0.13.4-rc2

2023-05-15 16:01:50 v0.13.4-rc1

主题(topics):

bert, gpt, language-model, natural-language-processing, natural-language-understanding, nlp, transformers

huggingface/tokenizers同语言 Rust最近更新仓库

2024-11-20 07:29:29 lanyeeee/jmcomic-downloader

2024-11-19 23:39:15 gleam-lang/gleam

2024-11-19 08:50:55 lapce/lapce

2024-11-11 22:51:00 tauri-apps/tauri

2024-11-11 07:55:30 dani-garcia/vaultwarden

2024-11-09 16:42:37 rustdesk/rustdesk