Skip to content

Commit

Permalink
Add ignore warning and flexible models for examples
Browse files Browse the repository at this point in the history
  • Loading branch information
bichengying committed May 23, 2020
1 parent 66c134c commit b76ac04
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions examples/pytorch_cifar10_resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import os
import sys
import math
import warnings
warnings.simplefilter('ignore')

import torch
import torch.backends.cudnn as cudnn
Expand Down Expand Up @@ -59,6 +61,8 @@
"executing allreduce across workers; it multiplies "
"total batch size.",
)
parser.add_argument('--model', type=str, default='resnet50',
help='model to benchmark')

# Default settings from https://arxiv.org/abs/1706.02677.
parser.add_argument(
Expand Down Expand Up @@ -183,8 +187,7 @@
val_dataset, batch_size=args.val_batch_size, sampler=val_sampler, **kwargs
)

# Set up standard ResNet-18 model.
model = models.resnet18()
model = getattr(models, args.model)()

if args.cuda:
# Move model to GPU.
Expand Down
2 changes: 2 additions & 0 deletions examples/pytorch_mnist.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import argparse
import os
import sys
import warnings
warnings.simplefilter('ignore')

import torch.nn as nn
import torch.nn.functional as F
Expand Down

0 comments on commit b76ac04

Please sign in to comment.