-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
60 lines (47 loc) · 1.79 KB
/
Copy pathsetup.sh
File metadata and controls
60 lines (47 loc) · 1.79 KB
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
#!/usr/bin/env bash
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PARENT_DIR="$(cd "${REPO_ROOT}/.." && pwd)"
VENV_DIR="${REPO_ROOT}/scenic_venv"
clone_or_update_repo() {
local repo_url="$1"
local target_dir="$2"
if [ -d "${target_dir}/.git" ]; then
git -C "${target_dir}" pull --ff-only
elif [ -d "${target_dir}" ]; then
echo "Directory ${target_dir} already exists but is not a git repo; leaving it unchanged."
else
git clone "${repo_url}" "${target_dir}"
fi
}
cd "${REPO_ROOT}"
sudo apt update -y
sudo apt install -y software-properties-common
sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo apt update -y
sudo apt install -y python3.10 python3.10-venv
python3.10 -m venv "${VENV_DIR}"
source "${VENV_DIR}/bin/activate"
python -m pip install --upgrade pip setuptools wheel
clone_or_update_repo "https://github.com/google-research/scenic.git" "${REPO_ROOT}/scenic"
python -m pip install "${REPO_ROOT}/scenic"
python -m pip uninstall -y jax jaxlib || true
python -m pip install "jax[tpu]" -f "https://storage.googleapis.com/jax-releases/libtpu_releases.html"
python -m pip install grain wandb ipdb scikit-learn tensorflow_text
rm -rf "${REPO_ROOT}/scenic"
clone_or_update_repo "https://github.com/google-research/big_vision.git" "${PARENT_DIR}/big_vision"
python - <<PY
import site
from pathlib import Path
site_packages = Path(site.getsitepackages()[0])
(site_packages / "big_vision_local.pth").write_text("${PARENT_DIR}/big_vision\n")
PY
clone_or_update_repo "https://github.com/google-deepmind/tips.git" "${PARENT_DIR}/tips"
echo
echo "Setup complete."
echo "Activate the environment with:"
echo " source ${VENV_DIR}/bin/activate"
echo "Expected sibling layout:"
echo " ${PARENT_DIR}/infusing"
echo " ${PARENT_DIR}/big_vision"
echo " ${PARENT_DIR}/tips"