Skip to content

Warn that remat is unsupported instead of zeroing weight grads - #86

Merged
hertschuh merged 2 commits into
mainfrom
remat-warn
Oct 8, 2026
Merged

hertschuh merged 2 commits into
mainfrom
remat-warn

Conversation

@MarcosAsh

Copy link
Copy Markdown
Collaborator

mx.checkpoint only differentiates the function's explicit args, so with RematScope the layer weights closed over inside the function got zero grads and the model silently stopped training. Until we can pass the scope's variables through explicitly (like mlx.nn.utils.checkpoint does with module params, the tricky part is carrying non-trainable updates like BN stats back out), remat now warns and runs the function as is, same as the numpy and openvino backends. test_remat_with_kwargs passes now so it comes off the exclusion list.

@hertschuh hertschuh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

@hertschuh
hertschuh merged commit ddaa698 into main Oct 8, 2026
9 of 10 checks passed
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