Skip to content

[bugfix] fix(metrics): set SceneMetric device_map for any non-CPU device - #1817

Open
li-lizhe wants to merge 1 commit into
hao-ai-lab:mainfrom
li-lizhe:fix/scene-device-map
Open

[bugfix] fix(metrics): set SceneMetric device_map for any non-CPU device#1817
li-lizhe wants to merge 1 commit into
hao-ai-lab:mainfrom
li-lizhe:fix/scene-device-map

Conversation

@li-lizhe

@li-lizhe li-lizhe commented Sep 5, 2026

Copy link
Copy Markdown

Problem

SceneMetric.setup() only passes a device_map to Qwen2_5OmniForConditionalGeneration.from_pretrained when self.device.type == "cuda":

device_map=str(self.device) if self.device.type == "cuda" else None,

On any non-CUDA accelerator (Ascend NPU, Apple MPS, Intel XPU, AMD ROCm) device_map is None, so the Qwen2.5-Omni model silently loads on CPU. The scene metric then runs on CPU (slow) even when a GPU/NPU is available.

Root cause

Hardcoded CUDA device-type assumption: only CUDA tensors get a device_map.

Fix

Pass a device_map for every non-CPU device type:

device_map=str(self.device) if self.device.type != "cpu" else None,

This is device-agnostic and matches the caller-selected device.

Verification

On Ascend 910B (torch.accelerator.current_accelerator() returns npu, torch.device("npu:0").type == "npu"), the new condition is True and a device_map is passed, so the metric loads on NPU instead of CPU. On CUDA behaviour is unchanged. One-line change, device-agnostic.

Fixes #1815

…-CPU device

The Qwen2.5-Omni model was only passed a device_map when self.device.type
== "cuda". On non-CUDA accelerators (Ascend NPU, Apple MPS, Intel XPU,
AMD ROCm) the model silently loads on CPU, making the scene metric
unusable on those devices.

Use device.type != "cpu" instead, which correctly passes a device_map
for every accelerator type.

Fixes hao-ai-lab#1815

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Welcome to FastVideo! Thanks for your first pull request.

How our CI works:

PRs run a three-tier CI system:

  1. Pre-commit — formatting (yapf), linting (ruff), type checking (mypy). Runs immediately on every PR.
  2. Fastcheck — six core GPU lanes run automatically via Buildkite (~10-15 min).
  3. Merge gate — a reviewer adds ready; changed paths select only the relevant integration, training, golden, or SSIM coverage.

Before your PR is reviewed:

  • pre-commit run --all-files passes locally
  • You've added or updated tests for your changes
  • The PR description explains what and why

If pre-commit fails, a bot comment will explain how to fix it. Fastcheck and merge-gate results appear in the Checks section below.

Useful links:

@mergify

mergify Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

⚠️ PR title format required

Your PR title must start with a type tag in brackets. Examples:

  • [feat] Add new model support
  • [bugfix] Fix VAE tiling corruption
  • [refactor] Restructure training pipeline
  • [perf] Optimize attention kernel
  • [ci] Update test infrastructure
  • [infra] Add activation trace hooks
  • [docs] Add inference guide
  • [misc] Clean up configs
  • [new-model] Port Flux2 to FastVideo
  • [skill] Add add-model agent skill

Valid tags: feat, feature, bugfix, fix, refactor, perf, ci, infra, doc, docs, misc, chore, kernel, new-model, skill, skills

Please update your PR title and the merge protection check will pass automatically.

@mergify

mergify Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🔴 1 of 1 protections blocking · waiting on 👀 reviews and 🤖 CI

Protection Waiting on
🔴 PR merge requirements 👀 reviews and 🤖 CI

🔴 PR merge requirements

Waiting for

  • #approved-reviews-by>=1
  • check-success=full-suite-passed
This rule is failing.
  • #approved-reviews-by>=1
  • check-success=full-suite-passed
  • check-success=fastcheck-passed
  • check-success~=pre-commit
  • title~=(?i)^\[(feat|feature|bugfix|fix|refactor|perf|ci|doc|docs|misc|chore|kernel|new.?model|skill|skills|infra)\]

@li-lizhe li-lizhe changed the title fix(metrics): set SceneMetric device_map for any non-CPU device [bugfix] fix(metrics): set SceneMetric device_map for any non-CPU device Sep 5, 2026
@mergify mergify Bot added the type: bugfix Bug fix label Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] VBench SceneMetric loads Qwen2.5-Omni on CPU on any non-CUDA accelerator (device_map hardcodes cuda)

1 participant