Skip to content

Commit a1f45ae

Browse files
authored
Merge branch 'master' into minjean/torchserve_with_ipex_2
2 parents 4e189ba + f007848 commit a1f45ae

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

beginner_source/fgsm_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
machine learning. You may be surprised to find that adding imperceptible
1818
perturbations to an image *can* cause drastically different model
1919
performance. Given that this is a tutorial, we will explore the topic
20-
via example on an image classifier. Specifically we will use one of the
20+
via example on an image classifier. Specifically, we will use one of the
2121
first and most popular attack methods, the Fast Gradient Sign Attack
2222
(FGSM), to fool an MNIST classifier.
2323

beginner_source/translation_transformer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ def train_epoch(model, optimizer):
309309
optimizer.step()
310310
losses += loss.item()
311311

312-
return losses / len(train_dataloader)
312+
return losses / len(list(train_dataloader))
313313

314314

315315
def evaluate(model):
@@ -333,7 +333,7 @@ def evaluate(model):
333333
loss = loss_fn(logits.reshape(-1, logits.shape[-1]), tgt_out.reshape(-1))
334334
losses += loss.item()
335335

336-
return losses / len(val_dataloader)
336+
return losses / len(list(val_dataloader))
337337

338338
######################################################################
339339
# Now we have all the ingredients to train our model. Let's do it!

intermediate_source/text_to_speech_with_torchaudio.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,11 @@ def text_to_sequence(text):
293293
# Waveglow
294294
# ~~~~~~~~
295295
#
296-
# Waveglow is a vocoder published by Nvidia. The pretrained weight is
297-
# publishe on Torch Hub. One can instantiate the model using ``torch.hub``
296+
# Waveglow is a vocoder published by Nvidia. The pretrained weights are
297+
# published on Torch Hub. One can instantiate the model using ``torch.hub``
298298
# module.
299299
#
300-
if False:
300+
if torch.cuda.is_available():
301301
waveglow = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_waveglow', model_math='fp32')
302302
else:
303303
# Workaround to load model mapped on GPU
@@ -309,7 +309,7 @@ def text_to_sequence(text):
309309
pretrained=False,
310310
)
311311
checkpoint = torch.hub.load_state_dict_from_url(
312-
"https://api.ngc.nvidia.com/v2/models/nvidia/waveglowpyt_fp32/versions/1/files/nvidia_waveglowpyt_fp32_20190306.pth",
312+
"https://api.ngc.nvidia.com/v2/models/nvidia/waveglow_ckpt_fp32/versions/19.09.0/files/nvidia_waveglowpyt_fp32_20190427",
313313
progress=False,
314314
map_location=device,
315315
)

0 commit comments

Comments
 (0)