diff options
author | Roman Grundkiewicz <rgrundki@exseed.ed.ac.uk> | 2018-11-07 19:39:31 +0300 |
---|---|---|
committer | Roman Grundkiewicz <rgrundki@exseed.ed.ac.uk> | 2018-11-07 19:39:31 +0300 |
commit | 9e0ae9b748d009b8cb2b41880969c80a7a2572cc (patch) | |
tree | 144329d53a3c545f3ee0cc52e17ce6f4403d14d4 /tests | |
parent | 251d34371d1ce92e7e4aa12aee15402d22d80a4f (diff) | |
parent | 1f0d02afe3d181f94dc9a9e60936f32d2f9f672e (diff) |
Merge branch 'add-warning-for-weights'
Diffstat (limited to 'tests')
-rw-r--r-- | tests/training/data-weighting/.gitignore | 4 | ||||
-rw-r--r-- | tests/training/data-weighting/test_length_mismatch_warnings.sh | 27 |
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 |