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

The "Loading an example dataset" in Readme doesn't work for https url #648

Open
omshinde opened this issue May 13, 2024 · 0 comments
Open

Comments

@omshinde
Copy link

What I tried -

import mlcroissant as mlc
url = "http://huggingface.co/api/datasets/fashion_mnist/croissant"
ds = mlc.Dataset(url)
metadata = ds.metadata.to_json()
print(f"{metadata['name']}: {metadata['description']}")
for x in ds.records(record_set="default"):
    print(x)

Output:

...
File [/opt/homebrew/anaconda3/lib/python3.10/site-packages/mlcroissant/_src/structure_graph/nodes/metadata.py:131](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/lib/python3.10/site-packages/mlcroissant/_src/structure_graph/nodes/metadata.py:131), in Metadata.from_file(cls, issues, file)
    [128](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/lib/python3.10/site-packages/mlcroissant/_src/structure_graph/nodes/metadata.py:128) @classmethod
    [129](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/lib/python3.10/site-packages/mlcroissant/_src/structure_graph/nodes/metadata.py:129) def from_file(cls, issues: Issues, file: epath.PathLike) -> Metadata:
    [130](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/lib/python3.10/site-packages/mlcroissant/_src/structure_graph/nodes/metadata.py:130)     """Creates the Metadata from a Croissant file."""
--> [131](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/lib/python3.10/site-packages/mlcroissant/_src/structure_graph/nodes/metadata.py:131)     folder, json_ = from_file_to_json(file)
    [132](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/lib/python3.10/site-packages/mlcroissant/_src/structure_graph/nodes/metadata.py:132)     return cls.from_json(issues=issues, json_=json_, folder=folder)

File [/opt/homebrew/anaconda3/lib/python3.10/site-packages/mlcroissant/_src/structure_graph/graph.py:44](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/lib/python3.10/site-packages/mlcroissant/_src/structure_graph/graph.py:44), in from_file_to_json(filepath)
...
--> [100](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/lib/python3.10/site-packages/etils/epath/register.py:100)   return _URI_PREFIXES_TO_CLS[uri_splits[0] + '://'](path)  # pytype: disable=bad-return-type
    [101](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/lib/python3.10/site-packages/etils/epath/register.py:101) elif is_windows:
    [102](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/anaconda3/lib/python3.10/site-packages/etils/epath/register.py:102)   return gpath.WindowsGPath(path)

KeyError: 'http://'

Python version - 3.10.13

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

No branches or pull requests

1 participant