Open
Conversation
Since the `DSVAE` class is already inheriting from `torch.nn.Module`, there is no need to inherit from `CUDAGraph` as well. You can remove the `CUDAGraph` inheritance. Instead of using `self.vae.requires_grad_(requires_grad=False)`, you can use `torch.no_grad()` context manager during initialization to disable gradient computation for the `self.vae` module. The `_graph_replay_decoder`, `_graph_replay_encoder`, and `_graph_replay` methods can benefit from the `@torch.no_grad()` decorator.
Author
@microsoft-github-policy-service agree |
Collaborator
|
@mzamini92 - since this PR made it quite a while before being lost, do you think it is still worth merging, if so could you resolve the merge conflicts? Or should we close this PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since the
DSVAEclass is already inheriting fromtorch.nn.Module, there is no need to inherit fromCUDAGraphas well. You can remove theCUDAGraphinheritance. Instead of usingself.vae.requires_grad_(requires_grad=False), you can usetorch.no_grad()context manager during initialization to disable gradient computation for theself.vaemodule. The_graph_replay_decoder,_graph_replay_encoder, and_graph_replaymethods can benefit from the@torch.no_grad()decorator.