ServiceNow / embedding-propagation

Codebase for Embedding Propagation: Smoother Manifold for Few-Shot Classification. This is a ServiceNow Research project that was started at Element AI.
Apache License 2.0
208 stars 21 forks source link

Can't load train_set #5

Closed Wiikk closed 4 years ago

Wiikk commented 4 years ago

Hi, thanks for your excellent work. I use the pickled version of mini-imagenet dataset and set the dataset name "episodic_miniimagenet_pkl". However, when I run the pre-training code, I get the following error message:

Traceback (most recent call last): File "trainval.py", line 220, in pretrained_weights_dir=args.pretrained_weights_dir) File "trainval.py", line 143, in trainval score_dict.update(model.train_on_loader(train_loader)) File "/remote-home/my/Code/embedding-propagation-master/src/models/pretraining.py", line 172, in train_on_loader for batch_idx, batch in enumerate(data_loader):
File "/usr/local/miniconda3/envs/dl10/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 346, in next data = self.dataset_fetcher.fetch(index) # may raise StopIteration File "/usr/local/miniconda3/envs/dl10/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 47, in fetch return self.collate_fn(data) File "/usr/local/miniconda3/envs/dl10/lib/python3.6/site-packages/torch/utils/data/_utils/collate.py", line 75, in default_collate return {key: default_collate([d[key] for d in batch]) for key in elem} File "/usr/local/miniconda3/envs/dl10/lib/python3.6/site-packages/torch/utils/data/_utils/collate.py", line 75, in return {key: default_collate([d[key] for d in batch]) for key in elem} File "/usr/local/miniconda3/envs/dl10/lib/python3.6/site-packages/torch/utils/data/_utils/collate.py", line 82, in default_collate raise TypeError(default_collate_err_msg_format.format(elem_type)) TypeError: default_collate: batch must contain tensors, numpy arrays, numbers, dicts or lists; found <class 'NoneType'>

Could you give some advice on dealing with NoneType values? Thanks a lot.

MichalisLazarou commented 4 years ago

Hey I have exactly the same problem how did you manage to solve it?

Wiikk commented 4 years ago

@MichalisLazarou You can write a new class called "RotatedNonEpisodicMiniImagenetPkl" imitating "RotatedNonEpisodicMiniImagenet" in src/datasets/miniimagenet.py. This works for me.

prlz77 commented 4 years ago

Thanks @Wiikk! Would you mind doing a pull request to include it in the repo?

Wiikk commented 4 years ago

@prlz77 Sure, I will do this later.

prlz77 commented 4 years ago

Thank you :)