Skip to content

Commit a23e4d9

Browse files
committed
coreml io
1 parent 1972e69 commit a23e4d9

File tree

7 files changed

+24
-4
lines changed

7 files changed

+24
-4
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

examples/apple/coreml/executor_runner/main.mm

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
#import <numeric>
1919
#import <string>
2020

21+
// #import <iostream>
22+
// #import <executorch/extension/evalue_util/print_evalue.h>
23+
2124
static inline id check_class(id obj, Class cls) {
2225
return [obj isKindOfClass:cls] ? obj : nil;
2326
}
@@ -393,6 +396,17 @@ int main(int argc, char * argv[]) {
393396

394397
dump_etdump_gen(etdump_gen.get(), debug_buffer, args);
395398

399+
for (size_t i = 0; i < method->outputs_size(); i++) {
400+
auto tensor = outputs[i].toTensor();
401+
NSLog(@"tensor[%zu] sizes=", i);
402+
for (size_t j = 0; j < tensor.sizes().size(); j++) {
403+
NSLog(@" %d,", tensor.sizes()[j]);
404+
}
405+
}
406+
// std::cout << executorch::extension::evalue_edge_items(100);
407+
// for (int i = 0; i < method->outputs_size(); i++) {
408+
// std::cout << "Output " << i << ": " << outputs[i] << std::endl;
409+
// }
396410
return EXIT_SUCCESS;
397411
}
398412
}

examples/apple/coreml/scripts/build_executor_runner.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ rm -rf "$CMAKE_BUILD_DIR_PATH"
2929
# Build executorch
3030
echo "ExecuTorch: Building executorch"
3131
cmake "$EXECUTORCH_ROOT_PATH" -B"$CMAKE_BUILD_DIR_PATH" \
32-
-DCMAKE_BUILD_TYPE=Release \
32+
-DCMAKE_BUILD_TYPE=Debug \
3333
-DCMAKE_TOOLCHAIN_FILE="$IOS_TOOLCHAIN_PATH" \
3434
-DPLATFORM=MAC_UNIVERSAL \
3535
-DDEPLOYMENT_TARGET=13.0 \

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+
breakpoint()
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
)

examples/models/llama/export_llama_lib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,7 @@ def _load_llama_model(
825825
output_prune_map_path=output_prune_map_path,
826826
args=args,
827827
)
828+
breakpoint()
828829
if dtype_override:
829830
assert isinstance(
830831
dtype_override, DType

exir/backend/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,8 @@ 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+
breakpoint()
384+
node.meta["delegation_tag"] = None # user_tags.pop()
384385

385386

386387
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)