-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
executable file
·56 lines (50 loc) · 1.29 KB
/
setup.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
#!/bin/sh
macOS=false
current_dir="$(pwd -P)"
check_requirements() {
case $(uname -s) in
Darwin)
if [ "$(uname -m)" = "arm64" ]; then
printf "macOS (Apple Silicon) system detected.\n"
device="osx-arm64"
else
printf "macOS (Intel) system detected.\n"
export CFLAGS='-stdlib=libc++'
device="osx-64"
fi
;;
Linux)
printf "Linux system detected.\n"
device="linux-64"
;;
*)
printf "Only Linux and macOS are currently supported.\n"
exit 1
;;
esac
}
install_torch() {
printf "\nInstalling PyTorch...\n"
case $device in
osx-arm64)
pip install torch torchvision torchaudio
;;
osx-64)
conda install -c pytorch pytorch torchvision torchaudio -y
;;
linux-64)
conda install -c pytorch pytorch torchvision torchaudio cudatoolkit=11.3 -y
;;
*)
pip install pytorch torchvision torchaudio
;;
esac
}
install_package() {
printf "\nInstall Python packages...\n"
pip install -e .
}
check_requirements
install_torch
install_package
printf '\nSetup completed.\n'