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

remove filecheck to enable symlinks #7133

Merged
merged 5 commits into from
Dec 24, 2024
Merged

remove filecheck to enable symlinks #7133

merged 5 commits into from
Dec 24, 2024

Conversation

fschlatt
Copy link
Contributor

Enables streaming from local symlinks #7083

@lhoestq

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

src/datasets/data_files.py Outdated Show resolved Hide resolved
@lhoestq
Copy link
Member

lhoestq commented Sep 2, 2024

The CI is failing, looks like it breaks imagefolder loading.

I just checked fsspec internals and maybe instead we can detect symlink by checking islink and size to make sure it's a file

if info["type"] == "file" or (info.get("islink") and info["size"])

@lhoestq
Copy link
Member

lhoestq commented Sep 2, 2024

hmm actually size doesn't seem to filter symlinked directories, we need another way

@fschlatt
Copy link
Contributor Author

fschlatt commented Sep 3, 2024

Does fsspec perhaps allow resolving symlinks? Something like https://docs.python.org/3/library/pathlib.html#pathlib.Path.resolve

@lhoestq
Copy link
Member

lhoestq commented Sep 4, 2024

there is info["destination"] in case of a symlink, so maybe

if info["type"] == "file" or (info.get("islink") and info.get("destination") and os.path.isfile(info["destination"]))

@fschlatt
Copy link
Contributor Author

I've added a fix which works with some temporary test files locally

(info["type"] == "file" or (info.get("islink") and os.path.isfile(os.path.realpath(filepath))))

Copy link
Member

@lhoestq lhoestq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great ! lgtm :)

@lhoestq lhoestq merged commit 6c6a82a into huggingface:main Dec 24, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants