File size: 407 Bytes
0d48901 bd864dd 084417b bd864dd 0d48901 084417b |
1 2 3 4 5 6 7 8 9 10 11 12 |
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):
artifact, _ = fetch_artifact(source)
return artifact().to_dataset()
|