Release/1.2 (#198)
* update template to pytorch 1.10+ and lightning 1.5+ * add experiment mode to all experiment configs and implement special logging paths for experiment mode * add `MaxMetric` to model, for computation of best so far validation accuracy * add RichProgressBar to default callbacks * get rid of trick for preventing auto hparam logging, since lightning now supports it with `self.save_hyperparameters(logger=False)` * add `self.save_hyperparameters()` to datamodule since lightinng now supports it * deprecate Apex support * deprecate bash script for conda setup * change `terminate_on_nan` debug option to `detect_anomaly` for compatibility with lightning v1.5 * specify model and datamodule during `trainer.test()`, for compatibility with lightning v1.5 * remove `configs/trainer/all_params.yaml` * make hyperparameter optimization compatible with lightning v1.5 * general documentation improvements
This commit is contained in:
1 parent
6159c413f2
commit
9468ef91c5
29 files changed
+278
-330
No files matched your search
@@ -1,43 +1,49 @@
|
||||
import pytest
|
||||
|
||||
from tests.helpers.run_command import run_command
|
||||
from tests.helpers.runif import RunIf
|
||||
|
||||
"""
|
||||
A couple of sanity checks to make sure the model doesn't crash with different running options.
|
||||
"""
|
||||
|
||||
|
||||
def test_fast_dev_run():
|
||||
"""Run 1 train, val, test batch."""
|
||||
"""Test running for 1 train, val and test batch."""
|
||||
command = ["run.py", "++trainer.fast_dev_run=true"]
|
||||
run_command(command)
|
||||
|
||||
|
||||
def test_default_cpu():
|
||||
"""Test default config on CPU."""
|
||||
def test_cpu():
|
||||
"""Test running 1 epoch on CPU."""
|
||||
command = ["run.py", "++trainer.max_epochs=1", "++trainer.gpus=0"]
|
||||
run_command(command)
|
||||
|
||||
|
||||
# use RunIf to skip execution of some tests, e.g. when no gpus are available
|
||||
@RunIf(min_gpus=1)
|
||||
def test_default_gpu():
|
||||
"""Test default config on GPU."""
|
||||
def test_gpu():
|
||||
"""Test running 1 epoch on GPU."""
|
||||
command = [
|
||||
"run.py",
|
||||
"++trainer.max_epochs=1",
|
||||
"++trainer.gpus=1",
|
||||
"++datamodule.pin_memory=True",
|
||||
]
|
||||
run_command(command)
|
||||
|
||||
|
||||
@pytest.mark.slow
|
||||
def test_experiments():
|
||||
"""Train 1 epoch with all experiment configs."""
|
||||
command = ["run.py", "-m", "experiment=glob(*)", "++trainer.max_epochs=1"]
|
||||
@RunIf(min_gpus=1)
|
||||
def test_mixed_precision():
|
||||
"""Test running 1 epoch with pytorch native automatic mixed precision (AMP)."""
|
||||
command = [
|
||||
"run.py",
|
||||
"++trainer.max_epochs=1",
|
||||
"++trainer.gpus=1",
|
||||
"++trainer.precision=16",
|
||||
]
|
||||
run_command(command)
|
||||
|
||||
|
||||
def test_limit_batches():
|
||||
"""Train 1 epoch on 25% of data."""
|
||||
"""Test running 1 epoch on 25% of data."""
|
||||
command = [
|
||||
"run.py",
|
||||
"++trainer.max_epochs=1",
|
||||
@@ -49,7 +55,7 @@ def test_limit_batches():
|
||||
|
||||
|
||||
def test_double_validation_loop():
|
||||
"""Train 1 epoch with validation loop twice per epoch."""
|
||||
"""Test running 1 epoch with validation loop twice per epoch."""
|
||||
command = [
|
||||
"run.py",
|
||||
"++trainer.max_epochs=1",
|
||||
|
||||
Reference in new issue
Block a user