Repository: open-compass/opencompass
Issue: [Bug] No Pattern match or more than one config Error when running NeedleBench
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': False,
 'GCC': 'gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0',
 'MMEngine': '0.10.3',
 'MUSA available': False,
 'OpenCV': '4.9.0',
 'PyTorch': '2.2.2',
 '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 v3.3.2 (Git Hash '
                              '2dc95a2ad0841e29db8b22fbccaf3e5da7992b01)\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: AVX512\n'
                              '  - Build settings: BLAS_INFO=mkl, '
                              'BUILD_TYPE=Release, CUDA_VERSION=12.1, '
                              'CUDNN_VERSION=8.9.2, '
                              'CXX_COMPILER=/opt/rh/devtoolset-9/root/usr/bin/c++, '
                              'CXX_FLAGS= -D_GLIBCXX_USE_CXX11_ABI=0 '
                              '-fabi-version=11 -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 -Wno-unused-parameter '
                              '-Wno-unused-function -Wno-unused-result '
                              '-Wno-strict-overflow -Wno-strict-aliasing '
                              '-Wno-stringop-overflow -Wsuggest-override '
                              '-Wno-psabi -Wno-error=pedantic '
                              '-Wno-error=old-style-cast -Wno-missing-braces '
                              '-fdiagnostics-color=always -faligned-new '
                              '-Wno-unused-but-set-variable '
                              '-Wno-maybe-uninitialized -fno-math-errno '
                              '-fno-trapping-math -Werror=format '
                              '-Wno-stringop-overflow, LAPACK_INFO=mkl, '
                              'PERF_WITH_AVX=1, PERF_WITH_AVX2=1, '
                              'PERF_WITH_AVX512=1, TORCH_VERSION=2.2.2, '
                              '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, '
                              'USE_ROCM_KERNEL_ASSERT=OFF, \n',
 'Python': '3.10.14 (main, Mar 21 2024, 16:24:04) [GCC 11.2.0]',
 'TorchVision': '0.17.2',
 'numpy_random_seed': 2147483648,
 'opencompass': '0.2.3+0a6a03f',
 'sys.platform': 'linux'}

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

见下面

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

ARGS=" --models hf_chatglm3_6b_32k --datasets needlebatch_8k/needlebench_single \
       --model-kwargs device_map='auto' \
        --max-out-len 512"
python run.py $ARGS

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

 Traceback (most recent call last):
  File "/cognitive_comp/hejunqing/projects/opencompass/run.py", line 357, in <module>
    main()
  File "/cognitive_comp/hejunqing/projects/opencompass/run.py", line 224, in main
    cfg = get_config_from_arg(args)
  File "/cognitive_comp/hejunqing/projects/opencompass/opencompass/utils/run.py", line 73, in get_config_from_arg
    for dataset in match_cfg_file(datasets_dir, args.datasets):
  File "/cognitive_comp/hejunqing/projects/opencompass/opencompass/utils/run.py", line 47, in match_cfg_file
File "/cognitive_comp/hejunqing/projects/opencompass/opencompass/utils/run.py", line 47, in match_cfg_file
    raise ValueError(err_msg)
ValueError: The provided pattern matches 0 or more than one config. Please verify your pattern and try again. You may use tools/list_configs.py to list or locate the configurations.
+-----------------------------------+
| Not matched patterns              |
|-----------------------------------|
| needlebench_8k/needlebench_single |
+-----------------------------------+

如果把 --datasets 改为needlebench_single，则报以下错误：
    raise ValueError(err_msg)
ValueError: The provided pattern matches 0 or more than one config. Please verify your pattern and try again. You may use tools/list_configs.py to list or locate the configurations.
+----------------------+----------------------------------------------------------------------+
| Ambiguous patterns   | Matched files                                                        |
|----------------------+----------------------------------------------------------------------|
| needlebench_single   | configs/datasets/needlebench/needlebench_32k/needlebench_single.py   |
|                      | configs/datasets/needlebench/needlebench_4k/needlebench_single.py    |
|                      | configs/datasets/needlebench/needlebench_128k/needlebench_single.py  |
|                      | configs/datasets/needlebench/needlebench_8k/needlebench_single.py    |
|                      | configs/datasets/needlebench/needlebench_200k/needlebench_single.py  |
|                      | configs/datasets/needlebench/needlebench_1000k/needlebench_single.py |
+----------------------+----------------------------------------------------------------------+

### 其他信息

_No response_

Hi , we will fix this bug later, but you can write a config file like https://github.com/open-compass/opencompass/blob/main/configs/eval_needlebench.py

In your case, it would be like 
```python
from mmengine.config import read_base
with read_base():
    # only eval original "needle in a haystack test" in needlebench_4k
    from .models.chatglm.hf_chatglm3_6b_32k import models
    from .datasets.needlebench.needlebench_8k.needlebench_single import needlebench_datasets_zh, needlebench_datasets_en
    from .summarizers.needlebench import needlebench_4k_summarizer as summarizer

for m in models:
    m['max_seq_len'] = 32768

datasets = sum([v for k, v in locals().items() if ('datasets' in k)], [])

work_dir = './outputs/needlebench'
```

and then run following command
```bash
python run.py the_config_file_path.py
```

make sure you have enough gpus, in your environment , it seems that your cuda is not available.
```bash
"'CUDA available': False,"
```

Hello @hejunqing , I have already fixed this issue in the latest OpenCompass. Please see this PR for details: https://github.com/open-compass/opencompass/pull/1102. It includes updated guides for conducting the Needle In A Haystack evaluation, including instructions for running from the command line.