-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Decouple DataModules from Models - GAN (#206)
* 🎨 decouple dms from gan * ✅ update tests * ✅ update tests * 💄 style * 🐛 Gan now has required args * 🐛 use argparse not hyperopt parser
- Loading branch information
Showing
4 changed files
with
59 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
import pytest | ||
import pytorch_lightning as pl | ||
from pytorch_lightning import seed_everything | ||
|
||
from pl_bolts.datamodules import MNISTDataModule, CIFAR10DataModule | ||
from pl_bolts.models.gans import GAN | ||
|
||
|
||
def test_gan(tmpdir): | ||
@pytest.mark.parametrize( | ||
"dm_cls", [pytest.param(MNISTDataModule, id="mnist"), pytest.param(CIFAR10DataModule, id="cifar10")] | ||
) | ||
def test_gan(tmpdir, dm_cls): | ||
seed_everything() | ||
|
||
model = GAN(data_dir=tmpdir) | ||
dm = dm_cls() | ||
model = GAN(*dm.size()) | ||
trainer = pl.Trainer(fast_dev_run=True, default_root_dir=tmpdir) | ||
trainer.fit(model) | ||
trainer.test(model) | ||
trainer.fit(model, dm) | ||
trainer.test(datamodule=dm) |