Skip to content

String as input in petastorm dataloaders #795

Open
@freud14-tm

Description

@freud14-tm

In the _sanitize_pytorch_types function used in petastorm dataloaders, an exception is raised when an input is a string:

elif re.search('[SaUO]', value.dtype.str):

Is this really necessary? Maybe the default_collate function from PyTorch might not always like, although it seems to support it according to the documentation, but this prevents making other types of collate functions.

Would you consider removing the exception? Thank you.

Activity

selitvin

selitvin commented on May 11, 2023

@selitvin
Collaborator

Sure! Would you like to propose a PR for that? Ideally, with a small unit test showing that it works.

freud14-tm

freud14-tm commented on Jul 11, 2023

@freud14-tm
Author

It seems more complicated than I thought with the current code base of the library and I am not using the library right now. Still think the idea is worthwhile but feel free to close the issue if you wish. Otherwise, let it open in order to keep the idea close.

pratikgujjar

pratikgujjar commented on Aug 23, 2023

@pratikgujjar

Wondering if there is a reason for the string type to not be supported? A column in a parquet file could be all string labels. It is currently not possible to read this parquet file as a PyTorch dataloader becuase this line in the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      String as input in petastorm dataloaders · Issue #795 · uber/petastorm