Skip to content

Commit 14028f7

Browse files
vkuzoBalandatSvetlana Karslioglu
authored
update NS for FX tutorial for PyTorch v1.13 (#2089)
* 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 * Pin importlib_metadata<5.0 for python <= 3.7 in requirements.txt (#2091) v5.0.0 causes issues with python 3.7: python/importlib_metadata#411 * Enable the FX tutorial Co-authored-by: Max Balandat <Balandat@users.noreply.github.com> Co-authored-by: Svetlana Karslioglu <svekars@fb.com>
1 parent 67a4eb7 commit 14028f7

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

.jenkins/validate_tutorials_built.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
"recipes/Captum_Recipe",
5151
"hyperparameter_tuning_tutorial",
5252
"flask_rest_api_tutorial",
53-
"fx_numeric_suite_tutorial", # remove when https://github.com/pytorch/tutorials/pull/2089 is fixed
5453
"ax_multiobjective_nas_tutorial",
5554
]
5655

prototype_source/fx_numeric_suite_tutorial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ def plot(xdata, ydata, xlabel, ylabel, title):
8484
# Note: quantization APIs are inplace, so we save a copy of the float model for
8585
# later comparison to the quantized model. This is done throughout the
8686
# tutorial.
87-
mobilenetv2_prepared = quantize_fx.prepare_fx(
88-
copy.deepcopy(mobilenetv2_float), qconfig_dict)
8987
datum = torch.randn(1, 3, 224, 224)
88+
mobilenetv2_prepared = quantize_fx.prepare_fx(
89+
copy.deepcopy(mobilenetv2_float), qconfig_dict, (datum,))
9090
mobilenetv2_prepared(datum)
9191
# Note: there is a long standing issue that we cannot copy.deepcopy a
9292
# quantized model. Since quantization APIs are inplace and we need to use

0 commit comments

Comments
 (0)