Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a3a09c8

Browse files
Fix for #188
1 parent 371633d commit a3a09c8

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

apex/amp/frontend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def initialize(
269269
https://github.com/NVIDIA/apex/tree/master/examples/imagenet
270270
"""
271271
_amp_state.opt_properties = Properties()
272-
_amp_state.opt_properties.verbosity = verbosity
272+
_amp_state.verbosity = verbosity
273273

274274
if not enabled:
275275
return models, optimizers

examples/imagenet/main_amp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,6 @@ def train(train_loader, model, criterion, optimizer, epoch):
334334
optimizer.step()
335335
if args.prof: torch.cuda.nvtx.range_pop()
336336

337-
input, target = prefetcher.next()
338-
339337
if i%args.print_freq == 0:
340338
# Every print_freq iterations, check the loss accuracy and speed.
341339
# For best performance, it doesn't make sense to print these metrics every
@@ -374,6 +372,8 @@ def train(train_loader, model, criterion, optimizer, epoch):
374372
batch_time=batch_time,
375373
loss=losses, top1=top1, top5=top5))
376374

375+
input, target = prefetcher.next()
376+
377377

378378
def validate(val_loader, model, criterion):
379379
batch_time = AverageMeter()

tests/L1/common/main_amp.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,9 @@ def train(train_loader, model, criterion, optimizer, epoch):
365365
batch_time.update(time.time() - end)
366366

367367
end = time.time()
368+
369+
# If you decide to refactor this test, like examples/imagenet, to sample the loss every
370+
# print_freq iterations, make sure to move this prefetching below the accuracy calculation.
368371
input, target = prefetcher.next()
369372

370373
if i % args.print_freq == 0 and i > 1:

0 commit comments

Comments
 (0)