File size: 1,670 Bytes
c887738 | 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
# AfriHuBERT-xlarge : DERNIERE famille d encodeur reellement ouverte.
#
# Pourquoi la loi de memorisation ne s applique PAS ici : c est un HubertModel,
# donc AUTO-SUPERVISE -- il a appris sur de l audio seul, sans jamais voir une
# transcription. Meme s il a entendu de l audio WAXAL, il ne peut rien reciter.
# Les deux modeles qui ont echoue (asr-africa, sulaimank) avaient une tete CTC
# entrainee sur les TEXTES WAXAL : c est ca qui produisait la recitation.
#
# 48 couches / hidden 1280, contre 24 / 1024 pour notre base w2v-BERT 2.0,
# et pre-entraine sur de la parole AFRICAINE.
set -e
export HF_TOKEN=REMPLACER_PAR_VOTRE_JETON_HF
/root/venv/bin/python - <<PY
from huggingface_hub import snapshot_download
p=snapshot_download(repo_id="ajesujoba/AfriHuBERT-xlarge", local_dir="/scratch/models/afrihubert_xl")
print("DL OK",p)
import json
c=json.load(open(p+"/config.json"))
print("arch",c.get("architectures"),"hidden",c.get("hidden_size"),"couches",c.get("num_hidden_layers"))
PY
# pas de vocab externe : train_wbert doit reconstruire le NOTRE (casse+ponctuation)
rm -f /scratch/models/afrihubert_xl/vocab.json /scratch/models/afrihubert_xl/tokenizer_config.json
[ -f /scratch/models/afrihubert_xl/vocab.json ] && { echo "ERREUR vocab present"; exit 1; }
M=/scratch/prep/manifests
SAVE_LIMIT=12 LOAD_BEST=0 IGNORE_MISMATCH=1 /root/venv/bin/python /root/train_wbert.py \
--lang lin --out /scratch/runs/ahb \
--init /scratch/models/afrihubert_xl \
--train $M/waxal_lin_train.jsonl $M/waxal_sna_train.jsonl \
--eval $M/waxal_lin_validation.jsonl \
--lr 5e-5 --epochs 6 --bs 4 --grad_accum 15 --warmup 300 --eval_steps 200
echo AHB_TRAIN_DONE
|