fix(backend): resolve MLX and Torch .safetensors checkpoint collision#254
Open
eaglstun wants to merge 1 commit into
Open
fix(backend): resolve MLX and Torch .safetensors checkpoint collision#254eaglstun wants to merge 1 commit into
eaglstun wants to merge 1 commit into
Conversation
The MLX setup in the README places the MLX weights at CorridorKeyModule/checkpoints/corridorkey_mlx.safetensors, next to the auto-downloaded Torch checkpoint (CorridorKey_v1.0.safetensors). Checkpoint discovery distinguished checkpoints by screen colour (the "blue" filename token) but not by backend, and both backends share the .safetensors extension. With two "green" .safetensors present, both the Torch and the MLX path raised "Multiple ... checkpoints. Keep exactly one." — so following the documented MLX setup broke inference on *both* backends. Make discovery backend-aware via an "mlx" filename token (mirroring the existing BLUE_FILENAME_TOKEN convention and the MLX_MODEL_FILENAME constant): - Torch discovery excludes MLX-named .safetensors files. - MLX discovery prefers an MLX-named file when present, but still falls back to any lone .safetensors so the previous contract is preserved. Adds a regression test covering the coexistence case; it fails on the prior code with the exact "Multiple ... checkpoints" error and passes with the fix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The MLX setup in the README places the MLX weights at CorridorKeyModule/checkpoints/corridorkey_mlx.safetensors, next to the auto-downloaded Torch checkpoint (CorridorKey_v1.0.safetensors). Checkpoint discovery distinguished checkpoints by screen colour (the "blue" filename token) but not by backend, and both backends share the .safetensors extension. With two "green" .safetensors present, both the Torch and the MLX path raised "Multiple ... checkpoints. Keep exactly one." — so following the documented MLX setup broke inference on both backends.
Make discovery backend-aware via an "mlx" filename token (mirroring the existing BLUE_FILENAME_TOKEN convention and the MLX_MODEL_FILENAME constant):
Adds a regression test covering the coexistence case; it fails on the prior code with the exact "Multiple ... checkpoints" error and passes with the fix.
What does this change?
How was it tested?
Checklist
uv run pytestpassesuv run ruff checkpassesuv run ruff format --checkpasses