-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.sh
71 lines (59 loc) · 1.83 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
set -e
set -x
echo 'Downloading Lama model (reference https://github.com/advimman/lama/blob/main/README.md)'
#check if big-lama.zip file exists
if [ ! -f "./big-lama.zip" ]; then
echo "Downloading big-lama.zip"
curl -LJO https://huggingface.co/smartywu/big-lama/resolve/main/big-lama.zip
fi
#check if big-lama directory exists
if [ ! -d "./big-lama" ]; then
echo "Unzipping big-lama.zip"
unzip big-lama.zip
fi
#rm -fr big-lama.zip
git submodule update --init --recursive
cp setup-lama.py ./third_party/lama/setup.py
#for each project in third_party directory run the setup.py if present
orginal_dir=$(pwd)
for dir in ./third_party/*/; do
echo "Creating dist from $dir"
if [ -f "$dir/setup.py" ]; then
echo "Running setup.py from $dir"
cd $dir
python setup.py sdist --formats=gztar -d "$orginal_dir/lib"
export EXIT_STATUS=$?
if [ $EXIT_STATUS -ne 0 ]; then
echo "Failed to generate artifact from $dir"
exit 1
fi
cd $orginal_dir
fi
done
conda install -y detectron2 -c conda-forge
#pip install git+https://github.com/facebookresearch/detectron2.git
export EXIT_STATUS=$?
if [ $EXIT_STATUS -ne 0 ]; then
echo "Failed to install detectron2 module"
exit 1
fi
#install the generated artifacts
for file in ./lib/*.tar.gz; do
echo "Installing $file"
pip install $file
done
echo "Installing requirements from $(pwd)"
pip install -r requirements.txt
export EXIT_STATUS=$?
if [ $EXIT_STATUS -ne 0 ]; then
echo "Failed to install requirements"
exit 1
fi
#install pyfftw module however if it fails installation ignore
conda install -y pyfftw -c conda-forge
echo 'Generating default directories'
mkdir -p ./src/images
mkdir -p ./src/images/generated
mkdir -p ./src/images/generated_mask
mkdir -p ./src/images/mrhi
mkdir -p ./src/images/pack