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

feat: use bagua_module_name to identify different modules #438

Merged
merged 3 commits into from
Dec 21, 2021

Conversation

wangraying
Copy link
Member

No description provided.

"""
return self._bagua_module_name

@bagua_module_name.setter
Copy link
Member

Choose a reason for hiding this comment

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

Why not use .bagua_module_name directly?

Copy link
Member Author

@wangraying wangraying Dec 20, 2021

Choose a reason for hiding this comment

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

Yes, we can use bagua_module_name directly, I just think it looks clearer.

@@ -99,24 +99,30 @@ def with_bagua( # pytype: disable=module-attr
if process_group is None:
process_group = _get_default_group()

bagua_module_name = None
if hasattr(self, "bagua_ddp"):
bagua_module_name = self.bagua_ddp.bagua_module_name
Copy link
Member

Choose a reason for hiding this comment

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

In my understanding, it cannot use .with_bagua and BaguaDistributedParallel at the same time. So may not need to use separate .bagua_module_name to identify different modules.

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 want to make it possible for our users to tell us whether two module instances are the same or not, instead of simply being determined by the their ids.

In fact, this comes from a dev requirement from Lightning. A torch.nn.Module can be wrapped multiple times, but they share same model parameters.

Copy link
Member

@shjwudp shjwudp Dec 20, 2021

Choose a reason for hiding this comment

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

I want to make it possible for our users to tell us whether two module instances are the same or not, instead of simply being determined by the their ids.

Users only need to print the module.
My core point is .with_bagua is deprecated, we should not use it anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants