Skip to content

Commit 53ce792

Browse files
committed
coreml io
1 parent a17b59b commit 53ce792

File tree

5 files changed

+9
-3
lines changed

5 files changed

+9
-3
lines changed

backends/apple/coreml/compiler/coreml_preprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ def preprocess(
446446
config = cto.coreml.OptimizationConfig(
447447
global_config=op_linear_quantizer_config,
448448
# skip embedding
449-
op_type_configs={"gather": None},
449+
# op_type_configs={"gather": None},
450450
)
451451
mlmodel = cto.coreml.linear_quantize_weights(mlmodel, config=config)
452452

backends/apple/coreml/partition/coreml_partitioner.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def __init__(
3737

3838
def is_node_supported(self, submodules, node: torch.fx.Node) -> bool:
3939
# get_attr node can always be supported on any backend
40+
breakpoint()
4041
if node.op == "get_attr":
4142
return True
4243
# check if the PyTorch op get called is supported in Core ML
@@ -75,6 +76,7 @@ def __init__(
7576
def partition(self, exported_program: ExportedProgram) -> PartitionResult:
7677
# Run the CapabilityBasedPartitioner to return the largest possible
7778
# subgraphs containing the nodes with the tags
79+
breakpoint()
7880
logger.info("CoreMLPartitioner::partition")
7981
partition_tags = {}
8082

examples/apple/coreml/scripts/export.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,12 @@ def main():
175175
edge_program_manager = exir.to_edge(exir_program_aten)
176176
edge_copy = copy.deepcopy(edge_program_manager)
177177
partitioner = CoreMLPartitioner(
178-
skip_ops_for_coreml_delegation=None, compile_specs=compile_specs
178+
skip_ops_for_coreml_delegation=["linear.bias", "linear.weight"],
179+
compile_specs=compile_specs,
179180
)
181+
180182
delegated_program_manager = edge_program_manager.to_backend(partitioner)
183+
breakpoint()
181184
exec_program = delegated_program_manager.to_executorch(
182185
config=exir.ExecutorchBackendConfig(extract_delegate_segments=True)
183186
)

exir/backend/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def tag_constant_data(edge_program: ExportedProgram) -> None:
380380
)
381381
# tag the data node with the same tag as the last user
382382
if len(user_tags) > 0:
383-
node.meta["delegation_tag"] = user_tags.pop()
383+
node.meta["delegation_tag"] = None # user_tags.pop()
384384

385385

386386
def tag_mutated_buffer(edge_program: ExportedProgram) -> None:

exir/program/_program.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,7 @@ def to_backend(
12791279
EdgeProgramManager: A copy of the calling EdgeProgramManager with the
12801280
specified subgraphs lowered.
12811281
"""
1282+
breakpoint()
12821283
new_edge_programs: Dict[str, ExportedProgram] = {}
12831284
if isinstance(partitioner, dict):
12841285
for name, program in self._edge_programs.items():

0 commit comments

Comments
 (0)