|
11 | 11 |
|
12 | 12 | import torch._export as export
|
13 | 13 |
|
14 |
| -from executorch.backends.xnnpack.partition.xnnpack_partitioner import ( |
15 |
| - XnnpackFloatingPointPartitioner, |
16 |
| - XnnpackQuantizedPartitioner, |
17 |
| -) |
18 |
| -from executorch.exir import CaptureConfig, EdgeCompileConfig |
| 14 | +from executorch.backends.xnnpack.partition.xnnpack_partitioner import XnnpackPartitioner |
| 15 | +from executorch.exir import EdgeCompileConfig |
19 | 16 | from executorch.exir.backend.backend_api import to_backend
|
20 |
| -from executorch.exir.backend.canonical_partitioners.duplicate_dequant_node_pass import ( |
21 |
| - DuplicateDequantNodePass, |
22 |
| -) |
23 | 17 |
|
24 | 18 | from ..export.utils import export_to_edge, save_pte_program
|
25 | 19 |
|
|
81 | 75 | # pre-autograd export. eventually this will become torch.export
|
82 | 76 | model = export.capture_pre_autograd_graph(model, example_inputs)
|
83 | 77 |
|
84 |
| - partitioner = XnnpackFloatingPointPartitioner |
85 | 78 | if args.quantize:
|
86 | 79 | logging.info("Quantizing Model...")
|
87 | 80 | model = quantize(model, example_inputs)
|
88 |
| - # TODO(T161849167): Partitioner will eventually be a single partitioner for both fp32 and quantized models |
89 |
| - partitioner = XnnpackQuantizedPartitioner |
90 |
| - |
91 |
| - capture_config = CaptureConfig(enable_aot=True) |
92 | 81 |
|
93 | 82 | edge = export_to_edge(
|
94 | 83 | model,
|
95 | 84 | example_inputs,
|
96 | 85 | edge_compile_config=EdgeCompileConfig(
|
97 |
| - # TODO(T162080278): Duplicated Dequant nodes will be in quantizer spec |
98 |
| - _check_ir_validity=False |
99 |
| - if args.quantize |
100 |
| - else True, |
| 86 | + _check_ir_validity=False if args.quantize else True, |
101 | 87 | ),
|
102 | 88 | )
|
103 | 89 | logging.info(f"Exported graph:\n{edge.exported_program.graph}")
|
104 | 90 |
|
105 |
| - edge.exported_program = to_backend( |
106 |
| - edge.transform(DuplicateDequantNodePass()).exported_program, partitioner |
107 |
| - ) |
| 91 | + edge.exported_program = to_backend(edge.exported_program, XnnpackPartitioner) |
108 | 92 | logging.info(f"Lowered graph:\n{edge.exported_program.graph}")
|
109 | 93 |
|
110 | 94 | exec_prog = edge.to_executorch()
|
|
0 commit comments