File size: 405 Bytes
0d48901
2237109
bd864dd
2237109
084417b
bd864dd
0d48901
 
 
 
 
9be434e
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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()