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

Potentially wrong inherence in lavis.datasets.datasets.base_dataset #682

Open
hexiaoxiao-cs opened this issue Apr 5, 2024 · 0 comments
Open

Comments

@hexiaoxiao-cs
Copy link

When I try the run_scripts/blip2/pretrain_stage1.sh, an error happened in the dataloader:

AttributeError('Caught AttributeError in DataLoader worker process 0.\nOriginal Traceback (most recent call last):\n File "//.conda/envs/lavis/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 308, in _worker_loop\n data = fetcher.fetch(index)\n File "//.conda/envs/lavis/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 54, in fetch\n return self.collate_fn(data)\n File "", line 2, in collater\n File "/***/.conda/envs/lavis/lib/python3.8/contextlib.py", line 111, in enter\n del self.args, self.kwds, self.func\nAttributeError: args\n')

After debugging, the problems comes from the class ConcatDataset in lavis/datasetes/datasets/base_dataset.

I've changed the line 13 to from torch.utils.data import Dataset, ConcatDataset as _ConcatDataset and line 74 to class ConcatDataset(_ConcatDataset):, and the problem goes away.

Here is the cause of the problem (what I believe, if not please correct me). The ConcatDataset should inherit from torch.dataset.ConcatDataset and it does not initialize correctly. Then, when the dataloader tries to get a batch of data, the dataloader did not find a getitems function under the ConcatDataset class (since it is not inherited correctly), thus raise the exception.

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

1 participant