Fix streaming

#7
by lhoestq HF Staff - opened

gzip.open only works for local files, not with URLs

To open remote files in streaming mode, we extend open to support URLs.
This should fix https://github.com/huggingface/datasets/issues/5060

I think key should also be fixed to avoid DuplicatedKeysError because of the outer loop over subdirs...

Hm, I didn't seem to run into any DuplicateKeyErrors on my end. Do the keys need to be unique per Arrow File that's written or per split?

They must be unique per split. And this error does not raise when streaming.

Great thanks for catching that! I didn't have an issue when I ran datasets-cli test however. I'll update the code to use the id of the compound (which should be unique)

Good catch - I made the keys unique :)

zpn changed pull request status to merged

@lhoestq unrelated to code itself but I tried to push changes from my local to this PR but I kept getting errors. Is it not possible to collaborate on a PR opened by another user?

this was the error I got. I was able to pull the code, just not push

git push origin pr/7:refs/pr/7
batch response: Forbidden to push on refs/pr/7                                                 
Uploading LFS objects:   0% (0/2), 0 B | 0 B/s, done.
error: failed to push some refs to 'https://huggingface.co/datasets/zpn/pubchem_selfies'

thanks for all your help as well :)

Thank you :P

regarding the error: there must have been an authentication issue (maybe the email you're using in git were not the one of you HF account or something like that)

:shrug who knows what it could be, but glad we are able to release the dataset thanks to you!

Sign up or log in to comment