From 0b32ddc13a4ad5a8fcba400558a349066d99f55e Mon Sep 17 00:00:00 2001 From: Karl Lessard Date: Fri, 24 Nov 2023 22:42:46 -0500 Subject: [PATCH] Download wheel and clib for Windows --- .../scripts/dist_download.sh | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/tensorflow-core/tensorflow-core-native/scripts/dist_download.sh b/tensorflow-core/tensorflow-core-native/scripts/dist_download.sh index 582597c192a..cbc9b2deda9 100755 --- a/tensorflow-core/tensorflow-core-native/scripts/dist_download.sh +++ b/tensorflow-core/tensorflow-core-native/scripts/dist_download.sh @@ -1,24 +1,24 @@ #!/bin/bash -set -eu +set -e DOWNLOAD_FOLDER="$1" -DOWNLOADED_FILE="tensorflow.zip" # TODO extract name from wheel url, change .whl to .zip case ${PLATFORM:-} in 'linux-x86_64') - DOWNLOAD_URL='https://files.pythonhosted.org/packages/57/bf/03debeeaeca996543478db89c8729a40dcb97a6be811804f4a08c8e1c75a/tensorflow_cpu-2.14.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl' + WHEEL_URL='https://files.pythonhosted.org/packages/57/bf/03debeeaeca996543478db89c8729a40dcb97a6be811804f4a08c8e1c75a/tensorflow_cpu-2.14.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl' ;; 'linux-x86_64-gpu') - DOWNLOAD_URL='https://files.pythonhosted.org/packages/09/63/25e76075081ea98ec48f23929cefee58be0b42212e38074a9ec5c19e838c/tensorflow-2.14.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl' + WHEEL_URL='https://files.pythonhosted.org/packages/09/63/25e76075081ea98ec48f23929cefee58be0b42212e38074a9ec5c19e838c/tensorflow-2.14.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl' ;; 'macosx-x86_64') - DOWNLOAD_URL='https://files.pythonhosted.org/packages/ad/e2/ff29a5e514ec25470b59e5d0134f08f75bd28d6ec6941a22bea6b78cb2fb/tensorflow_cpu-2.14.0-cp311-cp311-macosx_10_15_x86_64.whl' + WHEEL_URL='https://files.pythonhosted.org/packages/ad/e2/ff29a5e514ec25470b59e5d0134f08f75bd28d6ec6941a22bea6b78cb2fb/tensorflow_cpu-2.14.0-cp311-cp311-macosx_10_15_x86_64.whl' ;; 'macosx-arm64') - DOWNLOAD_URL='https://files.pythonhosted.org/packages/d3/4b/ae9037ea22ba94eb2cf267e991384c3444f3e6142fa49923352b4ab73e14/tensorflow_macos-2.14.0-cp311-cp311-macosx_12_0_arm64.whl' + WHEEL_URL='https://files.pythonhosted.org/packages/d3/4b/ae9037ea22ba94eb2cf267e991384c3444f3e6142fa49923352b4ab73e14/tensorflow_macos-2.14.0-cp311-cp311-macosx_12_0_arm64.whl' ;; 'windows-x86_64') - DOWNLOAD_URL='https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.14.0.zip' + WHEEL_URL='https://files.pythonhosted.org/packages/ad/6e/1bfe367855dd87467564f7bf9fa14f3b17889988e79598bc37bf18f5ffb6/tensorflow_intel-2.14.0-cp311-cp311-win_amd64.whl' + CLIB_URL='https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.14.0.zip' ;; *) echo "TensorFlow distribution for ${PLATFORM} is not supported for download" @@ -28,12 +28,20 @@ esac mkdir -p "$DOWNLOAD_FOLDER" cd "$DOWNLOAD_FOLDER" -if [ ! -f $DOWNLOADED_FILE ]; then - curl -L $DOWNLOAD_URL --output $DOWNLOADED_FILE +if [[ -n "$WHEEL_URL" ]]; then + if [ ! -f 'tensorflow.whl' ]; then + curl -L $WHEEL_URL --output 'tensorflow.whl' + fi + unzip -q -u 'tensorflow.whl' +fi + +if [[ -n "$CLIB_URL" ]]; then + if [ ! -f 'tensorflow_c.zip' ]; then + curl -L $CLIB_URL --output 'tensorflow_c.zip' + fi + unzip -q -u -d tensorflow 'tensorflow_c.zip' fi -unzip -q -u $DOWNLOADED_FILE -mkdir -p tensorflow cd tensorflow if [[ "$PLATFORM" =~ "linux" ]]; then ln -fs libtensorflow_cc.so.2 libtensorflow_cc.so @@ -42,6 +50,6 @@ elif [[ "$PLATFORM" =~ "macosx" ]]; then ln -fs libtensorflow_cc.2.dylib libtensorflow_cc.dylib ln -fs libtensorflow_framework.2.dylib libtensorflow_framework.dylib elif [[ "$PLATFORM" =~ "windows" ]]; then - ln -fs ../lib/tensorflow.dll tensorflow.dll + ln -fs lib/tensorflow.dll tensorflow.dll fi ls -l . \ No newline at end of file