MCPcopy
hub / github.com/THUDM/CogDL / build_dataset_from_name

Function build_dataset_from_name

cogdl/datasets/__init__.py:41–60  ·  view source on GitHub ↗
(dataset, split=0)

Source from the content-addressed store, hash-verified

39
40
41def build_dataset_from_name(dataset, split=0):
42 if isinstance(dataset, list):
43 dataset = dataset[0]
44 if isinstance(split, list):
45 split = split[0]
46 if dataset in SUPPORTED_DATASETS:
47 path = ".".join(SUPPORTED_DATASETS[dataset].split(".")[:-1])
48 module = importlib.import_module(path)
49 else:
50 dataset = build_dataset_from_path(dataset)
51 if dataset is not None:
52 return dataset
53 raise NotImplementedError(f"Failed to import {dataset} dataset.")
54 class_name = SUPPORTED_DATASETS[dataset].split(".")[-1]
55 dataset_class = getattr(module, class_name)
56 for key in inspect.signature(dataset_class.__init__).parameters.keys():
57 if key == "split":
58 return dataset_class(split=split)
59
60 return dataset_class()
61
62
63def build_dataset_pretrain(args):

Callers 15

download_datasetsFunction · 0.90
plot_graphFunction · 0.90
setup_classMethod · 0.90
2training.pyFile · 0.90
1graph.pyFile · 0.90
1graph_cn.pyFile · 0.90
4custom_gnn.pyFile · 0.90
2training_cn.pyFile · 0.90
load_datasetFunction · 0.90
load_inductive_datasetFunction · 0.90
_callMethod · 0.90

Calls 2

build_dataset_from_pathFunction · 0.85
keysMethod · 0.45

Tested by 1

setup_classMethod · 0.72