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

use_local_updates in optimizer #468

Merged
merged 4 commits into from
May 17, 2022
Merged

use_local_updates in optimizer #468

merged 4 commits into from
May 17, 2022

Conversation

justheuristic
Copy link
Member

@justheuristic justheuristic commented May 17, 2022

[this PR fixes some edge case bugs introduced since 1.1.0, those bugs do not affect pip version]

  • fix use_local_updates in Optimizer, add test cases to ensure that it works
  • ensure that grad_compression is always used

@justheuristic
Copy link
Member Author

[merging once all tests pass]

@codecov
Copy link

codecov bot commented May 17, 2022

Codecov Report

Merging #468 (643a1f8) into master (c6b2b2d) will increase coverage by 0.58%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #468      +/-   ##
==========================================
+ Coverage   83.12%   83.71%   +0.58%     
==========================================
  Files          81       81              
  Lines        8061     8063       +2     
==========================================
+ Hits         6701     6750      +49     
+ Misses       1360     1313      -47     
Impacted Files Coverage Δ
hivemind/optim/optimizer.py 69.66% <100.00%> (+7.23%) ⬆️
hivemind/averaging/averager.py 88.12% <0.00%> (-0.72%) ⬇️
hivemind/utils/mpfuture.py 95.02% <0.00%> (+0.90%) ⬆️
hivemind/optim/progress_tracker.py 98.90% <0.00%> (+1.09%) ⬆️
hivemind/dht/dht.py 92.40% <0.00%> (+2.53%) ⬆️
hivemind/averaging/matchmaking.py 89.28% <0.00%> (+5.05%) ⬆️

assert not optimizer.tracker.is_alive()
assert optimizer.grad_averager is None if use_local_updates else (not optimizer.grad_averager.is_alive())
Copy link
Member

Choose a reason for hiding this comment

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

Better to split the conditional in multiple lines:

assert not optimizer.tracker.is_alive()
assert optimizer.grad_averager is None if use_local_updates else (not optimizer.grad_averager.is_alive())
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
assert optimizer.grad_averager is None if use_local_updates else (not optimizer.grad_averager.is_alive())
if use_local_updates:
assert optimizer.grad_averager is None
else:
assert not optimizer.grad_averager.is_alive()

Copy link
Member Author

Choose a reason for hiding this comment

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

[implemented it as requested, but did not notice the suggestion

Comment on lines 310 to 316
(
True,
True,
False,
False,
False,
),
Copy link
Member

Choose a reason for hiding this comment

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

To make formatting more consistent, you can surround the entire block of cases above with # fmt: off and # fmt: on

Copy link
Member Author

@justheuristic justheuristic May 17, 2022

Choose a reason for hiding this comment

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

did as requested, thx for suggestion

@justheuristic justheuristic merged commit 35851c8 into master May 17, 2022
@justheuristic justheuristic deleted the fix_local_updates branch May 17, 2022 09:27
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.

3 participants