diff options
author | Roman Grundkiewicz <rgrundki@exseed.ed.ac.uk> | 2018-03-12 13:19:24 +0300 |
---|---|---|
committer | Roman Grundkiewicz <rgrundki@exseed.ed.ac.uk> | 2018-03-12 13:19:24 +0300 |
commit | a36d969687fd35ae7d14cee66cd297679b648cfe (patch) | |
tree | 55a71d304cda92a15b1216f02ee435924d082315 | |
parent | 4f626b79cc59726a77cf9180ae83af432424a1aa (diff) |
Simplify mini-batch-fit testing
-rw-r--r-- | tests/training/basics/.gitignore | 1 | ||||
-rw-r--r-- | tests/training/basics/batch_fit.expected | 5 | ||||
-rw-r--r-- | tests/training/basics/test_mini_batch_fit.sh | 27 | ||||
-rw-r--r-- | tests/training/batches/.gitignore | 2 | ||||
-rw-r--r-- | tests/training/batches/dynamic.expected | 5 | ||||
-rw-r--r-- | tests/training/batches/setup.sh | 2 | ||||
-rw-r--r-- | tests/training/batches/test_mini_batch_fit.sh | 32 |
7 files changed, 33 insertions, 41 deletions
diff --git a/tests/training/basics/.gitignore b/tests/training/basics/.gitignore index 4b52d7c..61de908 100644 --- a/tests/training/basics/.gitignore +++ b/tests/training/basics/.gitignore @@ -3,5 +3,6 @@ valid trans sqlite sqlite_seed +batch_fit *.temp vocab.*.yml diff --git a/tests/training/basics/batch_fit.expected b/tests/training/basics/batch_fit.expected new file mode 100644 index 0000000..fcb1994 --- /dev/null +++ b/tests/training/basics/batch_fit.expected @@ -0,0 +1,5 @@ +379 +367 +367 +369 +367 diff --git a/tests/training/basics/test_mini_batch_fit.sh b/tests/training/basics/test_mini_batch_fit.sh new file mode 100644 index 0000000..093a584 --- /dev/null +++ b/tests/training/basics/test_mini_batch_fit.sh @@ -0,0 +1,27 @@ +#!/bin/bash -x + +# Exit on error +set -e + +# Test code goes here +rm -rf batch_fit batch_fit.log +mkdir -p batch_fit + +$MRT_MARIAN/build/marian \ + --no-shuffle --seed 1111 --dim-emb 128 --dim-rnn 256 \ + -m batch_fit/model.npz -t $MRT_DATA/europarl.de-en/corpus.bpe.{en,de} -v vocab.{en,de}.yml \ + --disp-freq 20 --after-batches 100 \ + --log batch_fit.log \ + --mini-batch-fit -w 4000 + +test -e batch_fit/model.npz +test -e batch_fit/model.npz.yml +test -e batch_fit/model.npz.amun.yml + +test -e batch_fit.log + +cat batch_fit.log | grep 'Ep\. 1 :' | sed -r 's/.*Up\. ([0-9]+) .*Sen. ([0-9]+).*/\2\/\1/' | bc > batch_fit.out +diff batch_fit.out batch_fit.expected > batch_fit.diff + +# Exit with success code +exit 0 diff --git a/tests/training/batches/.gitignore b/tests/training/batches/.gitignore deleted file mode 100644 index 96e66f0..0000000 --- a/tests/training/batches/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -dynamic -vocab.*.yml diff --git a/tests/training/batches/dynamic.expected b/tests/training/batches/dynamic.expected deleted file mode 100644 index f130d79..0000000 --- a/tests/training/batches/dynamic.expected +++ /dev/null @@ -1,5 +0,0 @@ -222 -236 -231 -229 -231 diff --git a/tests/training/batches/setup.sh b/tests/training/batches/setup.sh deleted file mode 100644 index 8b8cd07..0000000 --- a/tests/training/batches/setup.sh +++ /dev/null @@ -1,2 +0,0 @@ -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/batches/test_mini_batch_fit.sh b/tests/training/batches/test_mini_batch_fit.sh deleted file mode 100644 index 6096bd5..0000000 --- a/tests/training/batches/test_mini_batch_fit.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -x - -# Exit on error -set -e - -# Test code goes here -rm -rf dynamic dynamic.log -mkdir -p dynamic - -$MRT_MARIAN/build/marian \ - --no-shuffle \ - -m dynamic/model.npz \ - -t $MRT_DATA/europarl.de-en/corpus.bpe.en $MRT_DATA/europarl.de-en/corpus.bpe.de \ - -v vocab.en.yml vocab.de.yml \ - --disp-freq 20 --after-batches 100 \ - --seed 1111 \ - --log dynamic.log \ - --mini-batch-fit -w 4000 - -test -e vocab.en.yml -test -e vocab.de.yml -test -e dynamic/model.npz -test -e dynamic/model.npz.yml -test -e dynamic/model.npz.amun.yml - -test -e dynamic.log - -cat dynamic.log | grep 'Ep\. 1 :' | sed -r 's/.*Up\. ([0-9]+) .*Sen. ([0-9]+).*/\2\/\1/' | bc > dynamic.out -diff dynamic.out dynamic.expected > dynamic.diff - -# Exit with success code -exit 0 |