| set -euo pipefail | |
| # ------------ CONFIGURATION ------------ | |
| # path to your stage_2_divprune config | |
| CONFIG="configs/slidechat/stage_2.py" | |
| # path to your model checkpoint (no “.pth” extension) | |
| CHECKPOINT="/data/qingq/PathVLM/baselines/github/SlideChat/models/slidechat_weight/stage2_pth" | |
| # path to the single-slide CSV | |
| TEST_CSV="/data/qingq/PathVLM/baselines/github/SlideChat/dataset/SlideBench-VQA-TCGA.csv" | |
| # directory containing BLCA.json, COAD.json, … SKCM.json | |
| TUMOR_DIR="/data/qingq/PathVLM/baselines/github/SlideChat/dataset/stage_2_vqa_by_tumor/stage2_vqa_tumor_" | |
| eval_txt="/data/qingq/PathVLM/baselines/github/SlideChat/outputs/slidechat_baseline_2000_visual_tokens.txt" | |
| # where to dump all your outputs | |
| OUTPUT_DIR="/data/qingq/PathVLM/baselines/github/SlideChat/outputs" | |
| mkdir -p "${OUTPUT_DIR}" | |
| # --------------------------------------- | |
| for tumor_json in "${TUMOR_DIR}"/*.json; do | |
| # extract “BLCA” from “BLCA.json” | |
| tumor=$(basename "${tumor_json}" .json) | |
| # lowercase for file names: “blca” | |
| tumor_lc=$(echo "${tumor}" | tr '[:upper:]' '[:lower:]') | |
| out_csv="${OUTPUT_DIR}/output_${tumor_lc}_baseline_2000_visual_tokens.csv" | |
| echo "=== Testing tumor_type=${tumor} → ${out_csv}, ${eval_txt} ===" | |
| CUDA_VISIBLE_DEVICES=2 \ | |
| xtuner test "${CONFIG}" \ | |
| --checkpoint "${CHECKPOINT}" \ | |
| --test_slide_csv "${TEST_CSV}" \ | |
| --test_output_csv "${out_csv}" \ | |
| --local_rank 0 \ | |
| --tumor_type "${tumor}" \ | |
| --eval_output_path "${eval_txt}" | |
| done |