Skip to content
Open
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
8 changes: 6 additions & 2 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,15 @@ def run_one_step_with_cudastreams(func, streamcount):
def printResultSummaryTime(
result_summary,
model,
metrics_needed=[],
metrics_needed=None,
flops_model_analyzer=None,
model_flops=None,
cpu_peak_mem=None,
mem_device_id=None,
gpu_peak_mem=None,
):
if metrics_needed is None:
metrics_needed = []
assert model is not None, "model can not be None."
if args.device == "cuda":
gpu_time = np.median(list(map(lambda x: x[0], result_summary)))
Expand Down Expand Up @@ -160,11 +162,13 @@ def run_one_step(
num_iter=10,
export_metrics_file=None,
stress=0,
metrics_needed=[],
metrics_needed=None,
metrics_gpu_backend=None,
model_flops=None,
):
# Warm-up `nwarmup` rounds
if metrics_needed is None:
metrics_needed = []
for _i in range(nwarmup):
func()

Expand Down
1 change: 1 addition & 0 deletions scripts/upload_scribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def upload(self, messages: list):
]
),
},
timeout=10.0,
)
print(r.text)
r.raise_for_status()
Expand Down
1 change: 1 addition & 0 deletions scripts/upload_scribe_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def upload(self, messages: list):
]
),
},
timeout=10.0,
)
print(r.text)
r.raise_for_status()
Expand Down
1 change: 1 addition & 0 deletions scripts/userbenchmark/upload_scribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def upload(self, messages: list):
]
),
},
timeout=10.0,
)
print(r.text)
r.raise_for_status()
Expand Down
6 changes: 4 additions & 2 deletions torchbenchmark/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,10 @@ def make_model_instance(
test: str,
device: str,
batch_size: Optional[int] = None,
extra_args: List[str] = [],
extra_args: List[str] = None,
) -> None:
if extra_args is None:
extra_args = []
Model = globals()["Model"]
model = Model(
test=test, device=device, batch_size=batch_size, extra_args=extra_args
Expand Down Expand Up @@ -733,7 +735,7 @@ def get_metadata_from_yaml(path):
md = None
if os.path.exists(metadata_path):
with open(metadata_path, "r") as f:
md = yaml.load(f, Loader=yaml.FullLoader)
md = yaml.safe_load(f, Loader=yaml.FullLoader)
return md


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ class ModelAnalyzer:
def __init__(
self,
export_metrics_file=None,
metrics_needed=[],
metrics_needed=None,
metrics_gpu_backend="nvml",
cpu_monitored_pid=None,
):
# For debug
# set_logger(logging.DEBUG)
if metrics_needed is None:
metrics_needed = []
set_logger()
# delay the initialization to start_monitor
self.gpu_factory = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ class CPUMonitor(Monitor):
A CPU monitor that uses psutil to monitor CPU usage
"""

def __init__(self, frequency, metrics_needed=[], monitored_pid=None):
def __init__(self, frequency, metrics_needed=None, monitored_pid=None):
if metrics_needed is None:
metrics_needed = []
super().__init__(frequency, metrics_needed)
# It is a raw record list. [timestamp, cpu_memory_usage, cpu_available_memory]
self._cpu_records = []
Expand Down
4 changes: 3 additions & 1 deletion torchbenchmark/canary_models/DALLE2_pytorch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ class Model(BenchmarkModel):
DEFAULT_EVAL_BSIZE = 1
CANNOT_SET_CUSTOM_OPTIMIZER = True

def __init__(self, test, device, batch_size=None, extra_args=[]):
def __init__(self, test, device, batch_size=None, extra_args=None):
if extra_args is None:
extra_args = []
super().__init__(
test=test, device=device, batch_size=batch_size, extra_args=extra_args
)
Expand Down