Repository: open-compass/opencompass
Issue: [Bug] 修改了模型路径后使用Lawbench 进行zero-shot测评，推理无误输出报错
Root cause: Architectural Constraint

### 先决条件

- [X] 我已经搜索过 [问题](https://github.com/open-compass/opencompass/issues/) 和 [讨论](https://github.com/open-compass/opencompass/discussions) 但未得到预期的帮助。
- [X] 错误在 [最新版本](https://github.com/open-compass/opencompass) 中尚未被修复。

### 问题类型

我正在使用官方支持的任务/模型/数据集进行评估。

### 环境

```python 
 {'CUDA available': True,
 'CUDA_HOME': '/usr/local/cuda',
 'GCC': 'gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0',
 'GPU 0,1': 'NVIDIA GeForce RTX 3090',
 'MMEngine': '0.10.4',
 'MUSA available': False,
 'NVCC': 'Cuda compilation tools, release 12.1, V12.1.105',
 'OpenCV': '4.10.0',
 'PyTorch': '2.1.2+cu121',
 'PyTorch compiling details': 'PyTorch built with:\n'
                              '  - GCC 9.3\n'
                              '  - C++ Version: 201703\n'
                              '  - Intel(R) oneAPI Math Kernel Library Version '
                              '2022.2-Product Build 20220804 for Intel(R) 64 '
                              'architecture applications\n'
                              '  - Intel(R) MKL-DNN v3.1.1 (Git Hash '
                              '64f6bcbcbab628e96f33a62c3e975f8535a7bde4)\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'
                              '  - CUDA Runtime 12.1\n'
                              '  - NVCC architecture flags: '
                              '-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-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 8.9.2\n'
                              '  - Magma 2.6.1\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 -Wno-psabi '
                              '-Wno-error=pedantic -Wno-error=old-style-cast '
                              '-Wno-invalid-partial-specialization '
                              '-Wno-unused-private-field '
                              '-Wno-aligned-allocation-unavailable '
                              '-Wno-missing-braces -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.1.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=1, USE_NNPACK=ON, '
                              'USE_OPENMP=ON, USE_ROCM=OFF, \n',
 'Python': '3.10.8 (main, Nov 24 2022, 14:13:03) [GCC 11.2.0]',
 'TorchVision': '0.16.2+cu121',
 'lmdeploy': "not installed:No module named 'lmdeploy'",
 'numpy_random_seed': 2147483648,
 'opencompass': '0.3.1+',
 'sys.platform': 'linux',
 'transformers': '4.39.3'}
```

### 重现问题 - 代码/配置示例
```python
from opencompass.models import HuggingFacewithChatTemplate

models = [
    dict(
        type=HuggingFacewithChatTemplate,
        abbr='qwen2-1.5b-instruct-hf',
        # path='Qwen/Qwen2-1.5B-Instruct',
        path="/root/autodl-tmp/qwen/qwen2-1-5b-instruct/",
        max_out_len=1024,
        batch_size=8,
        run_cfg=dict(num_gpus=2),
    )
]
```

### 重现问题 - 命令或脚本

```shell
 CUDA_VISIBLE_DEVICES=0,1 python run.py  --models  vllm_qwen2_1_5b_instruct  --datasets  lawbench_zero_shot_gen_002588 --debug --max-num-workers 8    --mode all
```

### 重现问题 - 错误信息

报错内容太长，下面评论放出

### 重现问题 - 错误信息


```08/28 16:49:15 - OpenCompass - INFO - Partitioned into 20 tasks.
Building prefix dict from the default dictionary ...
Loading model from cache /tmp/jieba.cache
Loading model cost 0.723 seconds.
Prefix dict has been built successfully.
08/28 16:49:18 - OpenCompass - INFO - Task [qwen2-1.5b-instruct-vllm/lawbench-1-1-article_recitation-0-shot]: {'score': 17.133605767041253}
08/28 16:49:18 - OpenCompass - INFO - Task [qwen2-1.5b-instruct-vllm/lawbench-1-2-knowledge_question_answering-0-shot]: {'score': 47.599999999999994, 'abstention_rate': 0.0}
Traceback (most recent call last):
  File "/root/autodl-tmp/opencompass-0.3.1/opencompass/datasets/lawbench/utils/parallel_to_m2.py", line 2, in <module>
    from modules.annotator import Annotator
  File "/root/autodl-tmp/opencompass-0.3.1/opencompass/datasets/lawbench/utils/modules/annotator.py", line 4, in <module>
    from modules.classifier import Classifier
  File "/root/autodl-tmp/opencompass-0.3.1/opencompass/datasets/lawbench/utils/modules/classifier.py", line 13, in <module>
    char_smi = CharFuncs(os.path.join(os.path.dirname(__file__), "..", "..", "..", "..", "..", "data", "lawbench", "eval_assets", "char_meta.txt"))
  File "/root/autodl-tmp/opencompass-0.3.1/opencompass/datasets/lawbench/utils/char_smi.py", line 100, in __init__
    self.data = self.load_char_meta(char_meta_fname)
  File "/root/autodl-tmp/opencompass-0.3.1/opencompass/datasets/lawbench/utils/char_smi.py", line 120, in load_char_meta
    f = open(fname, 'r', encoding='utf-8')
FileNotFoundError: [Errno 2] No such file or directory: '/root/autodl-tmp/opencompass-0.3.1/opencompass/datasets/lawbench/utils/modules/../../../../../data/lawbench/eval_assets/char_meta.txt'
Traceback (most recent call last):
  File "/root/autodl-tmp/opencompass-0.3.1/opencompass/datasets/lawbench/utils/parallel_to_m2.py", line 2, in <module>
    from modules.annotator import Annotator
  File "/root/autodl-tmp/opencompass-0.3.1/opencompass/datasets/lawbench/utils/modules/annotator.py", line 4, in <module>
    from modules.classifier import Classifier
  File "/root/autodl-tmp/opencompass-0.3.1/opencompass/datasets/lawbench/utils/modules/classifier.py", line 13, in <module>
    char_smi = CharFuncs(os.path.join(os.path.dirname(__file__), "..", "..", "..", "..", "..", "data", "lawbench", "eval_assets", "char_meta.txt"))
  File "/root/autodl-tmp/opencompass-0.3.1/opencompass/datasets/lawbench/utils/char_smi.py", line 100, in __init__
    self.data = self.load_char_meta(char_meta_fname)
  File "/root/autodl-tmp/opencompass-0.3.1/opencompass/datasets/lawbench/utils/char_smi.py", line 120, in load_char_meta
    f = open(fname, 'r', encoding='utf-8')
FileNotFoundError: [Errno 2] No such file or directory: '/root/autodl-tmp/opencompass-0.3.1/opencompass/datasets/lawbench/utils/modules/../../../../../data/lawbench/eval_assets/char_meta.txt'
Traceback (most recent call last):
  File "/root/autodl-tmp/opencompass-0.3.1/opencompass/datasets/lawbench/utils/compare_m2_for_evaluation.py", line 433, in <module>
    main()
  File "/root/autodl-tmp/opencompass-0.3.1/opencompass/datasets/lawbench/utils/compare_m2_for_evaluation.py", line 8, in main
    hyp_m2 = open(args.hyp).read().strip().split("\n\n")[args.start:args.end] if args.start is not None and args.end is not None else open(args.hyp).read().strip().split("\n\n")
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmput4v7362.m2'
Traceback (most recent call last):
  File "/root/autodl-tmp/opencompass-0.3.1/opencompass/runners/local.py", line 131, in launch
    task.run()
  File "/root/autodl-tmp/opencompass-0.3.1/opencompass/tasks/openicl_eval.py", line 114, in run
    self._score()
  File "/root/autodl-tmp/opencompass-0.3.1/opencompass/tasks/openicl_eval.py", line 230, in _score
    result = icl_evaluator.score(**preds)
  File "/root/autodl-tmp/opencompass-0.3.1/opencompass/datasets/lawbench/lawbench.py", line 71, in score
    scores = funct_dict[self.index](data_dict)
  File "/root/autodl-tmp/opencompass-0.3.1/opencompass/datasets/lawbench/evaluation_functions/wsjd.py", line 43, in compute_wsjd
    output = subprocess.check_output(
  File "/root/miniconda3/lib/python3.10/subprocess.py", line 421, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/root/miniconda3/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'python3 compare_m2_for_evaluation.py -hyp /tmp/tmput4v7362.m2 -ref /tmp/tmpbfsn8x81.m2' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/autodl-tmp/opencompass-0.3.1/run.py", line 4, in <module>
    main()
  File "/root/autodl-tmp/opencompass-0.3.1/opencompass/cli/main.py", line 351, in main
    runner(tasks)
  File "/root/autodl-tmp/opencompass-0.3.1/opencompass/runners/base.py", line 38, in __call__
    status = self.launch(tasks)
  File "/root/autodl-tmp/opencompass-0.3.1/opencompass/runners/local.py", line 143, in launch
    os.remove(param_file)
FileNotFoundError: [Errno 2] No such file or directory: 'tmp/9154_params.py'
```

还有一个问题，单机双卡环境下，仍然是单卡推理，导致资源浪费，如何解决呢
![image](https://github.com/user-attachments/assets/ea83677d-ba9d-46c4-bb9f-f2d5278d032d)


> ```shell
> lawbench_zero_shot_gen_002588
> ```

Don't set --debug in the CLI, it will only start one subprocess.
Regarding to your error message, try to delete the tmp folder under opencompass folder and re-start the job.

> Don't set --debug in the CLI, it will only start one subprocess.
> Regarding to your error message, try to delete the tmp folder under opencompass folder and re-start the job.

But without debugging, his progress bar keeps getting stuck. be like

![image](https://github.com/user-attachments/assets/dcf9cc22-92ac-4886-9e04-763cb80bfb09)

I want it to show details like turning on --debug .

this is my cli
```shell
model_name="vllm_chatglm3_6b_32k"
CUDA_VISIBLE_DEVICES=1,2,3 python run.py --models model_name  --datasets lawbench_zero_shot_gen_002588 --hf-num-gpus 3 -w ./outputs/$model name  -a vllm

```
Whether I set the parameters wrong, I want to use vllm to speed up inference

> > ```shell
> > lawbench_zero_shot_gen_002588
> > ```
> 
> Don't set --debug in the CLI, it will only start one subprocess. Regarding to your error message, try to delete the tmp folder under opencompass folder and re-start the job.

根据我的CLI，还是只有单卡运行，修改后


You didn't specifiy --max-num-workers, so the dataset will not be partitioned to different tasks. It works fine on my side.
![image](https://github.com/user-attachments/assets/33caf524-a752-4f05-9d3f-0acd5ed5249f)


Closed. Feel free to re-open the issue.