patientphex-task1 / scripts /chains /current_chain.sh
SocrAIte's picture
Upload folder using huggingface_hub
e7543dc verified
Raw History Blame Contribute Delete
2.09 kB
#!/bin/bash
# current 生产器链: candidates -> gate -> verifier x3 -> assemble q3636
set -x
export PYTHONPATH=/root/patientphex/retrain_t1/code
export HF_HUB_OFFLINE=1
export TRANSFORMERS_OFFLINE=1
PY=/root/patientphex/judge_venv/bin/python
C=/root/patientphex/retrain_t1/code
R=$C/artifacts/b_retrain
B=/root/patientphex/PatientPheX-V1-B/PatientPheX-V1-B.jsonl
$PY $C/scripts/build_deployment_candidates.py \
--train-data $C/artifacts/cleaned/PatientPheX-train.cleaned.jsonl \
--predict-data $B \
--ontology /root/patientphex/PatientPheX-V1-A/hp.obo \
--bio-output $R/bio/B-bio.json \
--phenotagger-output $R/pt-original/B-full.json \
--output $R/B-candidates.json \
--lexicon-threshold 0.55 \
--phenotagger-threshold 0.50 || exit 1
echo CANDIDATES_DONE
$PY /root/patientphex/check_count.py $R/B-candidates.json || true
pids=""
gpu=2
for seed in 2026 2027 2028; do
CUDA_VISIBLE_DEVICES=$gpu nohup $PY $C/scripts/train_predict_candidate_verifier.py \
--train-data $C/artifacts/cleaned/PatientPheX-train.cleaned.jsonl \
--train-candidates $C/artifacts/candidates/oof-union-pheno.json \
--predict-data $B \
--predict-candidates $R/B-candidates.json \
--model /root/patientphex/models/BiomedBERT-base-uncased-abstract-fulltext \
--epochs 3 --batch-size 16 --learning-rate 2e-5 --max-length 256 --seed $seed \
--output $R/verifier-seed$seed.json > $R/verifier-seed$seed.log 2>&1 &
pids="$pids $!"
gpu=$((gpu+1))
done
fail=0
for p in $pids; do wait $p || fail=1; done
[ $fail = 1 ] && { echo VERIFIER_FAIL; exit 2; }
echo VERIFIERS_DONE
CUDA_VISIBLE_DEVICES=1 $PY $C/scripts/assemble_task1_predictions.py \
--data $B \
--ontology /root/patientphex/PatientPheX-V1-A/hp.obo \
--verifier-glob "$R/verifier-seed202[678].json" \
--sapbert-model /root/patientphex/models/SapBERT-from-PubMedBERT-fulltext \
--output $R/B-task1-ensemble-q3636.jsonl \
--threshold 0.66 --target-fraction 0.3636 --lexicon-threshold 0.0 --phenotagger-threshold 0.90 || exit 3
echo ASSEMBLE_DONE
wc -l $R/B-task1-ensemble-q3636.jsonl
echo CURRENT_CHAIN_DONE