updated test docs

This commit is contained in:
William Falcon
2019-07-24 10:24:15 -04:00
parent f478fd9425
commit da19e0f7bc
+34 -32
View File
@@ -138,6 +138,40 @@ def test_multi_gpu_model_dp():
clear_tt_dir()
def test_amp_gpu_dp():
"""
Make sure DP + AMP work
:return:
"""
if not torch.cuda.is_available():
warnings.warn('test_amp_gpu_dp cannot run. Rerun on a GPU node to run this test')
return
if not torch.cuda.device_count() > 1:
warnings.warn('test_amp_gpu_dp cannot run. Rerun on a node with 2+ GPUs to run this test')
return
clear_tt_dir()
model = get_model()
trainer = Trainer(
progress_bar=False,
experiment=get_exp(),
max_nb_epochs=1,
train_percent_check=0.4,
gpus=[0, 1],
distributed_backend='dp',
use_amp=True
)
result = trainer.fit(model)
# correct result and ok accuracy
assert result == 1, 'amp + gpu model failed to complete'
assert_ok_acc(trainer)
clear_tt_dir()
def test_multi_gpu_model_ddp():
"""
Make sure DDP works
@@ -207,38 +241,6 @@ def test_amp_gpu_ddp():
clear_tt_dir()
def test_amp_gpu_dp():
"""
Make sure DP + AMP work
:return:
"""
if not torch.cuda.is_available():
warnings.warn('test_amp_gpu_dp cannot run. Rerun on a GPU node to run this test')
return
if not torch.cuda.device_count() > 1:
warnings.warn('test_amp_gpu_dp cannot run. Rerun on a node with 2+ GPUs to run this test')
return
clear_tt_dir()
model = get_model()
trainer = Trainer(
progress_bar=False,
experiment=get_exp(),
max_nb_epochs=1,
train_percent_check=0.4,
gpus=[0, 1],
distributed_backend='dp',
use_amp=True
)
result = trainer.fit(model)
# correct result and ok accuracy
assert result == 1, 'amp + gpu model failed to complete'
assert_ok_acc(trainer)
clear_tt_dir()
if __name__ == '__main__':