mboudiaf / pytorch-meta-dataset

A non-official 100% PyTorch implementation of META-DATASET benchmark for few-shot classification
59 stars 9 forks source link

How to run the code correctly? #14

Open Fei-Long121 opened 2 years ago

Fei-Long121 commented 2 years ago

Hi, Thank you for your outstanding work!I met the following problems when trying to use your code:When I've processed all the data,I just used the command :bash scripts/train.sh protonet resnet18 ilsvrc_2012, but got the error:“use_hierarchy" is incompatible with "num_ways". So I tried to set the num_ways to -1 to avoid this error, but strange things still happend: RuntimError:stack expects each tensor to be equal size, but got [50, 3, 84, 84] at entry 0 and [30, 3, 84, 84] at entry 1.This is the first question which puzzled me.What's more, How do I get a pre-trained model on ImageNet by training from scratch?There does not seem to be an option to obtain a pre-trained model in the method options.I am looking forward to your reply. Thank you!

mboudiaf commented 2 years ago

Hi,

Thanks for your interest and sorry for this late reply. There have been quite a few changes lately in the code, since I incoporated many more pre-trained models from timm and gradually started removing spread scripts in order to put all needed recipes in a single Makefile. As a consequence, the doc wasn't up-to-date anymore, and commands may have produced errors. I have updated the ReadMe to reflect those changes. All commands are now recipes of a single Makefile. If you want to use pre-trained models, e.g. some resnet, check the exact names at src/models/resnet.py and all keys of default_cfgs are valid architecture names. Could you please:

  1. `export RECORDS='path/to/records'
  2. Run make benchmark and let me know if you still face such issue. If not, you should be able to reproduce the numbers in the README.md
Fei-Long121 commented 2 years ago

Ok, thanks for your excellent effort! I'll try it as soon as possible.