File size: 1,402 Bytes
16231ab | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #!/usr/bin/env bash
# Linux/macOS setup: conda env + PyTorch + this package (editable) + ImageBind dependencies.
# Usage: ./setup_env.sh [env-name] [torch-backend: cu126|cu128|cu130|cpu] [--download-imagebind]
set -euo pipefail
cd "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ENV_NAME="${1:-viewing-sound-paq}"; BACKEND="${2:-cu126}"; DL="${3:-}"
command -v conda >/dev/null || { echo "conda not found" >&2; exit 1; }
if conda env list | awk '{print $1}' | grep -Fxq "$ENV_NAME"; then conda env update -n "$ENV_NAME" -f environment.yml; else conda env create -n "$ENV_NAME" -f environment.yml; fi
conda run -n "$ENV_NAME" python -m pip install --upgrade torch torchvision torchaudio --index-url "https://download.pytorch.org/whl/${BACKEND}"
conda run -n "$ENV_NAME" python -m pip install "git+https://github.com/facebookresearch/pytorchvideo.git@6cdc929315aab1b5674b6dcf73b16ec99147735f"
conda run -n "$ENV_NAME" python -m pip install -e ".[dev]"
if [[ "$DL" == "--download-imagebind" ]]; then
mkdir -p checkpoints; [[ -f checkpoints/imagebind_huge.pth ]] || curl -L -o checkpoints/imagebind_huge.pth https://dl.fbaipublicfiles.com/imagebind/imagebind_huge.pth
fi
if [[ "$BACKEND" == cpu ]]; then conda run -n "$ENV_NAME" python scripts/common/check_environment.py; else conda run -n "$ENV_NAME" python scripts/common/check_environment.py --require-cuda; fi
echo "Ready: conda activate $ENV_NAME"
|