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

Upgraded to 0.8.0 => def val_dataloader does not have access to properties from prepare_data #2249

Closed
ternaus opened this issue Jun 19, 2020 · 1 comment · Fixed by #2252
Closed
Labels
question Further information is requested

Comments

@ternaus
Copy link

ternaus commented Jun 19, 2020

Upgraded to version 0.8.0

In my code I define

self.val_samples in def prepare_data and use them later in

    def val_dataloader(self):
        val_aug = from_dict(self.hparams["val_aug"])

        return DataLoader(
            Dataset(self.val_samples, val_aug),
            batch_size=self.hparams["val_parameters"]["batch_size"],
            num_workers=self.hparams["num_workers"],
            shuffle=False,
            pin_memory=True,
            drop_last=False,
        )

This worked before the upgrade, but now I get

AttributeError: 'Model' object has no attribute 'val_samples'

what should I modify to make things work?

@ternaus ternaus added the question Further information is requested label Jun 19, 2020
@williamFalcon
Copy link
Contributor

williamFalcon commented Jun 19, 2020

yeah.. it was a bug that this worked before haha. prepare_data is only meant to be called from node=0 rank=0. Now it works as expected.

prepare_data should be only to download... then do the other stuff in either setup or dataloaders

def prepare_data(...):
    # download only
    # this won't happen on every GPU

def val_dataloader(...):
    # do assignments or anything you want here

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

Successfully merging a pull request may close this issue.

2 participants