Skip to content

Conversation

@Xuezhi-Liang
Copy link

Unknown

Notes:

  1. The first step is to create the Context class and start to move the core AdaptDL mathematics into that class.

  2. The AdaptiveDataLoader should get refactored to use the Context class for those AdaptDL logic to prevent duplication of logic.

  3. But the changes to AdaptiveDataLoader are purely implementation changes, users of the class shouldn't need to see any difference.

"""

def __init__(self, batch_size):
self._elastic = adaptdl.torch.data.AdaptiveDataLoaderHelper(batch_size)
Copy link
Contributor

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).

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))
Copy link
Contributor

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.

return self._elastic.training

def to_tensorboard(self, writer, global_step, tag_prefix=""):
self._elastic.to_tensorboard(writer, global_step, tag_prefix)
Copy link
Contributor

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.

import adaptdl.env
from adaptdl.torch._metrics import get_goodput_fn
import adaptdl.torch.data
from adaptdl.torch.scaling_rules import ScalingRuleBase
Copy link
Contributor

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

import adaptdl.torch.data
from adaptdl.torch.scaling_rules import ScalingRuleBase

class AdaptiveDLContext(object):
Copy link
Contributor

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

@Xuezhi-Liang
Copy link
Author

close via a new PR #123

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