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

[tensor] design DistSpec and DistSpecManager for ColoTensor #934

Merged
merged 15 commits into from
May 13, 2022

Conversation

ver217
Copy link
Member

@ver217 ver217 commented May 12, 2022

  1. design DistSpec and DistSpecManager for ColoTensor
  2. update current ops, besides loss
  3. skip test_model.py

@ver217 ver217 marked this pull request as ready for review May 13, 2022 05:04
@ver217 ver217 requested a review from feifeibear May 13, 2022 05:04
@ver217
Copy link
Member Author

ver217 commented May 13, 2022

All tests passed.
image

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

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?

Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Contributor

Choose a reason for hiding this comment

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

OK,that's fine

Copy link
Member Author

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

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?


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

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.

Copy link
Member Author

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.

Copy link
Member Author

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

Choose a reason for hiding this comment

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

OK,that's fine

colossalai/tensor/_ops/linear.py Outdated Show resolved Hide resolved
@ver217 ver217 merged commit 67c33f5 into main May 13, 2022
@ver217 ver217 deleted the feature/reshaper branch May 13, 2022 09:43
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