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

from dataloaders import make_data_loader #2

Open
OscarMind opened this issue Jul 22, 2022 · 3 comments
Open

from dataloaders import make_data_loader #2

OscarMind opened this issue Jul 22, 2022 · 3 comments

Comments

@OscarMind
Copy link

File "test.py", line 9, in
from dataloaders import make_data_loader
ImportError: cannot import name 'make_data_loader'

@jamesyoung0623
Copy link

Same problem.

@wonjunior
Copy link

It seems a file was removed from the /dataloaders directory.

Looking at the diff with the original repository, one workaround is to add a __init__.py file under /dataloaders and implement make_data_loader yourself. Something like this would work:

from torch.utils.data import DataLoader

from .datasets.multimodal_dataset import MultimodalDatasetSegmentation


def make_data_loader(args, **kwargs):
    if args.dataset == 'multimodal_dataset':
        train_set = MultimodalDatasetSegmentation(args, split='train')
        val_set = MultimodalDatasetSegmentation(args, split='val')
        num_class = train_set.NUM_CLASSES
        train_loader = DataLoader(train_set, batch_size=args.batch_size, shuffle=True, **kwargs)
        val_loader = DataLoader(val_set, batch_size=args.batch_size, shuffle=False, **kwargs)
        test_loader = None
        return train_loader, val_loader, test_loader, num_class

    else:
        raise NotImplementedError

You can extend the function to support additional datasets...

Best,
Ivan

@wonjunior
Copy link

You can refer to #3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants