Uh oh!
There was an error while loading. Please reload this page.
Use external hf_tokenizer in llama runner - #9112
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/9112
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit 4ff5d8b with merge base c5dd476 ( FLAKY - The following job failed but was likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
de6b735 to
a536432Compare
jackzhxng
left a comment
There was a problem hiding this comment.
Update - will change to use extension/llm/tokenizers/src/hf_tokenizer.cpp as real impl
08e7b04 to
4d29fdaCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
9b69efe to
51323bcCompare
jackzhxng
left a comment
There was a problem hiding this comment.
@swolchok This PR changed to directly use the hf tokenizer from https://github.com/pytorch-labs/tokenizers, can you give it a re-review? Most of your comments don't apply anymore as a result, but I addressed the ones that do
75dd028 to
63b2ed7Compare
swolchok
left a comment
There was a problem hiding this comment.
seems fine. sorry for the slow turnaround; feel free to ping me after it's been a day
Uh oh!
There was an error while loading. Please reload this page.
63b2ed7 to
dc8a31aCompare031d404 to
7fdb8aeCompare7d210be to
846951eComparefacebook-github-bot
commented
Apr 28, 2025
@jackzhxng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
facebook-github-bot
commented
Apr 28, 2025
@jackzhxng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
facebook-github-bot
commented
Apr 29, 2025
@jackzhxng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
facebook-github-bot
commented
Apr 29, 2025
@jackzhxng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
facebook-github-bot
commented
Apr 29, 2025
@jackzhxng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
facebook-github-bot
commented
Apr 29, 2025
@jackzhxng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
| auto json_tokenizer = std::make_unique<tokenizers::HFTokenizer>(); | ||
| if (json_tokenizer->load(tokenizer_path) == ::tokenizers::Error::Ok) { | ||
| ET_LOG(Info, "Loaded json tokenizer"); | ||
| return json_tokenizer; | ||
| } |
There was a problem hiding this comment.
Are custom special tokens, added tokens, etc already included in the tokenizer.json? Personally I haven't validated this yet, but I think we should before we claim HF tokenizer is supported.
There was a problem hiding this comment.
Yeah I think I'll need to follow up with some tests to verify this
facebook-github-bot
commented
Apr 30, 2025
@jackzhxng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
guangy10
commented
Apr 30, 2025
Getting this error when running the llm runner with a HF tokenizer: I also tried a hack with |
larryliu0820
commented
Apr 30, 2025
Yeah existing logic tries to deserialize the artifact as a tiktoken and then fallback to BPE tokenizer. We need some logic to use hf tokenizer. |
larryliu0820
commented
Apr 30, 2025
jackzhxng
commented
May 1, 2025
@guangy10 can you try building the runner with |
guangy10
commented
May 1, 2025
I was just using the build command in your test plan. This flag is set there I believe. |
Summary
Use https://github.com/pytorch-labs/tokenizers huggingface tokenizer in the Llama runner.
Results on Qwen2.5 with
extension/llm/tokenizerschecked out to meta-pytorch/tokenizers#50:Test plan
Build llama runner locally (note the inclusion of
-DSUPPORT_REGEX_LOOKAHEAD=ON):Run on Qwen2.5: