* 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
45 lines
964 B
Python
45 lines
964 B
Python
import pytest
|
|
|
|
from tests.helpers.run_command import run_command
|
|
|
|
"""
|
|
A couple of tests executing hydra sweeps.
|
|
|
|
Use the following command to skip slow tests:
|
|
pytest -k "not slow"
|
|
"""
|
|
|
|
|
|
@pytest.mark.slow
|
|
def test_experiments():
|
|
"""Test running all available experiment configs for 1 epoch."""
|
|
command = ["run.py", "-m", "experiment=glob(*)", "++trainer.max_epochs=1"]
|
|
run_command(command)
|
|
|
|
|
|
@pytest.mark.slow
|
|
def test_default_sweep():
|
|
"""Test default Hydra sweeper."""
|
|
command = [
|
|
"run.py",
|
|
"-m",
|
|
"datamodule.batch_size=64,128",
|
|
"model.lr=0.01,0.02",
|
|
"trainer=default",
|
|
"++trainer.fast_dev_run=true",
|
|
]
|
|
run_command(command)
|
|
|
|
|
|
@pytest.mark.slow
|
|
def test_optuna_sweep():
|
|
"""Test Optuna sweeper."""
|
|
command = [
|
|
"run.py",
|
|
"-m",
|
|
"hparams_search=mnist_optuna",
|
|
"trainer=default",
|
|
"++trainer.fast_dev_run=true",
|
|
]
|
|
run_command(command)
|