Skip to content

Remove Inspector API usage from lib.py #327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions sdk/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ python_library(
deps = [
"//executorch/sdk/edir:et_schema",
"//executorch/sdk/etdb:etdb",
"//executorch/sdk/etdb:inspector",
"//executorch/sdk/etrecord:etrecord",
],
)
Expand All @@ -24,7 +23,6 @@ python_binary(
deps = [
"//executorch/sdk/edir:et_schema",
"//executorch/sdk/etdb:etdb",
"//executorch/sdk/etdb:inspector",
"//executorch/sdk/etrecord:etrecord",
],
)
39 changes: 2 additions & 37 deletions sdk/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
import argparse
import asyncio
import os
from typing import Mapping, Optional, Union
from typing import Mapping, Optional

from executorch.sdk.edir.et_schema import (
FXOperatorGraph,
InferenceRun,
OperatorGraphWithStats,
)
from executorch.sdk.etdb.etdb import debug_graphs
from executorch.sdk.etdb.inspector import Inspector
from executorch.sdk.etrecord import ETRecord, parse_etrecord

"""
Expand Down Expand Up @@ -87,30 +86,6 @@ def debug_etrecord_path(
debug_etrecord(parse_etrecord(etrecord_path), et_dump_path, verbose)


def gen_inspector_from_etrecord(
etrecord: Union[str, ETRecord],
etdump_path: Optional[str] = None,
show_stack_trace: Optional[bool] = False,
verbose: Optional[bool] = False,
) -> Inspector:
"""
API that creates an Inspector instance based on a file path to an ETRecord instance
or an ETRecord instance and optional parameters including a file path to an ETDump
"""
if isinstance(etrecord, str):
etrecord = parse_etrecord(etrecord_path=str(etrecord))

op_graph_dict: Mapping[str, OperatorGraphWithStats] = _gen_graphs_from_etrecord(
etrecord=etrecord
)
if etdump_path is not None:
_gen_and_attach_metadata(op_graph_dict=op_graph_dict, et_dump_path=etdump_path)

return Inspector(
op_graph_dict=op_graph_dict, show_stack_trace=show_stack_trace, verbose=verbose
)


"""
SDK Binary
"""
Expand All @@ -125,10 +100,6 @@ def parse_args():
action="store_true",
help="Whether the terminal should display in verbose mode",
)
parser.add_argument(
"--show_stack_trace",
help="Whether to show stack trace in the output tables",
)
return parser.parse_args()


Expand All @@ -139,13 +110,7 @@ async def main() -> int:
Only required argument is an et_record path
"""
args = parse_args()
et_inspector = gen_inspector_from_etrecord(
etrecord=args.et_record,
etdump_path=args.et_dump,
show_stack_trace=args.show_stack_trace,
verbose=args.verbose,
)
et_inspector.cli_flow()
debug_etrecord_path(args.et_record, args.et_dump, args.verbose)
return 0


Expand Down