Skip to content

Commit 7c810fd

Browse files
committed
resolve comments
Signed-off-by: Will Guo <willg@nvidia.com>
1 parent 8e81fe0 commit 7c810fd

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

modelopt/onnx/quantization/autotune/__main__.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
)
2828

2929
DEFAULT_OUTPUT_DIR = "./autotuner_output"
30-
DEFAULT_NUM_SCHEMES = 30
30+
DEFAULT_NUM_SCHEMES = 50
3131
DEFAULT_QUANT_TYPE = "int8"
3232
DEFAULT_DQ_DTYPE = "float32"
3333
DEFAULT_TIMING_CACHE = str(Path(tempfile.gettempdir()) / "trtexec_timing.cache")
34-
DEFAULT_WARMUP_RUNS = 5
35-
DEFAULT_TIMING_RUNS = 20
34+
DEFAULT_WARMUP_RUNS = 50
35+
DEFAULT_TIMING_RUNS = 100
3636
MODE_PRESETS = {
3737
"quick": {"schemes_per_region": 30, "warmup_runs": 10, "timing_runs": 50},
3838
"default": {"schemes_per_region": 50, "warmup_runs": 50, "timing_runs": 100},
@@ -135,6 +135,8 @@ def run_autotune() -> int:
135135

136136
log_benchmark_config(args)
137137
trtexec_args = getattr(args, "trtexec_benchmark_args", None)
138+
if trtexec_args and isinstance(trtexec_args, str):
139+
trtexec_args = trtexec_args.split()
138140
benchmark_instance = init_benchmark_instance(
139141
use_trtexec=args.use_trtexec,
140142
plugin_libraries=args.plugin_libraries,
@@ -258,7 +260,7 @@ def _get_autotune_parser() -> argparse.ArgumentParser:
258260
dest="num_schemes",
259261
action=_StoreWithExplicitFlag,
260262
explicit_attr="_explicit_num_schemes",
261-
help=f"Number of schemes to test per region (default: {DEFAULT_NUM_SCHEMES}; overridden by --mode)",
263+
help=f"Schemes per region (default: {DEFAULT_NUM_SCHEMES}; preset from --mode if not set)",
262264
)
263265
strategy_group.add_argument(
264266
"--pattern_cache",
@@ -324,15 +326,15 @@ def _get_autotune_parser() -> argparse.ArgumentParser:
324326
default=DEFAULT_WARMUP_RUNS,
325327
action=_StoreWithExplicitFlag,
326328
explicit_attr="_explicit_warmup_runs",
327-
help=f"Number of warmup runs (default: {DEFAULT_WARMUP_RUNS}; overridden by --mode)",
329+
help=f"Number of warmup runs (default: {DEFAULT_WARMUP_RUNS}; preset from --mode applies if not set)",
328330
)
329331
trt_group.add_argument(
330332
"--timing_runs",
331333
type=int,
332334
default=DEFAULT_TIMING_RUNS,
333335
action=_StoreWithExplicitFlag,
334336
explicit_attr="_explicit_timing_runs",
335-
help=f"Number of timing runs (default: {DEFAULT_TIMING_RUNS}; overridden by --mode)",
337+
help=f"Number of timing runs (default: {DEFAULT_TIMING_RUNS}; preset from --mode applies if not set)",
336338
)
337339
trt_group.add_argument(
338340
"--plugin_libraries",

tests/_test_utils/onnx/quantization/autotune/models.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ def _create_simple_conv_onnx_model():
3232
"output", onnx.TensorProto.FLOAT, [64, 64, 224, 224]
3333
)
3434
conv_node = helper.make_node(
35-
"Conv", inputs=["input", "conv_weight"], outputs=["conv_out"], name="conv"
35+
"Conv",
36+
inputs=["input", "conv_weight"],
37+
outputs=["conv_out"],
38+
name="conv",
39+
kernel_shape=[3, 3],
40+
pads=[1, 1, 1, 1],
3641
)
3742
relu_node = helper.make_node("Relu", inputs=["conv_out"], outputs=["output"], name="relu")
3843
graph = helper.make_graph(

0 commit comments

Comments
 (0)