Fix Optimisers.adjust! to mutate Training.TrainState.optimizer#1725
Draft
Copilot wants to merge 1 commit into
Draft
Fix Optimisers.adjust! to mutate Training.TrainState.optimizer#1725Copilot wants to merge 1 commit into
Optimisers.adjust! to mutate Training.TrainState.optimizer#1725Copilot wants to merge 1 commit into
Conversation
Copilot
AI
changed the title
[WIP] Fix Optimisers.adjust! to mutate TrainState
Fix Jun 1, 2026
Optimisers.adjust! to mutate Training.TrainState.optimizer
b65bbdb to
f76fd73
Compare
Contributor
Benchmark Results (Julia v1.12)Time benchmarks
Memory benchmarks
|
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.
Optimisers.adjust!(::Training.TrainState, ...)updatedoptimizer_statebut did not actually mutate theoptimizerfield on the passedTrainState. As a result,train_state.optimizercould remain stale after in-place adjust calls.Behavior fix in Training helper API
Optimisers.adjust!(ts::TrainState, eta::Real)andOptimisers.adjust!(ts::TrainState; kwargs...)to directly assignts.optimizer = Optimisers.adjust(...).adjust!onTrainState.Regression coverage for optimizer consistency
tstate.optimizer_state...rule.etatstate.optimizer.etaadjustandadjust!overloads (etapositional and keyword forms).