From f91a4f7f0530b1847f386c606d665050d3e2e3b6 Mon Sep 17 00:00:00 2001 From: Vasiliy Kuznetsov Date: Wed, 19 Oct 2022 09:06:43 -0700 Subject: [PATCH 1/3] update NS for FX tutorial for PyTorch v1.13 Summary: Makes a couple of updates to ensure this tutorial still runs on 1.13: 1. changes the `qconfig_dict` argument of `prepare_fx` to `qconfig_mapping` 2. adds `example_inputs` to `prepare_fx` Test plan: Run the tutorial, it runs without errors on master --- prototype_source/fx_numeric_suite_tutorial.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prototype_source/fx_numeric_suite_tutorial.py b/prototype_source/fx_numeric_suite_tutorial.py index ac43ae49e05..922f48ae0fc 100644 --- a/prototype_source/fx_numeric_suite_tutorial.py +++ b/prototype_source/fx_numeric_suite_tutorial.py @@ -84,9 +84,9 @@ def plot(xdata, ydata, xlabel, ylabel, title): # Note: quantization APIs are inplace, so we save a copy of the float model for # later comparison to the quantized model. This is done throughout the # tutorial. -mobilenetv2_prepared = quantize_fx.prepare_fx( - copy.deepcopy(mobilenetv2_float), qconfig_dict) datum = torch.randn(1, 3, 224, 224) +mobilenetv2_prepared = quantize_fx.prepare_fx( + copy.deepcopy(mobilenetv2_float), qconfig_dict, (datum,)) mobilenetv2_prepared(datum) # Note: there is a long standing issue that we cannot copy.deepcopy a # quantized model. Since quantization APIs are inplace and we need to use From 0e2fc0ae039127546cdf2afdebcdf904028ec875 Mon Sep 17 00:00:00 2001 From: Max Balandat Date: Thu, 20 Oct 2022 20:12:21 -0700 Subject: [PATCH 2/3] Pin importlib_metadata<5.0 for python <= 3.7 in requirements.txt (#2091) v5.0.0 causes issues with python 3.7: https://github.com/python/importlib_metadata/issues/411 --- requirements.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/requirements.txt b/requirements.txt index 67bec81cd2b..53ab4553317 100644 --- a/requirements.txt +++ b/requirements.txt @@ -28,6 +28,10 @@ ax-platform nbformat>=4.2.0 deep_phonemizer==0.0.17 +# the following is necessary due to https://github.com/python/importlib_metadata/issues/411 +importlib-metadata < 5.0; python_version <= "3.7" +importlib-metadata; python_version > "3.7" + # PyTorch Theme -e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme From f31a46896d4ecaa3ad779dc267e3f3c203fcd80a Mon Sep 17 00:00:00 2001 From: Svetlana Karslioglu Date: Fri, 21 Oct 2022 13:46:07 -0700 Subject: [PATCH 3/3] Enable the FX tutorial --- .jenkins/validate_tutorials_built.py | 1 - 1 file changed, 1 deletion(-) diff --git a/.jenkins/validate_tutorials_built.py b/.jenkins/validate_tutorials_built.py index 5f9d563475f..b426049b583 100644 --- a/.jenkins/validate_tutorials_built.py +++ b/.jenkins/validate_tutorials_built.py @@ -50,7 +50,6 @@ "recipes/Captum_Recipe", "hyperparameter_tuning_tutorial", "flask_rest_api_tutorial", - "fx_numeric_suite_tutorial", # remove when https://github.com/pytorch/tutorials/pull/2089 is fixed "ax_multiobjective_nas_tutorial", ]