Repository: open-compass/opencompass
Issue: [Bug] 自定义config进行推理的时候报错
Root cause: Configuration Error

### Prerequisite

- [X] I have searched [Issues](https://github.com/open-compass/opencompass/issues/) and [Discussions](https://github.com/open-compass/opencompass/discussions) but cannot get the expected help.
- [X] The bug has not been fixed in the [latest version](https://github.com/open-compass/opencompass).

### Type

I'm evaluating with the officially supported tasks/models/datasets.

### Environment

（本次提交的错误在WSL2与实体服务器Linux（A800*8）环境中皆可复现，下列环境信息为WSL2）
```
{'CUDA available': True,
 'CUDA_HOME': '/usr',
 'GCC': 'gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0',
 'GPU 0': 'NVIDIA GeForce RTX 3060 Laptop GPU',
 'MMEngine': '0.10.1',
 'NVCC': 'Cuda compilation tools, release 11.5, V11.5.119',
 'OpenCV': '4.8.1',
 'PyTorch': '2.0.1',
 'PyTorch compiling details': 'PyTorch built with:\n'
                              '  - GCC 9.3\n'
                              '  - C++ Version: 201703\n'
                              '  - Intel(R) oneAPI Math Kernel Library Version '
                              '2023.1-Product Build 20230303 for Intel(R) 64 '
                              'architecture applications\n'
                              '  - Intel(R) MKL-DNN v2.7.3 (Git Hash '
                              '6dbeffbae1f23cbbeae17adb7b5b13f1f37c080e)\n'
                              '  - OpenMP 201511 (a.k.a. OpenMP 4.5)\n'
                              '  - LAPACK is enabled (usually provided by '
                              'MKL)\n'
                              '  - NNPACK is enabled\n'
                              '  - CPU capability usage: AVX2\n'
                              '  - CUDA Runtime 11.7\n'
                              '  - NVCC architecture flags: '
                              '-gencode;arch=compute_37,code=sm_37;-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_37,code=compute_37\n'
                              '  - CuDNN 8.5\n'
                              '  - Magma 2.6.1\n'
                              '  - Build settings: BLAS_INFO=mkl, '
                              'BUILD_TYPE=Release, CUDA_VERSION=11.7, '
                              'CUDNN_VERSION=8.5.0, '
                              'CXX_COMPILER=/opt/rh/devtoolset-9/root/usr/bin/c++, '
                              'CXX_FLAGS= -D_GLIBCXX_USE_CXX11_ABI=0 '
                              '-fabi-version=11 -Wno-deprecated '
                              '-fvisibility-inlines-hidden -DUSE_PTHREADPOOL '
                              '-DNDEBUG -DUSE_KINETO -DLIBKINETO_NOROCTRACER '
                              '-DUSE_FBGEMM -DUSE_QNNPACK '
                              '-DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK '
                              '-DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC '
                              '-Wall -Wextra -Werror=return-type '
                              '-Werror=non-virtual-dtor -Werror=bool-operation '
                              '-Wnarrowing -Wno-missing-field-initializers '
                              '-Wno-type-limits -Wno-array-bounds '
                              '-Wno-unknown-pragmas -Wunused-local-typedefs '
                              '-Wno-unused-parameter -Wno-unused-function '
                              '-Wno-unused-result -Wno-strict-overflow '
                              '-Wno-strict-aliasing '
                              '-Wno-error=deprecated-declarations '
                              '-Wno-stringop-overflow -Wno-psabi '
                              '-Wno-error=pedantic -Wno-error=redundant-decls '
                              '-Wno-error=old-style-cast '
                              '-fdiagnostics-color=always -faligned-new '
                              '-Wno-unused-but-set-variable '
                              '-Wno-maybe-uninitialized -fno-math-errno '
                              '-fno-trapping-math -Werror=format '
                              '-Werror=cast-function-type '
                              '-Wno-stringop-overflow, LAPACK_INFO=mkl, '
                              'PERF_WITH_AVX=1, PERF_WITH_AVX2=1, '
                              'PERF_WITH_AVX512=1, '
                              'TORCH_DISABLE_GPU_ASSERTS=ON, '
                              'TORCH_VERSION=2.0.1, USE_CUDA=ON, USE_CUDNN=ON, '
                              'USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, '
                              'USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, '
                              'USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, '
                              'USE_OPENMP=ON, USE_ROCM=OFF, \n',
 'Python': '3.10.11 (main, Apr 20 2023, 19:02:41) [GCC 11.2.0]',
 'TorchVision': '0.15.2',
 'numpy_random_seed': 2147483648,
 'opencompass': '0.1.9+',
 'sys.platform': 'linux'}
 ```

### Reproduces the problem - code/configuration sample

Config：(`my_config.py`)
```
from opencompass.models import HuggingFaceCausalLM, HuggingFace
from mmengine.config import read_base

model_path = f"/mnt/d/AI/models/Yi-6B-Chat"
ABBR = "hf_yi_6b"

NUM_GPUS=1

with read_base():
    from .datasets.ceval.ceval_gen import ceval_datasets
    from .datasets.cmmlu.cmmlu_gen import cmmlu_datasets
    from .datasets.mmlu.mmlu_gen import mmlu_datasets


_meta_template = dict(
    begin="
system\nYou are now a helpful and harmless AI assistant.
\n",
    round=[
        dict(role='HUMAN', begin='
user\n', end='
\n'),
        dict(role='BOT', begin='
assistant\n',  generate=True, end='
\n'),
    ],
    eos_token_id=7
)

models = [
    dict(
        type=HuggingFaceCausalLM,
        path=model_path,
        abbr=ABBR,
        model_kwargs=dict(device_map='auto', trust_remote_code=True),
        tokenizer_path=model_path,
        tokenizer_kwargs=dict(padding_side='left', truncation_side='left', trust_remote_code=True, use_fast=False),
        meta_template=_meta_template,
        max_seq_len=2048,
        max_out_len=100,
        run_cfg=dict(num_gpus=NUM_GPUS, num_procs=NUM_GPUS),
    )
]

datasets = [*(ceval_datasets[:3])]
```



### Reproduces the problem - command or script

`run.py configs/eval_yi_chat.py configs/my_config.py --datasets ceval_gen -w output`

### Reproduces the problem - error message

![image](https://github.com/open-compass/opencompass/assets/16441055/fceecd50-03ab-4e99-8e39-72c06b17d279)


### Other information

我的预期结果是使用自定义的prompt模板来完成推理评测，测试的数据集是ceval_gen。

Plz take a look at https://github.com/open-compass/opencompass/issues/673

Feel free to reopen if needed.

Feel free to reopen if needed.