-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun_jupyter.sh
executable file
·75 lines (64 loc) · 2.12 KB
/
run_jupyter.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
if `which nvidia-smi`
then
nvidia-smi -L
export GPU_PARAMS="--gpus all"
echo INFO: Running docker image with: $GPU_PARAMS
AIRT_DOCKER=ghcr.io/airtai/nbdev-mkdocs-tensorflow-2.12.0:latest
else
echo INFO: Running docker image without GPU-s
export GPU_PARAMS=""
AIRT_DOCKER=ghcr.io/airtai/nbdev-mkdocs:latest
fi
BRANCH=$(git branch --show-current)
if test -z "$AIRT_JUPYTER_PORT"
then
echo 'AIRT_JUPYTER_PORT variable not set, setting to 8888'
export AIRT_JUPYTER_PORT=8888
else
echo AIRT_JUPYTER_PORT variable set to $AIRT_JUPYTER_PORT
fi
if test -z "$AIRT_TB_PORT"
then
echo 'AIRT_TB_PORT variable not set, setting to 6006'
export AIRT_TB_PORT=6006
else
echo AIRT_TB_PORT variable set to $AIRT_TB_PORT
fi
if test -z "$AIRT_DASK_PORT"
then
echo 'AIRT_DASK_PORT variable not set, setting to 8787'
export AIRT_DASK_PORT=8787
else
echo AIRT_DASK_PORT variable set to $AIRT_DASK_PORT
fi
if test -z "$AIRT_DOCS_PORT"
then
echo 'AIRT_DOCS_PORT variable not set, setting to 4000'
export AIRT_DOCS_PORT=4000
else
echo AIRT_DOCS_PORT variable set to $AIRT_DOCS_PORT
fi
if test -z "$AIRT_PROJECT"
then
echo 'AIRT_PROJECT variable not set, setting to current directory'
export AIRT_PROJECT=`pwd`
fi
echo AIRT_PROJECT variable set to $AIRT_PROJECT
if test -z "$OPENAI_API_KEY"
then
echo 'WARNING: OPENAI_API_KEY variable not set, automatic generation of docstrings will not work!'
fi
echo Using $AIRT_DOCKER
docker image ls $AIRT_DOCKER
docker run --rm $GPU_PARAMS \
-e JUPYTER_CONFIG_DIR=/root/.jupyter \
-p $AIRT_JUPYTER_PORT:8888 -p $AIRT_TB_PORT:6006 -p $AIRT_DASK_PORT:8787 -p $AIRT_DOCS_PORT:4000 \
-v $AIRT_PROJECT:$AIRT_PROJECT --workdir=$AIRT_PROJECT \
-v /etc/passwd:/etc/passwd -v /etc/group:/etc/group -v /etc/shadow:/etc/shadow \
-v $HOME/.ssh:$HOME/.ssh -v $HOME/.gitconfig:$HOME/.gitconfig \
-e USER=$USER -e USERNAME=$USERNAME \
-e OPENAI_API_KEY=$OPENAI_API_KEY \
-e GITHUB_TOKEN=$GITHUB_TOKEN \
$AIRT_DOCKER
# -v $AIRT_PROJECT:/work/`basename $AIRT_PROJECT` --workdir=/work/`basename $AIRT_PROJECT` \