| 13 | from vlmeval.utils.result_transfer import MMMU_result_transfer, MMTBench_result_transfer |
| 14 | |
| 15 | def build_model_from_config(cfg, model_name): |
| 16 | import vlmeval.api |
| 17 | import vlmeval.vlm |
| 18 | config = cp.deepcopy(cfg[model_name]) |
| 19 | if config == {}: |
| 20 | return supported_VLM[model_name]() |
| 21 | assert 'class' in config |
| 22 | cls_name = config.pop('class') |
| 23 | if hasattr(vlmeval.api, cls_name): |
| 24 | return getattr(vlmeval.api, cls_name)(**config) |
| 25 | elif hasattr(vlmeval.vlm, cls_name): |
| 26 | return getattr(vlmeval.vlm, cls_name)(**config) |
| 27 | else: |
| 28 | raise ValueError(f'Class {cls_name} is not supported in `vlmeval.api` or `vlmeval.vlm`') |
| 29 | |
| 30 | |
| 31 | def build_dataset_from_config(cfg, dataset_name): |