re-port sanitize, fix #431#432
Merged
Merged
Conversation
davidkoski
commented
Oct 28, 2025
| newKey = newKey.replacingOccurrences(of: "lm_head", with: "language_model.lm_head") | ||
| guard !config.textConfiguration.tieWordEmbeddings else { continue } | ||
| adjusted[newKey] = value | ||
| continue |
Collaborator
Author
There was a problem hiding this comment.
Make the sanitize match the python version, see #431. It was converting
(lldb) po weights.keys.sorted()
▿ 1258 elements
- 0 : "language_model.lm_head.biases"
- 1 : "language_model.lm_head.scales"
- 2 : "language_model.lm_head.weight"
to
(lldb) po weights.keys.sorted()
▿ 1258 elements
- 0 : "language_language_model.lm_head.biases"
- 1 : "language_language_model.lm_head.scales"
- 2 : "language_language_model.lm_head.weight"
This omits the logic of guard !config.textConfiguration.tieWordEmbeddings else { continue } (these keys are unused if tieWordEmbeddings is present). If we need that I think it should be re-inserted right before line 1725 (adjusted[newKey] = value)
Collaborator
Author
There was a problem hiding this comment.
I think the mlx_vlm code doesn't end up caring if the lm_head keys are consumed so we do need that logic.
Contributor
|
Just went through this; LGTM! Apologies for the error in the first place |
atdrendel
pushed a commit
to shareup/mlx-swift-examples
that referenced
this pull request
Dec 6, 2025
* re-port sanitize, fix ml-explore#431
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.
No description provided.