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

Flexible Loader #7442

Open
dipta007 opened this issue Mar 9, 2025 · 2 comments
Open

Flexible Loader #7442

dipta007 opened this issue Mar 9, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@dipta007
Copy link

dipta007 commented Mar 9, 2025

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.

@dipta007 dipta007 added the enhancement New feature or request label Mar 9, 2025
@lhoestq
Copy link
Member

lhoestq commented Mar 13, 2025

Ideally save_to_disk should save in a format compatible with load_dataset, wdyt ?

@dipta007
Copy link
Author

Ideally save_to_disk should save in a format compatible with load_dataset, wdyt ?

That would be perfect if not at least a flexible loader.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants