Skip to content

Commit d956dba

Browse files
committed
hashing improvements
1 parent 8ad61eb commit d956dba

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

torchbench/object_detection/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def evaluate_detection_coco(
212212

213213

214214
if i == 0: # for sotabench.com caching of evaluation
215-
run_hash = calculate_run_hash(result, original_output)
215+
run_hash = calculate_run_hash([], original_output)
216216
# if we are in check model we don't need to go beyond the first
217217
# batch
218218
if in_check_mode():

torchbench/utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,13 @@ def calculate_run_hash(metrics: list, output: torch.Tensor):
131131
output: output from the model for a given batch of data.
132132
"""
133133

134-
hash_list = metrics + np.round(output.cpu().numpy(), 3).tolist()
134+
if isinstance(output, dict):
135+
output = list(output)
136+
137+
if not isinstance(output, list):
138+
output = np.round(output.cpu().numpy(), 3).tolist()
139+
140+
hash_list = metrics + output
135141
m = hashlib.sha256()
136142
m.update(str(hash_list).encode("utf-8"))
137143
return m.hexdigest()

0 commit comments

Comments
 (0)