Skip to content

Add hook for Modules that need finer grained control on validating missing parameters#336

Merged
davidkoski merged 2 commits intomainfrom
module-missing
Jan 22, 2026
Merged

Add hook for Modules that need finer grained control on validating missing parameters#336
davidkoski merged 2 commits intomainfrom
module-missing

Conversation

@davidkoski
Copy link
Collaborator

Proposed changes

  • if validation includes .allModelKeysSet then a missing non-optional parameter will throw a validation error
  • modules have no clean way to fine tune this, e.g. if one particular parameter is ok to be missing
  • would allow a fix for Add MiniMax and MiMo v2 Flash models mlx-swift-lm#50

Specifically this adds a method that can be overridden in subclasses to customize the behavior.

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the necessary documentation (if needed)

…ssing parameters

- if validation includes .allModelKeysSet then a missing non-optional parameter will throw a validation error
- modules have no clean way to fine tune this, e.g. if one particular parameter is ok to be missing
- would allow a fix for ml-explore/mlx-swift-lm#50
@davidkoski davidkoski requested a review from awni January 15, 2026 23:19
@davidkoski
Copy link
Collaborator Author

@ronaldmannak FYI

open func updateMissing(
parameter: String, verify: VerifyUpdate, path: [String], modulePath: [String]
) throws {
throw UpdateError.keyNotFound(path: path, modules: modulePath)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So for example if "x" was ok to be missing this could check parameter == "x" and simply return.

Copy link
Member

@awni awni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Member

@awni awni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@davidkoski davidkoski merged commit 4dccaed into main Jan 22, 2026
7 checks passed
@davidkoski davidkoski deleted the module-missing branch January 22, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants