File tree 8 files changed +14
-91
lines changed
examples/apple/coreml/scripts
8 files changed +14
-91
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ runtime.python_library(
23
23
],
24
24
deps = [
25
25
"fbsource//third-party/pypi/coremltools:coremltools",
26
- ":executorchcoreml ",
26
+ ":inmemoryfs_pybinding ",
27
27
"//executorch/exir/backend:backend_details",
28
28
"//executorch/exir/backend:compile_spec_schema",
29
29
],
@@ -59,7 +59,7 @@ runtime.python_library(
59
59
)
60
60
61
61
runtime.cxx_python_extension(
62
- name = "executorchcoreml ",
62
+ name = "inmemoryfs_pybinding ",
63
63
srcs = [
64
64
"runtime/inmemoryfs/inmemory_filesystem.cpp",
65
65
"runtime/inmemoryfs/inmemory_filesystem_py.cpp",
@@ -80,7 +80,7 @@ runtime.cxx_python_extension(
80
80
"-Iexecutorch/backends/apple/coreml/runtime/util",
81
81
],
82
82
types = [
83
- "executorchcoreml .pyi",
83
+ "inmemoryfs .pyi",
84
84
],
85
85
visibility = [
86
86
"//executorch/examples/apple/coreml/...",
Original file line number Diff line number Diff line change 16
16
17
17
import coremltools as ct
18
18
import coremltools .optimize as cto
19
- import executorchcoreml
20
19
20
+ from executorch .backends .apple .coreml import inmemoryfs
21
21
from executorch .exir .backend .backend_details import (
22
22
BackendDetails ,
23
23
ExportedProgram ,
@@ -385,8 +385,7 @@ def preprocess_model(
385
385
)
386
386
387
387
processed_bytes : bytes = (
388
- executorchcoreml .flatten_directory_contents (str (model_dir_path .resolve ()))
389
- or b""
388
+ inmemoryfs .flatten_directory_contents (str (model_dir_path .resolve ())) or b""
390
389
)
391
390
392
391
debug_handle_map : Optional [Dict [str , Tuple [int ]]] = None
File renamed without changes.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -62,8 +62,6 @@ if [ $STATUS -ne 0 ]; then
62
62
exit 1
63
63
fi
64
64
65
- sh " $COREML_DIR_PATH /scripts/install_inmemoryfs.sh"
66
-
67
65
echo " ${green} ExecuTorch: Copying protobuf files."
68
66
mkdir -p " $COREML_DIR_PATH /runtime/sdk/format/"
69
67
cp -rf " $PROTOBUF_FILES_DIR_PATH " " $COREML_DIR_PATH /runtime/sdk/format/"
Original file line number Diff line number Diff line change 10
10
11
11
from typing import List , Optional
12
12
13
- import executorchcoreml
14
-
13
+ from executorch .backends .apple .coreml import inmemoryfs
15
14
from executorch .backends .apple .coreml .compiler import CoreMLBackend
16
-
17
15
from executorch .exir ._serialize ._program import deserialize_pte_binary
18
-
19
16
from executorch .exir .schema import (
20
17
BackendDelegate ,
21
18
BackendDelegateDataReference ,
@@ -50,7 +47,7 @@ def extract_coreml_models(pte_data: bytes):
50
47
shutil .rmtree (model_path .absolute ())
51
48
os .makedirs (model_path .absolute ())
52
49
53
- if executorchcoreml .unflatten_directory_contents (
50
+ if inmemoryfs .unflatten_directory_contents (
54
51
coreml_processed_bytes , str (model_path .absolute ())
55
52
):
56
53
print (f"Core ML models are extracted and saved to path = { model_path } " )
Original file line number Diff line number Diff line change @@ -680,6 +680,12 @@ def run(self):
680
680
# add entries like `-DEXECUTORCH_BUILD_XNNPACK=ON` to the CMAKE_ARGS
681
681
# environment variable.
682
682
683
+ if ShouldBuild .coreml ():
684
+ cmake_args += [
685
+ "-DEXECUTORCH_BUILD_COREML=ON" ,
686
+ ]
687
+ build_args += ["--target" , "coreml_inmemoryfs_pybinding" ]
688
+
683
689
if ShouldBuild .llama_custom_ops ():
684
690
cmake_args += [
685
691
"-DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON" , # add llama sdpa ops to pybindings.
@@ -786,7 +792,7 @@ def get_ext_modules() -> List[Extension]:
786
792
]
787
793
)
788
794
789
- if ShouldBuild .pybindings () or ShouldBuild . coreml ():
795
+ if ShouldBuild .coreml ():
790
796
ext_modules .append (
791
797
BuiltExtension (
792
798
src = "coreml_inmemoryfs_pybinding.*" ,
You can’t perform that action at this time.
0 commit comments