Unverified Commit a4beb37b authored by Wang, Yi's avatar Wang, Yi Committed by GitHub
Browse files

fix ipex+fp32 jit trace error in ipex 1.13 (#20504)

error show like: “Currently the auto_kernel_selection does not support the grad mode! Please add torch.no_grad() before the inference runtime..”
since jit mode only work in inference mode, it's safe to add such logic.
parent 105c3a48
...@@ -1305,6 +1305,7 @@ class Trainer: ...@@ -1305,6 +1305,7 @@ class Trainer:
jit_inputs = tuple(jit_inputs) jit_inputs = tuple(jit_inputs)
jit_model = torch.jit.trace(jit_model, jit_inputs, strict=False) jit_model = torch.jit.trace(jit_model, jit_inputs, strict=False)
jit_model = torch.jit.freeze(jit_model) jit_model = torch.jit.freeze(jit_model)
with torch.no_grad():
jit_model(**example_batch) jit_model(**example_batch)
jit_model(**example_batch) jit_model(**example_batch)
model = jit_model model = jit_model
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment