|
| 1 | +<!--Copyright 2024 The HuggingFace Team. All rights reserved. |
| 2 | + |
| 3 | +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
| 4 | +the License. You may obtain a copy of the License at |
| 5 | + |
| 6 | +http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | + |
| 8 | +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
| 9 | +an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| 10 | +specific language governing permissions and limitations under the License. |
| 11 | +--> |
| 12 | + |
| 13 | +# Configuration for ExecuTorch Export |
| 14 | + |
| 15 | +ExecuTorch export provides a flexible configuration mechanism through dynamic registration, enabling users to have |
| 16 | +complete control over the export process. The configuration system is divided into task configurations and recipe |
| 17 | +configurations, each addressing specific aspects of the export pipeline. |
| 18 | + |
| 19 | + |
| 20 | +## Task Configurations |
| 21 | + |
| 22 | +Task configurations determine how a Hugging Face model should be loaded and prepared for export, tailored to specific tasks. |
| 23 | + |
| 24 | +For instance, when exporting a model for a text generation task, the provided configuration utilizes **static caching** and |
| 25 | +**SDPA (Scaled Dot-Product Attention)** for inference optimization. |
| 26 | + |
| 27 | +By leveraging task configurations, users can ensure that their models are appropriately prepared for efficient execution on |
| 28 | +the ExecuTorch backend. |
| 29 | + |
| 30 | +[[autodoc]] exporters.executorch.task_registry.discover_tasks |
| 31 | + |
| 32 | +[[autodoc]] exporters.executorch.task_registry.register_task |
| 33 | + |
| 34 | +[[autodoc]] exporters.executorch.tasks.causal_lm.load_causal_lm_model |
| 35 | + |
| 36 | + |
| 37 | +## Recipe Configurations |
| 38 | + |
| 39 | +Recipe configurations control the specifics of lowering an eager PyTorch module to the ExecuTorch backend. These |
| 40 | +configurations allow users to: |
| 41 | + |
| 42 | +- Specify whether and how to **quantize** the model. |
| 43 | +- Delegate computation to various accelerators, such as **CPU**, **GPU**, **NPU**, **DSP**, and others. |
| 44 | +- Define **custom transformation passes**. |
| 45 | +- Implement advanced techniques like memory planning algorithms to optimize resource utilization. |
| 46 | + |
| 47 | +[[autodoc]] exporters.executorch.recipe_registry.discover_recipes |
| 48 | + |
| 49 | +[[autodoc]] exporters.executorch.recipe_registry.register_recipe |
| 50 | + |
| 51 | +[[autodoc]] exporters.executorch.recipes.xnnpack.export_to_executorch_with_xnnpack |
| 52 | + |
| 53 | +The combination of task and recipe configurations ensures that users can customize both the high-level task setup |
| 54 | +and the low-level export details to suit their deployment requirements. |
0 commit comments