File size: 2,093 Bytes
e7543dc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/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