Skip to content

Fix wan2.2 VBench scorer cold-start failures: .mp4 staging, torch>=2.6 checkpoints, missing wget#403

Open
wu6u3tw wants to merge 2 commits into
mlcommons:mainfrom
wu6u3tw:wan22-vbench-deps
Open

Fix wan2.2 VBench scorer cold-start failures: .mp4 staging, torch>=2.6 checkpoints, missing wget#403
wu6u3tw wants to merge 2 commits into
mlcommons:mainfrom
wu6u3tw:wan22-vbench-deps

Conversation

@wu6u3tw

@wu6u3tw wu6u3tw commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Fix wan2.2 VBench scorer cold-start failures: .mp4 staging, torch>=2.6 checkpoints, missing wget

Split from #401 (part 2 of 2; the drain-timeout config is in the companion PR).

Three independent failures in the VBench scoring path, each discovered only after a full generation pass (30-50 min on 18 GB300 nodes). With these fixes (initially applied as runtime monkeypatches), a full wan2.2 Offline accuracy run completed on GB300-NVL72 and scored 0.69998 over 248 samples.

Fix 1: stage videos as .mp4 regardless of source suffix

VBenchScorer._stage_videos kept the source extension (src.suffix or '.mp4'). VBench's load_video dispatches purely on the extension and raises bare NotImplementedError for anything but .mp4/.gif/frame dirs. trtllm-serve emits MJPEG .avi when ffmpeg is not installed server-side, so a full accuracy pass generated all 248 videos and then died at scoring.

decord (libav) detects the container by content, not extension; an MJPEG-AVI symlinked under an .mp4 name decodes correctly (verified on GB300: 81 frames, 720x1280). Staged symlinks are now always named {prompt}-{idx}.mp4.

Fix 2: vbench_runner.py fails on torch >= 2.6 checkpoint loading

The wan2.2 accuracy subproject resolves torch 2.12, where torch.load defaults to weights_only=True (changed in 2.6). VBench's reference checkpoints (motion_smoothness AMT, RAFT) are full pickles and fail with UnpicklingError ("Unsupported global: typing.OrderedDict"). The runner now defaults torch.load to weights_only=False within the scorer subprocess only; callers passing weights_only explicitly (e.g. torch.hub) are unaffected, and the parent benchmark process keeps stock semantics.

Fix 3: opaque failure when wget/unzip are missing

vbench.utils.init_submodules downloads per-dimension weights via literal wget/unzip subprocesses on a cold cache. In a minimal client container this dies mid-evaluation with FileNotFoundError: 'wget', after the videos were already generated. The runner now preflights both tools and exits early with a structured error naming what is missing and how to fix it.

Testing

  • New test_stage_videos_renames_non_mp4_sources_to_mp4.
  • tests/unit/evaluation/test_scoring.py and the full unit suite pass with zero new failures vs the unmodified base commit.
  • Hardware validation on GB300-NVL72: VBench scored 248/248 staged .avi videos end to end (score 0.69998), including cold-cache weight downloads.

@wu6u3tw wu6u3tw requested a review from a team July 8, 2026 21:49
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves VBench evaluation robustness by ensuring staged videos always use the ".mp4" extension to avoid loading errors, adding pre-flight checks for system dependencies ("wget" and "unzip"), and monkeypatching "torch.load" to support older VBench checkpoints on PyTorch 2.6+. The review feedback suggests a cleaner approach to configuring PyTorch's loading behavior by setting the "TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD" environment variable instead of manually monkeypatching "torch.load".

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +42 to +64
def _default_torch_load_to_full_pickles() -> None:
"""Make torch.load default to weights_only=False in this subprocess.

VBench's reference checkpoints (e.g. motion_smoothness AMT, RAFT) are full
pickled objects, written before torch 2.6 flipped torch.load's default to
weights_only=True; loading them with the new default fails with
UnpicklingError (e.g. "Unsupported global: typing.OrderedDict"). They are
the VBench-sanctioned reference weights, so loading them unrestricted here
matches upstream VBench behavior on the torch versions it was written for.
Callers that pass weights_only explicitly (e.g. torch.hub) are unaffected;
scoped to this subprocess only, the parent benchmark keeps stock semantics.
"""
orig_load = torch.load

@functools.wraps(orig_load)
def _load(*args, **kwargs):
kwargs.setdefault("weights_only", False)
return orig_load(*args, **kwargs)

torch.load = _load


_default_torch_load_to_full_pickles()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Instead of manually monkeypatching torch.load, you can use PyTorch's built-in environment variable TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD. Setting this environment variable to "1" achieves the exact same behavior (defaulting weights_only to False when not explicitly specified) in a much cleaner, safer, and more robust way without modifying core library functions. This also allows you to remove the unused import functools.

import os

# PyTorch >= 2.6 defaults to weights_only=True. VBench's reference checkpoints
# are full pickled objects and fail to load with this default. Instead of
# monkeypatching torch.load, we use PyTorch's built-in environment variable
# to default weights_only to False when not explicitly specified.
os.environ["TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD"] = "1"

wu6u3tw added 2 commits July 8, 2026 14:52
VBench's load_video dispatches purely on the file extension and raises
NotImplementedError for anything but .mp4/.gif/frame dirs. trtllm-serve
emits MJPEG .avi when ffmpeg is unavailable server-side, so a full
accuracy run generated 248 videos and then failed at scoring.

decord (libav) detects the real container by content, so an .avi
symlinked under an .mp4 name decodes fine (verified on GB300: 81-frame
720x1280 MJPEG-AVI reads correctly). Always name the staged symlinks
.mp4.
Two cold-start failures observed on aarch64 GB300 runs:

- The accuracy venv resolves torch 2.12, where torch.load defaults to
  weights_only=True (since 2.6). VBench's reference checkpoints
  (motion_smoothness AMT, RAFT) are full pickles and fail with
  UnpicklingError. Default torch.load to weights_only=False in this
  subprocess only; explicit weights_only callers are unaffected.

- vbench.utils.init_submodules downloads per-dimension weights via
  literal wget/unzip subprocesses; without them the run dies with an
  opaque FileNotFoundError after videos were already generated. Fail
  fast preflight with a structured error naming the missing tools.
@wu6u3tw wu6u3tw force-pushed the wan22-vbench-deps branch from 6ab9beb to 38c44de Compare July 8, 2026 21:53
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@3131730). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #403   +/-   ##
=======================================
  Coverage        ?   80.03%           
=======================================
  Files           ?      129           
  Lines           ?    17226           
  Branches        ?        0           
=======================================
  Hits            ?    13786           
  Misses          ?     3440           
  Partials        ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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