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

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

#####################################################################
# SUMMARY: Training transformer model with guided alignment
# AUTHOR: snukky
# TAGS: align transformer
#####################################################################

# Exit on error
set -e

# Remove old artifacts and create working directory
rm -rf transformer transformer.{log,out,diff}
mkdir -p transformer

# Run marian command
$MRT_MARIAN/marian --type transformer \
    --no-shuffle --seed 2222 --dim-emb 32 --dim-rnn 64 --mini-batch 32 --maxi-batch 1 --maxi-batch-sort none --optimizer sgd \
    -m transformer/model.npz -t corpus.bpe.{en,de} -v vocab.en.yml vocab.de.yml \
    --after-batches 100 --disp-freq 10 \
    --guided-alignment corpus.bpe.align --guided-alignment-weight 1.0 --learn-rate 0.1 \
    --log transformer.log

# Check if files exist
test -e transformer/model.npz
test -e transformer.log
grep -qi "word alignments from file" transformer.log

# Compare the current output with the expected output
cat transformer.log | $MRT_TOOLS/extract-costs.sh > transformer.out
$MRT_TOOLS/diff-nums.py transformer.out transformer.expected -o transformer.diff

# Exit with success code
exit 0