Skip to content

Add opt-in Hugging Face Rust JSON tokenizer integration - #22548

Draft
JacobSzwejbka wants to merge 5 commits into
pytorch:mainfrom
JacobSzwejbka:hf-rust-tokenizer-tok
Draft

JacobSzwejbka wants to merge 5 commits into
pytorch:mainfrom
JacobSzwejbka:hf-rust-tokenizer-tok

Conversation

@JacobSzwejbka

@JacobSzwejbka JacobSzwejbka commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Depends on meta-pytorch/tokenizers#212.

This advances the tokenizer submodule and wires its opt-in Hugging Face Rust JSON backend into the LLM runner. EXECUTORCH_BUILD_HF_RUST_TOKENIZER remains off by default. When enabled, the backend accepts ordinary Hub tokenizer.json files through published Hugging Face v1.0.0-rc.2 crates and uses the upstream Rust encode/decode pipeline. Failed Rust loads retain the existing tokenizer fallback chain.

There is no .tok code or format selector in this PR. Experimental .tok work has moved to draft pytorch/executorch#23139, stacked on meta-pytorch/tokenizers#218, and is blocked on upstream stabilization.

Review and merge order

Land meta-pytorch/tokenizers#212 first. Then update this PR's submodule pointer to the canonical merge commit, rebase onto ExecuTorch main, and mark this PR ready.

Hugging Face's v1 RC post lists inference-only C/C++ bindings for ExecuTorch and llama.cpp on the v1 roadmap. Their experimental bindings PR #2375 is still open. The local bridge is deliberately narrow and can be replaced after that upstream ABI exposes the vocabulary and special-token metadata ExecuTorch requires.

Validation

Formatting and focused C++ adapter tests pass. The dependency PR validates Rust lint/tests, a clean CMake build, installed-package linkage, and a real GPT-2 JSON round trip. With the feature disabled, ExecuTorch does not invoke Cargo or link the optional backend.

AI-assisted by Codex.

@pytorch-bot

pytorch-bot Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/22548

Note: Links to docs will display an error until the docs builds have been completed.

❌ 64 New Failures, 10 Unclassified Failures

As of commit 1e71054 with merge base 83c4dc1 (image):

NEW FAILURES - The following jobs have failed:

UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 4, 2026
@JacobSzwejbka JacobSzwejbka added the release notes: llm Changes to llm utilities label Sep 24, 2026
@JacobSzwejbka
JacobSzwejbka force-pushed the hf-rust-tokenizer-tok branch 3 times, most recently from 582d583 to 9108d0d Compare September 24, 2026 19:06
@JacobSzwejbka JacobSzwejbka changed the title Add opt-in Hugging Face .tok tokenizer integration Add opt-in byte-level Hugging Face .tok tokenizer integration Sep 24, 2026
Point at the rebased tokenizer dependency with corrected BOS/EOS semantics, safe decoder gating, and regression coverage. Apply the required CMake formatting.

AI-assisted-by: Codex
@JacobSzwejbka JacobSzwejbka changed the title Add opt-in byte-level Hugging Face .tok tokenizer integration Add opt-in Hugging Face Rust tokenizer integration Sep 24, 2026
@JacobSzwejbka
JacobSzwejbka force-pushed the hf-rust-tokenizer-tok branch 2 times, most recently from 32a0d78 to 5764a02 Compare September 24, 2026 20:30
Generated with assistance from Codex.
Generated with assistance from Codex.
@JacobSzwejbka JacobSzwejbka changed the title Add opt-in Hugging Face Rust tokenizer integration Add opt-in Hugging Face Rust JSON tokenizer integration Sep 24, 2026

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 Facebook bot. Authors need to sign the CLA before a PR can be reviewed. release notes: llm Changes to llm utilities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant