Closed
Conversation
aurickq
suggested changes
Apr 6, 2022
adaptdl/adaptdl/torch/context.py
Outdated
| """ | ||
|
|
||
| def __init__(self, batch_size): | ||
| self._elastic = adaptdl.torch.data.AdaptiveDataLoaderHelper(batch_size) |
Contributor
There was a problem hiding this comment.
Should make sure the AdaptiveDLContext class does not depend on the AdaptiveDataLoaderHelper class (or anything related to PyTorch).
adaptdl/adaptdl/torch/context.py
Outdated
| self._elastic._state.accumulation_steps = accum_steps | ||
| self._elastic._state.current_local_bsz, self._elastic._state.accumulation_steps = \ | ||
| adaptdl.collective.broadcast((self._elastic._state.current_local_bsz, | ||
| self._elastic._state.accumulation_steps)) |
Contributor
There was a problem hiding this comment.
Shouldn't do any cross-replica synchronization from a call to the AdaptiveDLContext class. The synchronization should happen outside, from the callsite.
adaptdl/adaptdl/torch/context.py
Outdated
| return self._elastic.training | ||
|
|
||
| def to_tensorboard(self, writer, global_step, tag_prefix=""): | ||
| self._elastic.to_tensorboard(writer, global_step, tag_prefix) |
Contributor
There was a problem hiding this comment.
Tensorboard isn't core AdaptDL logic so shouldn't be included in this class.
adaptdl/adaptdl/torch/context.py
Outdated
| import adaptdl.env | ||
| from adaptdl.torch._metrics import get_goodput_fn | ||
| import adaptdl.torch.data | ||
| from adaptdl.torch.scaling_rules import ScalingRuleBase |
Contributor
There was a problem hiding this comment.
Should make sure this module doesn't depend on anything from PyTorch
adaptdl/adaptdl/torch/context.py
Outdated
| import adaptdl.torch.data | ||
| from adaptdl.torch.scaling_rules import ScalingRuleBase | ||
|
|
||
| class AdaptiveDLContext(object): |
Contributor
There was a problem hiding this comment.
Maybe rename it to just Context so usage of it can be simply adaptdl.Context
…etuum#118) * first conversion to v1 * disable CR pruning * add adaptdl SA * add status to schema * comply to ray-project/ray#21852
Author
|
close via a new PR #123 |
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.
Notes:
The first step is to create the Context class and start to move the core AdaptDL mathematics into that class.
The AdaptiveDataLoader should get refactored to use the Context class for those AdaptDL logic to prevent duplication of logic.
But the changes to AdaptiveDataLoader are purely implementation changes, users of the class shouldn't need to see any difference.