MCPcopy Create free account
hub / github.com/MotrixLab/FineMoGen / build_dataset

Function build_dataset

mogen/datasets/builder.py:28–40  ·  view source on GitHub ↗

Build dataset by the given config.

(cfg: Union[dict, list, tuple],
                  default_args: Optional[Union[dict, None]] = None)

Source from the content-addressed store, hash-verified

26
27
28def build_dataset(cfg: Union[dict, list, tuple],
29 default_args: Optional[Union[dict, None]] = None):
30 """"Build dataset by the given config."""
31 from .dataset_wrappers import ConcatDataset, RepeatDataset
32 if isinstance(cfg, (list, tuple)):
33 dataset = ConcatDataset([build_dataset(c, default_args) for c in cfg])
34 elif cfg['type'] == 'RepeatDataset':
35 dataset = RepeatDataset(build_dataset(cfg['dataset'], default_args),
36 cfg['times'])
37 else:
38 dataset = build_from_cfg(cfg, DATASETS, default_args)
39
40 return dataset
41
42
43def build_dataloader(dataset: Dataset,

Callers 3

mainFunction · 0.90
mainFunction · 0.90
train_modelFunction · 0.90

Calls 3

ConcatDatasetClass · 0.85
RepeatDatasetClass · 0.85
build_from_cfgFunction · 0.85

Tested by 1

mainFunction · 0.72