Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre.delaunay committed Jun 4, 2024
1 parent 430d4c2 commit e314563
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 15 deletions.
8 changes: 5 additions & 3 deletions benchmarks/torchvision/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class SyntheticData:
def __init__(self, model, device, batch_size, n, fixed_batch):
self.n = n
model = model.to(device)

self.inp = torch.randn((batch_size, 3, 224, 224), device=device)
self.out = torch.rand_like(model(self.inp))
self.fixed_batch = fixed_batch
Expand Down Expand Up @@ -184,7 +184,8 @@ def dataloader(args, model):
)

def model_optimizer(args, model, device):
model.train()
if hasattr(model, "train"):
model.train()

if "channel_last" in args.optim:
model = model.to(memory_format=torch.channels_last)
Expand Down Expand Up @@ -336,7 +337,8 @@ def iobench(args):


def train_epoch(args, model, criterion, optimizer, loader, device, dtype, scaler=None):
model.train()
if hasattr(model, "train"):
model.train()

set_to_none = "set_grad_none" in args.optim

Expand Down
40 changes: 28 additions & 12 deletions config/resnet50.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,33 +53,49 @@ resnet-matrix-noio:
--fixed-batch: true


resnet18-matrix:
# resnet18-matrix:
# matrix:
# worker: [8]
# batch-size: [256, 512, 1024]
# loader: ['pytorch', 'dali']

# job:
# name: 'resnet18-w{worker}-bs{batch-size}-{loader}'
# inherits: _resnet50
# argv:
# --model: resnet18
# --batch-size: '{batch-size}'
# --num-workers: '{worker}'
# --loader: '{loader}'

resnet-optim:
matrix:
worker: [8]
batch-size: [256, 512, 1024]
loader: ['pytorch', 'dali']
batch-size: [256]
loader: ['dali']
optim: ["trace", "inductor", "script", "channel_last", "set_grad_none"]

job:
name: 'resnet18-w{worker}-bs{batch-size}-{loader}'
name: 'resnet50-w{worker}-bs{batch-size}-{loader}-{optim}'
inherits: _resnet50
argv:
--model: resnet18
--batch-size: '{batch-size}'
--num-workers: '{worker}'
--loader: '{loader}'
--optim: '{optim}'

resnet-optim:

image-loading:
matrix:
worker: [8]
batch-size: [256]
loader: ['dali']
optim: ["trace", "inductor", "script", "channel_last", "set_grad_none"]
worker: [2, 4, 8, 16, 24, 32, 64]
batch-size: [32, 64, 128, 256, 512, 1024]
loader: ['pytorch', 'dali']

job:
name: 'resnet50-w{worker}-bs{batch-size}-{loader}-{optim}'
name: 'imageloading-w{worker}-bs{batch-size}-{loader}'
inherits: _resnet50
argv:
--batch-size: '{batch-size}'
--num-workers: '{worker}'
--loader: '{loader}'
--optim: '{optim}'
--iobench: true

0 comments on commit e314563

Please sign in to comment.