You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make getting started clearer and reduce formatting bugs (#5954)
Summary:
Giving the user specific instructions on where to create the new file and how to use it so they don't have to think as much or fall into a common issue.
Pull Request resolved: #5954
Test Plan: Went through the instructions in the readme manually
Reviewed By: dbort
Differential Revision: D64053565
Pulled By: byjlw
fbshipit-source-id: 5fb5cda2497e77c727ac99f17d7b1ec13e0b0941
Copy file name to clipboardExpand all lines: docs/source/getting-started-setup.md
+25-19Lines changed: 25 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,4 @@
1
1
<!---- DO NOT MODIFY Progress Bar Start --->
2
-
3
2
<divclass="progress-bar-wrapper">
4
3
<divclass="progress-bar-item">
5
4
<div class="step-number" id="step-1">1</div>
@@ -18,11 +17,7 @@
18
17
<span class="step-caption" id="caption-4"></span>
19
18
</div>
20
19
</div>
21
-
22
20
<!---- DO NOT MODIFY Progress Bar End--->
23
-
```{note}
24
-
Before diving in, make sure you understand the concepts in the [ExecuTorch Overview](intro-overview.md)
25
-
```
26
21
27
22
# Setting Up ExecuTorch
28
23
In this section, we'll learn how to
@@ -37,22 +32,16 @@ We've tested these instructions on the following systems, although they should
37
32
also work in similar environments.
38
33
39
34
40
-
::::{grid} 3
41
-
:::{grid-item-card} Linux (x86_64)
42
-
:class-card: card-prerequisites
35
+
Linux (x86_64)
43
36
- CentOS 8+
44
37
- Ubuntu 20.04.6 LTS+
45
38
- RHEL 8+
46
-
:::
47
-
:::{grid-item-card} macOS (x86_64/M1/M2)
48
-
:class-card: card-prerequisites
39
+
40
+
macOS (x86_64/M1/M2)
49
41
- Big Sur (11.0)+
50
-
:::
51
-
:::{grid-item-card} Windows (x86_64)
52
-
:class-card: card-prerequisites
42
+
43
+
Windows (x86_64)
53
44
- Windows Subsystem for Linux (WSL) with any of the Linux options
54
-
:::
55
-
::::
56
45
57
46
### Software
58
47
*`conda` or another virtual environment manager
@@ -140,7 +129,19 @@ ExecuTorch provides APIs to compile a PyTorch [`nn.Module`](https://pytorch.org/
140
129
1. Save the result as a [`.pte` binary](pte-file-format.md) to be consumed by the ExecuTorch runtime.
141
130
142
131
143
-
Let's try this using with a simple PyTorch model that adds its inputs. Create a file called `export_add.py` with the following code:
132
+
Let's try this using with a simple PyTorch model that adds its inputs.
133
+
134
+
Create `export_add.py` in a new directory outside of the ExecuTorch repo.
135
+
136
+
**Note: It's important that this file does does not live in the directory that's a parent of the `executorch` directory. We need python to import from site-packages, not from the repo itself.**
137
+
138
+
```
139
+
mkdir -p ../example_files
140
+
cd ../example_files
141
+
touch export_add.py
142
+
```
143
+
144
+
Add the following code to `export_add.py`:
144
145
```python
145
146
import torch
146
147
from torch.export import export
@@ -174,12 +175,17 @@ Then, execute it from your terminal.
174
175
python3 export_add.py
175
176
```
176
177
178
+
If it worked you'll see `add.pte`in that directory
179
+
177
180
See the [ExecuTorch export tutorial](tutorials_source/export-to-executorch-tutorial.py) to learn more about the export process.
178
181
179
182
180
183
## Build & Run
181
184
182
-
After creating a program, we can use the ExecuTorch runtime to execute it.
185
+
After creating a program go back to the executorch directory to execute it using the ExecuTorch runtime.
186
+
```
187
+
cd ../executorch
188
+
```
183
189
184
190
For now, let's use [`executor_runner`](https://github.com/pytorch/executorch/blob/main/examples/portable/executor_runner/executor_runner.cpp), an example that runs the `forward` method on your program using the ExecuTorch runtime.
185
191
@@ -215,7 +221,7 @@ The ExecuTorch repo uses CMake to build its C++ code. Here, we'll configure it t
215
221
Now that we've exported a program and built the runtime, let's execute it!
Our output is a `torch.Tensor` with a size of 1. The `executor_runner` sets all input values to a [`torch.ones`](https://pytorch.org/docs/stable/generated/torch.ones.html) tensor, so when `x=[1]` and `y=[1]`, we get `[1]+[1]=[2]`
0 commit comments