Skip to main content

UBPE Tokenizer

Project description

UBPE Tokenizer

UBPE -- Universal Byte-Pair Encoding. Universal means that it works not only with strings, but with general sequences too.

The package provides Universal Byte-Pair Encoding tokenizers:

  • UBPEClassic -- optimized version of classic BPE algorithm
  • UBPE -- novel approach to BPE tokenization which allows you to choose between multiple different variants of encodings according to scores of tf-idf metric or something else; the most optimal encoding from this implementation was shorter than the encoding from classic implementation

Guides and theory

Installation

I am planning to deliver different implementations for the algorithm, so the package is divided into general import package (this one), and implementations (for now, Python native and Cython with C++20 backend). To install use:

pip install ubpe[native]

Or,

pip install ubpe[cython]

Bug reports

If you find a bug that occurs under certain circumstances in some tests, please report it.

Contribution

I am pretty sure, that it has not the most optimal native Python implementation and C++ backend, so feel free to propose optimizations and bug fixes.

It's planned to add Rust implementation with Python bindings (not to bite Hugging Face, just because).

P.S. if you are working at Hugging Face, you can write me and hire me. Please.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

ubpe-0.2.1-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file ubpe-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: ubpe-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ubpe-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 874e2adee12dfd697a241a9a71e4dfbce1b03ef5e40b4d8dd2c214dac30c3027
MD5 4e260d2b07e2c5b3f1b2c3c92845ed29
BLAKE2b-256 4420c551f4a88e5a9487257b8e0d8aca1947aedb88e5300fc3706649428926b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for ubpe-0.2.1-py3-none-any.whl:

Publisher: pypi-publish.yml on Scurrra/ubpe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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