-
Notifications
You must be signed in to change notification settings - Fork 1
/
04.translate.sh
executable file
·38 lines (32 loc) · 1.17 KB
/
04.translate.sh
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
#!/bin/bash
## create and submit the batches on csd3 for translation
set -euo pipefail
. env/init.sh
. config.sh
. functions.sh
collection=$1
shift
for lang in $*; do
# Make sure we know how to translate this language pair
test -x $MODEL_DIR/${lang%~*}-${TARGET_LANG%~*}/translate.sh || (echo "No model: $MODEL_DIR/${lang%~*}-${TARGET_LANG%~*}/translate.sh" 1>&2 ; exit 255)
# Optionally load any env overrides for this model (mostly SBATCH_CPUS_PER_TASK, but also difference between cpu/gpu models)
if [[ -f $MODEL_DIR/${lang%~*}-${TARGET_LANG%~*}/env.sh ]]; then
source $MODEL_DIR/${lang%~*}-${TARGET_LANG%~*}/env.sh
fi
batch_list=$(make_batch_list 04 $collection $lang sentences_${TARGET_LANG%~*}.gz sentences.gz)
job_list=$(make_job_list $batch_list)
if [ ! -z $job_list ]; then
prompt "Scheduling $job_list\n"
if confirm; then
schedule \
-J translate-${lang%~*}-${collection} \
-a $job_list \
--cpus-per-task=${SBATCH_CPUS_PER_TASK:-16} \
--time 24:00:00 \
-e $SLURM_LOGS/04.translate-${lang%~*}-%A_%a.err \
-o $SLURM_LOGS/04.translate-${lang%~*}-%A_%a.out \
$SCRIPTS/generic.slurm $batch_list \
$SCRIPTS/04.translate ${lang%~*}
fi
fi
done