Skip to content

[NemotronH-Omni] Fix device mismatch in test tensor creation - #49102

Merged
ydshieh merged 3 commits into
mainfrom
fix-nemotron-h-omni-device
Sep 25, 2026
Merged

ydshieh merged 3 commits into
mainfrom
fix-nemotron-h-omni-device

Conversation

@ydshieh

@ydshieh ydshieh commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

CPU CI GPU run-slow

What does this PR fix?

Fixes 500+ test failures in NemotronHOmniVision2TextModelTest and NemotronHOmniAudio2TextModelTest introduced by #46509 (merged 2026-09-24).

Root cause

Four tensors in the test file were created without device=torch_device, causing RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! on GPU runners:

Location Tensor Collision
NemotronHOmniVision2TextModelTester._prepare_modality_inputs image_grid_hw summary_idxs buffer in RadioModel._forward_packed
NemotronHOmniAudio2TextModelTester.create_audio_mask positions (arange) lengths from ids_tensor (on GPU)
NemotronHOmniModelTestMixin._image_features_prepare_config_and_inputs image_grid_hw same as above
NemotronHOmniModelTestMixin._audio_features_prepare_config_and_inputs input_features_mask audio tower on GPU

Fix

Add device=torch_device to each of the four tensor creations. Also removes the now-redundant .to(torch_device) on the create_audio_mask return value.

🤖 Generated with Claude Code

`image_grid_hw`, `positions`, and `input_features_mask` were created
without `device=torch_device`, causing RuntimeError when tests run on
GPU: CPU tensors collided with GPU model buffers (e.g. `summary_idxs`
in RadioModel._forward_packed, `lengths` in create_audio_mask).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ydshieh

ydshieh commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

run-slow: nemotron_h_omni

@github-actions

Copy link
Copy Markdown
Contributor

Nvidia CI

Workflow Run ⚙️

This comment contains run-slow, running the specified jobs on Nvidia:

models: ["models/nemotron_h_omni"]
quantizations: []

@github-actions

Copy link
Copy Markdown
Contributor

AMD CI

Workflow Run ⚙️

This comment contains run-slow, running the specified jobs on AMD:

models: ["models/nemotron_h_omni"]

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@github-actions

Copy link
Copy Markdown
Contributor

CI Results (AMD)

Workflow Run ⚙️

Commit Info

Context Commit Description
RUN 5a1c462e workflow commit (merge commit)
PR 86dbb30f branch commit (from PR)
main 5880561a base commit (on main)

✅ No failing test specific to this PR 🎉 👏 !

@github-actions

Copy link
Copy Markdown
Contributor

CI Results (Nvidia)

Workflow Run ⚙️

Commit Info

Context Commit Description
RUN 5a1c462e workflow commit (merge commit)
PR 86dbb30f branch commit (from PR)
main 5880561a base commit (on main)

✅ No failing test specific to this PR 🎉 👏 !

@github-actions

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: nemotron_h_omni

@github-actions

Copy link
Copy Markdown
Contributor

CI recap

Dashboard: View test results in Grafana
Latest run: 36110968746:1
Result: success | Jobs: 5 | Tests: 680 | Failures: 0 | Duration: 2m 54s

@vasqu vasqu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yep totally reasonable with moving to device but I swear the run slow also didnt have that many failures on nemotron omni (i.e. mostly export failures)

@ydshieh
ydshieh merged commit 5e4d630 into main Sep 25, 2026
37 checks passed
@ydshieh
ydshieh deleted the fix-nemotron-h-omni-device branch September 25, 2026 10:39
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.

3 participants