From c2db6b628ac53fe684a5fd6c8039dfa0f4f6d5ec Mon Sep 17 00:00:00 2001 From: leslie-fang-intel Date: Fri, 19 Jul 2024 09:09:10 +0800 Subject: [PATCH] PT2E QAT Move model to eval before convert --- prototype_source/pt2e_quant_x86_inductor.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/prototype_source/pt2e_quant_x86_inductor.rst b/prototype_source/pt2e_quant_x86_inductor.rst index f9836d6e37..b5dec92e40 100644 --- a/prototype_source/pt2e_quant_x86_inductor.rst +++ b/prototype_source/pt2e_quant_x86_inductor.rst @@ -286,12 +286,12 @@ The PyTorch 2 Export QAT flow is largely similar to the PTQ flow: # train omitted - converted_model = convert_pt2e(prepared_model) - # we have a model with aten ops doing integer computations when possible - # move the quantized model to eval mode, equivalent to `m.eval()` torch.ao.quantization.move_exported_model_to_eval(converted_model) + converted_model = convert_pt2e(prepared_model) + # we have a model with aten ops doing integer computations when possible + # Lower the model into Inductor with torch.no_grad(): optimized_model = torch.compile(converted_model)