Skip to content

[executorch][native] Load Hugging Face tokenizer.json in the LLM runner - #24848

Open
SS-JIA wants to merge 1 commit into
gh/SS-JIA/704/basefrom
gh/SS-JIA/704/head
Open

SS-JIA wants to merge 1 commit into
gh/SS-JIA/704/basefrom
gh/SS-JIA/704/head

Conversation

@SS-JIA

@SS-JIA SS-JIA commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Ulterior Motive

Running Gemma 4 31B through ExecuTorch Native's GGML engine on CUDA, to find why it decodes slower than llama.cpp on the same GGUF.

Rationale

What: --tokenizer also takes a Hugging Face tokenizer.json, or a directory holding one.

Why: The runner loaded only Llama 3 TikToken models, and Gemma 4 ships its tokenizer as a tokenizer.json.

Details

  • Tokenizer: a path ending in .json, or a directory, loads tokenizers::HFTokenizer; any other path loads the Llama 3 TikToken model as before.
  • BOS:
    • Before: TikToken's encode prepended --num_bos BOS tokens, at most 127.
    • After: the runner prepends --num_bos copies of the tokenizer's BOS itself, because a tokenizer.json adds BOS only if its post-processor does. TikToken prompts encode to the same tokens as before.
  • llm_runner depends on //pytorch/tokenizers:hf_tokenizer.

Authored with Claude Code.

Differential Revision: D130721992

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ You can merge normally! (4 Unrelated Failures)

As of commit 8630f11 with merge base 4529a94 (image):

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@JakeStevens JakeStevens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

This branch was previously deployed

1 inactive deployment
cadence — 8630f11c Deployed Nov 10, 2026 by SS-JIA via hifi5s-op-test / hifi5s #37638
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. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants