Helixbench / evaluation /install.sh
Jiaming141's picture
Add reproducible evaluation installation and weight setup (#1)
e8fa465
Raw History Blame Contribute Delete
2.95 kB
#!/usr/bin/env bash
# Install the exact third-party source revisions used by the six-metric runner.
# Usage: bash evaluation/install.sh /absolute/path/to/runtime
set -euo pipefail
EVAL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PREFIX="${1:?Usage: bash evaluation/install.sh /absolute/path/to/runtime}"
if [[ "$PREFIX" != /* ]]; then
echo "The runtime path must be absolute: $PREFIX" >&2
exit 2
fi
for executable in python3 git ffmpeg ffprobe curl; do
command -v "$executable" >/dev/null || { echo "Missing executable: $executable" >&2; exit 2; }
done
mkdir -p "$PREFIX"/{deps,weights,torch}
python3 -m venv "$PREFIX/bootstrap_env"
"$PREFIX/bootstrap_env/bin/python" -m pip install 'uv==0.12.24'
UV="$PREFIX/bootstrap_env/bin/uv"
"$UV" python install 3.12.15
if [[ ! -x "$PREFIX/env/bin/python" ]]; then
"$UV" venv --python 3.12.15 "$PREFIX/env"
fi
"$UV" pip install --python "$PREFIX/env/bin/python" \
torch==2.7.0 torchvision==0.22.0 torchaudio==2.7.0 \
--index-url https://download.pytorch.org/whl/cu128
"$UV" pip install --python "$PREFIX/env/bin/python" \
numpy==2.5.2 scipy==1.18.1 transformers==4.57.3 librosa==0.11.0 \
timm==1.0.28 av==16.1.0 einops==0.8.1 fvcore==0.1.5.post20221221 \
fairscale==0.4.13 iopath==0.1.10 ftfy==6.3.1 omegaconf==2.3.0 \
huggingface-hub==0.36.2 boto3 soundfile scikit-learn pandas matplotlib \
h5py braceexpand webdataset wget regex tqdm packaging sentencepiece \
opencv-python-headless imageio-ffmpeg==0.6.0 psutil torchlibrosa==0.1.0 \
progressbar2 resampy 'setuptools==78.1.0' 'wandb==0.30.0'
while read -r name repo revision; do
destination="$PREFIX/deps/$name"
if [[ ! -d "$destination/.git" ]]; then
git clone "https://github.com/$repo.git" "$destination"
fi
git -C "$destination" fetch origin "$revision"
git -C "$destination" checkout --detach "$revision"
actual="$(git -C "$destination" rev-parse HEAD)"
if [[ "$actual" != "$revision" ]]; then
echo "Wrong Git revision in $destination: $actual" >&2
exit 1
fi
done <<'REPOS'
av-benchmark hkchengrex/av-benchmark f351b9a6fc6abde746d5f8e1d4c47c883319cb41
ImageBind facebookresearch/ImageBind 53680b02d7e37b19b124fa37bae4b6c98c38f5be
CLAP LAION-AI/CLAP 590b52df03a5e480634b8714135d3534313be860
hear21passt kkoutini/passt_hear21 5f1cce6a54b88faf0abad82ed428355e7931213a
REPOS
# The benchmark's ImageBind entrypoint requires this frozen compatibility shim.
cp "$EVAL_DIR/src/helixbench/engines/imagebind_compat_init.py" \
"$PREFIX/deps/ImageBind/imagebind/__init__.py"
"$UV" pip install --python "$PREFIX/env/bin/python" --no-deps -e "$PREFIX/deps/CLAP"
"$UV" pip install --python "$PREFIX/env/bin/python" --no-deps -e "$EVAL_DIR"
"$PREFIX/env/bin/helixbench" verify-package
"$UV" pip freeze --python "$PREFIX/env/bin/python" > "$PREFIX/environment.freeze.txt"
echo "Source and Python dependencies ready in $PREFIX"
echo "Next: $PREFIX/env/bin/python $EVAL_DIR/download_weights.py $PREFIX"