Skip to content

Draw the fused LM head VLM test labels within the head's output size - #8591

Open
albertvillanova wants to merge 1 commit into
mainfrom
fix-inkling2-test-label-range
Open

albertvillanova wants to merge 1 commit into
mainfrom
fix-inkling2-test-label-range

Conversation

@albertvillanova

@albertvillanova albertvillanova commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Fix #8590

The VLM tests of TestAddFusedLMHeadLoss drew input_ids and labels in [0, text_config.vocab_size), but Inkling 2's head outputs only unpadded_vocab_size logits, so about 1 run in 10 crashed with a CUDA error on an out-of-range label. The ids are now drawn from the head's output size (get_output_embeddings().out_features), which equals vocab_size for every other model.


Note

Low Risk
Test-only change in _setup_vlm; no production training or inference behavior is modified.

Overview
Fixes flaky Inkling 2 failures in TestAddFusedLMHeadLoss VLM helpers by aligning synthetic input_ids/labels with the LM head's actual output width.

In _setup_vlm, random token ids were sampled up to text_config.vocab_size, but Inkling 2's head only emits unpadded_vocab_size logits—labels could land outside that range and trigger intermittent CUDA errors during loss. The upper bound is now get_output_embeddings().out_features, which matches full vocab_size for the other VLM checkpoints in the suite.

Reviewed by Cursor Bugbot for commit 01c5830. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added the 🔧 maintenance CI, tooling, tests, or repo upkeep label Nov 25, 2026
@bot-ci-comment

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.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 01c5830. Configure here.

Comment thread tests/test_utils.py
B, S = 2, 16
vocab_size = ref_model.config.text_config.vocab_size
# Inkling 2's head outputs unpadded_vocab_size < vocab_size logits (#8590)
vocab_size = ref_model.get_output_embeddings().out_features

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Head size still includes Inkling's padded rows

Medium Severity

For Inkling 2, the head keeps its padded vocabulary rows and only the forward cuts the logits down to unpadded_vocab_size. That makes get_output_embeddings().out_features the same as text_config.vocab_size, so ids and labels can still fall in [unpadded_vocab_size, vocab_size). The reference loss would still hit the out-of-range label and crash with a CUDA error, so this change likely doesn't fix #8590.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 01c5830. Configure here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔧 maintenance CI, tooling, tests, or repo upkeep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI fails with latest dependencies for Inkling 2: torch.AcceleratorError: CUDA error: an illegal memory access was encountered

1 participant