-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix torch compile applied to model forward (#2932)
### Changes Check whether model is compiled based on `"_torchdynamo_orig_callable"` property of the model forward. ### Reason for changes `torch.compile` can be applied not only to the model itself, but to `forward()` method only. For example: ``` model.forward = torch.compile(model.forward) ``` In this case the model itself doesn't change and it won't be an instance of `torch._dynamo.OptimizedModule`. ### Related tickets 143796 ### Tests Added test when `torch.compile` is applied this way. It does not fail without the fix though, because the issue is sporadic. ### Relates to #2665, #2719
- Loading branch information
1 parent
2088962
commit eb61347
Showing
3 changed files
with
15 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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