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

AttributeError: 'DataLoader' object has no attribute '_dataset_kind' #63

Open
lpkoh opened this issue Nov 4, 2019 · 7 comments
Open

Comments

@lpkoh
Copy link

lpkoh commented Nov 4, 2019

Hi,

I am currently on Windows, Python 3.7. I have installed pip install torch==1.3.0+cpu torchvision==0.4.1+cpu -f https://download.pytorch.org/whl/torch_stable.html

When I run:
python run_classifier.py --load downloads/transformer_sst.clf --data data/binary_sst/test.csv --model "transformer"
I get AttributeError: 'DataLoader' object has no attribute '_dataset_kind'. I have switch through many versions, like torch 1.2.0 and torchvision==0.4.0, but the issue persists. May I know if anyone has worked around this?

@martian07
Copy link

same error, even tried earlier commits still didn't ran

@martian07
Copy link

resolved with
!pip install torch==1.0.1 torchvision==0.2.2

@forest1988
Copy link

I encountered a similar problem.

It seems that the defined 'DataLoader' in this repository corresponds to the old 'DataLoader' and does not support the newer version.

https://github.com/NVIDIA/sentiment-discovery/blob/master/data_utils/loaders.py#L91
I added 2 lines in def __init__() of class DataLoader(data.DataLoader) as below.

class DataLoader(data.DataLoader):
    """normal data loader except with options for distributed data batch sampling + wrap around"""
    def __init__(self, dataset, batch_size=1, shuffle=False, sampler=None, batch_sampler=None,
                 num_workers=0, collate_fn=default_collate, pin_memory=False, drop_last=False,
                 transpose=False, world_size=2, rank=-1, distributed=False, wrap_last=False,
                 timeout=0, worker_init_fn=None):
        self.dataset = dataset

        # added 2019-11-24
        self._dataset_kind = None
        self.multiprocessing_context = None

        self.batch_size = batch_size

I haven't confirmed that it works correctly, but at least it works without error.

@forest1988
Copy link

forest1988 commented Nov 25, 2019

Unfortunately, the method I wrote above may not be performing properly.
I tried using "Finetuned Plutchik Transformer" by the way above, but it doesn't seem to get good results...

self._dataset_kind = None

may be undesirable.

@matthias-tschoepe
Copy link

I had a similar problem maybe it helps someone: I tried to load my own Dataloader object, which I saved with a previous version of Pytorch. After updating Pytorch my Dataloader object could be loaded, but I couldn't iterate over it. So, I had to create a new Dataloader object with the new Pytorch version.

@ArronChan
Copy link

I had a similar problem maybe it helps someone: I tried to load my own Dataloader object, which I saved with a previous version of Pytorch. After updating Pytorch my Dataloader object could be loaded, but I couldn't iterate over it. So, I had to create a new Dataloader object with the new Pytorch version.

how to create a new Dataloader object with the new Pytorch version? I am so confused

@mgayari
Copy link

mgayari commented Apr 29, 2020

AttributeError: 'DirectoryDataLoader' object has no attribute 'label_map'. Please help.

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

6 participants