-
Notifications
You must be signed in to change notification settings - Fork 81
Stage1 #115
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
Stage1 #115
Conversation
adaptdl/adaptdl/torch/context.py
Outdated
| """ | ||
|
|
||
| def __init__(self, batch_size): | ||
| self._elastic = adaptdl.torch.data.AdaptiveDataLoaderHelper(batch_size) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
|
close via a new PR #123 |
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.