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,8 +1305,9 @@ class Trainer:
jit_inputs = tuple(jit_inputs)
jit_model = torch.jit.trace(jit_model, jit_inputs, strict=False)
jit_model = torch.jit.freeze(jit_model)
jit_model(**example_batch)
jit_model(**example_batch)
with torch.no_grad():
jit_model(**example_batch)
jit_model(**example_batch)
model = jit_model
self.use_cpu_amp = False
self.use_cuda_amp = False
......
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