diff options
author | Roman Grundkiewicz <rgrundki@exseed.ed.ac.uk> | 2018-02-21 21:38:49 +0300 |
---|---|---|
committer | Roman Grundkiewicz <rgrundki@exseed.ed.ac.uk> | 2018-02-21 21:38:49 +0300 |
commit | ba1b7807937ff2e3315aec7439e44664431bf165 (patch) | |
tree | 2eef644cd3b62ef423f4bbdfa38b1c2b19c35190 /tests/training | |
parent | 375cec74a7a398120a999be36ffb72babfca96cb (diff) |
Update regression tests
Diffstat (limited to 'tests/training')
4 files changed, 156 insertions, 0 deletions
diff --git a/tests/training/restart/.gitignore b/tests/training/restart/.gitignore index 60d3c29..504d7ac 100644 --- a/tests/training/restart/.gitignore +++ b/tests/training/restart/.gitignore @@ -12,3 +12,9 @@ corpus_sqlite corpus_sqlite.expected corpus_mini corpus_mini.expected +corpus_one +corpus_one.expected +corpus_maxi +corpus_maxi.expected +corpus_fit +corpus_fit.expected diff --git a/tests/training/restart/test_corpus_restoration_maxi_batch.sh b/tests/training/restart/test_corpus_restoration_maxi_batch.sh new file mode 100644 index 0000000..3d339e0 --- /dev/null +++ b/tests/training/restart/test_corpus_restoration_maxi_batch.sh @@ -0,0 +1,50 @@ +#!/bin/bash -x + +# Exit on error +set -e + +# Test code goes here +rm -rf corpus_maxi corpus_maxi*.log +mkdir -p corpus_maxi + +test -e vocab.de.yml +test -e vocab.en.yml + +extra_opts="--seed 1111 --maxi-batch 20 --mini-batch 32 -o sgd --dim-emb 128 --dim-rnn 256 --disp-freq 4 --restore-corpus" + +$MRT_MARIAN/build/marian \ + -m corpus_maxi/model_full.npz -t train.max50.{en,de} -v vocab.{en,de}.yml \ + --after-batches 70 $extra_opts \ + --log corpus_maxi.log + +test -e corpus_maxi/model_full.npz +test -e corpus_maxi.log + +cat corpus_maxi.log | $MRT_TOOLS/strip-timestamps.sh | grep "Ep\. " | sed 's/ : Time.*//' > corpus_maxi.expected + +$MRT_MARIAN/build/marian \ + -m corpus_maxi/model.npz -t train.max50.{en,de} -v vocab.{en,de}.yml \ + --after-batches 40 $extra_opts \ + --log corpus_maxi_1.log + +test -e corpus_maxi/model.npz +test -e corpus_maxi_1.log + +cat corpus_maxi_1.log | $MRT_TOOLS/strip-timestamps.sh | grep "Ep\. " | sed 's/ : Time.*//' > corpus_maxi_1.out +cp corpus_maxi/model.npz.yml corpus_maxi/model.npz.1.yml + +$MRT_MARIAN/build/marian \ + -m corpus_maxi/model.npz -t train.max50.{en,de} -v vocab.{en,de}.yml \ + --after-batches 70 $extra_opts \ + --log corpus_maxi_2.log + +test -e corpus_maxi/model.npz +test -e corpus_maxi_2.log + +cat corpus_maxi_2.log | $MRT_TOOLS/strip-timestamps.sh | grep "Ep\. " | sed 's/ : Time.*//' > corpus_maxi_2.out +cat corpus_maxi_1.out corpus_maxi_2.out > corpus_maxi.out + +$MRT_TOOLS/diff-floats.py corpus_maxi.out corpus_maxi.expected -p 0.1 > corpus_maxi.diff + +# Exit with success code +exit 0 diff --git a/tests/training/restart/test_corpus_restoration_mini_batch_fit.sh b/tests/training/restart/test_corpus_restoration_mini_batch_fit.sh new file mode 100644 index 0000000..5cbc4a0 --- /dev/null +++ b/tests/training/restart/test_corpus_restoration_mini_batch_fit.sh @@ -0,0 +1,50 @@ +#!/bin/bash -x + +# Exit on error +set -e + +# Test code goes here +rm -rf corpus_fit corpus_fit*.log +mkdir -p corpus_fit + +test -e vocab.de.yml +test -e vocab.en.yml + +extra_opts="--seed 5555 --maxi-batch 8 --maxi-batch-sort src --mini-batch 32 --mini-batch-fit -w 100 -o sgd --dim-emb 128 --dim-rnn 256 --disp-freq 4 --restore-corpus" + +$MRT_MARIAN/build/marian \ + -m corpus_fit/model_full.npz -t train.max50.{en,de} -v vocab.{en,de}.yml \ + --after-batches 80 $extra_opts \ + --log corpus_fit.log + +test -e corpus_fit/model_full.npz +test -e corpus_fit.log + +cat corpus_fit.log | $MRT_TOOLS/strip-timestamps.sh | grep "Ep\. " | sed 's/ : Time.*//' > corpus_fit.expected + +$MRT_MARIAN/build/marian \ + -m corpus_fit/model.npz -t train.max50.{en,de} -v vocab.{en,de}.yml \ + --after-batches 60 $extra_opts \ + --log corpus_fit_1.log + +test -e corpus_fit/model.npz +test -e corpus_fit_1.log + +cat corpus_fit_1.log | $MRT_TOOLS/strip-timestamps.sh | grep "Ep\. " | sed 's/ : Time.*//' > corpus_fit_1.out +cp corpus_fit/model.npz.yml corpus_fit/model.npz.1.yml + +$MRT_MARIAN/build/marian \ + -m corpus_fit/model.npz -t train.max50.{en,de} -v vocab.{en,de}.yml \ + --after-batches 80 $extra_opts \ + --log corpus_fit_2.log + +test -e corpus_fit/model.npz +test -e corpus_fit_2.log + +cat corpus_fit_2.log | $MRT_TOOLS/strip-timestamps.sh | grep "Ep\. " | sed 's/ : Time.*//' > corpus_fit_2.out +cat corpus_fit_1.out corpus_fit_2.out > corpus_fit.out + +$MRT_TOOLS/diff-floats.py corpus_fit.out corpus_fit.expected -p 0.1 > corpus_fit.diff + +# Exit with success code +exit 0 diff --git a/tests/training/restart/test_corpus_restoration_one_epoch.sh b/tests/training/restart/test_corpus_restoration_one_epoch.sh new file mode 100644 index 0000000..dd15815 --- /dev/null +++ b/tests/training/restart/test_corpus_restoration_one_epoch.sh @@ -0,0 +1,50 @@ +#!/bin/bash -x + +# Exit on error +set -e + +# Test code goes here +rm -rf corpus_one corpus_one*.log +mkdir -p corpus_one + +test -e vocab.de.yml +test -e vocab.en.yml + +extra_opts="--seed 9999 --maxi-batch 1 --maxi-batch-sort none --mini-batch 32 -o sgd --dim-emb 128 --dim-rnn 256 --disp-freq 4 --restore-corpus" + +$MRT_MARIAN/build/marian \ + -m corpus_one/model_full.npz -t train.max50.{en,de} -v vocab.{en,de}.yml \ + --after-batches 70 $extra_opts \ + --log corpus_one.log + +test -e corpus_one/model_full.npz +test -e corpus_one.log + +cat corpus_one.log | $MRT_TOOLS/strip-timestamps.sh | grep "Ep\. " | sed 's/ : Time.*//' > corpus_one.expected + +$MRT_MARIAN/build/marian \ + -m corpus_one/model.npz -t train.max50.{en,de} -v vocab.{en,de}.yml \ + --after-batches 25 $extra_opts \ + --log corpus_one_1.log + +test -e corpus_one/model.npz +test -e corpus_one_1.log + +cat corpus_one_1.log | $MRT_TOOLS/strip-timestamps.sh | grep "Ep\. " | sed 's/ : Time.*//' > corpus_one_1.out +cp corpus_one/model.npz.yml corpus_one/model.npz.1.yml + +$MRT_MARIAN/build/marian \ + -m corpus_one/model.npz -t train.max50.{en,de} -v vocab.{en,de}.yml \ + --after-batches 70 $extra_opts \ + --log corpus_one_2.log + +test -e corpus_one/model.npz +test -e corpus_one_2.log + +cat corpus_one_2.log | $MRT_TOOLS/strip-timestamps.sh | grep "Ep\. " | sed 's/ : Time.*//' > corpus_one_2.out +cat corpus_one_1.out corpus_one_2.out > corpus_one.out + +$MRT_TOOLS/diff-floats.py corpus_one.out corpus_one.expected -p 0.1 -n 1 > corpus_one.diff + +# Exit with success code +exit 0 |