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

[context] maintain the context object in with statement #1073

Merged
merged 1 commit into from
Jun 7, 2022

Conversation

FrankLeeeee
Copy link
Contributor

The InsertPostInitMethodToModuleSubClasses context manager does not return the object in with statement, this issue fixed this problem so that the attributes of the contexts can still be accessed after with statement.

Previous:

>>> with InsertPostInitMethodToModuleSubClasses() as ctx:
>>>        model = resnet18()
>>> print(ctx)
None

Now:

>>> with InsertPostInitMethodToModuleSubClasses() as ctx:
>>>        model = resnet18()
>>> print(ctx)
<colossalai.utils.model.colo_init_context.ColoInitContext at 0x7f75d031bcd0>

@FrankLeeeee FrankLeeeee merged commit bfdc5cc into hpcaitech:main Jun 7, 2022
@FrankLeeeee FrankLeeeee deleted the hotfix/context branch June 13, 2022 02:08
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.

2 participants