Skip to content

Commit

Permalink
Capture error message during sweep tests (#2351)
Browse files Browse the repository at this point in the history
* Collect error messages in results.csv

Co-authored-by: Michael Wyatt <michaelwyatt@microsoft.com>
Co-authored-by: Olatunji Ruwase <olruwase@microsoft.com>
  • Loading branch information
3 people authored Sep 27, 2022
1 parent e14d40e commit eed4032
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
20 changes: 15 additions & 5 deletions benchmarks/inference/collect_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ def get_generated_text(file_content, gen_text_n):
return {f"generated-text-{key}": val for key, val in matches}


def get_error(file_content):
matches = re.findall(r"TypeError:\s+(.+?)\n", file_content)
if matches is []:
return False
else:
return {f"error": val for val in matches}


if __name__ == "__main__":
# List to collect data from all benchmarks
benchmarks_data = []
Expand Down Expand Up @@ -112,15 +120,17 @@ def get_generated_text(file_content, gen_text_n):
perf_data = get_perf_data(file_content)
if not perf_data:
print(
f"WARNING: Could not detect benchmark performance data for file {file_path}, skipping"
f"WARNING: Could not detect benchmark performance data for file {file_path}"
)
continue

generated_text = get_generated_text(file_content, args.gen_text_n)
if not generated_text:
print(
f"WARNING: Could not detect generated text for file {file_path}, skipping"
)
print(f"WARNING: Could not detect generated text for file {file_path}")

error = get_error(file_content)
if error:
print(f"Error found in {file_path}, collecting error info...")
benchmarks_data.append({"branch": branch, **params, **error})
continue

benchmarks_data.append({
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/inference/run_model.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set -ex
set -x

model=$1
branch1=$2
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/inference/sweep.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set -ex
set -x

export TRANSFORMERS_CACHE=/tmp/hf-cache

Expand Down

0 comments on commit eed4032

Please sign in to comment.