Skip to content

Commit 83af3a4

Browse files
Olivia-liufacebook-github-bot
authored andcommitted
"CLI" aka a script to run the Inspector (pytorch#546)
Summary: Pull Request resolved: pytorch#546 Not a CLI strictly speaking, but should be good enough for MVP. See Test Plan for how to use it. Regarding added dependencies: * pandas: for dataframe usage [here](https://fburl.com/code/5i7nghbq) * tabulate: for pretty printing [here](https://fburl.com/code/krmppoh8) ***Note***: the changes in "executorch/oss/pyproject.toml" and "executorch/oss/setup.py" are not just for the CLI, but also *necessary* to enable the Python Inspector APIs in OSS. Reviewed By: tarun292 Differential Revision: D49758493 fbshipit-source-id: 4703ce68a3b2b59c2d50861934434ce5de7f95af
1 parent a3a1d64 commit 83af3a4

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ dependencies=[
1212
"hypothesis",
1313
"numpy",
1414
"packaging",
15+
"pandas",
1516
"parameterized",
1617
"pytest",
1718
"pytest-xdist",
1819
"pyyaml",
1920
"ruamel.yaml",
2021
"sympy",
22+
"tabulate",
2123
"tomli",
2224
"zstd",
2325
]

sdk/inspector/TARGETS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary")
12
load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
23

34
oncall("executorch")
@@ -20,6 +21,12 @@ python_library(
2021
],
2122
)
2223

24+
python_binary(
25+
name = "inspector_cli",
26+
main_src = "inspector_cli.py",
27+
deps = [":inspector"],
28+
)
29+
2330
python_library(
2431
name = "inspector_utils",
2532
srcs = [

sdk/inspector/inspector_cli.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
import argparse
8+
9+
from executorch.sdk.inspector.inspector import Inspector
10+
11+
if __name__ == "__main__":
12+
parser = argparse.ArgumentParser()
13+
parser.add_argument(
14+
"--etdump_path",
15+
required=True,
16+
help="Provide an ETDump file path.",
17+
)
18+
parser.add_argument(
19+
"--etrecord_path",
20+
required=False,
21+
help="Provide an optional ETRecord file path.",
22+
)
23+
24+
args = parser.parse_args()
25+
26+
inspector = Inspector(
27+
etdump_path=args.etdump_path, etrecord_path=args.etrecord_path
28+
)
29+
inspector.print_data_tabular()

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def run(self):
5757
"executorch/backends": "backends",
5858
"executorch/exir": "exir",
5959
"executorch/schema": "schema",
60+
"executorch/sdk": "sdk",
6061
"executorch/extension": "extension",
6162
"executorch/bundled_program": "bundled_program",
6263
"tosa": "backends/arm/third-party/serialization_lib/python/tosa",

0 commit comments

Comments
 (0)