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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declaring _MapStyleDataset inside function makes it unpicklable #2205

Open
AnthoJack opened this issue Sep 20, 2023 · 0 comments
Open

Declaring _MapStyleDataset inside function makes it unpicklable #2205

AnthoJack opened this issue Sep 20, 2023 · 0 comments

Comments

@AnthoJack
Copy link

馃悰 Bug

Describe the bug
When trying to use a Dataset that was converted to map-style using data.functional.to_map_style_dataset, I encountered the following error message:

...
File "/usr/lib/python3.8/multiprocessing/reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'to_map_style_dataset.._MapStyleDataset'

After some research, I found the list of what is picklable here and found that for a class to be picklable, it has to be from the top level of a module

This isn't the case for _MapStyleDataset as it is declared within the to_map_style_dataset function

The fix seems simple enough (declare _MapStyleDataset outside the function) so I would like to know if there was anything making it undesireable ? If not, I'll create a PR for it but I would like some opinions on it

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