-
-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Description
Hi,
I switches to Pathos.multiprocessing instead of multiprocessing but still getting a similar error with pickle dump.
Here is simplifed version of the code
def create_patches(location, file, path,
patch_folder, workers=1, patch_size=224, mask_overlap= 95.0):
# Calculate something
# pass input to next function.
def extract_and_save_patch(x_cord, y_cord, file_path=file_pth, file_name=file, mask_path=mask_path,
patch_folder=patch_folder, patch_size=patch_size, mask_overlap=mask_overlap):
# extract a small peice of image based on x_cord and y_cord from big iage
# save the image
def multiprocess_passer(x_cord, y_cord):
print(f"creating patches for ({x_cord},{y_cord})")
extract_and_save_patch(x_cord, y_cord)
list_cord = [(x, y) for x in range(0, n_across) for y in range(0, n_down)]
with Pool(processes=workers) as p:
p.map(extract_and_save_patch, list_cord)
create_patches(location, file, path, patch_folder, workers=num_workers)
I want to pass a tuple to function every time and leave other argument default which load the files and mask. But still getting the same error which appears in multiprocesisng library.
This the error trace.
Traceback (most recent call last):
File "multiprocess.py", line 137, in <module>
create_patches(location, file, path, patch_folder, workers=num_workers)
File "multiprocess.py", line 130, in create_patches
p.map(multiprocess_passer, list_cord)
File "/home/neel/miniconda3/envs/process/lib/python3.7/site-packages/pathos/multiprocessing.py", line 135, in map
return _pool.map(star(f), zip(*args)) # chunksize
File "/home/neel/miniconda3/envs/process/lib/python3.7/multiprocessing/pool.py", line 268, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/home/neel/miniconda3/envs/process/lib/python3.7/multiprocessing/pool.py", line 657, in get
raise self._value
File "/home/neel/miniconda3/envs/process/lib/python3.7/multiprocessing/pool.py", line 431, in _handle_tasks
put(task)
File "/home/neel/miniconda3/envs/process/lib/python3.7/multiprocessing/connection.py", line 206, in send
self._send_bytes(_ForkingPickler.dumps(obj))
File "/home/neel/miniconda3/envs/process/lib/python3.7/multiprocessing/reduction.py", line 51, in dumps
cls(buf, protocol).dump(obj)
AttributeError: Can't pickle local object 'starargs.<locals>.<lambda>'
Anyone faced a similar issue or solved it?
Thanks
Metadata
Metadata
Assignees
Labels
No labels