-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[tensor] design DistSpec and DistSpecManager for ColoTensor #934
Conversation
from .op_wrapper import ( | ||
colo_op_impl,) | ||
from .colo_tensor import ColoTensor | ||
from .colo_parameter import ColoParameter | ||
from .utils import convert_parameter, named_params_with_colotensor | ||
from ._ops import * | ||
from .optim.colo_optimizer import ColoOptimizer | ||
from . import dist_spec |
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.
why not name it as DistSpec?
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.
Or DistSignature? to be consistent with our design doc?
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.
It's a package not class. I just use package to implement the "namespace" in C++.
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.
OK,that's fine
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.
I've updated this part in our design doc. I think current implementation is simpler and it's easy to comprehend for users.
from .op_wrapper import ( | ||
colo_op_impl,) | ||
from .colo_tensor import ColoTensor | ||
from .colo_parameter import ColoParameter | ||
from .utils import convert_parameter, named_params_with_colotensor | ||
from ._ops import * | ||
from .optim.colo_optimizer import ColoOptimizer | ||
from . import dist_spec |
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.
Or DistSignature? to be consistent with our design doc?
colossalai/tensor/colo_tensor.py
Outdated
|
||
def has_spec(self) -> bool: | ||
return self._shard_spec is not None and self._shard_spec.num_action > 0 | ||
return self._spec is not None and self._spec.num_action > 0 |
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.
we'd better set _spec as a dummy one by default.
I think making it an optional variable may bring some trouble. According to our experiments in ShardTensor design.
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.
Oh, yes. Actually our default value of _spec is not None. This code snippet is outdated and I forgot to update.
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.
updated
from .op_wrapper import ( | ||
colo_op_impl,) | ||
from .colo_tensor import ColoTensor | ||
from .colo_parameter import ColoParameter | ||
from .utils import convert_parameter, named_params_with_colotensor | ||
from ._ops import * | ||
from .optim.colo_optimizer import ColoOptimizer | ||
from . import dist_spec |
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.
OK,that's fine
test_model.py