Skip to content

[Refactor] Refactor dataset config aliases and video presets - #1622

Merged
mzr1996 merged 17 commits into
open-compass:mainfrom
ssiq:alias_refactor
Sep 21, 2026
Merged

mzr1996 merged 17 commits into
open-compass:mainfrom
ssiq:alias_refactor

Conversation

@ssiq

@ssiq ssiq commented Aug 6, 2026 •

Copy link
Copy Markdown
Collaborator

Pull Request Description

Summary

This PR refactors VLMEvalKit dataset config handling to separate output aliases from logical dataset names.

Previously, the key under config data could be treated both as the output artifact name and as the logical dataset identity. That becomes ambiguous when users want custom output names for the same dataset configuration. This PR introduces a structured DatasetSpec resolution flow so output naming, dataset construction, evaluation, status tracking, and reporter recovery use the right identity consistently.

Motivation

For configs like:

{
  "data": {
    "Video-MME-custom": {
      "class": "VideoMME",
      "dataset": "Video-MME",
      "nframe": 16
    }
  }
}

Video-MME-custom should only be an output alias, while Video-MME should remain the logical dataset name used by dataset construction, prompts, judge/evaluate logic, and reporter lookup.

This PR makes that distinction explicit.

Main Changes

Dataset alias resolution

  • Add DatasetSpec and alias resolution helpers in vlmeval/smp/dataset_alias.py.
  • Resolve every dataset entry into:
    • dataset_alias_name: output-side alias.
    • dataset_name: logical dataset name.
    • dataset_class_name: class name used for strict build and reporter/status recovery.
    • build_config: dataset construction config.
    • source: direct dataset, explicit config, preset config, or predefined shortcut.
  • Validate output aliases as safe filename components:
    • allowed: letters, digits, ., _, -
    • must start with a letter or digit

Config and preset behavior

  • data keys are now output aliases.
  • Explicit dataset config must provide non-empty class and dataset.
  • Empty dict dataset config is no longer supported.
  • Predefined video shortcuts can be reused in config with:
{
  "MyAlias": {
    "preset": "MMBench_Video_8frame_nopack"
  }
}
  • Preset configs cannot override class or dataset.

Video shortcut unification

  • Replace predefined video shortcut callable/partial handling with DatasetSpec.
  • Add PREDEFINED_DATASET_SPECS.
  • Add a manifest fixture to guard predefined video shortcut migration coverage.

Inference path updates

  • Propagate both alias and logical dataset name through local, API, MT, and video inference paths.
  • Use alias for output files, checkpoints, status keys, reuse artifacts, and symlinks.
  • Use logical dataset name for dataset construction, model custom prompt checks, generation calls, judge/evaluate logic, and dataset-specific behavior.

Composite dataset evaluation

  • Stop deriving child eval files with string replacement on logical dataset names.
  • Add alias-safe child eval file naming:
_{parent_stem}_SUB_{child_name}{suffix}

This avoids overwriting parent prediction files or colliding when an alias does not contain the logical dataset name.

Status and reporter handling

  • Store alias, logical dataset name, and dataset class name in status.
  • After dataset construction, record the effective runtime dataset class name.
  • Improve reporter recovery for aliases, wrappers, custom datasets, and predefined shortcuts.

Video sampling validation

  • Add build config validation for video datasets.
  • Treat fps <= 0 as unset for ordinary video datasets.
  • Require exactly one valid sampling mode in ordinary cases:
    • nframe > 0, or
    • fps > 0
  • Keep special dataset behavior via class-level validation overrides where needed.

Dataset-specific fixes

  • Add explicit validation for special video datasets such as DREAM and MVUEval.
  • Fix CGBench / CG-AV-Counting local fps=0 handling.
  • Make model-dependent document VQA datasets accept explicit model constructor parameter:
    • DUDE / DUDE_MINI
    • SLIDEVQA / SLIDEVQA_MINI
    • MMLongBench_DOC
  • Add explicit SiteBenchImage.__init__ signature to keep strict config validation meaningful.

Documentation

  • Update English and Chinese config docs.
  • Update run.py --help.
  • Document:
    • data key as output alias
    • logical dataset name from dataset
    • preset usage
    • unsupported empty dict shortcut config
    • alias filename safety rule

Tests

Ran:

pytest tests/test_dataset_alias.py tests/test_inference_api.py
flake8 --max-line-length=120 --ignore=W503 tests/test_dataset_alias.py vlmeval/smp/dataset_alias.py run.py
git diff --check

Also passed pre-commit hooks during commits:

flake8
isort
yapf
trim trailing whitespace
check yaml
fix end of files
check for merge conflicts
mixed line ending

ssiq added 17 commits August 5, 2026 15:26
Introduce a DatasetSpec-based resolver for direct datasets, explicit configs, preset aliases, and predefined video shortcuts, replacing the old partial-based video shortcut registry with PREDEFINED_DATASET_SPECS covered by a manifest fixture.

Propagate dataset_alias_name, dataset_name, and dataset_class_name through run.py, local/API/MT/video inference, status files, and reporter recovery so output filenames use aliases while dataset-specific behavior keeps the logical dataset name.

Tighten config validation by rejecting empty configs, requiring non-empty class and dataset fields, validating video nframe/fps with class __init__ defaults, preserving the ReVSI all-frame override, and clearing Video-MME-v2 1fps presets with nframe=0.

Fix composite dataset child eval filenames under aliases and add tests for alias resolution, preset overrides, video shortcut migration, status reporting, composite datasets, and non-config local/API entry points.
Align video dataset sampling branches with build validation by treating fps=0 the same as fps unset when nframe is positive.

Update dataset-specific frame extraction paths to use fps <= 0 for nframe sampling, including the MVBench_MP4 read path so fps=0 no longer enters fps-based sampling.

Add regression coverage that fps=0,nframe>0 passes validation and that legacy fps < 0 sampling guards do not reappear.
Align CGBench and CGAVCounting helper sampling branches with video build validation by treating local fps=0 as unset when num_frames is positive.

Keep the standalone utils save_clue_video_frames behavior unchanged, as it is not part of the self.fps review finding.

Extend regression coverage to scan local fps guards and exercise the CGBench fps=0 nframe branch with a fake VideoReader.
Allow DREAM and MVUEval strict build validation to honor their class-level default frame sampling behavior.

Expose SiteBenchImage init parameters explicitly so strict config filtering accepts valid image dataset kwargs while still rejecting unknown options.

Add regression coverage for both validation paths.
Remove parent-name replacement from composite child eval file generation and use a stable _SUB_ marker to avoid collisions with normal result files.

Update SIUO, image concat, and video concat callers to pass only the child dataset name.

Adjust alias regression tests to cover the new two-argument helper and collision-resistant filenames.
Keep direct dataset specs independent of dataset imports and derive the effective dataset class name from the constructed dataset object.

Propagate the resolved class name into local status updates and API DatasetConfig so reporter recovery can use the actual runtime class.

Add regression coverage for direct datasets where the spec has no class before build but status/config records the built class.
# Conflicts:
#	vlmeval/dataset/video_dataset_config.py
# Conflicts:
#	vlmeval/dataset/video_dataset_config.py
@mzr1996
mzr1996 added this pull request to the merge queue Sep 21, 2026
Merged via the queue into open-compass:main with commit 302cbce Sep 21, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants