-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Fixes #12673. record_stream in group offloading is not working properly
#12721
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
base: main
Are you sure you want to change the base?
Conversation
|
As for why record_stream fails, I suspect it’s because calling |
0de99c0 to
cef1ed6
Compare
|
Also relevant to Tencent-Hunyuan/HunyuanVideo-1.5#10 |
sayakpaul
left a comment
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.
Thanks for your PR!
Could we also run the test_group_offloading tests?
pytest tests/models -k "test_group_offloading"?
|
|
||
| for group_module in self.modules: | ||
| for param in group_module.parameters(): | ||
| if self.record_stream and param.device.type == 'cuda': |
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 do we have to condition on param.device.type == 'cuda'?
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.
Because Tensors on CPU can not call record_stream
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 can do something like if self.record_stream and param.device.type != "cpu":, right?
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.
Yes, I updated the code as you recommended in the latest commit
Running pytest: |
record_stream is not working properlyrecord_stream in group offloading is not working properly
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
What does this PR do?
Fixes # (12673) and Tencent-Hunyuan/HunyuanVideo-1.5#10 I identified the root cause:
record_streamisn’t functioning as expected for unknown reasons. This causes theoffload_to_memoryfunction to updateparam.datawithout waiting for the default stream (current_stream) to complete (the forward pass).Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
cc @asomoza @sayakpaul @a-r-r-o-w @DN6