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

Capture error message during sweep tests #2351

Merged
merged 11 commits into from
Sep 27, 2022
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