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

test_compare_word_and_sentence_weighting.sh « data-weighting « training « tests - github.com/marian-nmt/marian-regression-tests.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6529857c8fd719700a4a5e07e18ea1ab38d9207b (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
#!/bin/bash

# Exit on error
set -e

# Test code goes here
rm -rf compare compare.{log,out,diff}
mkdir -p compare

cat $MRT_DATA/europarl.de-en/toy.bpe.en | sed -r -e 's/[^ ]+/3/g' -e 's/$/ 3/' > compare.words.weights.txt
cat $MRT_DATA/europarl.de-en/toy.bpe.en | sed -r -e 's/.*/3/' > compare.sents.weights.txt

# Train on sentence-level, each sentence has weight 3
$MRT_MARIAN/build/marian \
    --seed 3333 --no-shuffle --dim-emb 128 --dim-rnn 256 --optimizer sgd \
    -m compare/model.sents.npz -t $MRT_DATA/europarl.de-en/toy.bpe.{de,en} -v vocab.{de,en}.yml \
    --log compare.sents.log --disp-freq 5 -e 2 \
    --data-weighting compare.sents.weights.txt --data-weighting-type sentence

test -e compare/model.sents.npz
test -e compare.sents.log

cat compare.sents.log | $MRT_TOOLS/extract-disp.sh > compare.sents.out

# Train on word-level, each word has weight 3, including EOS
$MRT_MARIAN/build/marian \
    --seed 3333 --no-shuffle --dim-emb 128 --dim-rnn 256 --optimizer sgd \
    -m compare/model.words.npz -t $MRT_DATA/europarl.de-en/toy.bpe.{de,en} -v vocab.{de,en}.yml \
    --log compare.words.log --disp-freq 5 -e 2 \
    --data-weighting compare.words.weights.txt --data-weighting-type word

test -e compare/model.words.npz
test -e compare.words.log

cat compare.words.log | $MRT_TOOLS/extract-disp.sh > compare.words.out
$MRT_TOOLS/diff-nums.py compare.words.out compare.sents.out -p 0.1 -o compare.words.diff


# Exit with success code
exit 0