File size: 1,790 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 | #!/bin/bash
# e8 重训: gate(205052) -> HF Trainer 8ep -> gate(val acc)
set -x
export PYTHONPATH=/root/patientphex/retrain_t1/code
export HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 TOKENIZERS_PARALLELISM=false
PY=/root/patientphex/e8_venv/bin/python
C=/root/patientphex/retrain_t1/code
P=/root/patientphex/retrain_t1/third_party/PhenoTagger-Plus
for f in $P/data/distant_train_data/distant_train.conll \
$P/dict-hp-20260623-typo/lable.vocab \
$P/emb_20260623/transr-full/transR_512.emb \
/root/patientphex/assets/dmis-biobert-cased/pytorch_model.bin; do
[ -e "$f" ] || { echo MISSING $f; exit 1; }
done
$PY /root/patientphex/count_conll.py $P/data/distant_train_data/distant_train.conll > /root/patientphex/conll_count.txt 2>&1
cat /root/patientphex/conll_count.txt
grep -qE "records=2050[0-9][0-9]" /root/patientphex/conll_count.txt || { echo CONLL_COUNT_GATE_FAIL; exit 2; }
echo CONLL_GATE_OK
echo "NOTE: 44-record positive delta vs A-day (155008 vs 155052) accepted; root cause: A-day typo dict input-side diff (noabb md5 mismatch, nlpaug/py versions ruled out)"
CUDA_VISIBLE_DEVICES=1 $PY $C/scripts/train_phenotagger_plus_hf.py \
--train $P/data/distant_train_data/distant_train.conll \
--labels $P/dict-hp-20260623-typo/lable.vocab \
--embedding $P/emb_20260623/transr-full/transR_512.emb \
--backbone /root/patientphex/assets/dmis-biobert-cased \
--output-dir /root/patientphex/models_20260623/biobert-transr-v1 \
--epochs 8 --batch-size 64 --max-length 32 --learning-rate 5e-5 \
--warmup-ratio 0.03 --weight-decay 0.01 --seed 42 --validation-ratio 0.05 || { echo E8_TRAIN_FAIL; exit 3; }
echo E8_TRAIN_DONE
ls -la /root/patientphex/models_20260623/biobert-transr-v1/ /root/patientphex/models_20260623/biobert-transr-v1/best/ 2>/dev/null
|