nickgkan / orange

Orientation Attentive Robot Grasp Synthesis
GNU General Public License v3.0
25 stars 5 forks source link

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

Open JJayaL opened 1 month ago

JJayaL commented 1 month ago
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 commented 1 month ago

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.