Skip to content

Commit c5000e6

Browse files
lucylqfacebook-github-bot
authored andcommitted
examples nits (#820)
Summary: Pull Request resolved: #820 Update links, nits going through examples documentation Reviewed By: guangy10 Differential Revision: D50147439 fbshipit-source-id: d3bfb31177068bff3530ac54ebd4eec3cf02823d
1 parent 9d47e8c commit c5000e6

File tree

7 files changed

+26
-19
lines changed

7 files changed

+26
-19
lines changed

backends/qualcomm/setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on a Android device.
77

88
## Prerequisite
99

10-
Please finish tutorial [Setting up executorch](../../docs/website/docs/tutorials/00_setting_up_executorch.md).
10+
Please finish tutorial [Setting up executorch](../../docs/source/getting-started-setup.md).
1111

1212

1313
## Conventions

examples/arm/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## ExecuTorch on ARM Cortex-M55 + Ethos-U55
22

33
This dir contains scripts to help you prepare setup needed to run a PyTorch
4-
model on a ARM Corstone-300 platform via ExecuTorch. Corstone-300 platform
4+
model on an ARM Corstone-300 platform via ExecuTorch. Corstone-300 platform
55
contains the Cortex-M55 CPU and Ethos-U55 NPU.
66

77
We will start from a PyTorch model in python, export it, convert it to a `.pte`

examples/portable/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ examples/portable
1616

1717
## Using portable mode
1818

19-
We will walk through an example model to generate a `.pte` file in [portable mode](/docs/website/docs/basics/terminology.md) from a python `torch.nn.module`
19+
We will walk through an example model to generate a `.pte` file in [portable mode](../../docs/source/concepts.md#portable-mode-lean-mode) from a python `torch.nn.module`
2020
from the [`models/`](../models) directory using scripts in the `portable/scripts` directory. Then we will run on the `.pte` model on the ExecuTorch runtime. For that we will use `executor_runner`.
2121

2222

23-
1. Following the setup guide in [Setting up ExecuTorch from GitHub](/docs/website/docs/tutorials/00_setting_up_executorch.md)
23+
1. Following the setup guide in [Setting up ExecuTorch from GitHub](../../docs/source/getting-started-setup.md)
2424
you should be able to get the basic development environment for ExecuTorch working.
2525

2626
2. Using the script `portable/scripts/export.py` generate a model binary file by selecting a

examples/portable/custom_ops/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ This folder contains examples to register custom operators into PyTorch as well
33

44
## How to run
55

6-
Prerequisite: finish the [setting up wiki](https://github.com/pytorch/executorch/blob/main/docs/website/docs/tutorials/00_setting_up_executorch.md).
6+
Prerequisite: finish the [setting up wiki](../../../docs/source/getting-started-setup.md).
77

88
Run:
99

1010
```bash
11-
bash test_custom_ops.sh
11+
cd executorch
12+
bash examples/portable/custom_ops/test_custom_ops.sh [cmake|buck2]
1213
```
1314

1415
## AOT registration
@@ -27,7 +28,7 @@ By linking them both with `libtorch` and `executorch` library, we can build a sh
2728

2829
## C++ kernel registration
2930

30-
After the model is exported by EXIR, we need C++ implementations of these custom ops in order to run it. For example, `custom_ops_1_out.cpp` is C++ kernel that can be plugged in to ExecuTorch runtime. Other than that, we also need a way to bind the PyTorch op to this kernel. This binding is specified in `custom_ops.yaml`:
31+
After the model is exported by EXIR, we need C++ implementations of these custom ops in order to run it. For example, `custom_ops_1_out.cpp` is a C++ kernel that can be plugged into the ExecuTorch runtime. Other than that, we also need a way to bind the PyTorch op to this kernel. This binding is specified in `custom_ops.yaml`:
3132
```yaml
3233
- func: my_ops::mul3.out(Tensor input, *, Tensor(a!) output) -> Tensor(a!)
3334
kernels:
@@ -57,4 +58,4 @@ et_operator_library(
5758

5859
We then let the custom ops library depend on this target, to only register the ops we want.
5960

60-
For more information about selective build, please refer to [`docs/tutorials/selective_build.md`](https://github.com/pytorch/executorch/blob/main/docs/website/docs/tutorials/selective_build.md).
61+
For more information about selective build, please refer to [`selective_build.md`](../../../docs/source/kernel-library-selective_build.md).

examples/portable/custom_ops/test_custom_ops.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test_buck2_custom_op_1() {
2121
# should save file custom_ops_1.pte
2222

2323
echo 'Running executor_runner'
24-
buck2 run //examples/portable/executor_runner:executor_runner \
24+
$BUCK2 run //examples/portable/executor_runner:executor_runner \
2525
--config=executorch.register_custom_op=1 -- --model_path="./${model_name}.pte"
2626
# should give correct result
2727

@@ -37,7 +37,7 @@ test_cmake_custom_op_1() {
3737
(rm -rf cmake-out \
3838
&& mkdir cmake-out \
3939
&& cd cmake-out \
40-
&& retry cmake -DBUCK2=buck2 \
40+
&& retry cmake -DBUCK2=$BUCK2 \
4141
-DREGISTER_EXAMPLE_CUSTOM_OP=1 \
4242
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" ..)
4343

@@ -52,13 +52,13 @@ test_buck2_custom_op_2() {
5252
local model_name='custom_ops_2'
5353

5454
echo 'Building custom ops shared library'
55-
SO_LIB=$(buck2 build //examples/portable/custom_ops:custom_ops_aot_lib_2 --show-output | grep "buck-out" | cut -d" " -f2)
55+
SO_LIB=$($BUCK2 build //examples/portable/custom_ops:custom_ops_aot_lib_2 --show-output | grep "buck-out" | cut -d" " -f2)
5656

5757
echo "Exporting ${model_name}.pte"
5858
${PYTHON_EXECUTABLE} -m "examples.portable.custom_ops.${model_name}" --so_library="$SO_LIB"
5959
# should save file custom_ops_2.pte
6060

61-
buck2 run //examples/portable/executor_runner:executor_runner \
61+
$BUCK2 run //examples/portable/executor_runner:executor_runner \
6262
--config=executorch.register_custom_op=2 -- --model_path="./${model_name}.pte"
6363
# should give correct result
6464
echo "Removing ${model_name}.pte"
@@ -88,7 +88,7 @@ test_cmake_custom_op_2() {
8888
(rm -rf cmake-out \
8989
&& mkdir cmake-out \
9090
&& cd cmake-out \
91-
&& retry cmake -DBUCK2=buck2 \
91+
&& retry cmake -DBUCK2=$BUCK2 \
9292
-DREGISTER_EXAMPLE_CUSTOM_OP=2 \
9393
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
9494
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" ..)
@@ -109,6 +109,12 @@ if [[ -z $PYTHON_EXECUTABLE ]];
109109
then
110110
PYTHON_EXECUTABLE=python3
111111
fi
112+
113+
if [[ -z $BUCK2 ]];
114+
then
115+
BUCK2=buck2
116+
fi
117+
112118
if [[ $1 == "cmake" ]];
113119
then
114120
test_cmake_custom_op_1

examples/qualcomm/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Here are some general information and limitations.
88

99
## Prerequisite
1010

11-
Please finish tutorial [Setting up executorch](../../docs/website/docs/tutorials/00_setting_up_executorch.md).
11+
Please finish tutorial [Setting up executorch](../../docs/source/getting-started-setup.md).
1212

1313
Please finish [setup QNN backend](../../backends/qualcomm/setup.md).
1414

@@ -57,8 +57,7 @@ but the performance and accuracy number can differ.
5757
set of SoCs. Please check QNN documents for details.
5858

5959
3. The mobilebert example needs to train the last classifier layer a bit, so it takes
60-
time to run.
60+
time to run.
6161

6262
4. [**Important**] Due to the numerical limits of FP16, other use cases leveraging mobileBert wouldn't
6363
guarantee to work.
64-

examples/selective_build/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# Selective Build Examples
2-
To optimize binary size of ExecuTorch runtime, selective build can be used. This folder contains examples to select only the operators needed for ExecuTorch build. We provide APIs for both CMake build and buck2 build. This example will demonstrate both. You can find more information on how to use buck2 macros in [wiki](https://github.com/pytorch/executorch/blob/main/docs/website/docs/tutorials/selective_build.md).
2+
To optimize binary size of ExecuTorch runtime, selective build can be used. This folder contains examples to select only the operators needed for ExecuTorch build. We provide APIs for both CMake build and buck2 build. This example will demonstrate both. You can find more information on how to use buck2 macros in [wiki](../../docs/source/kernel-library-selective_build.md).
33

44
## How to run
55

6-
Prerequisite: finish the [setting up wiki](https://github.com/pytorch/executorch/blob/main/docs/website/docs/tutorials/00_setting_up_executorch.md).
6+
Prerequisite: finish the [setting up wiki](../../docs/source/getting-started-setup.md).
77

88
Run:
99

1010
```bash
11-
bash test_selective_build.sh [cmake|buck2]
11+
cd executorch
12+
bash examples/selective_build/test_selective_build.sh [cmake|buck2]
1213
```
1314

1415
## BUCK2 examples

0 commit comments

Comments
 (0)