import unittest

import catalyst

class TestCatalyst(unittest.TestCase):

    def test_version(self):
        self.assertIsNotNone(catalyst.__version__)

@@ -13,141 +13,2764 @@
 est%0A
-%0Aimport catalyst%0A%0Aclass TestCatalyst(unittest.TestCase):%0A%0A    def test_version(self):%0A        self.assertIsNotNone(catalyst.__version__
+import collections%0A%0Aimport torch%0Aimport torch.nn as nn%0Aimport torch.nn.functional as F%0Aimport torchvision%0Aimport torchvision.transforms as transforms%0A%0Aimport catalyst%0Afrom catalyst.dl import SupervisedRunner, CheckpointCallback%0Afrom safitty import Safict%0A%0A%0Aclass TestCatalyst(unittest.TestCase):%0A%0A    def test_version(self):%0A        self.assertIsNotNone(catalyst.__version__)%0A    %0A    def test_mnist(self):%0A        bs = 32%0A        num_workers = 4%0A%0A        data_transform = transforms.Compose(%5B%0A            transforms.ToTensor(),%0A            transforms.Normalize((0.1307, ), (0.3081, ))%0A        %5D)%0A%0A%0A        loaders = collections.OrderedDict()%0A%0A        trainset = torchvision.datasets.MNIST(%0A            root='./data', train=False,%0A            download=True, transform=data_transform)%0A        trainloader = torch.utils.data.DataLoader(%0A            trainset, batch_size=bs,%0A            shuffle=True, num_workers=num_workers)%0A%0A        testset = trainset%0A        testloader = torch.utils.data.DataLoader(%0A            testset, batch_size=bs,%0A            shuffle=False, num_workers=num_workers)%0A%0A        loaders%5B%22train%22%5D = trainloader%0A        loaders%5B%22valid%22%5D = testloader%0A        %0A        class Net(nn.Module):%0A            def __init__(self):%0A                super().__init__()%0A                self.conv1 = nn.Conv2d(1, 20, 5, 1)%0A                self.conv2 = nn.Conv2d(20, 50, 5, 1)%0A                self.fc1 = nn.Linear(4 * 4 * 50, 500)%0A                self.fc2 = nn.Linear(500, 10)%0A%0A            def forward(self, x):%0A                x = F.relu(self.conv1(x))%0A                x = F.max_pool2d(x, 2, 2)%0A                x = F.relu(self.conv2(x))%0A                x = F.max_pool2d(x, 2, 2)%0A                x = x.view(-1, 4 * 4 * 50)%0A                x = F.relu(self.fc1(x))%0A                x = self.fc2(x)%0A                return x%0A%0A        # experiment setup%0A        num_epochs = 3%0A        logdir = %22./logs%22%0A%0A        # model, criterion, optimizer%0A        model = Net()%0A        criterion = nn.CrossEntropyLoss()%0A        optimizer = torch.optim.Adam(model.parameters())%0A%0A        # model runner%0A        runner = SupervisedRunner()%0A%0A        # model training%0A        runner.train(%0A            model=model,%0A            criterion=criterion,%0A            optimizer=optimizer,%0A            loaders=loaders,%0A            logdir=logdir,%0A            num_epochs=num_epochs,%0A            verbose=False,%0A            callbacks=%5BCheckpointCallback(save_n_best=3)%5D%0A        )%0A        %0A        metrics = Safict.load(%22./logs/checkpoints/_metrics.json%22)%0A        metrics_flag1 = %5C%0A            metrics.get(%22train.2%22, %22loss%22) %3C metrics.get(%22train.0%22, %22loss%22)%0A        metrics_flag2 = metrics.get(%22train.2%22, %22loss%22) %3C 0.05%0A        self.assertTrue(metrics_flag1)%0A        self.assertTrue(metrics_flag2
 )%0A

Update test_catalyst.py