Repository navigation
fix(models): load flint checkpoints nested under language_model - #2
Merged
Merged
Conversation
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.
Flint's mlx-vlm conversions put the text model under
language_model.. Loading them failed with every key reported missing, and the nvfp4 conversion also crashed on itsweight_scale_2global scales.Fix
mlx_layouttakes only the text-model roots (model.,lm_head) out from underlanguage_model., and the quant section's entries are renamed to match. A tensor stored under both names is refused. The conversions also store an all-zero routerexpert_bias: it is dropped when zero and refused otherwise.weight_scale_2becomes itsoutput_scale. This is the dequantization-side global scale, as in ModelOpt. It applies only where the quant section declares the module nvfp4; anywhere else it is refused.Now loads
Checked with a header-only dry run. These 7 repos go from FAIL to PASS, and nothing else changes across 67 candidate repos:
mlx-community/flint-{oQ4e, oQ8e}nativ-community/flint-{4bit, 6bit, 8bit, bf16, nvfp4}Tested
Apple M4, 24 GB, macOS 15.3.
uv run pytest tests/ -q(1858 passed, 66 skipped) anduv run pre-commit run --all-filespass.RecursiveSI/flint-int4real load (ftm serve --model <dir> --max-seq-len 4096) gives the same greedy output asmain. The prefixed conversions were checked only with the dry run.