2021-10-28 16:21:23 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- encoding: utf-8 -*-
|
|
|
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
from colossalai.context.config import Config
|
|
|
|
|
|
|
|
|
|
|
|
def test_load_config():
|
2023-09-19 06:20:26 +00:00
|
|
|
filename = Path(__file__).parent.joinpath("sample_config.py")
|
2021-10-28 16:21:23 +00:00
|
|
|
config = Config.from_file(filename)
|
|
|
|
|
2023-09-19 06:20:26 +00:00
|
|
|
assert config.train_data, "cannot access train data as attribute"
|
|
|
|
assert config.train_data.dataset, "cannot access grandchild attribute"
|
|
|
|
assert isinstance(
|
|
|
|
config.train_data.dataset.transform_pipeline[0], dict
|
|
|
|
), f"expected attribute transform_pipeline elements to be a dict, but found {type(config.train_data.dataset.transform_pipeline)}"
|