Skip to content

Commit 372da45

Browse files
committed
Update
[ghstack-poisoned]
2 parents 4265c31 + ca4c14e commit 372da45

File tree

83 files changed

+725
-274
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+725
-274
lines changed

.ci/scripts/build_llama_android.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ set -exu
1010
# shellcheck source=/dev/null
1111
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1212

13+
if [[ -z "${PYTHON_EXECUTABLE:-}" ]]; then
14+
PYTHON_EXECUTABLE=python3
15+
fi
16+
which "${PYTHON_EXECUTABLE}"
17+
CMAKE_PREFIX_PATH="$(python3 -c 'import torch as _; print(_.__path__[0])')"
18+
1319
install_executorch_and_backend_lib() {
1420
echo "Installing executorch and xnnpack backend"
1521
clean_executorch_install_folders
@@ -22,6 +28,7 @@ install_executorch_and_backend_lib() {
2228
-DANDROID_ABI="${ANDROID_ABI}" \
2329
-DCMAKE_INSTALL_PREFIX=cmake-android-out \
2430
-DCMAKE_BUILD_TYPE=Release \
31+
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
2532
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
2633
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
2734
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
@@ -47,6 +54,7 @@ build_llama_runner() {
4754
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
4855
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
4956
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \
57+
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
5058
-Bcmake-android-out/examples/models/llama examples/models/llama
5159

5260
cmake --build cmake-android-out/examples/models/llama -j4 --config Release

.ci/scripts/test_llama.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ cmake_install_executorch_libraries() {
154154
rm -rf cmake-out
155155
retry cmake \
156156
-DCMAKE_INSTALL_PREFIX=cmake-out \
157+
-DCMAKE_PREFIX_PATH="$(python3 -c 'import torch as _; print(_.__path__[0])')" \
157158
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \
158159
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
159160
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \

.ci/scripts/test_llava.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ fi
3030
NPROC=8
3131
if hash nproc &> /dev/null; then NPROC=$(nproc); fi
3232

33+
python_lib=$($PYTHON_EXECUTABLE -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')
34+
CMAKE_PREFIX_PATH="$(python3 -c 'import torch as _; print(_.__path__[0])')"
3335
EXECUTORCH_COMMON_CMAKE_ARGS=" \
3436
-DCMAKE_INSTALL_PREFIX=${BUILD_DIR} \
35-
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
37+
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
3638
-DEXECUTORCH_ENABLE_LOGGING=ON \
3739
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
3840
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
@@ -46,6 +48,7 @@ EXECUTORCH_COMMON_CMAKE_ARGS=" \
4648
cmake_install_executorch_libraries() {
4749
cmake \
4850
${EXECUTORCH_COMMON_CMAKE_ARGS} \
51+
"-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" \
4952
-B${BUILD_DIR} .
5053

5154
cmake --build ${BUILD_DIR} -j${NPROC} --target install --config ${CMAKE_BUILD_TYPE}
@@ -56,6 +59,7 @@ cmake_install_executorch_libraries_for_android() {
5659
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
5760
-DANDROID_ABI=arm64-v8a \
5861
${EXECUTORCH_COMMON_CMAKE_ARGS} \
62+
"-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" \
5963
-B${BUILD_DIR} .
6064

6165
cmake --build ${BUILD_DIR} -j${NPROC} --target install --config ${CMAKE_BUILD_TYPE}
@@ -76,7 +80,7 @@ cmake_build_llava_runner() {
7680

7781
cmake \
7882
${LLAVA_COMMON_CMAKE_ARGS} \
79-
-DCMAKE_PREFIX_PATH="$python_lib" \
83+
-DCMAKE_PREFIX_PATH="$python_lib;${CMAKE_PREFIX_PATH}" \
8084
-B${BUILD_DIR}/${dir} \
8185
${dir}
8286

@@ -92,7 +96,7 @@ cmake_build_llava_runner_for_android() {
9296
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
9397
-DANDROID_ABI=arm64-v8a \
9498
${LLAVA_COMMON_CMAKE_ARGS} \
95-
-DCMAKE_PREFIX_PATH="$python_lib" \
99+
-DCMAKE_PREFIX_PATH="$python_lib;${CMAKE_PREFIX_PATH}" \
96100
-DLLAVA_RUNNER_NO_TORCH_DUMMY_IMAGE=ON \
97101
-B${BUILD_DIR}/${dir} \
98102
${dir}

.ci/scripts/test_model.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ prepare_artifacts_upload() {
5050

5151
build_cmake_executor_runner() {
5252
echo "Building executor_runner"
53+
CMAKE_PREFIX_PATH="$(python3 -c 'import torch as _; print(_.__path__[0])')"
5354
rm -rf ${CMAKE_OUTPUT_DIR}
5455
cmake -DCMAKE_BUILD_TYPE=Debug \
5556
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
5657
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
58+
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
5759
-B${CMAKE_OUTPUT_DIR} .
5860

5961
cmake --build ${CMAKE_OUTPUT_DIR} -j4 --config Debug
@@ -98,8 +100,7 @@ test_model() {
98100

99101
build_cmake_xnn_executor_runner() {
100102
echo "Building xnn_executor_runner"
101-
SITE_PACKAGES="$(${PYTHON_EXECUTABLE} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
102-
CMAKE_PREFIX_PATH="${SITE_PACKAGES}/torch"
103+
CMAKE_PREFIX_PATH="$(python3 -c 'import torch as _; print(_.__path__[0])')"
103104

104105
(rm -rf ${CMAKE_OUTPUT_DIR} \
105106
&& mkdir ${CMAKE_OUTPUT_DIR} \

.ci/scripts/test_phi_3_mini.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ NPROC=8
2222
if hash nproc &> /dev/null; then NPROC=$(nproc); fi
2323

2424
cmake_install_executorch_libraries() {
25+
CMAKE_PREFIX_PATH="$(python3 -c 'import torch as _; print(_.__path__[0])')"
2526
cmake -DPYTHON_EXECUTABLE=python \
2627
-DCMAKE_INSTALL_PREFIX=${BUILD_DIR} \
28+
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
2729
-DEXECUTORCH_ENABLE_LOGGING=1 \
2830
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
2931
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
@@ -39,8 +41,10 @@ cmake_install_executorch_libraries() {
3941
}
4042

4143
cmake_build_phi_3_mini() {
44+
CMAKE_PREFIX_PATH="$(python3 -c 'import torch as _; print(_.__path__[0])')"
4245
cmake -DPYTHON_EXECUTABLE=$PYTHON_EXECUTABLE \
4346
-DCMAKE_INSTALL_PREFIX=${BUILD_DIR} \
47+
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
4448
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
4549
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \
4650
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \

.ci/scripts/utils.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ cmake_install_executorch_lib() {
136136
clean_executorch_install_folders
137137
retry cmake -DBUCK2="$BUCK" \
138138
-DCMAKE_INSTALL_PREFIX=cmake-out \
139+
-DCMAKE_PREFIX_PATH="$($PYTHON_EXECUTABLE -c 'import torch as _; print(_.__path__[0])')" \
139140
-DCMAKE_BUILD_TYPE=Release \
140141
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
141142
-Bcmake-out .

.github/scripts/propose_ghstack_orig_pr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def create_prs_for_orig_branch(pr_stack: List[int], repo: Repository):
101101
# gh/user/x/orig is the clean diff between gh/user/x/base <- gh/user/x/head
102102
orig_branch_merge_head = pr.base.ref.replace("base", "orig")
103103
bot_metadata = f"""This PR was created by the merge bot to help merge the original PR into the main branch.
104-
ghstack PR number: https://github.com/pytorch/executorch/pull/{pr.number}
104+
ghstack PR number: https://github.com/pytorch/executorch/pull/{pr.number} by @{pr.user.login}
105105
^ Please use this as the source of truth for the PR details, comments, and reviews
106106
ghstack PR base: https://github.com/pytorch/executorch/tree/{pr.base.ref}
107107
ghstack PR head: https://github.com/pytorch/executorch/tree/{pr.head.ref}

.github/workflows/android-perf.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ jobs:
222222
--preq_mode 8da4w_output_8da8w \
223223
--preq_group_size 32 \
224224
--max_seq_length 2048 \
225+
--max_context_length 2048 \
225226
--output_name "${OUT_ET_MODEL_NAME}.pte" \
226227
-kv \
227228
-d fp32 \
@@ -253,6 +254,7 @@ jobs:
253254
--xnnpack-extended-ops \
254255
-d fp32 \
255256
--max_seq_length 2048 \
257+
--max_context_length 2048 \
256258
--output_name "${OUT_ET_MODEL_NAME}.pte" \
257259
--metadata '{"get_bos_id":128000, "get_eos_ids":[128009, 128001]}'
258260
ls -lh "${OUT_ET_MODEL_NAME}.pte"

.github/workflows/apple-perf.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ jobs:
233233
--preq_mode 8da4w_output_8da8w \
234234
--preq_group_size 32 \
235235
--max_seq_length 2048 \
236+
--max_context_length 2048 \
236237
--output_name "${OUT_ET_MODEL_NAME}.pte" \
237238
-kv \
238239
-d fp32 \
@@ -264,6 +265,7 @@ jobs:
264265
--xnnpack-extended-ops \
265266
-d fp32 \
266267
--max_seq_length 2048 \
268+
--max_context_length 2048 \
267269
--output_name "${OUT_ET_MODEL_NAME}.pte" \
268270
--metadata '{"get_bos_id":128000, "get_eos_ids":[128009, 128001]}'
269271
ls -lh "${OUT_ET_MODEL_NAME}.pte"

.github/workflows/pull.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ jobs:
147147
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
148148
conda activate "${CONDA_ENV}"
149149
150+
source .ci/scripts/utils.sh
151+
install_executorch "use-pt-pinned-commit"
150152
BUILD_TOOL="cmake"
151153
PYTHON_EXECUTABLE=python \
152154
bash .ci/scripts/build_llama_android.sh "${BUILD_TOOL}"

0 commit comments

Comments
 (0)