Fix throughput experiments

parent 35351a27
......@@ -20,19 +20,21 @@ jpeg_model = models.JpegResNet(spatial_model, n_freqs=6).to(device)
optimizer = optim.Adam(jpeg_model.parameters())
t0 = time.perf_counter()
t0 = time.time()
models.train(jpeg_model, device, dataset[0], optimizer, 0)
torch.cuda.synchronize()
t1 = time.perf_counter()
t1 = time.time()
training_time = t1 - t0
t0 = time.perf_counter()
jpeg_model.explode_all()
t0 = time.time()
models.test(jpeg_model, device, dataset[1])
torch.cuda.synchronize()
t1 = time.perf_counter()
t1 = time.time()
testing_time = t1 - t0
with open('{}_jpeg_throughput.csv'.format(args.dataset), 'w') as f:
f.write('Training, Testing\n')
f.write('{}, {}\n'.format(training_time / len(dataset[0]), testing_time / len(dataset[1])))
f.write('{}, {}\n'.format(len(dataset[0]) / training_time, len(dataset[1]) / testing_time))
......@@ -20,19 +20,19 @@ spatial_model = models.SpatialResNet(dataset_info['channels'], dataset_info['cla
optimizer = optim.Adam(spatial_model.parameters())
t0 = time.perf_counter()
t0 = time.time()
models.train(spatial_model, device, dataset[0], optimizer, 0, do_decode=True)
torch.cuda.synchronize()
t1 = time.perf_counter()
t1 = time.time()
training_time = t1 - t0
t0 = time.perf_counter()
t0 = time.time()
models.test(spatial_model, device, dataset[1], do_decode=True)
torch.cuda.synchronize()
t1 = time.perf_counter()
t1 = time.time()
testing_time = t1 - t0
with open('{}_spatial_throughput.csv'.format(args.dataset), 'w') as f:
f.write('Training, Testing\n')
f.write('{}, {}\n'.format(training_time / len(dataset[0]), testing_time / len(dataset[1])))
f.write('{}, {}\n'.format(len(dataset[0]) / training_time, len(dataset[1]) / testing_time ))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment