Repository: open-compass/opencompass
Issue: [Bug] on agieval_gen_617738, pyarrow.lib.ArrowInvalid: Could not convert '$5$;$10$' with type str: tried to convert to int64
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': '/usr/local/cuda:/usr/local/cuda',
 'GCC': 'gcc (Ubuntu 7.5.0-6ubuntu2) 7.5.0',
 'GPU 0,1,2,3,4': 'NVIDIA GeForce RTX 3090',
 'MMEngine': '0.10.7',
 'MUSA available': False,
 'OpenCV': '4.11.0',
 'PyTorch': '2.6.0+cu124',
 'PyTorch compiling details': 'PyTorch built with:\n'
                              '  - GCC 9.3\n'
                              '  - C++ Version: 201703\n'
                              '  - Intel(R) oneAPI Math Kernel Library Version '
                              '2024.2-Product Build 20240605 for Intel(R) 64 '
                              'architecture applications\n'
                              '  - Intel(R) MKL-DNN v3.5.3 (Git Hash '
                              '66f0cb9eb66affd2da3bf5f8d897376f04aae6af)\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 12.4\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 90.1\n'
                              '  - Magma 2.6.1\n'
                              '  - Build settings: BLAS_INFO=mkl, '
                              'BUILD_TYPE=Release, '
                              'COMMIT_SHA=2236df1770800ffea5697b11b0bb0d910b2e59e1, '
                              'CUDA_VERSION=12.4, CUDNN_VERSION=9.1.0, '
                              '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 -DLIBKINETO_NOXPUPTI=ON '
                              '-DUSE_FBGEMM -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-strict-overflow -Wno-strict-aliasing '
                              '-Wno-stringop-overflow -Wsuggest-override '
                              '-Wno-psabi -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, '
                              'TORCH_VERSION=2.6.0, USE_CUDA=ON, USE_CUDNN=ON, '
                              'USE_CUSPARSELT=1, USE_EXCEPTION_PTR=1, '
                              'USE_GFLAGS=OFF, USE_GLOG=OFF, USE_GLOO=ON, '
                              'USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, '
                              'USE_NCCL=1, USE_NNPACK=ON, USE_OPENMP=ON, '
                              'USE_ROCM=OFF, USE_ROCM_KERNEL_ASSERT=OFF, \n',
 'Python': '3.10.16 (main, Dec 11 2024, 16:24:50) [GCC 11.2.0]',
 'lmdeploy': "not installed:No module named 'lmdeploy'",
 'numpy_random_seed': 2147483648,
 'opencompass': '0.4.1+',
 'sys.platform': 'linux',
 'transformers': '4.50.0'}

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

python run.py myconfigs/hf_llama2_7b_base_agieval.py --debug

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

```
from mmengine.config import read_base
from opencompass.models import HuggingFaceBaseModel


# export DATASET_SOURCE='ModelScope' # before run this script
# pip install modelscope[framework]
# will degrade datasets-3.2.0 fsspec-2024.9.0 modelscope-1.24.1 setuptools-69.5.1 simplejson-3.20.1 sortedcontainers-2.4.0


with read_base():
    # from opencompass.configs.datasets.agieval.agieval_mixed import agieval_datasets # 有格式报错
    from opencompass.configs.datasets.agieval.agieval_gen import agieval_datasets # 有格式报错

dataset_name = 'agieval'
models = [
    dict(
        type=HuggingFaceBaseModel,
        abbr='llama-2-7b-hf',
        path='meta-llama/Llama-2-7b-hf',
        max_out_len=1024,
        batch_size=8,
        run_cfg=dict(num_gpus=1),
    )
]
model_name = models[0]['abbr']
datasets = agieval_datasets
work_dir = f'outputs/{model_name}_{dataset_name}_base'
```

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

Generating dev split: 5 examples [00:00, 1044.19 examples/s]
Generating test split: 118 examples [00:00, 26710.99 examples/s]
Traceback (most recent call last):
  File "/home/ygc/anaconda3/envs/opencompass/lib/python3.10/site-packages/datasets/arrow_writer.py", line 228, in __arrow_array__
    out = pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
  File "pyarrow/array.pxi", line 372, in pyarrow.lib.array
  File "pyarrow/array.pxi", line 42, in pyarrow.lib._sequence_to_array
  File "pyarrow/error.pxi", line 155, in pyarrow.lib.pyarrow_internal_check_status
  File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: Could not convert '$5$;$10$' with type str: tried to convert to int64

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ygc/fllm/opencompass/run.py", line 4, in <module>
    main()
  File "/home/ygc/fllm/opencompass/opencompass/cli/main.py", line 337, in main
    runner(tasks)
  File "/home/ygc/fllm/opencompass/opencompass/runners/base.py", line 38, in __call__
    status = self.launch(tasks)
  File "/home/ygc/fllm/opencompass/opencompass/runners/local.py", line 128, in launch
    task.run(cur_model=getattr(self, 'cur_model',
  File "/home/ygc/fllm/opencompass/opencompass/tasks/openicl_infer.py", line 79, in run
    self.dataset = build_dataset_from_cfg(self.dataset_cfg)
  File "/home/ygc/fllm/opencompass/opencompass/utils/build.py", line 12, in build_dataset_from_cfg
    return LOAD_DATASET.build(dataset_cfg)
  File "/home/ygc/anaconda3/envs/opencompass/lib/python3.10/site-packages/mmengine/registry/registry.py", line 570, in build
    return self.build_func(cfg, *args, **kwargs, registry=self)
  File "/home/ygc/anaconda3/envs/opencompass/lib/python3.10/site-packages/mmengine/registry/build_functions.py", line 121, in build_from_cfg
    obj = obj_cls(**args)  # type: ignore
  File "/home/ygc/fllm/opencompass/opencompass/datasets/base.py", line 17, in __init__
    dataset = self.load(**kwargs)
  File "/home/ygc/fllm/opencompass/opencompass/datasets/agieval/agieval.py", line 65, in load
    dataset = Dataset.from_list(dataset)
  File "/home/ygc/anaconda3/envs/opencompass/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 989, in from_list
    return cls.from_dict(mapping, features, info, split)
  File "/home/ygc/anaconda3/envs/opencompass/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 943, in from_dict
    pa_table = InMemoryTable.from_pydict(mapping=mapping)
  File "/home/ygc/anaconda3/envs/opencompass/lib/python3.10/site-packages/datasets/table.py", line 757, in from_pydict
    return cls(pa.Table.from_pydict(*args, **kwargs))
  File "pyarrow/table.pxi", line 1968, in pyarrow.lib._Tabular.from_pydict
  File "pyarrow/table.pxi", line 6337, in pyarrow.lib._from_pydict
  File "pyarrow/array.pxi", line 402, in pyarrow.lib.asarray
  File "pyarrow/array.pxi", line 252, in pyarrow.lib.array
  File "pyarrow/array.pxi", line 114, in pyarrow.lib._handle_arrow_array_protocol
  File "/home/ygc/anaconda3/envs/opencompass/lib/python3.10/site-packages/datasets/arrow_writer.py", line 296, in __arrow_array__
    out = pa.array(cast_to_python_objects(data, only_1d_for_numpy=True, optimize_list_casting=False))
  File "pyarrow/array.pxi", line 372, in pyarrow.lib.array
  File "pyarrow/array.pxi", line 42, in pyarrow.lib._sequence_to_array
  File "pyarrow/error.pxi", line 155, in pyarrow.lib.pyarrow_internal_check_status
  File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: Could not convert '$5$;$10$' with type str: tried to convert to int64

### 其他信息

During loading gaokao-mathcloze (after the jec-qa-ca)

In the data file, I found: 
{"passage": null, "question": "已知多项式 $(x-1)^{3}+(x+1)^{4}=x^{4}+a_{1} x^{3}+a_{2} x^{2}+a_{3} x+a_{4}$, 则 $a_{1}=(\\quad)$, $a_{2}+a_{3}+a_{4}=(\\quad)$", "options": null, "label": "$5$;$10$", "other": {"source": "2021年浙江卷—数学"}, "explanation": null}

And lots of samples in this file have multiple number or equation with latex format

Hi @Youth-49, would you confirm you _did not_ encounter the same error when using:
```
from opencompass.configs.datasets.agieval.agieval_mixed import agieval_datasets
```

I **did encounter** the same error when using agieval_mixed.
Sorry for the misleading comment, I forgot to remove it.