Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to simply download mnist and train. getting RuntimeError: Dataset not found. You can use download=True to download it #353

Closed
simeneide opened this issue Nov 10, 2020 · 4 comments
Labels
question Further information is requested
Milestone

Comments

@simeneide
Copy link

simeneide commented Nov 10, 2020

❓ Questions and Help

Before asking:

  1. search the issues.
  2. search the docs.

What is your question?

Tried to get a simple mnist example working from bolts and lightning, but ended up in this error. It seems like the data are downloaded correctly the first time but that the files are in wrong format or similar. All fixes Ive seen seem very complex for such a "simple" task to be running. (e.g. a separate script that prepares the data).

Replicated in google colab (see link below).

Code

`
!pip install pytorch-lightning pytorch-lightning-bolts -q
from pl_bolts.datamodules import BinaryMNISTDataModule
import torch
from torch.nn import functional as F
from torch import nn
from pytorch_lightning.core.lightning import LightningModule
from pytorch_lightning import Trainer, seed_everything

class LitMNIST(LightningModule):
def init(self):
super().init()
self.layer_1 = torch.nn.Linear(28 * 28, 128)
self.layer_2 = torch.nn.Linear(128, 256)
self.layer_3 = torch.nn.Linear(256, 10)

def forward(self, x):
    batch_size, channels, width, height = x.size()
    x = x.view(batch_size, -1)
    x = self.layer_1(x)
    x = F.relu(x)
    x = self.layer_2(x)
    x = F.relu(x)
    x = self.layer_3(x)
    x = F.log_softmax(x, dim=1)
    return x

def training_step(self, batch, batch_idx):
    x, y = batch
    logits = self(x)
    loss = F.nll_loss(logits, y)
    return loss
    
def configure_optimizers(self):
    optimizer = torch.optim.Adam(self.parameters(), lr=1e-3)
    return optimizer

model = LitMNIST()
dm = BinaryMNISTDataModule('.')
Trainer().fit(model, dm)
`

What have you tried?

Have I misunderstood how to use bolts or is this a bit hard? The code should be pretty much copy paste from tutorials to get a fully working example as seen here:
https://pytorch-lightning-bolts.readthedocs.io/en/latest/api/pl_bolts.datamodules.html#pl_bolts.datamodules.BinaryMNISTDataModule

Relevant post: https://discuss.pytorch.org/t/cant-load-dataset-using-dataloader/34831/2

What's your environment?

https://colab.research.google.com/drive/1MovSwV87jxaLod3Hbs-rnmlNg0eyKBeS?usp=sharing

@simeneide simeneide added the question Further information is requested label Nov 10, 2020
@github-actions
Copy link

Hi! thanks for your contribution!, great first issue!

@annikabrundyn
Copy link
Contributor

Thanks for thoroughly reporting the issue @simeneide - looking into it now! :)

@annikabrundyn
Copy link
Contributor

Hi @simeneide - thanks for reporting this! We've merged a PR which fixes this :)

#377

@simeneide
Copy link
Author

Thanks! 😄

@Borda Borda added this to the v0.3 milestone Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants