open-compass / open-compass/VLMEvalKit

[BUG] dataset parameter not passed when using config.json with MMMUProDataset

Open
#1,185 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
4.4k
Forks
768
Avg merge
2d 27m
Merged PRs (30d)
18

Description

🐛 Bug Report: dataset parameter not passed when using config.json with MMMUProDataset

What's happening?

When trying to load any benchmark from MMMUProDataset via config.json, the dataset fails to build correctly because the dataset parameter is not passed to the class constructor.

This happens due to how build_dataset_from_config() filters parameters based on the class constructor signature using Python's inspect module.


✅ Works (using command-line args)
python3 run.py --data MMMU_Pro_10c --model Qwen2-VL-2B-Instruct --verbose

❌ Fails (using config file)
python3 run.py --config config.json
Example config.json:
{
  "model": {
    "Qwen2-VL-2B-Instruct": {
      "class": "Qwen2VLChat",
      "model_path": "Qwen/Qwen2-VL-2B-Instruct",
      "temperature": 0.1
    }
  },
  "data": {
    "MMMU": {
      "class": "MMMUProDataset",
      "dataset": "MMMU_Pro_10c"
    }
  }
}

📌 Root Cause
  • The function build_dataset_from_config() uses this logic:

    valid_params = {k: v for k, v in config.items() if k in sig.parameters}
    
  • MMMUProDataset.__init__() is defined with **kwargs:

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
    
  • Because of this, inspect.signature(cls.__init__) returns:

    Signature(self, **kwargs)
    
  • It does not include dataset, even though the superclass (ImageBaseDataset) accepts dataset explicitly:

    def __init__(self, dataset='MMBench', skip_noimg=True):
        self.dataset_name = dataset
    
  • So the filtering logic incorrectly drops the dataset key from config.


✅ Why build_dataset() works

In contrast, build_dataset() passes arguments directly without filtering:

return cls(dataset=dataset_name, **kwargs)

It doesn't rely on inspect.signature, so dataset is passed correctly and everything works.


🔁 Suggested Fix

Update the logic in build_dataset_from_config() to detect when a class uses **kwargs, and skip filtering in that case:

if any(p.kind == p.VAR_KEYWORD for p in sig.parameters.values()):
    valid_params = config
else:
    valid_params = {k: v for k, v in config.items() if k in sig.parameters}

Alternatively, traverse the class's MRO to find the first constructor with concrete parameters (not just **kwargs).


✅ Expected Behavior

Running with --config config.json should work identically to the command-line approach, even for classes that inherit dataset via super().__init__(**kwargs).


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 in build_dataset_from_config() and inspect how it filters parameters for classes such as MMMUProDataset. Compare its constructor signature with ImageBaseDataset and run the config.json example using MMMU_Pro_10c. Done means the dataset parameter reaches the constructor and config-based loading works like the command-line path.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.