Skip to content

Commit

Permalink
Download wheel and clib for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
karllessard committed Nov 25, 2023
1 parent 5a79628 commit 0b32ddc
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions tensorflow-core/tensorflow-core-native/scripts/dist_download.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
Expand All @@ -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 .

0 comments on commit 0b32ddc

Please sign in to comment.