Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

created original copy of the model by loading from disk #2406

Merged
merged 7 commits into from
Jun 7, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions prototype_source/fx_graph_mode_ptq_dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,13 @@ def evaluate(model_, data_source):
.set_object_type(nn.LSTM, default_dynamic_qconfig)
.set_object_type(nn.Linear, default_dynamic_qconfig)
)
# Deepcopying the original model because quantization api changes the model inplace and we want
# Load model to create the original model because quantization api changes the model inplace and we want
# to keep the original model for future comparison
model_to_quantize = copy.deepcopy(model)

# Load the model
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A duplicate comment now?

model_to_quantize = torch.load(model_data_filepath + 'word_language_model_quantize.pth', map_location=torch.device('cpu'))
Samsonboadi marked this conversation as resolved.
Show resolved Hide resolved
model_to_quantize.eval()

prepared_model = prepare_fx(model_to_quantize, qconfig_mapping, example_inputs)
print("prepared model:", prepared_model)
quantized_model = convert_fx(prepared_model)
Expand Down