diff --git a/.github/workflows/native_s3_pytorch_android.yml b/.github/workflows/native_s3_pytorch_android.yml index d16a8add873..1d2592497d2 100644 --- a/.github/workflows/native_s3_pytorch_android.yml +++ b/.github/workflows/native_s3_pytorch_android.yml @@ -10,8 +10,8 @@ jobs: matrix: format: ["armeabi-v7a", "arm64-v8a", "x86" ,"x86_64"] env: - PYTORCH_VERSION: "1.8.1" - NDK_VERSION: "20.0.5594570" + PYTORCH_VERSION: "1.11.0" + NDK_VERSION: "21.0.6113669" steps: - uses: actions/checkout@v2 - name: Set up JDK 11 @@ -19,9 +19,7 @@ jobs: with: java-version: 11 - name: Set up Python3 - uses: actions/setup-python@v1 - with: - python-version: '3.x' + uses: actions/setup-python@v3 - name: clone pytorch run: | git clone https://github.com/pytorch/pytorch android_pytorch_tmp -b "v${PYTORCH_VERSION}" --recursive @@ -34,7 +32,7 @@ jobs: export ANDROID_NDK=${ANDROID_SDK_ROOT}/ndk/${NDK_VERSION} export ANDROID_ABI=${{ matrix.format }} cd android_pytorch_tmp - bash ./scripts/build_android.sh + BUILD_LITE_INTERPRETER=0 ./scripts/build_android.sh cd build_android zip -r ${{ matrix.format }}_native.zip install/include lib - name: Configure AWS Credentials diff --git a/engines/pytorch/pytorch-native/build_android.sh b/engines/pytorch/pytorch-native/build_android.sh index 46dee3254cd..1618f1f659e 100755 --- a/engines/pytorch/pytorch-native/build_android.sh +++ b/engines/pytorch/pytorch-native/build_android.sh @@ -26,12 +26,15 @@ if [[ ! -d libtorch_android/"$FLAVOR" ]]; then fi fi +if [[ "$VERSION" =~ ^1\.10\..*|^1\.9\..* ]]; then + PT_OLD_VERSION=1 +fi pushd . rm -rf build mkdir build && cd build mkdir classes javac -sourcepath ../../pytorch-engine/src/main/java/ ../../pytorch-engine/src/main/java/ai/djl/pytorch/jni/PyTorchLibrary.java -h include -d classes -cmake -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK"/build/cmake/android.toolchain.cmake -DANDROID_ABI="$FLAVOR" -DANDROID_NATIVE_API_LEVEL=21 -DBUILD_ANDROID=ON .. +cmake -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK"/build/cmake/android.toolchain.cmake -DANDROID_ABI="$FLAVOR" -DANDROID_NATIVE_API_LEVEL=21 -DBUILD_ANDROID=ON -DPT_OLD_VERSION=${PT_OLD_VERSION} .. cmake --build . --config Release -- -j "${NUM_PROC}" popd