Download reproduce.sh from Pathstudy/fourmodal-pathology-bind: direct link, hf CLI and curl.
- Browser
- Download file 1.72 kB
-
https://huggingface.co/Pathstudy/fourmodal-pathology-bind/resolve/main/reproduce.sh
- Command line
-
hf download hf://Pathstudy/fourmodal-pathology-bind/reproduce.sh
-
curl -L -o reproduce.sh https://huggingface.co/Pathstudy/fourmodal-pathology-bind/resolve/main/reproduce.sh
1.72 kB
| # Reproduce the final model from the cached encoder features (GPU, ~20 min on one RTX A5000). | |
| # | |
| # PYTHON=python bash reproduce.sh # feature-level checks + retraining (no frozen encoders needed) | |
| # RAW=1 PYTHON=python bash reproduce.sh # + raw-input check of embed.py (run setup_encoders.sh first) | |
| # | |
| # Steps | |
| # 0. download cache/ + splits/ (features of the real paired data + virtual / synthetic test data, ~1.1 GB) | |
| # from the dataset repo Pathstudy/fourmodal-pathology-features (skipped if present) | |
| # 1. evaluate_saved.py: shipped fold-0 checkpoint on its held-out test -> must equal models/ej_ad_mv_fold0/test.csv | |
| # 2. retrain fold 0 (models/repro_fold0) and the 5-fold CV (results/final_cv_*_repro.csv), compare with the shipped | |
| # numbers (compare_reproduction.py); shipped checkpoints / results are not overwritten | |
| # 3. retrain the release model (models/repro_release; train = fold-0 train + test, val = fold-0 val) | |
| # 4. (RAW=1) example_check.py: raw images / text / counts / mIF tiles in examples/ -> embed.py | |
| set -euo pipefail | |
| cd "$(dirname "$0")" | |
| PY=${PYTHON:-python} | |
| if [ ! -f cache/he_uni2.npy ]; then | |
| "$PY" -I -c "from huggingface_hub import snapshot_download as s; s('Pathstudy/fourmodal-pathology-features', repo_type='dataset', local_dir='.', allow_patterns=['cache/*', 'splits/*'])" | |
| fi | |
| "$PY" -I evaluate_saved.py models/ej_ad_mv_fold0 | |
| "$PY" -I 52_final_model.py fold0 --out repro_fold0 | |
| "$PY" -I 52_final_model.py cv --out repro | |
| "$PY" -I compare_reproduction.py repro | |
| "$PY" -I 52_final_model.py release --out repro_release | |
| if [ "${RAW:-0}" = 1 ]; then | |
| "$PY" -I example_check.py models/ej_ad_mv_fold0 | |
| fi | |
| echo "reproduce.sh: all steps finished" | |