Download load.py from unitxt/data: direct link, hf CLI and curl.
- Browser
- Download file 419 Bytes
-
https://huggingface.co/datasets/unitxt/data/resolve/2aa918a61ba35a1eb6644cfa3b68f0763548af48/load.py
- Command line
-
hf download hf://datasets/unitxt/data@2aa918a61ba35a1eb6644cfa3b68f0763548af48/load.py
-
curl -L -o load.py https://huggingface.co/datasets/unitxt/data/resolve/2aa918a61ba35a1eb6644cfa3b68f0763548af48/load.py
419 Bytes
| from typing import Union | |
| from datasets import DatasetDict | |
| from .artifact import fetch_artifact | |
| from .operator import StreamSource | |
| def load_dataset(source: Union[StreamSource, str]) -> DatasetDict: | |
| assert isinstance( | |
| source, (StreamSource, str) | |
| ), "source must be a StreamSource or a string" | |
| if isinstance(source, str): | |
| source, _ = fetch_artifact(source) | |
| return source().to_dataset() | |