Skip to content

Commit

Permalink
[userbenchmark] Broader error catching
Browse files Browse the repository at this point in the history
- Failures on a recent sample run indicate that errors raised by the
subprocess are not always Exceptions, but are still sometimes
recoverable
- Add `except` clause to catch all such errors, short of keyboard
interrupts, so the compilation can complete despite such errors
  • Loading branch information
gs-olive committed Oct 9, 2023
1 parent 99d1e7a commit cc34f3b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions userbenchmark/torch_trt/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,15 @@ def run(args: List[str]):
# Delete model instance and clean up workspace
del Model

except Exception as e:
# Halt further model runs
except KeyboardInterrupt:
break

# Any subprocess errors should be caught and reported
except:
traceback.print_exc()
print(
f"\nLoading model {model_name} failed with:\n{e}\nSkipping the model.\n"
f"\nBenchmarking model {model_name} failed.\nSkipping the model.\n"
)
metrics = {
model_name: f"Failed to run benchmark: {traceback.format_exc()}"
Expand Down

0 comments on commit cc34f3b

Please sign in to comment.