-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.sh
executable file
·36 lines (31 loc) · 1.24 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
#!/bin/bash
pin_and_add_path() {
local module="$1"
local commit_sha="$2"
local output=$(cd "$module" && git reset --hard "$commit_sha" && realpath . 2>&1)
local module_path=$(echo "$output" | tail -n 1)
if [ $? -eq 0 ]; then
export PYTHONPATH="${PYTHONPATH}:${module_path}"
printf "Added %s with commit %s to PYTHONPATH\n" "$module" "$commit_sha"
else
printf "Error: %s\n" "module_path"
fi
}
# Add submodules to PYTHONPATH. Pin to specific commits.
pin_and_add_path "taming-transformers" "3ba01b2"
pin_and_add_path "CLIP" "a9b1bf5"
pin_and_add_path "image-background-remove-tool" "2935e46"
#
pin_and_add_path "zero123" "78bc429"
# Path to the vendored ldm code on the original zero123 repo
zero123_path=$(echo $PYTHONPATH | awk -F: '{print $NF}')
export PYTHONPATH="${PYTHONPATH}:${zero123_path}/zero123"
# One requirements file to rule them all
pip install -r requirements.txt
# Patching existing code - don't fork or vendor just for a couple of lines
#
# Make zero123's ldm source compatible with newer versions of lightning
(cd ./zero123/zero123/ldm/models/diffusion && patch < ../../../../../patches/ldm_ddpm.patch)
# Compatibility with newer PIL
(cd ./zero123/zero123/ldm && patch < ../../../patches/ldm_util.patch)
echo $PYTHONPATH