diff options
author | Roman Grundkiewicz <rgrundki@exseed.ed.ac.uk> | 2018-11-28 19:58:01 +0300 |
---|---|---|
committer | Roman Grundkiewicz <rgrundki@exseed.ed.ac.uk> | 2018-11-28 19:58:01 +0300 |
commit | 8b50eb0ae106bee2fa58a8005c1819c85d00bda3 (patch) | |
tree | 6420b72307cc6fd44b321cd5676dbbf2073ca2e1 /tests/training/models/lm | |
parent | 9cc169495729ce9d25ffae7492f08fd6d8619915 (diff) |
Organize tests
Diffstat (limited to 'tests/training/models/lm')
-rw-r--r-- | tests/training/models/lm/.gitignore | 7 | ||||
-rw-r--r-- | tests/training/models/lm/lm-transformer.expected | 5 | ||||
-rw-r--r-- | tests/training/models/lm/lm-transformer.scores.expected | 10 | ||||
-rw-r--r-- | tests/training/models/lm/lm.expected | 5 | ||||
-rw-r--r-- | tests/training/models/lm/lm.scores.expected | 10 | ||||
-rw-r--r-- | tests/training/models/lm/setup.sh | 2 | ||||
-rw-r--r-- | tests/training/models/lm/test_lm-transformer.sh | 31 | ||||
-rw-r--r-- | tests/training/models/lm/test_lm.sh | 31 |
8 files changed, 101 insertions, 0 deletions
diff --git a/tests/training/models/lm/.gitignore b/tests/training/models/lm/.gitignore new file mode 100644 index 0000000..38d4404 --- /dev/null +++ b/tests/training/models/lm/.gitignore @@ -0,0 +1,7 @@ +lm +lm-transformer +multi-s2s +multi-transformer + +vocab.*.yml +test.bpe.en diff --git a/tests/training/models/lm/lm-transformer.expected b/tests/training/models/lm/lm-transformer.expected new file mode 100644 index 0000000..30093eb --- /dev/null +++ b/tests/training/models/lm/lm-transformer.expected @@ -0,0 +1,5 @@ +403.40 +291.95 +215.86 +151.40 +86.24 diff --git a/tests/training/models/lm/lm-transformer.scores.expected b/tests/training/models/lm/lm-transformer.scores.expected new file mode 100644 index 0000000..c3cc9e9 --- /dev/null +++ b/tests/training/models/lm/lm-transformer.scores.expected @@ -0,0 +1,10 @@ +-111.429642 +-202.879257 +-99.488770 +-232.767487 +-648.426636 +-151.236145 +-385.781769 +-60.357460 +-89.177971 +-104.630791 diff --git a/tests/training/models/lm/lm.expected b/tests/training/models/lm/lm.expected new file mode 100644 index 0000000..ad2275c --- /dev/null +++ b/tests/training/models/lm/lm.expected @@ -0,0 +1,5 @@ +410.28 +307.48 +234.20 +159.79 +89.71 diff --git a/tests/training/models/lm/lm.scores.expected b/tests/training/models/lm/lm.scores.expected new file mode 100644 index 0000000..f36053b --- /dev/null +++ b/tests/training/models/lm/lm.scores.expected @@ -0,0 +1,10 @@ +-110.248581 +-196.816528 +-99.821030 +-227.068649 +-617.119629 +-148.625153 +-366.640015 +-59.929665 +-89.517532 +-107.458366 diff --git a/tests/training/models/lm/setup.sh b/tests/training/models/lm/setup.sh new file mode 100644 index 0000000..8b8cd07 --- /dev/null +++ b/tests/training/models/lm/setup.sh @@ -0,0 +1,2 @@ +test -f $MRT_DATA/europarl.de-en/corpus.bpe.en || exit 1 +test -f $MRT_DATA/europarl.de-en/corpus.bpe.de || exit 1 diff --git a/tests/training/models/lm/test_lm-transformer.sh b/tests/training/models/lm/test_lm-transformer.sh new file mode 100644 index 0000000..47737e5 --- /dev/null +++ b/tests/training/models/lm/test_lm-transformer.sh @@ -0,0 +1,31 @@ +#!/bin/bash -x + +# Exit on error +set -e + +# Test code goes here +rm -rf lm-transformer lm-transformer.log +mkdir -p lm-transformer + +$MRT_MARIAN/build/marian \ + --seed 1111 --no-shuffle \ + --type lm-transformer --dim-emb 128 --dim-rnn 256 \ + -m lm-transformer/model.npz -t $MRT_DATA/europarl.de-en/corpus.bpe.en -v vocab.en.yml \ + --disp-freq 20 --after-batches 100 \ + --log lm-transformer.log + +test -e lm-transformer/model.npz +test -e lm-transformer/model.npz.yml +test -e lm-transformer.log + +cat lm-transformer.log | grep 'Ep\. 1 :' | $MRT_TOOLS/extract-costs.sh > lm-transformer.out +$MRT_TOOLS/diff-nums.py lm-transformer.out lm-transformer.expected -p 0.02 -o lm-transformer.diff + +# Scoring with LM +test -s temp.bpe.en || tail $MRT_DATA/europarl.de-en/corpus.bpe.en > test.bpe.en + +$MRT_MARIAN/build/marian-scorer -m lm-transformer/model.npz -t test.bpe.en -v vocab.en.yml > lm-transformer.scores.out +$MRT_TOOLS/diff-nums.py lm-transformer.scores.out lm-transformer.scores.expected -p 0.002 -o lm-transformer.scores.diff + +# Exit with success code +exit 0 diff --git a/tests/training/models/lm/test_lm.sh b/tests/training/models/lm/test_lm.sh new file mode 100644 index 0000000..e3c32a0 --- /dev/null +++ b/tests/training/models/lm/test_lm.sh @@ -0,0 +1,31 @@ +#!/bin/bash -x + +# Exit on error +set -e + +# Test code goes here +rm -rf lm lm.log +mkdir -p lm + +$MRT_MARIAN/build/marian \ + --seed 1111 --no-shuffle \ + --type lm --dim-emb 128 --dim-rnn 256 \ + -m lm/model.npz -t $MRT_DATA/europarl.de-en/corpus.bpe.en -v vocab.en.yml \ + --disp-freq 20 --after-batches 100 \ + --log lm.log + +test -e lm/model.npz +test -e lm/model.npz.yml +test -e lm.log + +cat lm.log | grep 'Ep\. 1 :' | $MRT_TOOLS/extract-costs.sh > lm.out +$MRT_TOOLS/diff-nums.py lm.out lm.expected -p 0.02 -o lm.diff + +# Scoring with LM +test -s temp.bpe.en || tail $MRT_DATA/europarl.de-en/corpus.bpe.en > test.bpe.en + +$MRT_MARIAN/build/marian-scorer -m lm/model.npz -t test.bpe.en -v vocab.en.yml > lm.scores.out +$MRT_TOOLS/diff-nums.py lm.scores.out lm.scores.expected -p 0.002 -o lm.scores.diff + +# Exit with success code +exit 0 |