Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hivemind.Optimizer] TrainingStateAverager #407

Merged
merged 42 commits into from
Nov 15, 2021
Merged

Conversation

justheuristic
Copy link
Member

@justheuristic justheuristic commented Nov 8, 2021

This PR implements a component of hivemind.Optimizer ( #400 ) that holds the training state and supports (delayed) optimizer steps and averaging rounds.
Unlike TrainingAverager, this class is does not need data locks as it will only update model parameters during .step.

  • implement TrainingStateAverager
  • test different initializations
  • test load_state_from_peers
  • test synchronous offloaded
  • test asynchronous updates (with "slow" optimizer)
  • include scheduler in load_state_from_peers

justheuristic and others added 2 commits November 8, 2021 23:21
Co-authored-by: Roman Zhytar <[email protected]>
Co-authored-by: Roman Zhytar <[email protected]>
@codecov
Copy link

codecov bot commented Nov 8, 2021

Codecov Report

Merging #407 (cf40b94) into master (8fa0a8e) will increase coverage by 0.31%.
The diff coverage is 90.53%.

@@            Coverage Diff             @@
##           master     #407      +/-   ##
==========================================
+ Coverage   83.84%   84.15%   +0.31%     
==========================================
  Files          74       75       +1     
  Lines        6783     7121     +338     
==========================================
+ Hits         5687     5993     +306     
- Misses       1096     1128      +32     
Impacted Files Coverage Δ
hivemind/optim/experimental/state_averager.py 90.53% <90.53%> (ø)
hivemind/utils/mpfuture.py 94.03% <0.00%> (-0.92%) ⬇️
hivemind/averaging/matchmaking.py 84.19% <0.00%> (-0.31%) ⬇️
hivemind/dht/node.py 91.44% <0.00%> (+0.71%) ⬆️

tests/test_optimizer.py Show resolved Hide resolved
tests/test_optimizer.py Outdated Show resolved Hide resolved
tests/test_optimizer.py Outdated Show resolved Hide resolved
tests/test_optimizer.py Show resolved Hide resolved
@justheuristic
Copy link
Member Author

Note to a potential @mryab : despite running 20 optimizer steps, the test runs in ~1.3s on my laptop and ~2s in the CI.

hivemind/optim/experimental/state_averager.py Outdated Show resolved Hide resolved
hivemind/optim/experimental/state_averager.py Outdated Show resolved Hide resolved
hivemind/optim/experimental/state_averager.py Show resolved Hide resolved
hivemind/optim/experimental/state_averager.py Outdated Show resolved Hide resolved
hivemind/optim/experimental/state_averager.py Outdated Show resolved Hide resolved
hivemind/optim/experimental/state_averager.py Outdated Show resolved Hide resolved
hivemind/optim/experimental/state_averager.py Outdated Show resolved Hide resolved
@justheuristic
Copy link
Member Author

Note: this implements delayed optimizer step as a part of #394

@justheuristic justheuristic merged commit 02eee92 into master Nov 15, 2021
@justheuristic justheuristic deleted the state_averaging branch November 15, 2021 14:06
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