yinboc / few-shot-meta-baseline

Meta-Baseline: Exploring Simple Meta-Learning for Few-Shot Learning, in ICCV 2021
MIT License
615 stars 107 forks source link

AttributeError: Can't pickle local object 'MiniImageNet.__init__.<locals>.convert_raw' #17

Closed xqyd closed 4 years ago

xqyd commented 4 years ago

I was testing the code with "python train_classifier.py --config configs/train_classifier_mini.yaml", and I got this error message. The output in my powershell console is:

set gpu: 0 ./save\classifier_mini-imagenet_resnet12 exists, remove? ([y]/n): y train dataset: torch.Size([3, 80, 80]) (x38400), 64 val dataset: torch.Size([3, 80, 80]) (x18748), 64 fs dataset: torch.Size([3, 80, 80]) (x12000), 20 num params: 8.0M train: 0%| | 0/1200 [00:00<?, ?it/s]Traceback (most recent call last): File "train_classifier.py", line 279, in main(config) File "train_classifier.py", line 147, in main for data, label in tqdm(train_loader, desc='train', leave=False): File "C:\Users\Administrator\anaconda3\lib\site-packages\tqdm\std.py", line 1107, in iter for obj in iterable: File "C:\Users\Administrator\anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 279, in iter return _MultiProcessingDataLoaderIter(self) File "C:\Users\Administrator\anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 719, in init w.start() File "C:\Users\Administrator\anaconda3\lib\multiprocessing\process.py", line 112, in start self._popen = self._Popen(self) File "C:\Users\Administrator\anaconda3\lib\multiprocessing\context.py", line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "C:\Users\Administrator\anaconda3\lib\multiprocessing\context.py", line 322, in _Popen return Popen(process_obj) File "C:\Users\Administrator\anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 89, in init reduction.dump(process_obj, to_child) File "C:\Users\Administrator\anaconda3\lib\multiprocessing\reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) AttributeError: Can't pickle local object 'MiniImageNet.init..convert_raw' PS D:\few-shot-meta-baseline-master> Traceback (most recent call last): File "", line 1, in File "C:\Users\Administrator\anaconda3\lib\multiprocessing\spawn.py", line 105, in spawn_main exitcode = _main(fd) File "C:\Users\Administrator\anaconda3\lib\multiprocessing\spawn.py", line 115, in _main self = reduction.pickle.load(from_parent) EOFError: Ran out of input

Have anyone run into the same problem under windows 10?

yinboc commented 4 years ago

Does the problem still exists when you follow the recommended environment setting and run in Linux/Mac?

Since convert_raw is only for visualizing the dataset, you can also delete all the convert_raw functions in the dataset classes, and set visualize_datasets: false in the configs. This should work if convert_raw is the only issue in your environment.

xqyd commented 4 years ago

I haven't install Linux at this moment. But I managed to remove 'convert_raw' related stuff to get this work. Thanks for your help!

yinboc commented 4 years ago

Cool. You're welcome.