Skip to content

[VisualBert] Refactor output tracing using capture_outputs and can_return_tuple decorators#44073

Open
aman-coder03 wants to merge 5 commits intohuggingface:mainfrom
aman-coder03:refactor-visual-bert-output-capture
Open

[VisualBert] Refactor output tracing using capture_outputs and can_return_tuple decorators#44073
aman-coder03 wants to merge 5 commits intohuggingface:mainfrom
aman-coder03:refactor-visual-bert-output-capture

Conversation

@aman-coder03
Copy link

What does this PR do?

This PR migrates VisualBert to the new standardized output tracing system using the @capture_outputs and @can_return_tuple decorators.

Specifically, this PR:

  • Adds _can_record_outputs to VisualBertPreTrainedModel
  • Applies @capture_outputs to VisualBertModel.forward
  • Updates downstream task-specific forward methods to use @can_return_tuple
  • Removes manual handling of output_hidden_states, output_attentions, and return_dict
  • Relies on the decorator-based approach for output collection

Why is this needed?

This aligns VisualBert with the new standardized output tracing framework introduced in #43979 and removes legacy manual output tracing logic.

@aman-coder03 aman-coder03 force-pushed the refactor-visual-bert-output-capture branch from cc74230 to c2db7ff Compare February 17, 2026 10:17
@aman-coder03 aman-coder03 force-pushed the refactor-visual-bert-output-capture branch from c2db7ff to ca18eb2 Compare February 17, 2026 11:20
@github-actions
Copy link
Contributor

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

run-slow: visual_bert

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.

1 participant