File tree Expand file tree Collapse file tree 3 files changed +37
-19
lines changed Expand file tree Collapse file tree 3 files changed +37
-19
lines changed Original file line number Diff line number Diff line change 11
11
# Expects pytorch, torchvision to be installed.
12
12
13
13
BASE_DIR=" $( pwd) /$( dirname $0 ) "
14
- source $BASE_DIR /init_examples.sh
14
+ source $BASE_DIR /utils.sh
15
+
16
+ USE_CUDA=$( python -c " import torch; print(torch.cuda.is_available())" )
17
+ case $USE_CUDA in
18
+ " True" )
19
+ echo " using cuda"
20
+ CUDA=1
21
+ CUDA_FLAG=" --cuda"
22
+ ;;
23
+ " False" )
24
+ echo " not using cuda"
25
+ CUDA=0
26
+ CUDA_FLAG=" "
27
+ ;;
28
+ " " )
29
+ exit 1;
30
+ ;;
31
+ esac
15
32
16
33
function distributed() {
17
34
start
Original file line number Diff line number Diff line change 11
11
# Expects pytorch, torchvision to be installed.
12
12
13
13
BASE_DIR=" $( pwd) /$( dirname $0 ) "
14
- source $BASE_DIR /init_examples.sh
14
+ source $BASE_DIR /utils.sh
15
+
16
+ USE_CUDA=$( python -c " import torchvision, torch; print(torch.cuda.is_available())" )
17
+ case $USE_CUDA in
18
+ " True" )
19
+ echo " using cuda"
20
+ CUDA=1
21
+ CUDA_FLAG=" --cuda"
22
+ ;;
23
+ " False" )
24
+ echo " not using cuda"
25
+ CUDA=0
26
+ CUDA_FLAG=" "
27
+ ;;
28
+ " " )
29
+ exit 1;
30
+ ;;
31
+ esac
15
32
16
33
function dcgan() {
17
34
start
Original file line number Diff line number Diff line change 2
2
# This script contains utility functions and initialize exmaple scripts.
3
3
# Eg: run_python_examples.sh, run_distributed_examples.sh
4
4
5
+ BASE_DIR=" $( pwd) /$( dirname $0 ) "
5
6
EXAMPLES=$( echo $1 | sed -e ' s/ //g' )
6
7
7
8
# Redirect 'python' calls to 'python3'
8
9
python () {
9
10
command python3 " $@ "
10
11
}
11
12
12
- USE_CUDA=$( python -c " import torchvision, torch; print(torch.cuda.is_available())" )
13
- case $USE_CUDA in
14
- " True" )
15
- echo " using cuda"
16
- CUDA=1
17
- CUDA_FLAG=" --cuda"
18
- ;;
19
- " False" )
20
- echo " not using cuda"
21
- CUDA=0
22
- CUDA_FLAG=" "
23
- ;;
24
- " " )
25
- exit 1;
26
- ;;
27
- esac
28
-
29
13
ERRORS=${ERRORS-" " }
30
14
31
15
function error() {
You can’t perform that action at this time.
0 commit comments