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

[userbenchmark] Broader error catching in Torch-TRT userbenchmark #1974

Closed
wants to merge 1 commit into from
Closed
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
16 changes: 15 additions & 1 deletion userbenchmark/torch_trt/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,29 @@ def run(args: List[str]):
# Delete model instance and clean up workspace
del Model

# Exceptions raised can be reported in a verbose manner
except Exception as e:
traceback.print_exc()
print(
f"\nLoading model {model_name} failed with:\n{e}\nSkipping the model.\n"
f"\nBenchmarking model {model_name} failed with:\n{e}\nSkipping the model.\n"
)
metrics = {
model_name: f"Failed to run benchmark: {traceback.format_exc()}"
}

# Halt further model runs on KeyboardInterrupt
except KeyboardInterrupt:
break

# Any recoverable subprocess errors are caught and reported
except:
print(
f"\nBenchmarking model {model_name} failed.\nSkipping the model.\n"
)
metrics = {
model_name: f"Failed to run benchmark: Error"
}

all_metrics = {**all_metrics, **metrics}

save_metrics(all_metrics)