Compose a rule with trailing transforms, and scale by a schedule - #108
Merged
jessegrabowski merged 2 commits intoAug 25, 2026
Merged
Conversation
The body already threaded its incoming argument straight into the head, so a rule-headed chain ran correctly all along; only the signature and the docstring said transforms only, and a type checker rejected the composition the issue asks for. Closes pymc-devs#81
Scheduling the rate after the rule is a different graph from scheduling it inside, whenever a clip sits between the two: the clip then bounds a step at unit rate, so its bound stays in gradient units rather than moving with whatever rate the schedule currently holds. Closes pymc-devs#82
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #108 +/- ##
=======================================
Coverage 97.52% 97.52%
=======================================
Files 61 61
Lines 3069 3076 +7
=======================================
+ Hits 2993 3000 +7
Misses 76 76 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
chainalready worked with a rule at the head — the body threads whatever it's handed into the first callable — but the signature said transforms only, and mypy rejectedchain(adam(1e-3), clip_by_global_norm(1.0), scale(0.5)). That's overloads now.headstays unannotated: any type wide enough to accept both is a union, and a union return won't pass tocompile_train, so that onehead(...)call is unchecked.scale_by_scheduleschedules the rate after the rule instead of inside it. Those are different graphs once a clip sits between the two — the clip bounds a step at unit rate, so its bound stays in gradient units rather than moving with whatever the schedule currently holds. It owns its clock, andcompile_trainadvances it.Closes #81
Closes #82