Skip to content

Commit b74f25b

Browse files
pytorchbotlucylq
andauthored
Update using-executorch-export docs (#14598)
1. Remove unused partial_function 2. Add import torch 3. Add pybindings example for program-data separation pick to 1.0 release Co-authored-by: lucylq <[email protected]>
1 parent fc48f5c commit b74f25b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

docs/source/using-executorch-export.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ delegate_external_constants_pass_unlifted(
141141
exported_program = export(tagged_module, inputs, dynamic_shapes=dynamic_shapes)
142142
executorch_program = to_edge_transform_and_lower(
143143
exported_program,
144-
transform_passes = [partial_function],
145144
partitioner = [XnnpackPartitioner()]
146145
).to_executorch()
147146
```
@@ -184,6 +183,7 @@ For more complex use cases, dynamic shape specification allows for mathematical
184183
Before integrating the runtime code, it is common to test the exported model from Python. This can be used to evaluate model accuracy and sanity check behavior before moving to the target device. Note that not all hardware backends are available from Python, as they may require specialized hardware to function. See the specific backend documentation for more information on hardware requirements and the availablilty of simulators. The XNNPACK delegate used in this example is always available on host machines.
185184

186185
```python
186+
import torch
187187
from executorch.runtime import Runtime
188188

189189
runtime = Runtime.get()
@@ -194,7 +194,17 @@ method = program.load_method("forward")
194194
outputs = method.execute([input_tensor])
195195
```
196196

197-
Pybindings currently does not support loading program and data. To run a model with PTE and PTD components, please use the [Extension Module](extension-module.md). There is also an E2E demo in [executorch-examples](https://github.com/meta-pytorch/executorch-examples/tree/main/program-data-separation).
197+
To run a model with program and data separated, please use the [ExecuTorch Module pybindings](https://github.com/pytorch/executorch/blob/main/extension/pybindings/README.md).
198+
```python
199+
import torch
200+
from executorch.extension.pybindings import portable_lib
201+
202+
input_tensor = torch.randn(1, 3, 32, 32)
203+
module = portable_lib._load_for_executorch("model.pte", "model.ptd")
204+
outputs = module.forward([input_tensor])
205+
```
206+
207+
There is also an E2E demo in [executorch-examples](https://github.com/meta-pytorch/executorch-examples/tree/main/program-data-separation).
198208

199209
For more information, see [Runtime API Reference](executorch-runtime-api-reference.md).
200210

0 commit comments

Comments
 (0)