diff options
author | Roman Grundkiewicz <rgrundki@exseed.ed.ac.uk> | 2018-02-19 15:26:47 +0300 |
---|---|---|
committer | Roman Grundkiewicz <rgrundki@exseed.ed.ac.uk> | 2018-02-19 15:26:47 +0300 |
commit | 46ef147d713ba244c51c3bf8b4c8f9ebdafec0cf (patch) | |
tree | c810bc9c7d1d31302f7f3d5be0a57bc5599bdc25 /tests/training | |
parent | 9cefe7eaa4d8dfd5766bd8a1c0ad6043c7eaeefa (diff) |
Update tests
Diffstat (limited to 'tests/training')
-rw-r--r-- | tests/training/restart/_test_adam_for_two_epochs.sh | 46 | ||||
-rw-r--r-- | tests/training/restart/adam_async.costs.expected | 18 | ||||
-rw-r--r-- | tests/training/restart/adam_async.mt.expected | 2 | ||||
-rw-r--r-- | tests/training/restart/adam_async.vt.expected | 2 | ||||
-rw-r--r-- | tests/training/restart/adam_load.expected | 6 | ||||
-rw-r--r-- | tests/training/restart/adam_load_1.expected | 3 | ||||
-rw-r--r-- | tests/training/restart/adam_load_2.expected | 3 | ||||
-rw-r--r-- | tests/training/restart/test_loading_adam_params.sh | 7 | ||||
-rw-r--r-- | tests/training/restart/test_restoring_validation.sh | 1 | ||||
-rw-r--r-- | tests/training/restart/test_saving_adam_params_async.sh | 3 | ||||
-rw-r--r-- | tests/training/restart/test_saving_adam_params_sync.sh | 3 |
11 files changed, 70 insertions, 24 deletions
diff --git a/tests/training/restart/_test_adam_for_two_epochs.sh b/tests/training/restart/_test_adam_for_two_epochs.sh new file mode 100644 index 0000000..dbd534d --- /dev/null +++ b/tests/training/restart/_test_adam_for_two_epochs.sh @@ -0,0 +1,46 @@ +#!/bin/bash -x + +# Exit on error +set -e + +# Test code goes here +rm -rf adam_2e adam_1st_epoch.log adam_2nd_epoch.log adam_two_epochs.log +mkdir -p adam_2e + +extra_opts="--no-shuffle --seed 1111 --maxi-batch 1 --maxi-batch-sort none --mini-batch 32 --dim-emb 64 --dim-rnn 128 --disp-freq 4 --save-freq 32 -l 0.1 -o adam" + + +## Uncomment to update the test +#$MRT_MARIAN/build/marian $extra_opts \ + #-m adam_2e/model_2e.npz -t train.max50.{en,de} -v vocab.{en,de}.yml --after-epoch 2 \ + #--log adam_two_epochs.log + +#cat adam_two_epochs.log | $MRT_TOOLS/strip-timestamps.sh | grep "Ep\. 1" | sed 's/ : Time.*//' > adam_2e_1st.expected +#cat adam_two_epochs.log | $MRT_TOOLS/strip-timestamps.sh | grep "Ep\. 2" | sed 's/ : Time.*//' > adam_2e_2nd.expected + + +$MRT_MARIAN/build/marian \ +$MRT_MARIAN/build/marian $extra_opts \ + -m adam_2e/model.npz -t train.max50.{en,de} -v vocab.{en,de}.yml --after-epoch 1 \ + --log adam_1st_epoch.log + +test -e adam_2e/model.npz +test -e adam_1st_epoch.log + +cat adam_1st_epoch.log | $MRT_TOOLS/strip-timestamps.sh | grep "Ep\. " | sed 's/ : Time.*//' > adam_1st_epoch.out +cp adam_2e/model.npz.yml adam_2e/model.npz.1st_epoch.yml + +$MRT_MARIAN/build/marian $extra_opts \ + -m adam_2e/model.npz -t train.max50.{en,de} -v vocab.{en,de}.yml --after-epoch 2 \ + --log adam_2nd_epoch.log + +test -e adam_2e/model.npz +test -e adam_2nd_epoch.log + +cat adam_2nd_epoch.log | $MRT_TOOLS/strip-timestamps.sh | grep "Ep\. " | sed 's/ : Time.*//' > adam_2nd_epoch.out + +$MRT_TOOLS/diff-floats.py adam_1st_epoch.out adam_2e_1st.expected -p 0.01 > adam_2e_1st.diff +$MRT_TOOLS/diff-floats.py adam_2nd_epoch.out adam_2e_2nd.expected -p 0.1 > adam_2e_2nd.diff + +# Exit with success code +exit 0 diff --git a/tests/training/restart/adam_async.costs.expected b/tests/training/restart/adam_async.costs.expected index 4134e31..c9555e5 100644 --- a/tests/training/restart/adam_async.costs.expected +++ b/tests/training/restart/adam_async.costs.expected @@ -1,10 +1,10 @@ 226.77 -250.64 -243.71 -246.06 -236.14 -221.90 -211.39 -202.45 -204.81 -201.36 +250.60 +243.75 +250.90 +233.68 +219.93 +207.92 +205.94 +205.11 +204.37 diff --git a/tests/training/restart/adam_async.mt.expected b/tests/training/restart/adam_async.mt.expected index 852700a..119d79b 100644 --- a/tests/training/restart/adam_async.mt.expected +++ b/tests/training/restart/adam_async.mt.expected @@ -1 +1 @@ -[[ 0.00351954 -0.00345516 0.00260725 ..., 0. 0. 0. ]] +[[ 0.00309358 -0.00285356 0.0023213 ..., 0. 0. 0. ]] diff --git a/tests/training/restart/adam_async.vt.expected b/tests/training/restart/adam_async.vt.expected index dfe7787..99e13d3 100644 --- a/tests/training/restart/adam_async.vt.expected +++ b/tests/training/restart/adam_async.vt.expected @@ -1,2 +1,2 @@ -[[ 6.58408317e-06 6.16061698e-06 3.20382856e-06 ..., 0.00000000e+00 +[[ 5.10732070e-06 4.67832115e-06 2.71009117e-06 ..., 0.00000000e+00 0.00000000e+00 0.00000000e+00]] diff --git a/tests/training/restart/adam_load.expected b/tests/training/restart/adam_load.expected new file mode 100644 index 0000000..747cbb1 --- /dev/null +++ b/tests/training/restart/adam_load.expected @@ -0,0 +1,6 @@ +Ep. 1 : Up. 1 : Sen. 8 : Cost 279.36 +Ep. 1 : Up. 2 : Sen. 16 : Cost 244.33 +Ep. 1 : Up. 3 : Sen. 24 : Cost 190.35 +Ep. 1 : Up. 4 : Sen. 32 : Cost 183.99 +Ep. 1 : Up. 5 : Sen. 40 : Cost 203.82 +Ep. 1 : Up. 6 : Sen. 48 : Cost 204.94 diff --git a/tests/training/restart/adam_load_1.expected b/tests/training/restart/adam_load_1.expected deleted file mode 100644 index ef5e82b..0000000 --- a/tests/training/restart/adam_load_1.expected +++ /dev/null @@ -1,3 +0,0 @@ -Ep. 1 : Up. 1 : Sen. 8 : Cost 279.36 -Ep. 1 : Up. 2 : Sen. 16 : Cost 244.33 -Ep. 1 : Up. 3 : Sen. 24 : Cost 190.35 diff --git a/tests/training/restart/adam_load_2.expected b/tests/training/restart/adam_load_2.expected deleted file mode 100644 index 4d8b436..0000000 --- a/tests/training/restart/adam_load_2.expected +++ /dev/null @@ -1,3 +0,0 @@ -Ep. 1 : Up. 4 : Sen. 32 : Cost 183.98 -Ep. 1 : Up. 5 : Sen. 40 : Cost 207.76 -Ep. 1 : Up. 6 : Sen. 48 : Cost 164.58 diff --git a/tests/training/restart/test_loading_adam_params.sh b/tests/training/restart/test_loading_adam_params.sh index f298b54..f7865ec 100644 --- a/tests/training/restart/test_loading_adam_params.sh +++ b/tests/training/restart/test_loading_adam_params.sh @@ -18,7 +18,7 @@ test -e adam_load/model.npz test -e adam_load/model.npz.optimizer.npz test -e adam_load_1.log -cat adam_load_1.log | $MRT_TOOLS/strip-timestamps.sh | grep "Ep\. " | sed 's/ : Time.*//' > adam_load_1.out +cat adam_load_1.log | $MRT_TOOLS/strip-timestamps.sh | grep "Ep\. " | sed 's/ : Time.*//' > adam_load.out $MRT_MARIAN/build/marian \ -m adam_load/model.npz -t train.max50.{en,de} -v vocab.{en,de}.yml \ @@ -29,10 +29,9 @@ test -e adam_load/model.npz test -e adam_load/model.npz.optimizer.npz test -e adam_load_2.log -cat adam_load_2.log | $MRT_TOOLS/strip-timestamps.sh | grep "Ep\. " | sed 's/ : Time.*//' > adam_load_2.out +cat adam_load_2.log | $MRT_TOOLS/strip-timestamps.sh | grep "Ep\. " | sed 's/ : Time.*//' >> adam_load.out -$MRT_TOOLS/diff-floats.py -p 0.99 adam_load_1.out adam_load_1.expected > adam_load_1.diff -$MRT_TOOLS/diff-floats.py -p 0.99 -n 1 adam_load_2.out adam_load_2.expected > adam_load_2.diff +$MRT_TOOLS/diff-floats.py -p 0.99 adam_load.out adam_load.expected > adam_load.diff # Exit with success code exit 0 diff --git a/tests/training/restart/test_restoring_validation.sh b/tests/training/restart/test_restoring_validation.sh index fda8c45..e7d23d6 100644 --- a/tests/training/restart/test_restoring_validation.sh +++ b/tests/training/restart/test_restoring_validation.sh @@ -23,7 +23,6 @@ test -e valid_1.log cp valid/model.npz.yml valid/model.npz.yml.bac cat valid_1.log | $MRT_TOOLS/strip-timestamps.sh | grep "valid-script" > valid.out -#$MRT_TOOLS/diff-floats.py valid_1.out valid_1.expected -p 0.2 > valid_1.diff $MRT_MARIAN/build/marian \ --no-shuffle --seed 2222 --maxi-batch 1 --maxi-batch-sort none \ diff --git a/tests/training/restart/test_saving_adam_params_async.sh b/tests/training/restart/test_saving_adam_params_async.sh index e0f34b0..8219fc4 100644 --- a/tests/training/restart/test_saving_adam_params_async.sh +++ b/tests/training/restart/test_saving_adam_params_async.sh @@ -29,8 +29,9 @@ python $MRT_MARIAN/scripts/contrib/model_info.py -m adam_async/model.npz.optimiz diff adam_async.keys.out adam.keys.expected > adam_async.keys.diff python $MRT_MARIAN/scripts/contrib/model_info.py -m adam_async/model.npz.optimizer.npz -k "adam_mt" > adam_async.mt.out -$MRT_TOOLS/diff-floats.py -p 0.0005 adam_async.mt.out adam_async.mt.expected > adam_async.mt.diff python $MRT_MARIAN/scripts/contrib/model_info.py -m adam_async/model.npz.optimizer.npz -k "adam_vt" > adam_async.vt.out + +$MRT_TOOLS/diff-floats.py -p 0.0005 adam_async.mt.out adam_async.mt.expected > adam_async.mt.diff $MRT_TOOLS/diff-floats.py -p 0.000005 adam_async.vt.out adam_async.vt.expected > adam_async.vt.diff # Exit with success code diff --git a/tests/training/restart/test_saving_adam_params_sync.sh b/tests/training/restart/test_saving_adam_params_sync.sh index 78e9220..b3c0cc0 100644 --- a/tests/training/restart/test_saving_adam_params_sync.sh +++ b/tests/training/restart/test_saving_adam_params_sync.sh @@ -29,8 +29,9 @@ python $MRT_MARIAN/scripts/contrib/model_info.py -m adam_sync/model.npz.optimize diff adam_sync.keys.out adam.keys.expected > adam_sync.keys.diff python $MRT_MARIAN/scripts/contrib/model_info.py -m adam_sync/model.npz.optimizer.npz -k "adam_mt" > adam_sync.mt.out -$MRT_TOOLS/diff-floats.py -p 0.0001 adam_sync.mt.out adam_sync.mt.expected > adam_sync.mt.diff python $MRT_MARIAN/scripts/contrib/model_info.py -m adam_sync/model.npz.optimizer.npz -k "adam_vt" > adam_sync.vt.out + +$MRT_TOOLS/diff-floats.py -p 0.0001 adam_sync.mt.out adam_sync.mt.expected > adam_sync.mt.diff $MRT_TOOLS/diff-floats.py -p 0.0000009 adam_sync.vt.out adam_sync.vt.expected > adam_sync.vt.diff # Exit with success code |