feat(frontend): make tokenizer fallback configurable - #12923
Conversation
Signed-off-by: xianlubird <xianlubird@gmail.com>
|
/ok to test 58097b8 |
WalkthroughChangesThe frontend now configures tokenizer fallback through CLI and environment settings. The model card preserves fallback by default and supports strict errors for alternate tokenizer failures. Tests and documentation cover both modes. Tokenizer fallback control
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/fern/pages/use-cases/fastokens-tokenizer/overview.md`:
- Line 120: Update the Mermaid flow chart near the fastokens loading path to
branch on whether tokenizer fallback is disabled: failed fastokens loading
should stop model initialization when `--no-tokenizer-fallback` is set, while
retaining the existing HuggingFace fallback and request-serving path when
fallback remains enabled.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 621a7633-3dc0-4d64-959b-acf83abb9127
📒 Files selected for processing (7)
components/src/dynamo/frontend/frontend_args.pycomponents/src/dynamo/frontend/main.pydocs/fern/pages/developer-guide/knowledge-base/modular-components/frontend/tokenizer.mddocs/fern/pages/reference/components/frontend-configuration.mdxdocs/fern/pages/use-cases/fastokens-tokenizer/overview.mdlib/llm/src/model_card.rslib/llm/tests/model_card.rs
Signed-off-by: xianlubird <xianlubird@gmail.com>
|
/ok to test 82d9f0b |
Signed-off-by: xianlubird <xianlubird@gmail.com>
|
/ok to test 01159fc |
|
🎯 Code Coverage (details) 🔗 Commit SHA: 87d75bf | Docs | Datadog PR Page | Give us feedback! |
jthomson04
left a comment
There was a problem hiding this comment.
The explicit fallback setting is lost in the normal dynamic frontend path, and the boolean parsing behavior is inconsistent between the Python and Rust entry points. Please keep the fix focused and add one regression test that applies an explicit false override to a discovered model card.
Signed-off-by: xianlubird <xianlubird@gmail.com>
|
/ok to test b7b4a6e |
Signed-off-by: xianlubird <xianlubird@gmail.com>
|
/ok to test f342a71 |
Signed-off-by: xianlubird <xianlubird@gmail.com>
|
/ok to test ad47f56 |
jthomson04
left a comment
There was a problem hiding this comment.
The earlier propagation and strict parsing issues are fixed. One non-blocking CLI help and documentation note remains.
Signed-off-by: xianlubird <xianlubird@gmail.com>
|
/ok to test fe28206 |
harryskim
left a comment
There was a problem hiding this comment.
Docs-only review (the 4 hand-written pages; the three docs/fern/pages/reference/api/python/*.mdx files are regenerated output and look consistent with _core.pyi).
Overall this reads well and the option is documented in all three places a reader would look. I checked the "in dynamic mode, discovery retries the load while the frontend continues running" claim against the discovery controller's retry/backoff path and it holds. The ParamField added to frontend-configuration.mdx matches the file's existing convention for negatable booleans, and the mermaid branch split in the fastokens guide is correct.
One blocking issue (wrong valid values in the tokenizer guide table) plus a couple of nits inline.
Signed-off-by: xianlubird <xianlubird@gmail.com>
|
/ok to test 9b1a49d |
Signed-off-by: xianlubird <xianlubird@gmail.com>
|
/ok to test 6d24456 |
Signed-off-by: xianlubird <xianlubird@gmail.com>
|
/ok to test 87d75bf |
|
Looks like this CI failure is unrelated to the code changes in this PR. The first lychee pass hit a connection failure on an Istio docs URL. The retry did run and that link recovered, but a different CNCF Slack redirect then failed with a connection reset by peer. All PR-specific checks passed, so this appears to be an external network flake. |
Summary
Basetenkenizer support landed in #12376 alongside the existing fastokens backend. Both alternate tokenizer backends currently prioritize availability: when the selected implementation cannot load a model's
tokenizer.json, the frontend logs a warning and transparently uses HuggingFace instead.That default is useful for general serving, but it can hide a configuration mismatch when an operator explicitly requires an alternate backend. For example, a performance run can complete successfully while measuring HuggingFace after an unnoticed fallback, and a production deployment can start without the tokenizer implementation it was configured to use.
This change makes that fallback policy configurable while keeping existing deployments compatible:
--tokenizer-fallback/--no-tokenizer-fallbackfrontend option, withDYN_TOKENIZER_FALLBACKas the equivalent environment variable.EntrypointArgs,ModelRuntimeConfig, and everyModelWatcherpath so dynamically discovered model cards receive the same policy before tokenizer construction.true/false,1/0,on/off, andyes/no; invalid values now fail with a configuration error instead of silently restoring the default.Example:
Validation
cargo test -p dynamo-llm --no-default-features tokenizer_fallback --lib --tests(3 focused tests passed)falseoverride to a dynamically discovered model cardcargo fmt --all -- --checkpython3 -m black --check components/src/dynamo/common/configuration/utils.py components/src/dynamo/common/tests/configuration/test_utils.py components/src/dynamo/frontend/frontend_args.pypython3 docs/fern/scripts/check_asset_paths.pypython3 docs/fern/scripts/gen_python_api.py --check(Python 3.13, matching CI)python3 -m py_compile components/src/dynamo/common/configuration/utils.py components/src/dynamo/common/tests/configuration/test_utils.py components/src/dynamo/frontend/frontend_args.pyRelated Issues
None.
Reviewer Guide
Start with the negatable frontend option in
components/src/dynamo/frontend/frontend_args.pyand the explicit Python-to-Rust handoff incomponents/src/dynamo/frontend/main.pyandlib/bindings/python/rust/llm/entrypoint.rs. Then review strict fallback precedence inlib/llm/src/local_model/runtime_config.rs, propagation into dynamic model discovery inlib/llm/src/discovery/watcher.rs, and the fail-fast branches inlib/llm/src/model_card.rs.