WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

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

@FarzanT

Description

@FarzanT

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions