Skip to content

studio: preserve ambient transformers tier for tokenizer-only models - #10949

Closed
TaskPuppyNatani wants to merge 2 commits into
unslothai:mainfrom
TaskPuppyNatani:fix/transformers-tier-routing
Closed

TaskPuppyNatani wants to merge 2 commits into
unslothai:mainfrom
TaskPuppyNatani:fix/transformers-tier-routing

Conversation

@TaskPuppyNatani

Copy link
Copy Markdown
Contributor

Summary

Preserves a sufficient ambient Transformers 5.x environment when tier selection is driven only by tokenizer metadata and secure AutoConfig probing cannot conclusively parse a custom remote-code model.

Previously, tokenizer-only 5.x signals always used the historical 5.3.0 floor. For custom-code models such as K2-Horizon, the secure probe intentionally keeps trust_remote_code=False, so every probed tier can fail even when the ambient default is already a suitable 5.x version. That could incorrectly demote the model to the 5.3.0 sidecar.

This PR adds a narrow tokenizer-tier resolver that:

  • probes the ambient default first when the configured default Transformers major is already 5.x
  • uses floor="default" for that ambient-5.x path
  • preserves the existing sidecar-only probing and 5.3.0 floor when the ambient default is still 4.x
  • leaves the secure AutoConfig probe policy unchanged with trust_remote_code=False

The change is applied to both local and remote tokenizer-only routing paths.

Validation

  • studio/backend/tests/test_transformers_version.py: 324 passed
  • git diff --check: clean

Regression coverage includes:

  • local custom-code tokenizer-only routing with ambient 5.x
  • remote custom-code tokenizer-only fallback with ambient 5.x vs 4.x
  • successful ambient-default parse short-circuit
  • escalation to a higher 5.x sidecar when the ambient parser fails
  • an explicit assertion that the tier probe still uses trust_remote_code=False

Context

This was found while validating IFM/K2-Horizon support in Studio. The IFM protocol support itself is intentionally kept in separate PR #10948, so this PR remains a generic Transformers tier-routing fix.

@danielhanchen

Copy link
Copy Markdown
Member

Confirmed the tokenizer-only paths at studio/backend/utils/transformers_version.py:1847 and :1927 still fall back to the 5.3.0 floor even when the ambient default is already 5.5.0, and this keeps the 4.x behaviour intact. Will get this reviewed.

@Imagineer99 Imagineer99 self-assigned this Sep 18, 2026
@Imagineer99

Copy link
Copy Markdown
Member

I reproduced the tokenizer-only routing failure against the PR's parent commit: four new regression cases fail with the wrong tier, while all six pass at 924fb7b. The full test_transformers_version.py suite passes on Linux with Python 3.10, 3.12, and 3.13 (324/324 each). On Windows, 322 pass; the two failures require symlink privileges and reproduce unchanged on the parent commit.

The fix is scoped to tokenizer-only routing, preserves the ambient 4.x path in the tests, and leaves trust_remote_code=False in place. I found no blocking issue. A real K2-Horizon load and macOS routing test remain unverified.

@Imagineer99

Copy link
Copy Markdown
Member

Rechecked unchanged head 924fb7b1829e and tested a clean simulated merge with main at b37bddb439. All 324 routing tests passed on Linux/Python 3.12, and CI has no failing or pending checks.

Friday’s Linux and Windows findings remain applicable. No blocking issue found. Real K2-Horizon loading and dedicated macOS routing remain unverified.

Copy link
Copy Markdown
Contributor Author

General validation note for my open PRs:

I’m no longer able to keep my primary machine pinned several versions behind, or repeatedly rebuild historical ROCm/Unsloth environments solely for PR testing. My current priority is restoring and maintaining a stable training setup, because training attempts are currently crashing my system and blocking normal work.

Going forward, I can validate changes on my current working/supported local stack and provide logs or reproductions there. If a PR requires hardware validation on an older ROCm/Unsloth stack, that will need CI or another tester who already has an appropriate environment. If I later have dedicated isolated lab hardware available, I may be able to test older stacks there, but I will not hold back or destabilize my primary environment for PR validation.

This does not withdraw the PR; it is a boundary on what version-specific hardware validation I can personally provide.

Copy link
Copy Markdown
Contributor Author

Hardware testing update: I’m planning to put Ubuntu on an NVMe so I can help with any additional validation you still need on these PRs. It’s going to take me a couple of days to get that environment set up, but once it’s ready I should be available for hardware-specific testing.

@danielhanchen danielhanchen self-assigned this Nov 13, 2026
@danielhanchen

Copy link
Copy Markdown
Member

Thanks for the PR! This is already fixed on main: #16096 routes custom-code models by the transformers version that saved them, before the tokenizer check, so every K2-Horizon repo resolves correctly (5.4-saved -> default, 5.13-saved -> 5.13 sidecar) without reaching this code. Closing as resolved.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants