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
This commit is contained in:
1 parent
362a4beebb
commit
d45f604bc8
35 files changed
+398
-424
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import os
|
||||
|
||||
import pytest
|
||||
import torch
|
||||
|
||||
from src.datamodules.mnist_datamodule import MNISTDataModule
|
||||
|
||||
|
||||
@pytest.mark.parametrize("batch_size", [32, 128])
|
||||
def test_mnist_datamodule(batch_size):
|
||||
datamodule = MNISTDataModule(batch_size=batch_size)
|
||||
datamodule.prepare_data()
|
||||
|
||||
assert not datamodule.data_train and not datamodule.data_val and not datamodule.data_test
|
||||
|
||||
assert os.path.exists(os.path.join("data", "MNIST"))
|
||||
assert os.path.exists(os.path.join("data", "MNIST", "raw"))
|
||||
|
||||
datamodule.setup()
|
||||
|
||||
assert datamodule.data_train and datamodule.data_val and datamodule.data_test
|
||||
assert (
|
||||
len(datamodule.data_train) + len(datamodule.data_val) + len(datamodule.data_test) == 70_000
|
||||
)
|
||||
|
||||
assert datamodule.train_dataloader()
|
||||
assert datamodule.val_dataloader()
|
||||
assert datamodule.test_dataloader()
|
||||
|
||||
batch = next(iter(datamodule.train_dataloader()))
|
||||
x, y = batch
|
||||
|
||||
assert len(x) == batch_size
|
||||
assert len(y) == batch_size
|
||||
assert x.dtype == torch.float32
|
||||
assert y.dtype == torch.int64
|
||||
@@ -1,26 +0,0 @@
|
||||
import pytest
|
||||
|
||||
from tests.helpers.runif import RunIf
|
||||
|
||||
|
||||
def test_something1():
|
||||
"""Some test description."""
|
||||
assert True is True
|
||||
|
||||
|
||||
def test_something2():
|
||||
"""Some test description."""
|
||||
assert 1 + 1 == 2
|
||||
|
||||
|
||||
@pytest.mark.parametrize("arg1", [0.5, 1.0, 2.0])
|
||||
def test_something3(arg1: float):
|
||||
"""Some test description."""
|
||||
assert arg1 > 0
|
||||
|
||||
|
||||
# use RunIf to skip execution of some tests, e.g. when not on windows or when no gpus are available
|
||||
@RunIf(skip_windows=True, min_gpus=1)
|
||||
def test_something4():
|
||||
"""Some test description."""
|
||||
assert True is True
|
||||
Reference in new issue
Block a user