muzairkhattak / multimodal-prompt-learning

[CVPR 2023] Official repository of paper titled "MaPLe: Multi-modal Prompt Learning".
https://muzairkhattak.github.io/multimodal-prompt-learning/
MIT License
619 stars 43 forks source link

assert len(data_loader) > 0 #23

Closed Pefect96 closed 1 year ago

Pefect96 commented 1 year ago

Thank you for your work. I am very intrested in this work, but I meet this kind of error when running the "bash scripts/maple/base2new_train_maple.sh imagenet 1" on Imagenet dataset. How to solve it? I have normalized the imagenet dataset format according to datasets.md. Specially, the imagenet/images/train includes 1000 folds, and the imagenet/images/val alse includes 1000 folds after our classification.

Traceback (most recent call last): File "train.py", line 234, in main(args) File "train.py", line 169, in main trainer = build_trainer(cfg) File "/home/abc/dev/abc/Dassl.pytorch/dassl/engine/build.py", line 11, in build_trainer return TRAINER_REGISTRY.get(cfg.TRAINER.NAME)(cfg) File "/home/abc/dev/abc/Dassl.pytorch/dassl/engine/trainer.py", line 324, in init self.build_data_loader() File "/home/abc/dev/abc/Dassl.pytorch/dassl/engine/trainer.py", line 347, in build_data_loader dm = DataManager(self.cfg) File "/home/abc/dev/abc/Dassl.pytorch/dassl/data/data_manager.py", line 131, in init test_loader = build_data_loader( File "/home/abc/dev/abc/Dassl.pytorch/dassl/data/data_manager.py", line 48, in build_data_loader assert len(data_loader) > 0 AssertionError

muzairkhattak commented 1 year ago

Hi @Pefect96,

Thank you for showing interest in our work!

From the above logs, it looks like the issue is occurring during the creation of test data loader.

Can you please verify the following checks:

imagenet/
|–– images/
|   |–– train/ # contains 1,000 folders like n01440764, n01443537, etc.
|   |–– val/

Please let us know if your query is resolved.

Thank you and kind regards.

Pefect96 commented 1 year ago

Hi @Pefect96,

Thank you for showing interest in our work!

From the above logs, it looks like the issue is occurring during the creation of test data loader.

Can you please verify the following checks:

  • Your imageNet folder should be organized with a directory structure as follows:
imagenet/
|–– images/
|   |–– train/ # contains 1,000 folders like n01440764, n01443537, etc.
|   |–– val/
  • Also, please verify if you are providing correct data root path in the script file. You should provide the parent directory path in which your ImageNet folder is present. The data path should be provided in this DATA variable in the script file.

Please let us know if your query is resolved.

Thank you and kind regards.

Thanks for your reply. My train and val folders are organized as follows: /home/abc/dev/datasets/common/imagenet/images/train, /home/abc/dev/datasets/common/imagenet/images/val, and there are 1000 folders in both train and val folders. Thus, I think there is no error about our folders. Also, I have provided correct data root path in this DATA variable in the script file, i.e., /home/abc/dev/datasets/common. I do not known where is my error.

muzairkhattak commented 1 year ago

Hi @Pefect96,

Can you check if there are images present inside the val folder?

Pefect96 commented 1 year ago

Thanks, the error is solved. The reason is that I didn't categorize the files in val at the beginning, so the saved preprocessed.pkl file was wrong, and the subsequent training directly read the previously saved preprocessed.pkl. Now I've removed preprocessed.pkl, run it again, and the problem is solved.

Thank you very much for your reply!