open-compass / open-compass/opencompass

[Bug] TypeError: Expected a datasets.Dataset or a datasets.DatasetDict object, but got {'train': <modelscope.msdatasets.ms_dataset.MsDataset object at xxx>, 'test': <modelscope.msdatasets.ms_dataset.MsDataset object at xxx>}

Open
#1,678 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.5k
Forks
869
Avg merge
17h 52m
Merged PRs (30d)
13

Description

先决条件
问题类型

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

环境
{'CUDA available': True,
 'CUDA_HOME': '/usr/local/cuda',
 'GCC': 'gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0',
 'GPU 0,1': 'NVIDIA A10',
 'MMEngine': '0.10.5',
 'MUSA available': False,
 'NVCC': 'Cuda compilation tools, release 12.0, V12.0.140',
 'PyTorch': '2.5.1+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: 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_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, 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.5.1, 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.15 (main, Oct  3 2024, 07:27:34) [GCC 11.2.0]',
 'TorchVision': '0.20.1+cu124',
 'lmdeploy': '0.2.2',
 'numpy_random_seed': 2147483648,
 'opencompass': '0.3.5+a0ef2fd',
 'sys.platform': 'linux',
 'transformers': '4.46.2'}

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

按照README执行opencompass --models hf_internlm2_5_1_8b_chat --datasets demo_gsm8k_chat_gen,完整输出如下:

/root/opencompass/opencompass/__init__.py:17: UserWarning: Starting from v0.4.0, all AMOTIC configuration files currently located in `./configs/datasets`, `./configs/models`, and `./configs/summarizers` will be migrated to the `opencompass/configs/` package. Please update your configuration file paths accordingly.
  _warn_about_config_migration()
11/12 14:50:56 - OpenCompass - WARNING - Found ambiguous patterns, using the first matched config.
+----------------------+------------------------------------------------------------------------------+
| Ambiguous patterns   | Matched files                                                                |
|----------------------+------------------------------------------------------------------------------|
| demo_gsm8k_chat_gen  | configs/datasets/demo/demo_gsm8k_chat_gen.py                                 |
|                      | /root/opencompass/opencompass/configs/./datasets/demo/demo_gsm8k_chat_gen.py |
+----------------------+------------------------------------------------------------------------------+
11/12 14:50:56 - OpenCompass - INFO - Loading demo_gsm8k_chat_gen: configs/datasets/demo/demo_gsm8k_chat_gen.py
11/12 14:50:56 - OpenCompass - WARNING - Found ambiguous patterns, using the first matched config.
+--------------------------+----------------------------------------------------------------------------------------+
| Ambiguous patterns       | Matched files                                                                          |
|--------------------------+----------------------------------------------------------------------------------------|
| hf_internlm2_5_1_8b_chat | configs/models/hf_internlm/hf_internlm2_5_1_8b_chat.py                                 |
|                          | /root/opencompass/opencompass/configs/./models/hf_internlm/hf_internlm2_5_1_8b_chat.py |
+--------------------------+----------------------------------------------------------------------------------------+
11/12 14:50:56 - OpenCompass - INFO - Loading hf_internlm2_5_1_8b_chat: configs/models/hf_internlm/hf_internlm2_5_1_8b_chat.py
11/12 14:50:56 - OpenCompass - WARNING - Found ambiguous patterns, using the first matched config.
+----------------------+----------------------------------------------------------------+
| Ambiguous patterns   | Matched files                                                  |
|----------------------+----------------------------------------------------------------|
| example              | configs/summarizers/example.py                                 |
|                      | /root/opencompass/opencompass/configs/./summarizers/example.py |
+----------------------+----------------------------------------------------------------+
11/12 14:50:56 - OpenCompass - INFO - Loading example: configs/summarizers/example.py
11/12 14:50:56 - OpenCompass - INFO - Current exp folder: outputs/default/20241112_145056
11/12 14:50:56 - OpenCompass - WARNING - SlurmRunner is not used, so the partition argument is ignored.
Traceback (most recent call last):
  File "/root/anaconda3/envs/opencompass/bin/opencompass", line 33, in <module>
    sys.exit(load_entry_point('opencompass', 'console_scripts', 'opencompass')())
  File "/root/opencompass/opencompass/cli/main.py", line 299, in main
    tasks = partitioner(cfg)
  File "/root/opencompass/opencompass/partitioners/base.py", line 83, in __call__
    tasks = self.partition(**model_and_dataset_args,
  File "/root/opencompass/opencompass/partitioners/num_worker.py", line 69, in partition
    dataset_size = self.get_size(dataset)
  File "/root/opencompass/opencompass/partitioners/num_worker.py", line 141, in get_size
    dataset = build_dataset_from_cfg(dataset)
  File "/root/opencompass/opencompass/utils/build.py", line 13, in build_dataset_from_cfg
    return LOAD_DATASET.build(dataset_cfg)
  File "/root/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 "/root/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 "/root/opencompass/opencompass/datasets/base.py", line 13, in __init__
    self._init_reader(**reader_cfg)
  File "/root/opencompass/opencompass/datasets/base.py", line 16, in _init_reader
    self.reader = DatasetReader(self.dataset, **kwargs)
  File "/root/opencompass/opencompass/openicl/icl_dataset_reader.py", line 85, in __init__
    self.dataset = _check_dataset(dataset)
  File "/root/opencompass/opencompass/utils/types.py", line 38, in _check_dataset
    raise TypeError(
TypeError: Expected a datasets.Dataset or a datasets.DatasetDict object, but got {'train': <modelscope.msdatasets.ms_dataset.MsDataset object at 0x7fbae84aa2f0>, 'test': <modelscope.msdatasets.ms_dataset.MsDataset object at 0x7fbae60d37c0>}

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

opencompass --models hf_internlm2_5_1_8b_chat --datasets demo_gsm8k_chat_gen

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

TypeError: Expected a datasets.Dataset or a datasets.DatasetDict object, but got {'train': <modelscope.msdatasets.ms_dataset.MsDataset object at 0x7fbae84aa2f0>, 'test': <modelscope.msdatasets.ms_dataset.MsDataset object at 0x7fbae60d37c0>}

### 其他信息

_No response_

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with opencompass/partitioners/num_worker.py and trace dataset handling through opencompass/utils/build.py, opencompass/openicl/icl_dataset_reader.py, and opencompass/utils/types.py. Reproduce the failure with the reported opencompass command and inspect how the train/test MsDataset mapping reaches the type check. Done means the command proceeds without this TypeError and the dataset is accepted by the reader.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.