"""
Test module for testing yaml tools, MindFormerConfig.
How to run this:
windows: pytest .\\tests\\st\\test_yaml.py
linux: pytest ./tests/st/test_yaml.py
Note:
the name of model yaml file should start with model.
the name of model ckpt file should be same with yaml file.
example:
clip_vit_b_32.yaml starts with clip,
and clip_vit_b_32.ckpt is model ckpt file.
"""
import os
import pytest
from mindformers import MindFormerBook
from mindformers.tools.register import MindFormerConfig
from mindformers.tools.logger import logger
@pytest.mark.level0
@pytest.mark.platform_x86_cpu
@pytest.mark.platform_x86_gpu_training
@pytest.mark.env_onecard
def test_yaml():
"""
Feature: MindFormerConfig
Description: Test to transform yaml file as MindFormerConfig
Expectation: TypeError
"""
yaml_path = os.path.join(
MindFormerBook.get_project_path(), 'configs', 'glm4', 'predict_glm4_9b_chat.yaml')
yaml_content = MindFormerConfig(yaml_path)
logger.info(yaml_content)
assert isinstance(yaml_content, MindFormerConfig)
assert isinstance(yaml_content, dict)