I am using a pretrained model for text recognition. I developed the entire project in ubuntu based system. Last week, I switched to Mac M1. I am using the same code, same versions of libraries/packages but I am not able to make it through,.
The problem lies with the dataloader particularly when I iterate through the dataloader object. I am able to use the same code in ubuntu based system with x86 architecture but not here.
Below is the error that I am getting. Any help would be appreciated.
ERROR:root:2021-07-11_12-18-14 exception caused - cannot pickle 'module' object
Traceback (most recent call last):
  File "/Users/dhruv/PycharmProjects/ocr/src/recognition/recognition.py", line 154, in recog_only
    recog_model.recognition_output(input_dir=os.path.join(input_path, folder))
  File "/Users/dhruv/PycharmProjects/ocr/src/recognition/recognition.py", line 70, in recognition_output
    for image_tensors, image_path_list in self.demo_loader:
  File "/Users/dhruv/miniforge3/envs/ocr-py38/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 355, in __iter__
    return self._get_iterator()
  File "/Users/dhruv/miniforge3/envs/ocr-py38/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 301, in _get_iterator
    return _MultiProcessingDataLoaderIter(self)
  File "/Users/dhruv/miniforge3/envs/ocr-py38/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 914, in __init__
    w.start()
  File "/Users/dhruv/miniforge3/envs/ocr-py38/lib/python3.8/multiprocessing/process.py", line 121, in start
    self._popen = self._Popen(self)
  File "/Users/dhruv/miniforge3/envs/ocr-py38/lib/python3.8/multiprocessing/context.py", line 224, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "/Users/dhruv/miniforge3/envs/ocr-py38/lib/python3.8/multiprocessing/context.py", line 284, in _Popen
    return Popen(process_obj)
  File "/Users/dhruv/miniforge3/envs/ocr-py38/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    super().__init__(process_obj)
  File "/Users/dhruv/miniforge3/envs/ocr-py38/lib/python3.8/multiprocessing/popen_fork.py", line 19, in __init__
    self._launch(process_obj)
  File "/Users/dhruv/miniforge3/envs/ocr-py38/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 47, in _launch
    reduction.dump(process_obj, fp)
  File "/Users/dhruv/miniforge3/envs/ocr-py38/lib/python3.8/multiprocessing/reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
TypeError: cannot pickle 'module' object

Thanks,
Dhruv