Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ForkingPickler(file, protocol).dump(obj) AttributeError: Can't pickle local object 'main.<locals>.<lambda>' #255

Open
xiaojunkameng opened this issue Mar 25, 2024 · 0 comments

Comments

@xiaojunkameng
Copy link

Why do I get the following error when I set numworkers to 10 (by default):

Traceback (most recent call last):
File "D:\Pointnet_Pointnet2_pytorch-master\Pointnet_Pointnet2_pytorch-master\train_semseg.py", line 294, in
main(args)
File "D:\Pointnet_Pointnet2_pytorch-master\Pointnet_Pointnet2_pytorch-master\train_semseg.py", line 180, in main
for i, (points, target) in tqdm(enumerate(trainDataLoader), total=len(trainDataLoader), smoothing=0.9):
File "D:\Anaconda\envs\y8\lib\site-packages\torch\utils\data\dataloader.py", line 438, in iter
return self._get_iterator()
File "D:\Anaconda\envs\y8\lib\site-packages\torch\utils\data\dataloader.py", line 386, in _get_iterator
return _MultiProcessingDataLoaderIter(self)
File "D:\Anaconda\envs\y8\lib\site-packages\torch\utils\data\dataloader.py", line 1039, in init
w.start()
File "D:\Anaconda\envs\y8\lib\multiprocessing\process.py", line 121, in start
self._popen = self._Popen(self)
File "D:\Anaconda\envs\y8\lib\multiprocessing\context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "D:\Anaconda\envs\y8\lib\multiprocessing\context.py", line 327, in _Popen
return Popen(process_obj)
File "D:\Anaconda\envs\y8\lib\multiprocessing\popen_spawn_win32.py", line 93, in init
reduction.dump(process_obj, to_child)
File "D:\Anaconda\envs\y8\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'main..'

And when I set numworkers to 0, an error will be reported:

D:\Anaconda\envs\y8\python.exe D:\Pointnet_Pointnet2_pytorch-master\Pointnet_Pointnet2_pytorch-master\train_semseg.py
PARAMETER ...
Namespace(batch_size=16, decay_rate=0.0001, epoch=32, gpu='0', learning_rate=0.001, log_dir=None, lr_decay=0.7, model='pointnet_sem_seg', npoint=4096, optimizer='Adam', step_size=10, test_area=5)
start loading training data ...
[nan nan nan nan nan nan nan nan nan nan nan nan nan]
Totally 0 samples in train set.
start loading test data ...
[nan nan nan nan nan nan nan nan nan nan nan nan nan]
Totally 0 samples in test set.
0it [00:00, ?it/s]
D:\Pointnet_Pointnet2_pytorch-master\Pointnet_Pointnet2_pytorch-master\data_utils\S3DISDataLoader.py:37: RuntimeWarning: invalid value encountered in divide
labelweights = labelweights / np.sum(labelweights)
0it [00:00, ?it/s]
The number of training data is: 0
The number of test data is: 0
No existing model, starting training from scratch...
**** Epoch 1 (1/32) ****
Learning rate:0.001000
BN momentum updated to: 0.100000
0it [00:00, ?it/s]
Traceback (most recent call last):
File "D:\Pointnet_Pointnet2_pytorch-master\Pointnet_Pointnet2_pytorch-master\train_semseg.py", line 295, in
main(args)
File "D:\Pointnet_Pointnet2_pytorch-master\Pointnet_Pointnet2_pytorch-master\train_semseg.py", line 204, in main
log_string('Training mean loss: %f' % (loss_sum / num_batches))
ZeroDivisionError: division by zero

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant