Skip to content
This repository was archived by the owner on Nov 1, 2024. It is now read-only.

Conversation

@cbalioglu
Copy link
Contributor

This PR introduces a convenience helper function is_deferred, that returns a boolean value indicating whether a provided tensor or module has been constructed in a deferred-init context.

Fixes #49

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 10, 2022
@cbalioglu
Copy link
Contributor Author

cc @carmocca, @tchaton

Copy link

@carmocca carmocca left a comment

Choose a reason for hiding this comment

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

Great!

Copy link
Member

@H-Huang H-Huang left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@rohan-varma rohan-varma left a comment

Choose a reason for hiding this comment

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

thanks! this will make it easier for FSDP to check if the module is deferred, which we are currently doing via any(fake.is_fake(t) for t in module.parameters())!

@cbalioglu cbalioglu merged commit 0011555 into pytorch:main Aug 10, 2022
@cbalioglu cbalioglu deleted the is_deferred branch August 10, 2022 15:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Utility to check if a module needs to be materialized

5 participants