#!/usr/bin/env bash # Fetch the third-party code / weights that embed.py needs for RAW inputs (images, text, counts, mIF tiles). # Not needed for the feature-level API (E.*_from_feats), evaluate_saved.py or training (52_final_model.py). # # PYTHON=python bash setup_encoders.sh # # Code is cloned at the exact commits the features were extracted with; nothing is pip-installed. The other frozen # encoders (KEEP, BiomedCLIP, Qwen3-Embedding-0.6B, Tahoe-x1, SE-600M, AIDO.Cell, VirTues weights) are downloaded # from the Hugging Face Hub on first use at pinned revisions (see the 4x_ / 14_ scripts). # UNI2-h is gated (MahmoodLab/UNI2-h, accept the licence on its HF page): either log in with an account that has # access, or point $UNI2_PATH at a local pytorch_model.bin. set -euo pipefail cd "$(dirname "$0")" PY=${PYTHON:-python} mkdir -p ext/medvtok clone() { # url dir commit [ -d "$2/.git" ] || git clone -q "$1" "$2" git -C "$2" checkout -q "$3" echo "$2 @ $(git -C "$2" rev-parse --short HEAD)" } clone https://github.com/bunnelab/virtues.git ext/virtues 2c9c6cb # VirTues model code (MIT) clone https://github.com/genbio-ai/ModelGenerator.git ext/modelgenerator bda6f2d # AIDO.Cell gene list clone https://github.com/Masaaki-75/medvtok.git ext/medvtok/repo a558c24 # MedVTok model code (MIT) # MedVTok weights (3.3 GB; MIT) "$PY" -I -c "from huggingface_hub import snapshot_download as s; print(s('massaki75/medvtok', revision='9e70a000b1040ce498450a877da91a8fe02dac41', local_dir='ext/medvtok/weights', allow_patterns=['ckpt.pth', 'config.json']))" # ext/marker_embeddings/ (ESM-2 embeddings of the 16 marker proteins, VirTues input) ships with this repo test -d ext/marker_embeddings/esm2_t30_150M_UR50D && echo "marker embeddings ok" "$PY" -I -c "import os, sys; sys.path.insert(0, os.getcwd()); import embed; p = os.environ.get('UNI2_PATH', embed.UNI2_LOCAL); print('UNI2-h:', p if os.path.exists(p) else 'will be downloaded from the gated HF repo MahmoodLab/UNI2-h')"