|
18 | 18 |
|
19 | 19 | import torch
|
20 | 20 | from examples.devtools.scripts.export_bundled_program import save_bundled_program
|
21 |
| -from executorch.backends.arm.common.arm_compile_spec import ArmCompileSpec |
22 | 21 | from executorch.backends.arm.ethosu import EthosUCompileSpec, EthosUPartitioner
|
23 | 22 | from executorch.backends.arm.quantizer import (
|
24 | 23 | EthosUQuantizer,
|
@@ -387,7 +386,6 @@ def get_compile_spec(
|
387 | 386 | memory_mode: Optional[str] = None,
|
388 | 387 | quantize: bool = False,
|
389 | 388 | config: Optional[str] = None,
|
390 |
| - debug_mode: Optional[str] = None, |
391 | 389 | ) -> TosaCompileSpec | EthosUCompileSpec | VgfCompileSpec:
|
392 | 390 | compile_spec = None
|
393 | 391 | if target.startswith("TOSA"):
|
@@ -416,10 +414,6 @@ def get_compile_spec(
|
416 | 414 | if intermediates is not None:
|
417 | 415 | compile_spec.dump_intermediate_artifacts_to(intermediates)
|
418 | 416 |
|
419 |
| - if debug_mode is not None: |
420 |
| - mode = ArmCompileSpec.DebugMode[debug_mode.upper()] |
421 |
| - compile_spec.dump_debug_info(mode) |
422 |
| - |
423 | 417 | return compile_spec
|
424 | 418 |
|
425 | 419 |
|
@@ -607,12 +601,6 @@ def get_args():
|
607 | 601 | action="store_true",
|
608 | 602 | help="Enable the QuantizedOpFusionPass fusion step",
|
609 | 603 | )
|
610 |
| - parser.add_argument( |
611 |
| - "--enable_debug_mode", |
612 |
| - required=False, |
613 |
| - choices=["json", "tosa"], |
614 |
| - help="Flag to enable ATen-to-TOSA debug mode.", |
615 |
| - ) |
616 | 604 | args = parser.parse_args()
|
617 | 605 |
|
618 | 606 | if args.evaluate and (
|
@@ -747,7 +735,6 @@ def to_edge_TOSA_delegate(
|
747 | 735 | args.memory_mode,
|
748 | 736 | args.quantize,
|
749 | 737 | args.config,
|
750 |
| - args.enable_debug_mode, |
751 | 738 | )
|
752 | 739 |
|
753 | 740 | model_int8 = None
|
@@ -789,7 +776,6 @@ def to_edge_no_delegate(exported_program, args, model: torch.nn.Module, example_
|
789 | 776 | args.memory_mode,
|
790 | 777 | args.quantize,
|
791 | 778 | args.config,
|
792 |
| - args.enable_debug_mode, |
793 | 779 | )
|
794 | 780 | model, exported_program = quantize_model(
|
795 | 781 | args, model, example_inputs, compile_spec
|
@@ -838,21 +824,12 @@ def transform_for_cortex_m_backend(edge, args):
|
838 | 824 | exported_program = torch.export.export(
|
839 | 825 | model, example_inputs, strict=args.strict_export
|
840 | 826 | )
|
841 |
| - |
842 | 827 | model = exported_program.module()
|
843 | 828 | model_fp32 = model
|
844 | 829 |
|
845 |
| - model_name = os.path.basename(os.path.splitext(args.model_name)[0]) |
846 | 830 | if args.intermediates:
|
847 | 831 | os.makedirs(args.intermediates, exist_ok=True)
|
848 | 832 |
|
849 |
| - # We only support Python3.10 and above, so use a later pickle protocol |
850 |
| - torch.export.save( |
851 |
| - exported_program, |
852 |
| - f"{args.intermediates}/{model_name}_exported_program.pt2", |
853 |
| - pickle_protocol=5, |
854 |
| - ) |
855 |
| - |
856 | 833 | # Quantize if required
|
857 | 834 | model_int8 = None
|
858 | 835 | if args.delegate:
|
@@ -885,6 +862,7 @@ def transform_for_cortex_m_backend(edge, args):
|
885 | 862 | else:
|
886 | 863 | raise e
|
887 | 864 |
|
| 865 | + model_name = os.path.basename(os.path.splitext(args.model_name)[0]) |
888 | 866 | output_name = f"{model_name}" + (
|
889 | 867 | f"_arm_delegate_{args.target}"
|
890 | 868 | if args.delegate is True
|
|
0 commit comments