Skip to content

Commit d41e23b

Browse files
authored
Copy float_model using load_model (#2385)
1 parent 9b54056 commit d41e23b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

prototype_source/fx_graph_mode_ptq_static.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ Download the `torchvision resnet18 model <https://download.pytorch.org/models/re
214214
float_model = load_model(saved_model_dir + float_model_file).to("cpu")
215215
float_model.eval()
216216
217-
# deepcopy the model since we need to keep the original model around
218-
import copy
219-
model_to_quantize = copy.deepcopy(float_model)
217+
# create another instance of the model since
218+
# we need to keep the original model around
219+
model_to_quantize = load_model(saved_model_dir + float_model_file).to("cpu")
220220
221221
3. Set model to eval mode
222222
-------------------------
@@ -408,4 +408,4 @@ Running the model in AIBench (with single threading) gives the following result:
408408
409409
As we can see for resnet18 both FX graph mode and eager mode quantized model get similar speedup over the floating point model,
410410
which is around 2-4x faster than the floating point model. But the actual speedup over floating point model may vary
411-
depending on model, device, build, input batch sizes, threading etc.
411+
depending on model, device, build, input batch sizes, threading etc.

0 commit comments

Comments
 (0)