DMPR-PS icon indicating copy to clipboard operation
DMPR-PS copied to clipboard

Exception in train.py - Can't pickle local object 'train_detector.<locals>.<lambda>

Open johannesTech opened this issue 3 years ago • 1 comments

Hello @Teoge, first of all, thank you for sharing your research together with your code here!

I tried to execute your code and the inference ran flawlessly. Unfortunately, the training is not running due to the following error at location https://github.com/Teoge/DMPR-PS/blob/88b77e3c3c7e3c14b58db29e4810bc586d0a6896/train.py#L73-L79 Exception has occurred: AttributeError Can't pickle local object 'train_detector.<locals>.<lambda>' This issue is seems to be a result of the lambda function being called in the DataLoader.

I executed your code with python 3.7.0 and torch 1.7.0.

I would appreciate any hint you have for me :)

Best, Johannes

johannesTech avatar Feb 03 '22 15:02 johannesTech

Did you run your training on windows? It looks similar to this issue. You can try the solutions inside, replacing lambda with a normally defined function, or setting num_workers to 0.

Teoge avatar Feb 09 '22 14:02 Teoge