Manually fully initialize the dataset in runner when building dataloader (#190)

* full init the dataset when building data loader

* resolve comments
pull/198/head
Wenwei Zhang 2022-04-22 20:44:52 +08:00 committed by GitHub
parent 4f5c0cd273
commit fb7d8ccd6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -906,6 +906,8 @@ class Runner:
dataset_cfg = dataloader_cfg.pop('dataset')
if isinstance(dataset_cfg, dict):
dataset = DATASETS.build(dataset_cfg)
if hasattr(dataset, 'full_init'):
dataset.full_init()
else:
# fallback to raise error in dataloader
# if `dataset_cfg` is not a valid type