Repository: open-compass/opencompass
Issue: [Bug] SyntaxError: invalid syntax
Root cause: Validation Gap

### 先决条件

- [x] 我已经搜索过 [问题](https://github.com/open-compass/opencompass/issues/) 和 [讨论](https://github.com/open-compass/opencompass/discussions) 但未得到预期的帮助。
- [x] 错误在 [最新版本](https://github.com/open-compass/opencompass) 中尚未被修复。

### 问题类型

我正在使用官方支持的任务/模型/数据集进行评估。

### 环境

{'CUDA available': True,
 'CUDA_HOME': None,
 'GCC': 'n/a',
 'GPU 0': 'NVIDIA GeForce RTX 4090',
 'MMEngine': '0.10.7',
 'MSVC': '用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.41.34123 版',
 'MUSA available': False,
 'OpenCV': '4.11.0',
 'PyTorch': '2.4.1+cu124',
 'PyTorch compiling details': 'PyTorch built with:\n'
                              '  - C++ Version: 201703\n'
                              '  - MSVC 192930154\n'
                              '  - Intel(R) oneAPI Math Kernel Library Version '
                              '2024.2.1-Product Build 20240722 for Intel(R) 64 '
                              'architecture applications\n'
                              '  - Intel(R) MKL-DNN v3.4.2 (Git Hash '
                              '1137e04ec0b5251ca2b4400a4fd3c667ce843d67)\n'
                              '  - OpenMP 2019\n'
                              '  - LAPACK is enabled (usually provided by '
                              'MKL)\n'
                              '  - CPU capability usage: AVX512\n'
                              '  - CUDA Runtime 12.4\n'
                              '  - NVCC architecture flags: '
                              '-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_90,code=sm_90\n'
                              '  - CuDNN 90.1\n'
                              '  - Magma 2.5.4\n'
                              '  - Build settings: BLAS_INFO=mkl, '
                              'BUILD_TYPE=Release, CUDA_VERSION=12.4, '
                              'CUDNN_VERSION=9.1.0, '
                              'CXX_COMPILER=C:/actions-runner/_work/pytorch/pytorch/builder/windows/tmp_bin/sccache-cl.exe, '
                              'CXX_FLAGS=/DWIN32 /D_WINDOWS /GR /EHsc '
                              '/Zc:__cplusplus /bigobj /FS /utf-8 '
                              '-DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO '
                              '-DLIBKINETO_NOCUPTI -DLIBKINETO_NOROCTRACER '
                              '-DUSE_FBGEMM -DUSE_XNNPACK '
                              '-DSYMBOLICATE_MOBILE_DEBUG_HANDLE /wd4624 '
                              '/wd4068 /wd4067 /wd4267 /wd4661 /wd4717 /wd4244 '
                              '/wd4804 /wd4273, LAPACK_INFO=mkl, '
                              'PERF_WITH_AVX=1, PERF_WITH_AVX2=1, '
                              'PERF_WITH_AVX512=1, TORCH_VERSION=2.4.1, '
                              'USE_CUDA=ON, USE_CUDNN=ON, USE_CUSPARSELT=OFF, '
                              'USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, '
                              'USE_GLOG=OFF, USE_GLOO=ON, USE_MKL=ON, '
                              'USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=OFF, '
                              'USE_NNPACK=OFF, USE_OPENMP=ON, USE_ROCM=OFF, '
                              'USE_ROCM_KERNEL_ASSERT=OFF, \n',
 'Python': '3.10.16 | packaged by Anaconda, Inc. | (main, Dec 11 2024, '
           '16:19:12) [MSC v.1929 64 bit (AMD64)]',
 'TorchVision': '0.19.1+cu124',
 'lmdeploy': "not installed:No module named 'lmdeploy'",
 'numpy_random_seed': 2147483648,
 'opencompass': '0.4.1+709bc4a',
 'sys.platform': 'win32',
 'transformers': '4.49.0'}

### 重现问题 - 代码/配置示例

# This config is used for pass@k evaluation with `num_return_sequences`
# That model can generate multiple responses for single input
from mmengine.config import read_base

from opencompass.models import HuggingFaceCausalLM
from opencompass.partitioners import SizePartitioner
from opencompass.runners import LocalRunner
from opencompass.tasks import OpenICLInferTask

with read_base():
    from opencompass.configs.datasets.humaneval.humaneval_passk_gen_8e312c import \
        humaneval_datasets
    from opencompass.configs.datasets.mbpp.deprecated_mbpp_passk_gen_1e1056 import \
        mbpp_datasets
    from opencompass.configs.datasets.mbpp.deprecated_sanitized_mbpp_passk_gen_1e1056 import \
        sanitized_mbpp_datasets

datasets = []
datasets += humaneval_datasets
datasets += mbpp_datasets
datasets += sanitized_mbpp_datasets

models = [
    dict(
        type=HuggingFaceCausalLM,
        abbr='Qwen2-1.5B-Instruct',
        path='G:/zhiwei/orig_models/Qwen2-1.5B-Instruct/',
        tokenizer_kwargs=dict(
            padding_side='left',
            truncation_side='left',
            trust_remote_code=True,
        ),
        max_out_len=1024,
        max_seq_len=2048,
        batch_size=8,
        model_kwargs=dict(trust_remote_code=True, device_map='auto'),
        generation_kwargs=dict(
            num_return_sequences=10,
            do_sample=True,
            top_p=0.95,
            temperature=0.8,
        ),
        run_cfg=dict(num_gpus=1, num_procs=1),
    ),
]

infer = dict(
    partitioner=dict(type=SizePartitioner, max_task_size=300),
    runner=dict(type=LocalRunner,
                max_num_workers=16,
                task=dict(type=OpenICLInferTask)),
)


### 重现问题 - 命令或脚本

(G:\zhiwei\py310) PS G:\zhiwei\opencompass> python run.py .\examples\eval_code_passk.py --debug

### 重现问题 - 错误信息

signal.SIGALRM is not available on this platform
signal.SIGALRM is not available on this platform
03/12 23:13:54 - OpenCompass - INFO - Current exp folder: outputs\default\20250312_231354
outputs\default\20250312_231354\configs\20250312_231354_85524.py
Traceback (most recent call last):
  File "G:\zhiwei\opencompass\run.py", line 4, in <module>
    main()
  File "G:\zhiwei\opencompass\opencompass\cli\main.py", line 286, in main
    cfg = Config.fromfile(output_config_path, format_python_code=False)
  File "G:\zhiwei\py310\lib\site-packages\mmengine\config\config.py", line 460, in fromfile
    lazy_import is None and not Config._is_lazy_import(filename):
  File "G:\zhiwei\py310\lib\site-packages\mmengine\config\config.py", line 1664, in _is_lazy_import
    parsed_codes = ast.parse(codes_str)
  File "G:\zhiwei\py310\lib\ast.py", line 50, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 5
    type=<class 'opencompass.datasets.humaneval.HumanEvalEvaluator'>),
         ^
SyntaxError: invalid syntax

### 其他信息

输出的output下的配置文件type
eval=dict(
    partitioner=dict(
        n=10,
        type=<class 'opencompass.partitioners.naive.NaivePartitioner'>),
    runner=dict(
        max_num_workers=2,
        task=dict(
            cal_extract_rate=True,
            dump_details=True,
            type=<class 'opencompass.tasks.openicl_eval.OpenICLEvalTask'>),
        type=<class 'opencompass.runners.local.LocalRunner'>))
infer=dict(
    partitioner=dict(
        num_worker=8,
        type=<class 'opencompass.partitioners.num_worker.NumWorkerPartitioner'>),
    runner=dict(
        max_num_workers=8,
        task=dict(
            type=<class 'opencompass.tasks.openicl_infer.OpenICLInferTask'>),
        type=<class 'opencompass.runners.local.LocalRunner'>))