-
Notifications
You must be signed in to change notification settings - Fork 240
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
Fix torch operator unpatching #2719
Fix torch operator unpatching #2719
Conversation
@@ -80,14 +80,24 @@ def test_jit_script_exception_preserves_patching_isolated(): | |||
|
|||
|
|||
def compile_and_run_test_model() -> torch.Tensor: | |||
from tests.torch.helpers import BasicConvTestModel |
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.
Had to drop BasicConvTestModel
because during its import nncf.torch
is imported which is not acceptable for this specific test
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.
LGTM
torch nightly build 256 is green |
### 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
Changes
nncf.torch
)Reason for changes
Fix inference of compiled torch models when
nncf.torch
is importedRelated tickets
140265
Tests
Added
test_operator_unpatching