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

Asynchronous Dataloader: RecursionError: maximum recursion depth exceeded while calling a Python object #1020

Open
FarzanT opened this issue May 24, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@FarzanT
Copy link

FarzanT commented May 24, 2023

Hello,
There seems to be a bug where if there's an array of strings, the load_instance method is called again on the sample:

https://github.com/Lightning-Universe/lightning-bolts/blob/0290ab0ad7824a9917935af0975244f01a6e1ca7/src/pl_bolts/datamodules/async_dataloader.py#LL79C3-L81C10

elif elem_type.__module__ == "numpy" and elem_type.__name__ != "str_" and elem_type.__name__ != "string_":
    if elem_type.__name__ == "ndarray" and self.np_str_obj_array_pattern.search(sample.dtype.str) is not None:
        return self.load_instance(sample)

I think the correct version would just return the sample, like so:

elif elem_type.__module__ == "numpy" and elem_type.__name__ != "str_" and elem_type.__name__ != "string_":
    if elem_type.__name__ == "ndarray" and self.np_str_obj_array_pattern.search(sample.dtype.str) is not None:
        return sample

This works in my case. If it's acceptable, please let me know so I'll open a pull request.

@Borda Borda added fix fixing issues... bug Something isn't working and removed fix fixing issues... labels Jun 20, 2023
@Borda
Copy link
Member

Borda commented Jun 20, 2023

@FarzanT, nice finding, would you be interested in seeing fix? 🐰

@FarzanT
Copy link
Author

FarzanT commented Jun 23, 2023

@Borda Of course, I’m on vacation, but I’ll slowly start a pull request. It’s a single line change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants