Elron commited on
Commit
084417b
1 Parent(s): 5d49838

Upload load.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. load.py +3 -13
load.py CHANGED
@@ -1,21 +1,11 @@
1
  from typing import Union
2
-
3
  from datasets import DatasetDict
4
-
5
- from .artifact import Artifact
6
- from .catalog import LocalCatalog
7
  from .operator import StreamSource
8
 
9
 
10
- def load_stream(source_name_or_path: str) -> StreamSource:
11
- if Artifact.is_artifact_file(source_name_or_path):
12
- return Artifact.load(source_name_or_path)
13
- else:
14
- return LocalCatalog().load(source_name_or_path)
15
-
16
-
17
  def load_dataset(source: Union[StreamSource, str]) -> DatasetDict:
18
  assert isinstance(source, (StreamSource, str)), "source must be a StreamSource or a string"
19
  if isinstance(source, str):
20
- source = load_stream(source)
21
- return source().to_dataset()
 
1
  from typing import Union
 
2
  from datasets import DatasetDict
3
+ from .artifact import fetch_artifact
 
 
4
  from .operator import StreamSource
5
 
6
 
 
 
 
 
 
 
 
7
  def load_dataset(source: Union[StreamSource, str]) -> DatasetDict:
8
  assert isinstance(source, (StreamSource, str)), "source must be a StreamSource or a string"
9
  if isinstance(source, str):
10
+ artifact, _ = fetch_artifact(source)
11
+ return artifact().to_dataset()