Skip to content

Commit 32d8cf9

Browse files
committed
test
1 parent 751e646 commit 32d8cf9

File tree

2 files changed

+58
-57
lines changed

2 files changed

+58
-57
lines changed

backends/apple/coreml/scripts/install_requirements.sh

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -5,58 +5,58 @@
55
# This source code is licensed under the BSD-style license found in the
66
# LICENSE file in the root directory of this source tree.
77

8-
SCRIPT_DIR_PATH="$(
9-
cd -- "$(dirname "$0")" >/dev/null 2>&1
10-
pwd -P
11-
)"
12-
13-
# TODO(jathu): remove the need to fetch coremltools to build deps for coreml_executor_runner.
14-
# Keep this version in sync with: pyproject.toml
15-
COREMLTOOLS_VERSION="8.1"
16-
17-
red=`tput setaf 1`
18-
green=`tput setaf 2`
19-
20-
EXECUTORCH_ROOT_PATH=$(realpath "$SCRIPT_DIR_PATH/../../../../")
21-
COREML_DIR_PATH="$EXECUTORCH_ROOT_PATH/backends/apple/coreml"
22-
COREMLTOOLS_DIR_PATH="$COREML_DIR_PATH/third-party/coremltools"
23-
PROTOBUF_FILES_DIR_PATH="$COREMLTOOLS_DIR_PATH/build/mlmodel/format/"
24-
25-
cd "$EXECUTORCH_ROOT_PATH"
26-
27-
rm -rf "$COREML_DIR_PATH/third-party"
28-
mkdir "$COREML_DIR_PATH/third-party"
29-
30-
echo "${green}ExecuTorch: Cloning coremltools."
31-
git clone --depth 1 --branch "${COREMLTOOLS_VERSION}" "https://github.com/apple/coremltools.git" $COREMLTOOLS_DIR_PATH
32-
cd $COREMLTOOLS_DIR_PATH
33-
34-
STATUS=$?
35-
if [ $STATUS -ne 0 ]; then
36-
echo "${red}ExecuTorch: Failed to clone coremltools."
37-
exit 1
38-
fi
39-
40-
echo "${green}ExecuTorch: Installing coremltools dependencies."
41-
pip install -r "$COREMLTOOLS_DIR_PATH/reqs/build.pip"
42-
STATUS=$?
43-
if [ $STATUS -ne 0 ]; then
44-
echo "${red}ExecuTorch: Failed to install coremltools dependencies."
45-
exit 1
46-
fi
47-
48-
mkdir "$COREMLTOOLS_DIR_PATH/build"
49-
cmake -S "$COREMLTOOLS_DIR_PATH" -B "$COREMLTOOLS_DIR_PATH/build"
50-
cmake --build "$COREMLTOOLS_DIR_PATH/build" --parallel --target mlmodel
51-
52-
echo "${green}ExecuTorch: Cloning nlohmann."
53-
git clone https://github.com/nlohmann/json.git "$COREML_DIR_PATH/third-party/nlohmann_json"
54-
STATUS=$?
55-
if [ $STATUS -ne 0 ]; then
56-
echo "${red}ExecuTorch: Failed to clone nlohmann."
57-
exit 1
58-
fi
59-
60-
echo "${green}ExecuTorch: Copying protobuf files."
61-
mkdir -p "$COREML_DIR_PATH/runtime/sdk/format/"
62-
cp -rf "$PROTOBUF_FILES_DIR_PATH" "$COREML_DIR_PATH/runtime/sdk/format/"
8+
# SCRIPT_DIR_PATH="$(
9+
# cd -- "$(dirname "$0")" >/dev/null 2>&1
10+
# pwd -P
11+
# )"
12+
13+
# # TODO(jathu): remove the need to fetch coremltools to build deps for coreml_executor_runner.
14+
# # Keep this version in sync with: pyproject.toml
15+
# COREMLTOOLS_VERSION="8.1"
16+
17+
# red=`tput setaf 1`
18+
# green=`tput setaf 2`
19+
20+
# EXECUTORCH_ROOT_PATH=$(realpath "$SCRIPT_DIR_PATH/../../../../")
21+
# COREML_DIR_PATH="$EXECUTORCH_ROOT_PATH/backends/apple/coreml"
22+
# COREMLTOOLS_DIR_PATH="$COREML_DIR_PATH/third-party/coremltools"
23+
# PROTOBUF_FILES_DIR_PATH="$COREMLTOOLS_DIR_PATH/build/mlmodel/format/"
24+
25+
# cd "$EXECUTORCH_ROOT_PATH"
26+
27+
# rm -rf "$COREML_DIR_PATH/third-party"
28+
# mkdir "$COREML_DIR_PATH/third-party"
29+
30+
# echo "${green}ExecuTorch: Cloning coremltools."
31+
# git clone --depth 1 --branch "${COREMLTOOLS_VERSION}" "https://github.com/apple/coremltools.git" $COREMLTOOLS_DIR_PATH
32+
# cd $COREMLTOOLS_DIR_PATH
33+
34+
# STATUS=$?
35+
# if [ $STATUS -ne 0 ]; then
36+
# echo "${red}ExecuTorch: Failed to clone coremltools."
37+
# exit 1
38+
# fi
39+
40+
# echo "${green}ExecuTorch: Installing coremltools dependencies."
41+
# pip install -r "$COREMLTOOLS_DIR_PATH/reqs/build.pip"
42+
# STATUS=$?
43+
# if [ $STATUS -ne 0 ]; then
44+
# echo "${red}ExecuTorch: Failed to install coremltools dependencies."
45+
# exit 1
46+
# fi
47+
48+
# mkdir "$COREMLTOOLS_DIR_PATH/build"
49+
# cmake -S "$COREMLTOOLS_DIR_PATH" -B "$COREMLTOOLS_DIR_PATH/build"
50+
# cmake --build "$COREMLTOOLS_DIR_PATH/build" --parallel --target mlmodel
51+
52+
# echo "${green}ExecuTorch: Cloning nlohmann."
53+
# git clone https://github.com/nlohmann/json.git "$COREML_DIR_PATH/third-party/nlohmann_json"
54+
# STATUS=$?
55+
# if [ $STATUS -ne 0 ]; then
56+
# echo "${red}ExecuTorch: Failed to clone nlohmann."
57+
# exit 1
58+
# fi
59+
60+
# echo "${green}ExecuTorch: Copying protobuf files."
61+
# mkdir -p "$COREML_DIR_PATH/runtime/sdk/format/"
62+
# cp -rf "$PROTOBUF_FILES_DIR_PATH" "$COREML_DIR_PATH/runtime/sdk/format/"

examples/apple/coreml/scripts/build_executor_runner.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ cmake "$EXECUTORCH_ROOT_PATH" -B"$CMAKE_BUILD_DIR_PATH" \
4242
-DCOREML_BUILD_EXECUTOR_RUNNER=ON \
4343
-DCMAKE_MACOSX_BUNDLE=OFF
4444

45-
cmake --build "$CMAKE_BUILD_DIR_PATH" -j9 -t coremldelegate
46-
cmake --build "$CMAKE_BUILD_DIR_PATH" -j9 -t etdump -t flatccrt
45+
core_count=$(sysctl -n hw.ncpu)
46+
cmake --build "$CMAKE_BUILD_DIR_PATH" -j$(core_count) -t coremldelegate
47+
cmake --build "$CMAKE_BUILD_DIR_PATH" -j$(core_count) -t etdump -t flatccrt
4748

4849
# Copy CoreML delegate headers
4950
echo "ExecuTorch: Copying headers"

0 commit comments

Comments
 (0)