ColossalAI/tests/test_config/test_load_config.py
Frank Lee 2b2dc1c86b
[pipeline] refactor the pipeline module (#1087)
* [pipeline] refactor the pipeline module

* polish code
2022-06-10 11:27:38 +08:00

20 lines
645 B
Python

#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from pathlib import Path
import pytest
from colossalai.context.config import Config
@pytest.mark.cpu
def test_load_config():
filename = Path(__file__).parent.joinpath('sample_config.py')
config = Config.from_file(filename)
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)}'