-
Notifications
You must be signed in to change notification settings - Fork 812
/
Copy pathinstall_torchdata.sh
executable file
·40 lines (34 loc) · 1.11 KB
/
install_torchdata.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
#!/bin/bash
package_type="$PACKAGE_TYPE"
channel="$CHANNEL"
if [ -z "$package_type" ]; then
package_type="wheel"
fi
if [ -z "$channel" ]; then
channel="nightly"
fi
# Wrong values
if [ "$package_type" != "wheel" ] && [ "$package_type" != "conda" ]; then
exit 1
fi
if [ "$channel" != "nightly" ] && [ "$channel" != "test" ]; then
exit 1
fi
if [ "$package_type" = "wheel" ]; then
install_cmd="pip install"
if [ "$channel" = "nightly" ]; then
install_cmd="${install_cmd} --pre"
fi
install_channel="--index-url https://download.pytorch.org/whl/${channel}/cpu"
else
install_cmd="conda install"
install_channel="-c pytorch-${channel}"
fi
$install_cmd torchdata $install_channel
if [ "$package_type" = "wheel" ]; then
TORCHDATA_VERSION="$(pip show torchdata | grep ^Version: | sed 's/Version: *//' | sed 's/+.\+//')"
else
TORCHDATA_VERSION="$(conda list -fe torchdata | grep torchdata | sed -e 's/torchdata=\(.*\)=py.*/\1/')"
echo "export CONDA_TORCHDATA_CONSTRAINT='- torchdata==${TORCHDATA_VERSION}'" >> "${BUILD_ENV_FILE}"
fi
echo "export TORCHDATA_VERSION=${TORCHDATA_VERSION}" >> "${BUILD_ENV_FILE}"