Пример #1
0
def test_gan(tmpdir):
    reset_seed()

    model = GAN(data_dir=tmpdir)
    trainer = pl.Trainer(fast_dev_run=True, default_root_dir=tmpdir)
    trainer.fit(model)
    trainer.test(model)
Пример #2
0
def test_gan(tmpdir):
    seed_everything()

    model = GAN(data_dir=tmpdir)
    trainer = pl.Trainer(fast_dev_run=True, default_root_dir=tmpdir)
    trainer.fit(model)
    trainer.test(model)
Пример #3
0
def test_gan(tmpdir, datadir, dm_cls):
    seed_everything()

    dm = dm_cls(data_dir=datadir, num_workers=0)
    model = GAN(*dm.size())
    trainer = pl.Trainer(fast_dev_run=True, default_root_dir=tmpdir)
    trainer.fit(model, datamodule=dm)
    trainer.test(datamodule=dm, ckpt_path=None)
Пример #4
0
def test_gan(tmpdir, dm_cls):
    seed_everything()

    dm = dm_cls()
    model = GAN(*dm.size())
    trainer = pl.Trainer(fast_dev_run=True, default_root_dir=tmpdir)
    trainer.fit(model, dm)
    trainer.test(datamodule=dm)
Пример #5
0
def test_latent_dim_interpolator(tmpdir):
    class FakeTrainer(object):
        def __init__(self):
            self.current_epoch = 1
            self.global_step = 1
            self.logger = DummyLogger()

    model = GAN(3, 28, 28)
    cb = LatentDimInterpolator(interpolate_epoch_interval=2)

    cb.on_epoch_end(FakeTrainer(), model)