Skip to content

Commit fdc6653

Browse files
authored
Merge branch 'main' into add_coding_ddpg
2 parents 1b1bfc1 + 3b6d83b commit fdc6653

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

intermediate_source/seq2seq_translation_tutorial.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
:alt:
4646
4747
To improve upon this model we'll use an `attention
48-
mechanism <https://arxiv.org/abs/1409.0473>`__, which lets the decoder
48+
mechanism <https://arxiv.org/abs/1508.04025>`__, which lets the decoder
4949
learn to focus over a specific range of the input sequence.
5050
5151
**Recommended Reading:**
@@ -66,8 +66,8 @@
6666
Statistical Machine Translation <https://arxiv.org/abs/1406.1078>`__
6767
- `Sequence to Sequence Learning with Neural
6868
Networks <https://arxiv.org/abs/1409.3215>`__
69-
- `Neural Machine Translation by Jointly Learning to Align and
70-
Translate <https://arxiv.org/abs/1409.0473>`__
69+
- `Effective Approaches to Attention-based Neural Machine
70+
Translation <https://arxiv.org/abs/1508.04025>`__
7171
- `A Neural Conversational Model <https://arxiv.org/abs/1506.05869>`__
7272
7373
You will also find the previous tutorials on

intermediate_source/torch_compile_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def forward(self, x):
105105
#
106106
# Let's now demonstrate that using ``torch.compile`` can speed
107107
# up real models. We will compare standard eager mode and
108-
# ``torch.compile`` by evaluating and training ResNet-18 on random data.
108+
# ``torch.compile`` by evaluating and training a ``torchvision`` model on random data.
109109
#
110110
# Before we start, we need to define some utility functions.
111111

prototype_source/fx_graph_mode_ptq_dynamic.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,27 @@ def evaluate(model_, data_source):
239239
.set_object_type(nn.LSTM, default_dynamic_qconfig)
240240
.set_object_type(nn.Linear, default_dynamic_qconfig)
241241
)
242-
# Deepcopying the original model because quantization api changes the model inplace and we want
242+
# Load model to create the original model because quantization api changes the model inplace and we want
243243
# to keep the original model for future comparison
244-
model_to_quantize = copy.deepcopy(model)
244+
245+
246+
model_to_quantize = LSTMModel(
247+
ntoken = ntokens,
248+
ninp = 512,
249+
nhid = 256,
250+
nlayers = 5,
251+
)
252+
253+
model_to_quantize.load_state_dict(
254+
torch.load(
255+
model_data_filepath + 'word_language_model_quantize.pth',
256+
map_location=torch.device('cpu')
257+
)
258+
)
259+
260+
model_to_quantize.eval()
261+
262+
245263
prepared_model = prepare_fx(model_to_quantize, qconfig_mapping, example_inputs)
246264
print("prepared model:", prepared_model)
247265
quantized_model = convert_fx(prepared_model)
@@ -289,4 +307,4 @@ def time_model_evaluation(model, test_data):
289307
# 3. Conclusion
290308
# -------------
291309
# This tutorial introduces the api for post training dynamic quantization in FX Graph Mode,
292-
# which dynamically quantizes the same modules as Eager Mode Quantization.
310+
# which dynamically quantizes the same modules as Eager Mode Quantization.

0 commit comments

Comments
 (0)