Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[benchmarks] Small fixes for benchmarking script. #6632

Merged
merged 4 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions benchmarks/torchbench_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import importlib
import logging
import os
from os.path import abspath, exists
import sys
import torch
import torch.amp
Expand Down Expand Up @@ -306,18 +305,19 @@ def batch_size(self):
def load_benchmark(self):
cant_change_batch_size = (
not getattr(self.benchmark_cls(), "ALLOW_CUSTOMIZE_BSIZE", True) or
model_name in config_data()["dont_change_batch_size"])
self.model_name in config_data()["dont_change_batch_size"])

if cant_change_batch_size:
self.benchmark_experiment.batch_size = None

if self.benchmark_experiment.batch_size is not None:
batch_size = self.benchmark_experiment.batch_size
elif self.is_training() and self.model_name in self.batch_size["training"]:
batch_size = self.batch_size["training"][self.model_name]
elif self.is_inference(
) and self.model_name in self.batch_size["inference"]:
batch_size = self.batch_size["inference"][self.model_name]
batch_size = self.benchmark_experiment.batch_size

if batch_size is None:
if self.is_training() and self.model_name in self.batch_size["training"]:
batch_size = self.batch_size["training"][self.model_name]
elif self.is_inference(
) and self.model_name in self.batch_size["inference"]:
batch_size = self.batch_size["inference"][self.model_name]

# workaround "RuntimeError: not allowed to set torch.backends.cudnn flags"
# torch.backends.__allow_nonbracketed_mutation_flag = True
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging
import numpy as np
import os
from os.path import abspath
from os.path import abspath, exists
import random
import subprocess
import torch
Expand Down Expand Up @@ -158,7 +158,7 @@ def get_torchbench_test_name(test):
return {"train": "training", "eval": "inference"}[test]


def find_near_file(self, names):
def find_near_file(names):
"""Find a file near the current directory.

Looks for `names` in the current directory, up to its two direct parents.
Expand Down
Loading