mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-09 11:32:07 +08:00
@@ -16,9 +16,15 @@ except ImportError:
|
||||
# TODO: this should be discussed and moved out of this package
|
||||
raise ImportError('Missing test-tube package.')
|
||||
|
||||
from pytorch_lightning.core.decorators import data_loader
|
||||
from pytorch_lightning.core.lightning import LightningModule
|
||||
|
||||
# TODO: remove after getting own MNIST
|
||||
# TEMPORAL FIX, https://github.com/pytorch/vision/issues/1938
|
||||
import urllib.request
|
||||
opener = urllib.request.build_opener()
|
||||
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
|
||||
urllib.request.install_opener(opener)
|
||||
|
||||
|
||||
class TestingMNIST(MNIST):
|
||||
|
||||
@@ -54,8 +60,8 @@ class DictHparamsModel(LightningModule):
|
||||
return torch.optim.Adam(self.parameters(), lr=0.02)
|
||||
|
||||
def train_dataloader(self):
|
||||
return DataLoader(MNIST(os.getcwd(), train=True, download=True,
|
||||
transform=transforms.ToTensor()), batch_size=32)
|
||||
return DataLoader(TestingMNIST(os.getcwd(), train=True, download=True,
|
||||
transform=transforms.ToTensor()), batch_size=32)
|
||||
|
||||
|
||||
class TestModelBase(LightningModule):
|
||||
|
||||
Reference in New Issue
Block a user