Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test_ensemble_of_different_s2s.sh « mixed-ensembles « features « training « tests - github.com/marian-nmt/marian-regression-tests.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cd465c713e60ce7d905751fc088b34836a0e0860 (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
#!/bin/bash -x

#####################################################################
# SUMMARY: Train and decode with RNN models of different architectures
# AUTHOR: snukky
# TAGS: unstable
#####################################################################

# Exit on error
set -e

# Test code goes here
rm -rf two_s2s two_s2s*.log
mkdir -p two_s2s

options="--no-shuffle --mini-batch 32 --maxi-batch 1 --maxi-batch-sort none --optimizer sgd --disp-freq 20 --after-batches 100"

# Train model A
$MRT_MARIAN/marian \
    --type s2s -m two_s2s/modelA.npz -t $MRT_DATA/europarl.de-en/corpus.bpe.{en,de} -v vocab.en.yml vocab.de.yml \
    $options --seed 1111 --dim-emb 128 --dim-rnn 256 \
    --log two_s2s_A.log

test -e two_s2s/modelA.npz
test -e two_s2s_A.log

# Train model B with different architecture
$MRT_MARIAN/marian \
    --type s2s -m two_s2s/modelB.npz -t $MRT_DATA/europarl.de-en/corpus.bpe.{en,de} -v vocab.en.yml vocab.de.yml \
    $options --seed 2222 --dim-emb 256 --dim-rnn 128 --layer-normalization --enc-depth 2 \
    --log two_s2s_B.log

test -e two_s2s/modelB.npz
test -e two_s2s_B.log

# Check if the ensemble of two different s2s models works
$MRT_MARIAN/marian-decoder -m two_s2s/modelA.npz two_s2s/modelB.npz -v vocab.en.yml vocab.de.yml \
    -i text.in -o two_s2s.out --log two_s2s.log

$MRT_TOOLS/diff.sh two_s2s.out two_s2s.expected > two_s2s.diff

# Exit with success code
exit 0