Skip to content

Commit d5dbc4d

Browse files
committed
chore: Fix reporting to a file setting
Signed-off-by: Dheeraj Peri <[email protected]>
1 parent 3a14f23 commit d5dbc4d

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

tools/perf/perf_run.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# Importing supported Backends
1616
import torch
1717
import torch_tensorrt as torchtrt
18-
from torch_tensorrt.fx.lower import lower_to_trt
18+
from torch_tensorrt.fx.lower import compile
1919
from torch_tensorrt.fx.utils import LowerPrecision
2020

2121
import tensorrt as trt
@@ -89,7 +89,7 @@ def run_torch_tensorrt(model, input_tensors, params, precision, truncate_long_an
8989
if precision == "int8":
9090
compile_settings.update({"calib": params.get("calibration_cache")})
9191

92-
with torchtrt.logging.errors():
92+
with torchtrt.logging.debug():
9393
model = torchtrt.compile(model, **compile_settings)
9494

9595
iters = params.get("iterations", 20)
@@ -123,7 +123,7 @@ def run_fx2trt(model, input_tensors, params, precision, batch_size):
123123
model.half()
124124
input_tensors = [tensor.half() for tensor in input_tensors]
125125
# Run lowering eager mode benchmark
126-
model = lower_to_trt(
126+
model = compile(
127127
model,
128128
input_tensors,
129129
max_batch_size=batch_size,
@@ -430,7 +430,8 @@ def load_model(params):
430430
print("Model Summary: ", model_name)
431431
summary = pd.DataFrame(results)
432432
print(summary)
433-
with open(args.report, "w") as file:
434-
file.write("Model Summary: " + model_name + "\n")
435-
file.write(summary.to_string())
436-
file.close()
433+
if args.report:
434+
with open(args.report, "w") as file:
435+
file.write("Model Summary: " + model_name + "\n")
436+
file.write(summary.to_string())
437+
file.close()

0 commit comments

Comments
 (0)