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

Can't pickle local object 'GraspDataLoader.__init__.<locals>.<lambda>' when running python main.py #7

Open
JJayaL opened this issue Jul 30, 2024 · 1 comment

Comments

@JJayaL
Copy link

JJayaL commented Jul 30, 2024

jayalekshmijayakumar@Jayalekshmis-MacBook-Air orange % python prepare_data.py cornell
Creating annotations for cornell
885it [00:00, 726695.19it/s]
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 885/885 [04:12<00:00,  3.50it/s]
Done.
(myproject) jayalekshmijayakumar@Jayalekshmis-MacBook-Air orange % python main.py --dataset=cornell --model=unet --use_bin_loss --use_bin_attention_loss --use_graspness_loss
2024-07-30 14:13:16,614 - INFO - Performing training for unet_cornell
2024-07-30 14:13:16,616 - DEBUG - Set up dataset of 796 files
2024-07-30 14:13:16,617 - DEBUG - Set up dataset of 89 files
2024-07-30 14:13:16,617 - DEBUG - Batch size is 8
2024-07-30 14:13:16,617 - DEBUG - Learning rate is now 0.002
  0%|                                                                                                                                                                                    | 0/99 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/Users/jayalekshmijayakumar/orange/main.py", line 167, in <module>
    main()
  File "/Users/jayalekshmijayakumar/orange/main.py", line 163, in main
    model.train_test(cfg, model_params)
  File "/Users/jayalekshmijayakumar/orange/src/models/unet.py", line 120, in train_test
    train_tester.train_test()
  File "/Users/jayalekshmijayakumar/orange/src/train_testers/base_train_tester.py", line 72, in train_test
    self.train(
  File "/Users/jayalekshmijayakumar/orange/src/train_testers/base_train_tester.py", line 105, in train
    loss_history, keep_training = self._train_epoch(
                                  ^^^^^^^^^^^^^^^^^^
  File "/Users/jayalekshmijayakumar/orange/src/train_testers/base_train_tester.py", line 130, in _train_epoch
    for batch in tqdm(self.data_loader):
  File "/Users/jayalekshmijayakumar/.pyenv/versions/myproject/lib/python3.12/site-packages/tqdm/std.py", line 1181, in __iter__
    for obj in iterable:
  File "/Users/jayalekshmijayakumar/.pyenv/versions/myproject/lib/python3.12/site-packages/torch/utils/data/dataloader.py", line 440, in __iter__
    return self._get_iterator()
           ^^^^^^^^^^^^^^^^^^^^
  File "/Users/jayalekshmijayakumar/.pyenv/versions/myproject/lib/python3.12/site-packages/torch/utils/data/dataloader.py", line 388, in _get_iterator
    return _MultiProcessingDataLoaderIter(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jayalekshmijayakumar/.pyenv/versions/myproject/lib/python3.12/site-packages/torch/utils/data/dataloader.py", line 1038, in __init__
    w.start()
  File "/Users/jayalekshmijayakumar/.pyenv/versions/3.12.0/lib/python3.12/multiprocessing/process.py", line 121, in start
    self._popen = self._Popen(self)
                  ^^^^^^^^^^^^^^^^^
  File "/Users/jayalekshmijayakumar/.pyenv/versions/3.12.0/lib/python3.12/multiprocessing/context.py", line 224, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jayalekshmijayakumar/.pyenv/versions/3.12.0/lib/python3.12/multiprocessing/context.py", line 289, in _Popen
    return Popen(process_obj)
           ^^^^^^^^^^^^^^^^^^
  File "/Users/jayalekshmijayakumar/.pyenv/versions/3.12.0/lib/python3.12/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    super().__init__(process_obj)
  File "/Users/jayalekshmijayakumar/.pyenv/versions/3.12.0/lib/python3.12/multiprocessing/popen_fork.py", line 19, in __init__
    self._launch(process_obj)
  File "/Users/jayalekshmijayakumar/.pyenv/versions/3.12.0/lib/python3.12/multiprocessing/popen_spawn_posix.py", line 47, in _launch
    reduction.dump(process_obj, fp)
  File "/Users/jayalekshmijayakumar/.pyenv/versions/3.12.0/lib/python3.12/multiprocessing/reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'GraspDataLoader.__init__.<locals>.<lambda>'
@nickgkan
Copy link
Owner

nickgkan commented Aug 4, 2024

Hi, I've never ran into this issue. It seems that you're using python3.12. Although I don't see why that would create a problem, keep in mind that we tested this with python3.7 or earlier.
You can give it a shot.

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

2 participants