waxal2026-backup / archive /scripts_B /queue_real_punct.sh
Pricile's picture
Upload folder using huggingface_hub
c887738 verified
Raw
History Blame Contribute Delete
1.76 kB
#!/bin/bash
# Attend la fin de la transcription shona, puis entraine la ponctuation sur les
# VRAIES sorties ASR (lingala + shona), puis publie le modele.
#
# REGLE ANTI-AUTO-BLOCAGE : motif a crochet "[r]eal_asr_punct".
exec >> /root/queue_real.log 2>&1
echo "########## file ponctuation REELLE demarree $(date -u '+%d/%m %H:%M UTC') ##########"
V=/root/venv/bin/python
echo "attente de la transcription shona..."
while pgrep -f "[r]eal_asr_punct" > /dev/null; do sleep 30; done
sleep 10
echo "transcriptions terminees $(date -u '+%H:%M')"
wc -l /scratch/real_lin.jsonl /scratch/real_sna.jsonl 2>/dev/null
# afro-xlmr-base : c est LUI qui gagne au LB, pas mBERT (0.696 de precision hors ligne
# mais meilleur au reel). On garde donc la base gagnante et on ne change QUE les donnees.
$V /root/train_punct.py \
--out /scratch/runs/punct_real --base Davlan/afro-xlmr-base \
--real /scratch/real_lin.jsonl /scratch/real_sna.jsonl \
--lr 3e-5 --epochs 4 --bs 16 \
|| echo "!! entrainement reel echoue"
if [ -d /scratch/runs/punct_real/best ]; then
$V -c "
from huggingface_hub import HfApi
HfApi(token=open('/root/.cache/huggingface/token').read().strip()).upload_folder(
folder_path='/scratch/runs/punct_real/best', path_in_repo='punct/real_best',
repo_id='Pricile/waxal2026-backup', repo_type='model')
print('PONCT_REELLE_PUBLIEE')" || echo "!! publication echouee (depot HF plein ?)"
# repli : liaison directe B -> A si HF refuse
echo "copie directe vers A"
scp -r -o StrictHostKeyChecking=no -o BatchMode=yes /scratch/runs/punct_real/best \
root@151.115.78.57:/scratch/punct_real_best 2>/dev/null \
&& echo COPIE_A_OK || echo "(pas de cle B->A, utiliser HF ou tirer depuis A)"
fi
echo "FILE_REELLE_TERMINEE $(date -u '+%H:%M')"