From 9be15aa29f59a0f1dc053e433eb10c7badb094c9 Mon Sep 17 00:00:00 2001 From: William Falcon Date: Wed, 24 Jul 2019 19:17:08 -0400 Subject: [PATCH] added cpu + amp error --- tests/test_models.py | 45 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/tests/test_models.py b/tests/test_models.py index 152fdfef18..e4ca171b86 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -21,6 +21,27 @@ np.random.seed(SEED) # ------------------------------------------------------------------------ # TESTS # ------------------------------------------------------------------------ +def test_early_stopping_cpu_model(): + """ + Test each of the trainer options + :return: + """ + + stopping = EarlyStopping() + trainer_options = dict( + early_stop_callback=stopping, + gradient_clip=1.0, + overfit_pct=0.20, + track_grad_norm=2, + print_nan_grads=True, + progress_bar=False, + experiment=get_exp(), + train_percent_check=0.1, + val_percent_check=0.1 + ) + + model, hparams = get_model() + run_gpu_model_test(trainer_options, model, hparams, on_gpu=False) def test_cpu_model_with_amp(): @@ -156,30 +177,6 @@ def test_all_features_cpu_model(): run_gpu_model_test(trainer_options, model, hparams, on_gpu=False) -def test_early_stopping_cpu_model(): - """ - Test each of the trainer options - :return: - """ - - stopping = EarlyStopping() - trainer_options = dict( - early_stop_callback=stopping, - gradient_clip=1.0, - overfit_pct=0.20, - track_grad_norm=2, - print_nan_grads=True, - progress_bar=False, - experiment=get_exp(), - max_nb_epochs=1, - train_percent_check=0.4, - val_percent_check=0.4 - ) - - model, hparams = get_model() - run_gpu_model_test(trainer_options, model, hparams, on_gpu=False) - - def test_single_gpu_model(): """ Make sure single GPU works (DP mode)