-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-text.sh
executable file
·57 lines (49 loc) · 1.01 KB
/
build-text.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
set -e
usage() {
echo "Usage: $0 -p <py3_ver> -t <tf_ver>"
echo " -p <py3_ver> Python version to use (6-12)"
echo " -t <tf_ver> TensorFlow version to use (2.3.0, 2.4.0, etc.)"
}
if [ $# -lt 4 ]; then
usage
exit
fi
while getopts "ht:p:" opt; do
case $opt in
p)
py3_ver=$OPTARG
;;
t)
tf_ver=$OPTARG
;;
h)
usage
exit
;;
\?)
echo "Invalid option: -$OPTARG" >&2
usage
exit
;;
esac
done
if [ "$py3_ver" -lt 6 ] || [ "$py3_ver" -gt 12 ]; then
echo "Python version must be between 6 and 12"
usage
exit
fi
rm -rf venvs
python3.$py3_ver -m venv venvs/py3$py3_ver
. venvs/py3${py3_ver}/bin/activate
# Get most recent wheel
tf_wheel=$(ls ../wheels/tensorflow/tensorflow-${tf_ver}-cp3${py3_ver}-*-linux_x86_64.whl)
echo "Installing TensorFlow wheel $tf_wheel"
pip install -q --ignore-requires-python "$tf_wheel"
pip uninstall -q -y tensorflow-text
bazel clean --expunge
./oss_scripts/run_build.sh
mv tensorflow_text-*.whl ../wheels/text
bazel clean --expunge
deactivate
rm -rf venvs