-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·43 lines (36 loc) · 932 Bytes
/
build.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
#!/bin/sh
set -eu
CWD=$(basename "$PWD")
build() {
docker build . --tag "$CWD"
}
clean() {
docker system prune -f
}
runWithGPUs() {
echo "Running docker with gpus"
docker run --rm --gpus=all \
-v huggingface:/home/huggingface/.cache/huggingface \
-v "$PWD"/input:/home/huggingface/input \
-v "$PWD"/output:/home/huggingface/output \
"$CWD" "$@"
}
runWithoutGPUs() {
echo "Running docker without gpus"
docker run --rm \
-v huggingface:/home/huggingface/.cache/huggingface \
-v "$PWD"/input:/home/huggingface/input \
-v "$PWD"/output:/home/huggingface/output \
"$CWD" "$@"
}
mkdir -p input output
case ${1:-build} in
build) build ;;
clean) clean ;;
dev) dev "$@" ;;
run) shift; run "$@" ;;
runWithoutGPUs) shift; runWithoutGPUs "$@" ;;
runWithGPUs) shift; runWithGPUs "$@" ;;
test) tests ;;
*) echo "$0: No command named '$1'" ;;
esac