blob: 8d6fcef6e907feb9fd8eed81d63aa77fcafac6c1 (
plain)
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
55
56
57
58
59
60
|
#!/bin/bash -x
# Exit on error
set -e
if (( $MRT_NUM_DEVICES < 2 )); then
echo "Too few devices available"
exit 100
fi
# Test code goes here
rm -rf async async_*.log async.*out async.*expected
mkdir -p async
opts="--no-shuffle --seed 777 --mini-batch 1 --maxi-batch 1 --maxi-batch-sort none --dim-rnn 64 --dim-emb 32 --optimizer sgd --learn-rate 0.1 --devices 0 1"
opt_disp=1
opt_save=8
opt_finish=16
$MRT_MARIAN/build/marian \
-m async/model.full.npz -t $MRT_DATA/europarl.de-en/corpus.bpe.{en,de} -v vocab.en.yml vocab.de.yml \
--disp-freq $opt_disp --after-batches $opt_finish $opts \
--log async_f.log
test -e async/model.full.npz
test -e async_f.log
cat async_f.log | $MRT_TOOLS/extract-costs.sh > async.unsorted.expected
$MRT_MARIAN/build/marian \
-m async/model.npz -t $MRT_DATA/europarl.de-en/corpus.bpe.{en,de} -v vocab.en.yml vocab.de.yml \
--disp-freq $opt_disp --after-batches $opt_save $opts \
--log async_1.log
test -e async/model.npz
test -e async_1.log
cat async_1.log | $MRT_TOOLS/extract-costs.sh > async.unsorted.out
$MRT_MARIAN/build/marian \
-m async/model.npz -t $MRT_DATA/europarl.de-en/corpus.bpe.{en,de} -v vocab.en.yml vocab.de.yml \
--disp-freq $opt_disp --after-batches $opt_finish $opts \
--log async_2.log
test -e async/model.npz
test -e async_2.log
# costs are sorted as the order of each N (N is the number of GPUs) consecutive costs is undeterministic
cat async_2.log | $MRT_TOOLS/extract-costs.sh >> async.unsorted.out
cat async.unsorted.expected | head -n -4 | sort -n > async.expected
cat async.unsorted.out | head -n -4 | sort -n > async.out
# async is undeterministic, so the conditions are weak
$MRT_TOOLS/diff-floats.py -p 1.0 -n 2 async.out async.expected > async.diff
# Exit with success code
exit 0
|