fastok

Crates.iofastok
lib.rsfastok
version0.0.1
sourcesrc
created_at2023-10-19 19:00:45.366688
updated_at2023-10-19 19:00:45.366688
descriptionBPE in Rust with bindings to Python using PyO3
homepage
repositoryhttps://github.com/alvarobartt/fastok
max_upload_size
id1008162
size8,203
Alvaro Bartolome (alvarobartt)

documentation

README

💥 fastok

BPE in Rust with bindings to Python using PyO3

Development

maturin develop

Python bindings

>>> from fastok import PreTokenizer

>>> pre_tokenizer = PreTokenizer(model="gpt2")
>>> pre_tokenizer.pre_tokenize_str("My name is Alvaro and I live in Barcelona.")
['My', ' name', ' is', ' Alvaro', ' and', ' I', ' live', ' in', ' Barcelona', '.']
>>> pre_tokenizer.pre_tokenize(["My name is Alvaro and I live in Barcelona.", "I like pizza."])
[['My', ' name', ' is', ' Alvaro', ' and', ' I', ' live', ' in', ' Barcelona', '.'], ['I', ' like', ' pizza', '.']]
Commit count: 0

cargo fmt