Skip to content

Commit bfd6428

Browse files
committed
add command
1 parent f1353ac commit bfd6428

File tree

1 file changed

+52
-3
lines changed

1 file changed

+52
-3
lines changed

onnx_diagnostic/_command_lines_parser.py

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,53 @@ def _cmd_config(argv: List[Any]):
227227
print(f"task: {task_from_id(args.mid)}")
228228

229229

230+
def get_parser_inputs() -> ArgumentParser:
231+
parser = ArgumentParser(
232+
prog="test",
233+
description=dedent(
234+
"""
235+
Prints out dummy inputs for a particular task or a model id.
236+
"""
237+
),
238+
epilog="If the model id is specified, one untrained "
239+
"version of it is instantiated.",
240+
)
241+
parser.add_argument(
242+
"-m",
243+
"--mid",
244+
type=str,
245+
required=True,
246+
help="model id, usually <author>/<name>",
247+
)
248+
parser.add_argument(
249+
"-t",
250+
"--task",
251+
default=None,
252+
help="force the task to use",
253+
)
254+
parser.add_argument(
255+
"-e",
256+
"--export",
257+
default=False,
258+
action=BooleanOptionalAction,
259+
help="runs the model to check it runs",
260+
)
261+
parser.add_argument(
262+
"-r",
263+
"--run",
264+
default=False,
265+
action=BooleanOptionalAction,
266+
help="runs the model to check it runs",
267+
)
268+
parser.add_argument(
269+
"-v",
270+
"--verbose",
271+
default=0,
272+
help="verbosity",
273+
)
274+
return parser
275+
276+
230277
def get_main_parser() -> ArgumentParser:
231278
parser = ArgumentParser(
232279
prog="onnx_diagnostic",
@@ -237,17 +284,18 @@ def get_main_parser() -> ArgumentParser:
237284
Type 'python -m onnx_diagnostic <cmd> --help'
238285
to get help for a specific command.
239286
287+
config - prints a configuration for a model id
288+
find - find node consuming or producing a result
240289
lighten - makes an onnx model lighter by removing the weights,
241290
unlighten - restores an onnx model produces by the previous experiment
242291
print - prints the model on standard output
243-
find - find node consuming or producing a result
244-
config - prints a configuration for a model id
292+
test - tests a model
245293
"""
246294
),
247295
)
248296
parser.add_argument(
249297
"cmd",
250-
choices=["lighten", "unlighten", "run", "print", "find", "config"],
298+
choices=["config", "find", "lighten", "print", "unlighten", "test"],
251299
help="Selects a command.",
252300
)
253301
return parser
@@ -260,6 +308,7 @@ def main(argv: Optional[List[Any]] = None):
260308
print=_cmd_print,
261309
find=_cmd_find,
262310
config=_cmd_config,
311+
text=_cmd_test,
263312
)
264313

265314
if argv is None:

0 commit comments

Comments
 (0)