Skip to content

Add experimental Hugging Face .tok tokenizer backend - #218

Draft
JacobSzwejbka wants to merge 4 commits into
meta-pytorch:mainfrom
JacobSzwejbka:hf-rust-tokenizer-tok-followup
Draft

JacobSzwejbka wants to merge 4 commits into
meta-pytorch:mainfrom
JacobSzwejbka:hf-rust-tokenizer-tok-followup

Conversation

@JacobSzwejbka

Copy link
Copy Markdown
Contributor

Summary

This is the experimental .tok follow-up to meta-pytorch/tokenizers#212. Do not merge it before #212.

It adds an independently selectable .tok-only backend and a dual JSON/.tok configuration. The implementation is preserved separately so the JSON integration can merge using only released Hugging Face RC crates.

Dependency status

.tok is not part of Hugging Face tokenizers v1.0.0-rc.2 or its published crates. This draft pins commit 054bdf469b2cf416c0da953923d88c82f4d765b5 from the experimental feat/tok-format branch. It should remain draft until the format and reader land in a protected upstream branch or release.

Because this is stacked on #212, GitHub currently shows the JSON base changes too. Once #212 lands and this branch is rebased, the diff will contain only .tok support.

Validation

Before the split, the .tok-only, JSON-only, and combined Rust configurations passed formatting, Clippy with warnings denied, unit tests, CMake builds, installed-package linkage, and real GPT-2 round trips. The .tok path remains byte-level-only because the experimental schema does not serialize decoder chains.

AI-assisted by Codex.

Preserve independent BOS/EOS counts, avoid guessing a missing token ID, and reject .tok files whose decoder cannot yet be represented safely. Add C++ regression coverage and run the Rust checks in CI.

AI-assisted-by: Codex
Generated with assistance from Codex.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant