Skip to content

Flexible Loader #7442

@dipta007

Description

@dipta007

Feature request

Can we have a utility function that will use load_from_disk when given the local path and load_dataset if given an HF dataset?

It can be something as simple as this one:

def load_hf_dataset(path_or_name):
    if os.path.exists(path_or_name):
        return load_from_disk(path_or_name)
    else:
        return load_dataset(path_or_name)

Motivation

This can be done inside the user codebase, too, but in my experience, it becomes repetitive code.

Your contribution

I can open a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions