@@ -4,11 +4,12 @@ This is a tutorial for building and installing Executorch from the GitHub reposi
4
4
5
5
## AOT Setup [ (Open on Google Colab)] ( https://colab.research.google.com/drive/1m8iU4y7CRVelnnolK3ThS2l2gBo7QnAP#scrollTo=1o2t3LlYJQY5 )
6
6
7
+ [ (Open on Google Colab)] ( https://colab.research.google.com/drive/1oJBt3fj_Tr3FE7L9RdUgSKK9XzJfUv4F#scrollTo=fC4CB3kFhHPJ )
7
8
8
9
This will install an ` executorch ` pip package to your conda environment and
9
10
allow you to export your PyTorch model to a flatbuffer file using ExecuTorch.
10
11
11
- ** Step 1: Set up a conda environment**
12
+ ### Step 1: Set up a conda environment
12
13
13
14
To install conda, you can look at the
14
15
[ conda installation guide] ( https://conda.io/projects/conda/en/latest/user-guide/install/index.html ) .
@@ -25,22 +26,21 @@ conda install -c conda-forge flatbuffers
25
26
pip install --force-reinstall --pre torch -i https://download.pytorch.org/whl/nightly/cpu
26
27
```
27
28
28
- ** Step 2: Set up Executorch** . This will install an ` executorch ` pip package to your conda environment.
29
- ``` bash
29
+ ### Step 2: Install the ` executorch ` pip package
30
+
31
+ This will install an ` executorch ` pip package to your conda environment.
30
32
33
+ ``` bash
31
34
# Do one of these, depending on how your auth is set up
32
35
git clone https://github.com/pytorch/executorch.git
33
36
git clone
[email protected] :pytorch/executorch.git
34
37
35
- # [Runtime requirement] Run the following to get all submodules, only need for runtime setup
38
+ # Install the pip package
36
39
cd executorch
37
- git submodule update --init
38
-
39
40
pip install .
40
-
41
41
```
42
42
43
- ** Step 3: Try it out **
43
+ ### Step 3: Generate a program file from an ` nn.Module `
44
44
45
45
Via python script:
46
46
``` bash
@@ -53,7 +53,7 @@ python3 -m examples.export.export_and_delegate --option "composite"
53
53
54
54
Or via python interpreter:
55
55
``` python
56
- (executorch) ~ / $ python
56
+ $ python3
57
57
>> > import executorch.exir as exir
58
58
>> > from executorch.exir.tests.models import Mul
59
59
>> > m = Mul()
@@ -63,19 +63,38 @@ Or via python interpreter:
63
63
64
64
## Runtime Setup
65
65
66
- ** Step 1: Install buck2**
66
+ ### Step 1: Install buck2
67
67
68
68
- If you don't have the ` zstd ` commandline tool, install it with ` pip install zstd `
69
69
- Download a prebuilt buck2 archive for your system from https://github.com/facebook/buck2/releases/tag/2023-07-18
70
- - Decompress with the following command (filename will need to change for non-Linux systems).
70
+ - Decompress with the following command (filename depends on your system)
71
71
72
- ```
73
- zstd -cdq buck2-x86_64-unknown-linux-musl.zst > /tmp/buck2 && chmod +x /tmp/buck2
72
+ ``` bash
73
+ # For example, buck2-x86_64-unknown-linux-musl.zst
74
+ zstd -cdq buck2-DOWNLOADED_FILENAME.zst > /tmp/buck2 && chmod +x /tmp/buck2
74
75
```
75
76
76
77
You may want to copy the ` buck2 ` binary into your ` $PATH ` so you can run it as ` buck2 ` .
77
78
78
- ** Step 2: Build a binary**
79
+ ### Step 2: Clone the ` executorch ` repo
80
+
81
+ Clone the repo if you haven't already.
82
+
83
+ ``` bash
84
+ # Do one of these, depending on how your auth is set up
85
+ git clone https://github.com/pytorch/executorch.git
86
+ git clone
[email protected] :pytorch/executorch.git
87
+ ```
88
+
89
+ Ensure that git has fetched the submodules. This is only necessary after
90
+ cloning.
91
+
92
+ ``` bash
93
+ cd executorch
94
+ git submodule update --init
95
+ ```
96
+
97
+ ### Step 3: Build a binary
79
98
80
99
` executor_runner ` is an example wrapper around executorch runtime which includes all the operators and backends
81
100
@@ -90,7 +109,7 @@ If you run into `Stderr: clang-14: error: invalid linker name in argument '-fuse
90
109
conda install -c conda-forge lld
91
110
```
92
111
93
- ** Step 3: Run a binary**
112
+ ### Step 3: Run a binary
94
113
95
114
``` bash
96
115
# add.ff is the program generated from export_example.py during AOT Setup Step 3
0 commit comments