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

github.com/marian-nmt/marian-regression-tests.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Grundkiewicz <rgrundki@exseed.ed.ac.uk>2018-11-07 12:05:31 +0300
committerRoman Grundkiewicz <rgrundki@exseed.ed.ac.uk>2018-11-07 12:05:31 +0300
commit1f0d02afe3d181f94dc9a9e60936f32d2f9f672e (patch)
tree4d1a39158467d8a10d26ef0361770cadad9ec8e5 /tests/training/data-weighting
parentda0408ae996de2970d84930c971f1e2ebb42eb02 (diff)
Add test
Diffstat (limited to 'tests/training/data-weighting')
-rw-r--r--tests/training/data-weighting/.gitignore4
-rw-r--r--tests/training/data-weighting/test_length_mismatch_warnings.sh27
2 files changed, 30 insertions, 1 deletions
diff --git a/tests/training/data-weighting/.gitignore b/tests/training/data-weighting/.gitignore
index 7bf6c5d..ae9f462 100644
--- a/tests/training/data-weighting/.gitignore
+++ b/tests/training/data-weighting/.gitignore
@@ -21,4 +21,6 @@ valid_script.temp
maxibatch
word_maxibatch
compare
-compare.*.weights.txt
+compare*.weights.txt
+warn
+warn*.weights.txt
diff --git a/tests/training/data-weighting/test_length_mismatch_warnings.sh b/tests/training/data-weighting/test_length_mismatch_warnings.sh
new file mode 100644
index 0000000..9a52fcc
--- /dev/null
+++ b/tests/training/data-weighting/test_length_mismatch_warnings.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+# Exit on error
+set -e
+
+# Test code goes here
+rm -rf warn warn.log warn.weights.txt
+mkdir -p warn
+
+
+cat $MRT_DATA/europarl.de-en/toy.bpe.en | sed -r 's/[^ ]+/1/g' > warn.weights.txt
+sed -i '2s/1 1 /1 /g' warn.weights.txt
+sed -i '3s/1 /1 1 /g' warn.weights.txt
+
+$MRT_MARIAN/build/marian \
+ --seed 1111 --dim-emb 64 --dim-rnn 128 --optimizer sgd \
+ -m warn/model.npz -t $MRT_DATA/europarl.de-en/toy.bpe.{de,en} -v vocab.{de,en}.yml \
+ --log warn.log -e 1 \
+ --data-weighting warn.weights.txt --data-weighting-type word
+
+test -e warn.log
+grep -qi "[warn].*number of weights.* does not match.* words.* line #1" warn.log
+grep -qi "[warn].*number of weights.* does not match.* words.* line #2" warn.log
+
+
+# Exit with success code
+exit 0