forked from GoogleCloudPlatform/asl-ml-immersion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uncertainty_aware_models.sh
executable file
·37 lines (29 loc) · 1.01 KB
/
uncertainty_aware_models.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
#!/bin/bash
#
# To build the kernel: ./kernels/uncertainty_aware_models.sh
# To remove the kernel: ./kernels/uncertainty_aware_models.sh remove
#
# This scripts will create a ipython kernel named $MODULE
# populated with the reqs in ./notebooks/$MODULE/requirements.txt
MODULE=uncertainty_aware_models
ENVNAME=${MODULE}_kernel
REPO_ROOT_DIR="$(dirname $(cd $(dirname $BASH_SOURCE) && pwd))"
# Cleaning up the kernel and exiting if first arg is 'remove'
if [ "$1" == "remove" ]; then
echo Removing kernel $ENVNAME
jupyter kernelspec remove $ENVNAME
rm -r "$REPO_ROOT_DIR/notebooks/$MODULE/$ENVNAME"
exit 0
fi
cd $REPO_ROOT_DIR/notebooks/$MODULE
# Setup virtual env and kernel
echo creating $ENVNAME at $(pwd)
python3 -m venv $ENVNAME
# Registering the venv as an ipython kernel
source $ENVNAME/bin/activate
pip install -U pip
pip install ipykernel
python -m ipykernel install --user --name=$ENVNAME
# Install Object Detection API and its dependencies
test -f requirements.txt && pip install -r requirements.txt
deactivate