Releases: pytorch/executorch
Releases · pytorch/executorch
stable-2023-09-19
New models enabled (e2e tested via portable lib):
- Emformer RNN-T Transcriber, Predictor, Joiner (as three modules)
Quantization:
- Enabled quantization for incpetion_v4 and deeplab_v3 in examples with XNNPACKQuantizer
API changes:
- Runtime API
- Many runtime APIs changed to improve ergonomics and to better match the style guide. Most of these changes are non-breaking (unless indicated as breaking), since the old APIs are available but marked as deprecated. We recommend that users migrate off of the deprecated APIs before the next release.
- For an example of how these API changes affected common use cases, see the edits made to
examples/executor_runner/executor_runner.cppunder the "Files changed" tab of stable-2023-09-12...78f884f
- For an example of how these API changes affected common use cases, see the edits made to
- Breaking behavioral change:
MethodMetaMethodMeta::num_non_const_buffersandMethodMeta::non_const_buffer_sizeno longer require adjusting by 1 to skip over the reserved zero index. This will require that users ofMethodMetaremove adjustments while counting and iterating over non-const buffers.- Details about the change, including migration to adapt to the new behavior: 5762802
- Also note that these methods have been renamed to
num_memory_planned_buffersandmemory_planned_buffer_size(see note below) - Note that the deprecated
Program::num_non_const_buffersandProgram::get_non_const_buffer_sizemethods did not change behavior re: skipping index zero. But they are deprecated, and will be removed in a future release, so we recommend that users migrate to theMethodMetaAPI and behavior.
MethodMetamethod names changed fromnon_const to memory_plannedMethodMeta::num_non_const_buffers()is nowMethodMeta::num_memory_planned_buffers()MethodMeta::non_const_buffer_size(N)is nowMethodMeta::memory_planned_buffer_size(N)- Changed in 6944c45
- The old names are available but deprecated, and will be removed in a future release
- Breaking code-compatibility change:
Method's constructor andinit()method are now private- Users should not have used these methods;
Methodinstances should only be created byProgram::load_method() - Changed in 4f3e5e6
- Users should not have used these methods;
MemoryManagerconstructor no longer requiresconst_allocatororkernel_temporary_allocator- A new constructor lets users avoid creating zero-sized allocators that they don't use
- It also renames the parameters for the remaining allocators to make their uses more clear
- Changed in 6944c45
- Example migration to the new constructor: fedc04c
- The old constructor is available but deprecated, and will be removed in a future release
- Breaking code-compatibility change:
MemoryManageris now final and cannot be subclassed- Changed in 6944c45
HierarchicalAllocator's constructor now takes an array ofSpan<uint8_t>instead of an array ofMemoryAllocator- Breaking code-compatibility change:
HierarchicalAllocatoris nowfinaland cannot be subclassed- Changed in 58c8c92
Program::Load()renamed toProgram::load()- Changed in 8a5f3e8
- The old name is still available but deprecated, and will be removed in a future release
FileDataLoader::From()renamed toFileDataLoader::from()- Changed in e2dd0be
- The old name is still available but deprecated, and will be removed in a future release
MmapDataLoader::From()renamed toMmapDataLoader::from()- Changed in 395e51a
- The old name is still available but deprecated, and will be removed in a future release
- Many runtime APIs changed to improve ergonomics and to better match the style guide. Most of these changes are non-breaking (unless indicated as breaking), since the old APIs are available but marked as deprecated. We recommend that users migrate off of the deprecated APIs before the next release.
- Delegate API
- File rename:
runtime/backend/backend_registry.cpp->runtime/backend/interface.cpp - Partition API update: Partitioner.partition function takes
ExportedPrograminstead oftorch.nn.GraphModule. With this change we access the parameters and buffer in partition function.- How to rebase: access graphmodule by
exported_program.graph_module
- How to rebase: access graphmodule by
- File rename:
- SDK
- BundledProgram updates APIs to enable user bundling test cases on specific method by using method name instead of method id in the past
-
AOT: class
BundledConfig (method_names: List[str], inputs: List[List[Any]], expected_outputs: List[List[Any]]).method_namesis the new added attribute. -
Runtime: Replace the original method_idx with method_name
- API for load bundled test input to ET program:
__ET_NODISCARD Error LoadBundledInput( Method& method, serialized_bundled_program* bundled_program_ptr, MemoryAllocator* memory_allocator, const char* method_name, size_t testset_idx); - API for verify result with bundled expected output:
__ET_NODISCARD Error VerifyResultWithBundledExpectedOutput( Method& method, serialized_bundled_program* bundled_program_ptr, MemoryAllocator* memory_allocator, const char* method_name, size_t testset_idx, double rtol = 1e-5, double atol = 1e-8);
- API for load bundled test input to ET program:
-
Details and examples can be found https://github.com/pytorch/executorch/blob/stable/docs/website/docs/tutorials/bundled_program.md
-
- BundledProgram updates APIs to enable user bundling test cases on specific method by using method name instead of method id in the past
Bug Fixes:
- When exporting with enable_aot=True, all constant tensors will be lifted as inputs to the graph (in addition to the parameters and buffers).
- Kwargs are now consistently placed in the call_spec of the exported program.
stable-2023-09-12
New models enabled (e2e tested via portable lib):
- MobileBert
Export API
- Two stage export API
- We are in the process of moving away from
exir.capture(): Please refer to this issue #290 for more details. Also look at the updated doc at https://github.com/pytorch/executorch/blob/stable/docs/website/docs/tutorials/exporting_to_executorch.md
- We are in the process of moving away from
exir.serialize- The
exir.serializemodule was renamed toexir._serializeand is now private
- The
transform()- For perform passes on the same dialect, use transform()
Runtime API
- Method
- Added
set_output_data_ptr(), which is a simpler and safer way to set the output buffers if they were not memory-planned Program::load_method()now accepts an optionalEventTracerparameter for non-global profiling and event data collection
- Added
Delegation API
backend.init()andbackend.execute()API changes.BackendInitContextis a new added argument forbackend.initandBackendExecutionContextis the new added argument forbackend.execute().- How to rebase on these apis changes?
- For backend.init, if
runtime_allocatoris not used, just mark context is not used with__ET_UNUSED. Otherwise,runtime_allocatorcan be accessed from the context. - For backend.execute, nothing has been added to
contextyet, just mark it with__ET_UNUSEDdirectly. We’ll add event tracer for profiling viacontextsoon.
- For backend.init, if
backend.preprocess()API changes- Updated backend.preprocess:
def preprocess( edge_program: ExportedProgram, compile_specs: List[CompileSpec], ) -> PreprocessResult
- How to rebase on this API changes?
- Wrap the result like
PreprocessResult(processed_bytes=bytes)
- Wrap the result like
- Updated backend.preprocess:
- Partitioner.partition API changes
- Updated Partition class definition. Move partition_tags from class attribute to be part of the
ParititionResult.def partition(self, graph_module: GraphModule) -> PartitionResult
- How to rebase on this API change?
- Wrap both
partition_tagsand thetagged_graphtogether asPartitionResult
- Wrap both
- Updated Partition class definition. Move partition_tags from class attribute to be part of the
- Example Quantizer and Delegate e2e demo
- Added an example to show to add a quantizer and have it working with delegate to fully delegated a quantized MobileNetV2 model to the example backend.
XnnpackDelegate
- In an effort to align better with the rest of the Executorch AoT stack, XnnpackDelegate added preliminary support to also handle graphs exported with the canonical capture config (i.e. CaptureConfig.enable_aot=True and CaptureConfig._unlift=False)
SDK
- DelegateMappingBuilder to generate debug handle mapping AOT for delegates
- BundledProgram enabled for usage with examples (more API changes to come in subsequent releases to improve usability, these will be breaking API changes)** **
- Documentation:
- Example code pointers:
Misc
- Linter enabled
pytestenabled. Rerunpip install .to installpytestand other deps- gtest enabled via buck, for example, run gtest for
runtime/core/tmp/buck2 test runtime/core/test/…
- Index operator rewrite:
- Fixed bug related to null indices.
- Implemented full Numpy’s advanced indexing functionality (now it is possible to use multidimensional indices, and masks that only index a subspace).
- Build/CMake
- CMake release build mode with size optimization flags. We have an example in
examples/selective_build/test_selective_build.sh
- CMake release build mode with size optimization flags. We have an example in
stable-2023-08-29
New models enabled (e2e tested via portable lib):
- Wav2Letter
- Inception V3 and Inception V4
- Resnet18 and Resnet50
Quantization:
- Enabled E2E MobileNet V2:
- Model can be quantized and run with portable + quantized op (for quantize/dequantize ops) lib.
Follow, https://github.com/pytorch/executorch/blob/main/examples/README.md#quantization, to run a quantized model via portable lib.
- Model can be quantized and run with portable + quantized op (for quantize/dequantize ops) lib.
- MobileNet V3:
- Needs bumping up the pytorch nightly version (dev20230828) in order to enable MobileNet V3 quantization. However, this breaks ViT export, hence this cut will skip MobileNet V3 quantization until we resolve ViT export breakage.
Delegation:
- API update:
- [breaking changes] delegate AOT APIs are moved from
executorch/backends/toexecutorch/exir/backend. To address the breakage: Updatefrom executorch.backends.backend_detailstofrom executorch.exir.backend.backend_details, andfrom executorch.backends.backend_apitofrom executorch.exir.backend.backend_api
- [breaking changes] delegate AOT APIs are moved from
- XNNPACK:
- XNNPACK delegated models can run on Mac/Linux in OSS
- XNNPACK lowering workflow examples have been added for MobileNet V2 (with quantization and delegation) and MobileNet V3 (with delegation)
- Showcase preliminary XNNPACK perf stats on Linux x86 & Mac M1
Selective build:
- Added buck2 examples to demonstrate 3 APIs to do selective build on any executorch runtime build
- Run test_selective_build.sh
stable-2023-08-15
- New models in example folder:
- Torchvision ViT. Run the example from
executorchdir:python3 -m examples.export.export_example --model_name="vit"buck2 run //examples/executor_runner:executor_runner -- --model_path vit.pte
- Torchvision ViT. Run the example from
- Quantization workflow example added and validated to work with MV2:
python3 -m examples.quantization.example --model_name mv2
- CMake build:
- executor_runner can be built via cmake. See cmake_build_system.md.
- Custom ops:
- Add examples to register custom ops into EXIR and Executorch runtime.
- Note: buck2 in test_custom_ops.sh should point to installed buck2 if it is not accessible in system’s PATH
stable-2023-08-01
Initial release to early users.