Skip to content

Commit ced7e0f

Browse files
guangy10facebook-github-bot
authored andcommitted
Prohibit customize export config (#337)
Summary: More cleanup in `executorch/examples`. `_unlift` flag is removed for all models and all use-cases in examples, we can push to use canonical export config one step further. Not in this diff but `enable_aot` will be removed later together with `exir.capture()` Reviewed By: digantdesai Differential Revision: D49258936
1 parent dc009f8 commit ced7e0f

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

examples/export/utils.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
from executorch.exir.tracer import Value
1717

1818

19-
_CAPTURE_CONFIG = exir.CaptureConfig(enable_aot=True)
20-
21-
# TODO(T163721729): Enable IR check after decomposing div.Tensor_mode
19+
# Explicitly force the activation of the IR validator
2220
_EDGE_COMPILE_CONFIG = exir.EdgeCompileConfig(
2321
_check_ir_validity=False,
2422
)
@@ -27,14 +25,15 @@
2725
def _to_core_aten(
2826
model: torch.fx.GraphModule,
2927
example_inputs: Tuple[Value, ...],
30-
capture_config=_CAPTURE_CONFIG,
3128
) -> ExirExportedProgram:
3229
# post autograd export. eventually this will become .to_core_aten
3330
if not isinstance(model, torch.fx.GraphModule):
3431
raise ValueError(
3532
f"Expected passed in model to be an instance of fx.GraphModule, got {type(model)}"
3633
)
37-
core_aten_exir_ep = exir.capture(model, example_inputs, capture_config)
34+
core_aten_exir_ep = exir.capture(
35+
model, example_inputs, exir.CaptureConfig(enable_aot=True)
36+
)
3837
logging.info(f"Core ATen graph:\n{core_aten_exir_ep.exported_program.graph}")
3938
return core_aten_exir_ep
4039

@@ -51,17 +50,15 @@ def _core_aten_to_edge(
5150
def export_to_edge(
5251
model: torch.fx.GraphModule,
5352
example_inputs: Tuple[Value, ...],
54-
capture_config=_CAPTURE_CONFIG,
5553
edge_compile_config=_EDGE_COMPILE_CONFIG,
5654
) -> ExirExportedProgram:
57-
core_aten_exir_ep = _to_core_aten(model, example_inputs, capture_config)
55+
core_aten_exir_ep = _to_core_aten(model, example_inputs)
5856
return _core_aten_to_edge(core_aten_exir_ep, edge_compile_config)
5957

6058

6159
def export_to_exec_prog(
6260
model,
6361
example_inputs,
64-
capture_config=_CAPTURE_CONFIG,
6562
edge_compile_config=_EDGE_COMPILE_CONFIG,
6663
backend_config=None,
6764
):

0 commit comments

Comments
 (0)