Files
audio-driven-face-animation/tests/shell/test_basic_commands.py
T
Łukasz Zalewski d45f604bc8 Release/1.0 (#156)
* update to Hydra 1.1
* add bash folder with scripts for conda setup and run scheduling
* add saving seed in `log_hyperparameters()` method
* redesign Dockerfile to make it weight less
* add `test_after_training` parameter to config
* add inheritance to trainer configs
* remove forcing ddp-friendly configuration
* refactor tests
* remove conda_env_gpu.yaml
* remove default langage version from pre-commit config
* add mnist datamodule unit test
* rename test folder from 'smoke' to 'shell'
* remove wandb import from utils.py
* change 'use_artifact' to 'log_artifact' in wandb callbacks
* add rank zero decorator to wandb callbacks
* add dumping rich tree config to file
* get rid of `=` character in ckpt names
* update requirements.txt
* update LICENSE
* update README.md
2021-07-21 03:37:45 +02:00

59 lines
1.4 KiB
Python

import pytest
from tests.helpers.run_command import run_command
from tests.helpers.runif import RunIf
def test_fast_dev_run():
"""Run 1 train, val, test batch."""
command = ["run.py", "++trainer.fast_dev_run=true"]
run_command(command)
def test_default_cpu():
"""Test default config 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."""
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"]
run_command(command)
def test_limit_batches():
"""Train 1 epoch on 25% of data."""
command = [
"run.py",
"++trainer.max_epochs=1",
"++trainer.limit_train_batches=0.25",
"++trainer.limit_val_batches=0.25",
"++trainer.limit_test_batches=0.25",
]
run_command(command)
def test_double_validation_loop():
"""Train 1 epoch with validation loop twice per epoch."""
command = [
"run.py",
"++trainer.max_epochs=1",
"++trainer.val_check_interval=0.5",
]
run_command(command)