Open NMZ0429 opened 2 weeks ago
Hi! Thanks for the very clear issue report.
It seems to be the same issue as #51. It is related to the multiprocessing in PyTorch's DataLoader
. Setting num_workers=0
should solve this error.
Thank you for your prompt reply and sorry for raising a duplicated issue. Before closing this, would you mind if I write a PR that adds a comment line warning Mac/Win users of the multiprocessing bug? Something like the following should be helpful.
test_loader = DataLoader(
test_set,
batch_sampler=test_sampler,
num_workers=12, # Set to 0 if you get a "PicklingError" in the next cell
pin_memory=True,
collate_fn=test_sampler.episodic_collate_fn,
)
Yes, adding a warning would be valuable! I believe it's best to link to the issue for completeness, and maybe put it in the markdown rather than in the code.
Describe the bug
my_first_few_shot_classifier.ipynb
raises pickling error when the data loader with lambda function spawns a process.To Reproduce Steps to reproduce the behavior:
Error
PicklingError: Can't pickle <function <lambda> at 0x13fee15a0>: attribute lookup <lambda> on __main__ failed
Additional context
Seems like the cause of this error is the line that defines get_labels method of dataset class. Specifically,
As I searched the old issues and referred https://github.com/sicara/easy-few-shot-learning/issues/121 , I have solved the issue by passing
Omniglot
toWrapFewShotDataset
and delete the above line. Yet, I wrote this issue as I do not know if this is the best solution.