Skip to content

Commit 835bd34

Browse files
Olivia-liufacebook-github-bot
authored andcommitted
New URL for the Inspector page (#5810)
Summary: Pull Request resolved: #5810 This diff is to rename the "sdk-inspector" documentation page to just "model-inspector". Old URL: https://pytorch.org/executorch/main/sdk-inspector.html New URL: https://pytorch.org/executorch/main/model-inspector.html Design doc: https://docs.google.com/document/d/1l6DYTq9Kq6VrPohruRFP-qScZDj01W_g4zlKyvqKGF4/edit?usp=sharing Reviewed By: dbort Differential Revision: D63741034 fbshipit-source-id: 57ce5769790d4da431333c781dec2fdbb8ebdb80
1 parent 6f17947 commit 835bd34

12 files changed

+174
-170
lines changed

docs/source/build-run-coreml.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ cd executorch
108108
./coreml_executor_runner --model_path mv3_coreml_all.pte --profile_model --etdump_path etdump.etdp
109109
```
110110

111-
4. Create an instance of the [Inspector API](./sdk-inspector.rst) by passing in the [ETDump](./etdump.md) you have sourced from the runtime along with the optionally generated [ETRecord](./etrecord.rst) from step 1 or execute the following command in your terminal to display the profiling data table.
111+
4. Create an instance of the [Inspector API](./model-inspector.rst) by passing in the [ETDump](./etdump.md) you have sourced from the runtime along with the optionally generated [ETRecord](./etrecord.rst) from step 1 or execute the following command in your terminal to display the profiling data table.
112112
```bash
113113
python examples/apple/coreml/scripts/inspector_cli.py --etdump_path etdump.etdp --etrecord_path mv3_coreml.bin
114114
```

docs/source/delegate-debugging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ A demo of the runtime code can be found [here](https://github.com/pytorch/execut
127127

128128
## Surfacing custom metadata from delegate events
129129

130-
As seen in the runtime logging API's above, users can log an array of bytes along with their delegate profiling event. We make this data available for users in post processing via the [Inspector API](./sdk-inspector.rst).
130+
As seen in the runtime logging API's above, users can log an array of bytes along with their delegate profiling event. We make this data available for users in post processing via the [Inspector API](./model-inspector.rst).
131131

132132
Users can pass a metadata parser when creating an instance of the Inspector. The parser is a callable that deserializes the data and returns a list of strings or a dictionary containing key-value pairs. The deserialized data is then added back to the corresponding event in the event block for user consumption. Here's an example of how to write this parser:
133133

docs/source/devtools-overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ More details are available in the [ETDump documentation](etdump.md) on how to ge
4242
### Inspector APIs
4343
The Inspector Python APIs are the main user enrty point into the Developer Tools. They join the data sourced from ETDump and ETRecord to give users access to all the performance and debug data sourced from the runtime along with linkage back to eager model source code and module hierarchy in an easy to use API.
4444

45-
More details are available in the [Inspector API documentation](sdk-inspector.rst) on how to use the Inspector APIs.
45+
More details are available in the [Inspector API documentation](model-inspector.rst) on how to use the Inspector APIs.

docs/source/etdump.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ target_compile_options(portable_ops_lib INTERFACE -DET_EVENT_TRACER_ENABLED)
4141
```
4242
## Using an ETDump
4343

44-
Pass this ETDump into the [Inspector API](./sdk-inspector.rst) to access this data and do post-run analysis.
44+
Pass this ETDump into the [Inspector API](./model-inspector.rst) to access this data and do post-run analysis.

docs/source/etrecord.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ them to debug and visualize their model.
1818
* Delegate debug handle maps
1919

2020
The ``ETRecord`` object itself is intended to be opaque to users and they should not access any components inside it directly.
21-
It should be provided to the `Inspector API <sdk-inspector.html>`__ to link back performance and debug data sourced from the runtime back to the Python source code.
21+
It should be provided to the `Inspector API <model-inspector.html>`__ to link back performance and debug data sourced from the runtime back to the Python source code.
2222

2323
Generating an ``ETRecord``
2424
--------------------------
@@ -37,4 +37,4 @@ they are interested in working with via our tooling.
3737
Using an ``ETRecord``
3838
---------------------
3939

40-
Pass the ``ETRecord`` as an optional argument into the `Inspector API <sdk-inspector.html>`__ to access this data and do post-run analysis.
40+
Pass the ``ETRecord`` as an optional argument into the `Inspector API <model-inspector.html>`__ to access this data and do post-run analysis.

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ Topics in this section will help you get started with ExecuTorch.
206206
etdump
207207
sdk-profiling
208208
model-debugging
209-
sdk-inspector
209+
model-inspector
210210
memory-planning-inspection
211211
delegate-debugging
212212
devtools-tutorial

docs/source/llm/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ This prints the performance data in a tabular format in “inspector_out.txt”,
843843
![](../_static/img/llm_manual_print_data_tabular.png)
844844
<a href="../_static/img/llm_manual_print_data_tabular.png" target="_blank">View in full size</a>
845845

846-
To learn more about the Inspector and the rich functionality it provides, see the [Inspector API Reference](../sdk-inspector.md).
846+
To learn more about the Inspector and the rich functionality it provides, see the [Inspector API Reference](../model-inspector.md).
847847

848848
## Custom Kernels
849849
With the ExecuTorch custom operator APIs, custom operator and kernel authors can easily bring in their kernel into PyTorch/ExecuTorch.

docs/source/model-debugging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ For a real example reflecting the steps below, please refer to [example_runner.c
3535

3636

3737
### Accessing the debug outputs post run using the Inspector API's
38-
Once a model has been run, using the generated ETDump and debug buffers, users can leverage the [Inspector API's](./sdk-inspector.rst) to inspect these debug outputs.
38+
Once a model has been run, using the generated ETDump and debug buffers, users can leverage the [Inspector API's](./model-inspector.rst) to inspect these debug outputs.
3939

4040
```python
4141
from executorch.devtools import Inspector

docs/source/model-inspector.rst

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
Inspector APIs
2+
==============
3+
4+
Overview
5+
--------
6+
7+
The Inspector APIs provide a convenient interface for analyzing the
8+
contents of `ETRecord <etrecord.html>`__ and
9+
`ETDump <etdump.html>`__, helping developers get insights about model
10+
architecture and performance statistics. It’s built on top of the `EventBlock Class <#eventblock-class>`__ data structure,
11+
which organizes a group of `Event <#event-class>`__\ s for easy access to details of profiling events.
12+
13+
There are multiple ways in which users can interact with the Inspector
14+
APIs:
15+
16+
* By using `public methods <#inspector-methods>`__ provided by the ``Inspector`` class.
17+
* By accessing the `public attributes <#inspector-attributes>`__ of the ``Inspector``, ``EventBlock``, and ``Event`` classes.
18+
* By using a `CLI <#cli>`__ tool for basic functionalities.
19+
20+
Please refer to the `e2e use case doc <tutorials/devtools-integration-tutorial.html>`__ get an understanding of how to use these in a real world example.
21+
22+
23+
Inspector Methods
24+
-----------------
25+
26+
Constructor
27+
~~~~~~~~~~~
28+
29+
.. autofunction:: executorch.devtools.Inspector.__init__
30+
31+
**Example Usage:**
32+
33+
.. code:: python
34+
35+
from executorch.devtools import Inspector
36+
37+
inspector = Inspector(etdump_path="/path/to/etdump.etdp", etrecord="/path/to/etrecord.bin")
38+
39+
to_dataframe
40+
~~~~~~~~~~~~~~~~
41+
42+
.. autofunction:: executorch.devtools.Inspector.to_dataframe
43+
44+
45+
print_data_tabular
46+
~~~~~~~~~~~~~~~~~~
47+
48+
.. autofunction:: executorch.devtools.Inspector.print_data_tabular
49+
50+
.. _example-usage-1:
51+
52+
**Example Usage:**
53+
54+
.. code:: python
55+
56+
inspector.print_data_tabular()
57+
58+
.. image:: _static/img/print_data_tabular.png
59+
Note that the unit of delegate profiling events is "cycles". We're working on providing a way to set different units in the future.
60+
61+
62+
find_total_for_module
63+
~~~~~~~~~~~~~~~~~~~~~
64+
65+
.. autofunction:: executorch.devtools.Inspector.find_total_for_module
66+
67+
.. _example-usage-2:
68+
69+
**Example Usage:**
70+
71+
.. code:: python
72+
73+
print(inspector.find_total_for_module("L__self___conv_layer"))
74+
75+
::
76+
77+
0.002
78+
79+
80+
get_exported_program
81+
~~~~~~~~~~~~~~~~~~~~
82+
83+
.. autofunction:: executorch.devtools.Inspector.get_exported_program
84+
85+
.. _example-usage-3:
86+
87+
**Example Usage:**
88+
89+
.. code:: python
90+
91+
print(inspector.get_exported_program())
92+
93+
::
94+
95+
ExportedProgram:
96+
class GraphModule(torch.nn.Module):
97+
def forward(self, arg0_1: f32[4, 3, 64, 64]):
98+
# No stacktrace found for following nodes
99+
_param_constant0 = self._param_constant0
100+
_param_constant1 = self._param_constant1
101+
102+
### ... Omit part of the program for documentation readability ... ###
103+
104+
Graph signature: ExportGraphSignature(parameters=[], buffers=[], user_inputs=['arg0_1'], user_outputs=['aten_tan_default'], inputs_to_parameters={}, inputs_to_buffers={}, buffers_to_mutate={}, backward_signature=None, assertion_dep_token=None)
105+
Range constraints: {}
106+
Equality constraints: []
107+
108+
109+
Inspector Attributes
110+
--------------------
111+
112+
``EventBlock`` Class
113+
~~~~~~~~~~~~~~~~~~~~
114+
115+
Access ``EventBlock`` instances through the ``event_blocks`` attribute
116+
of an ``Inspector`` instance, for example:
117+
118+
.. code:: python
119+
120+
inspector.event_blocks
121+
122+
.. autoclass:: executorch.devtools.inspector.EventBlock
123+
124+
``Event`` Class
125+
~~~~~~~~~~~~~~~
126+
127+
Access ``Event`` instances through the ``events`` attribute of an
128+
``EventBlock`` instance.
129+
130+
.. autoclass:: executorch.devtools.inspector.Event
131+
132+
**Example Usage:**
133+
134+
.. code:: python
135+
136+
for event_block in inspector.event_blocks:
137+
for event in event_block.events:
138+
if event.name == "Method::execute":
139+
print(event.perf_data.raw)
140+
141+
::
142+
143+
[175.748, 78.678, 70.429, 122.006, 97.495, 67.603, 70.2, 90.139, 66.344, 64.575, 134.135, 93.85, 74.593, 83.929, 75.859, 73.909, 66.461, 72.102, 84.142, 77.774, 70.038, 80.246, 59.134, 68.496, 67.496, 100.491, 81.162, 74.53, 70.709, 77.112, 59.775, 79.674, 67.54, 79.52, 66.753, 70.425, 71.703, 81.373, 72.306, 72.404, 94.497, 77.588, 79.835, 68.597, 71.237, 88.528, 71.884, 74.047, 81.513, 76.116]
144+
145+
146+
CLI
147+
---
148+
149+
Execute the following command in your terminal to display the data
150+
table. This command produces the identical table output as calling the
151+
`print_data_tabular <#print-data-tabular>`__ mentioned earlier:
152+
153+
.. code:: bash
154+
155+
python3 -m devtools.inspector.inspector_cli --etdump_path <path_to_etdump> --etrecord_path <path_to_etrecord>
156+
157+
Note that the `etrecord_path` argument is optional.
158+
159+
We plan to extend the capabilities of the CLI in the future.

docs/source/sdk-inspector.rst

Lines changed: 1 addition & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -1,159 +1,4 @@
11
Inspector APIs
22
==============
33

4-
Overview
5-
--------
6-
7-
The Inspector APIs provide a convenient interface for analyzing the
8-
contents of `ETRecord <etrecord.html>`__ and
9-
`ETDump <etdump.html>`__, helping developers get insights about model
10-
architecture and performance statistics. It’s built on top of the `EventBlock Class <#eventblock-class>`__ data structure,
11-
which organizes a group of `Event <#event-class>`__\ s for easy access to details of profiling events.
12-
13-
There are multiple ways in which users can interact with the Inspector
14-
APIs:
15-
16-
* By using `public methods <#inspector-methods>`__ provided by the ``Inspector`` class.
17-
* By accessing the `public attributes <#inspector-attributes>`__ of the ``Inspector``, ``EventBlock``, and ``Event`` classes.
18-
* By using a `CLI <#cli>`__ tool for basic functionalities.
19-
20-
Please refer to the `e2e use case doc <tutorials/devtools-integration-tutorial.html>`__ get an understanding of how to use these in a real world example.
21-
22-
23-
Inspector Methods
24-
-----------------
25-
26-
Constructor
27-
~~~~~~~~~~~
28-
29-
.. autofunction:: executorch.devtools.Inspector.__init__
30-
31-
**Example Usage:**
32-
33-
.. code:: python
34-
35-
from executorch.devtools import Inspector
36-
37-
inspector = Inspector(etdump_path="/path/to/etdump.etdp", etrecord="/path/to/etrecord.bin")
38-
39-
to_dataframe
40-
~~~~~~~~~~~~~~~~
41-
42-
.. autofunction:: executorch.devtools.Inspector.to_dataframe
43-
44-
45-
print_data_tabular
46-
~~~~~~~~~~~~~~~~~~
47-
48-
.. autofunction:: executorch.devtools.Inspector.print_data_tabular
49-
50-
.. _example-usage-1:
51-
52-
**Example Usage:**
53-
54-
.. code:: python
55-
56-
inspector.print_data_tabular()
57-
58-
.. image:: _static/img/print_data_tabular.png
59-
Note that the unit of delegate profiling events is "cycles". We're working on providing a way to set different units in the future.
60-
61-
62-
find_total_for_module
63-
~~~~~~~~~~~~~~~~~~~~~
64-
65-
.. autofunction:: executorch.devtools.Inspector.find_total_for_module
66-
67-
.. _example-usage-2:
68-
69-
**Example Usage:**
70-
71-
.. code:: python
72-
73-
print(inspector.find_total_for_module("L__self___conv_layer"))
74-
75-
::
76-
77-
0.002
78-
79-
80-
get_exported_program
81-
~~~~~~~~~~~~~~~~~~~~
82-
83-
.. autofunction:: executorch.devtools.Inspector.get_exported_program
84-
85-
.. _example-usage-3:
86-
87-
**Example Usage:**
88-
89-
.. code:: python
90-
91-
print(inspector.get_exported_program())
92-
93-
::
94-
95-
ExportedProgram:
96-
class GraphModule(torch.nn.Module):
97-
def forward(self, arg0_1: f32[4, 3, 64, 64]):
98-
# No stacktrace found for following nodes
99-
_param_constant0 = self._param_constant0
100-
_param_constant1 = self._param_constant1
101-
102-
### ... Omit part of the program for documentation readability ... ###
103-
104-
Graph signature: ExportGraphSignature(parameters=[], buffers=[], user_inputs=['arg0_1'], user_outputs=['aten_tan_default'], inputs_to_parameters={}, inputs_to_buffers={}, buffers_to_mutate={}, backward_signature=None, assertion_dep_token=None)
105-
Range constraints: {}
106-
Equality constraints: []
107-
108-
109-
Inspector Attributes
110-
--------------------
111-
112-
``EventBlock`` Class
113-
~~~~~~~~~~~~~~~~~~~~
114-
115-
Access ``EventBlock`` instances through the ``event_blocks`` attribute
116-
of an ``Inspector`` instance, for example:
117-
118-
.. code:: python
119-
120-
inspector.event_blocks
121-
122-
.. autoclass:: executorch.devtools.inspector.EventBlock
123-
124-
``Event`` Class
125-
~~~~~~~~~~~~~~~
126-
127-
Access ``Event`` instances through the ``events`` attribute of an
128-
``EventBlock`` instance.
129-
130-
.. autoclass:: executorch.devtools.inspector.Event
131-
132-
**Example Usage:**
133-
134-
.. code:: python
135-
136-
for event_block in inspector.event_blocks:
137-
for event in event_block.events:
138-
if event.name == "Method::execute":
139-
print(event.perf_data.raw)
140-
141-
::
142-
143-
[175.748, 78.678, 70.429, 122.006, 97.495, 67.603, 70.2, 90.139, 66.344, 64.575, 134.135, 93.85, 74.593, 83.929, 75.859, 73.909, 66.461, 72.102, 84.142, 77.774, 70.038, 80.246, 59.134, 68.496, 67.496, 100.491, 81.162, 74.53, 70.709, 77.112, 59.775, 79.674, 67.54, 79.52, 66.753, 70.425, 71.703, 81.373, 72.306, 72.404, 94.497, 77.588, 79.835, 68.597, 71.237, 88.528, 71.884, 74.047, 81.513, 76.116]
144-
145-
146-
CLI
147-
---
148-
149-
Execute the following command in your terminal to display the data
150-
table. This command produces the identical table output as calling the
151-
`print_data_tabular <#print-data-tabular>`__ mentioned earlier:
152-
153-
.. code:: bash
154-
155-
python3 -m devtools.inspector.inspector_cli --etdump_path <path_to_etdump> --etrecord_path <path_to_etrecord>
156-
157-
Note that the `etrecord_path` argument is optional.
158-
159-
We plan to extend the capabilities of the CLI in the future.
4+
Please update your link to <https://pytorch.org/executorch/main/model-inspector.html>. This URL will be deleted after v0.4.0.

0 commit comments

Comments
 (0)