[ColQwen2] Refactor output tracing (issue #43979)#44713
Open
kulkarni-rohan wants to merge 1 commit intohuggingface:mainfrom
Open
[ColQwen2] Refactor output tracing (issue #43979)#44713kulkarni-rohan wants to merge 1 commit intohuggingface:mainfrom
kulkarni-rohan wants to merge 1 commit intohuggingface:mainfrom
Conversation
Applies the output tracing refactor to ColQwen2ForRetrieval as part of the broader effort tracked in issue huggingface#43979 to modernize output handling across all models in the library. Changes in both modular_colqwen2.py and modeling_colqwen2.py: - Add TransformersKwargs to imports; add Unpack import in modeling file - Remove explicit output_attentions, output_hidden_states, and return_dict params from ColQwen2ForRetrieval.forward() -- these are now captured via **kwargs: Unpack[TransformersKwargs] - Remove manual config-resolution boilerplate for those three flags - Pop output_hidden_states from kwargs and resolve from config as fallback (matching the pattern established in ColPali parent) - Always pass output_hidden_states=True to self.vlm.model() so hidden states are always collected internally; only returned to the caller when explicitly requested - Spread **kwargs into self.vlm.model() so output_attentions and other flags flow through naturally to the underlying Qwen2VL model, which already handles output capturing via @capture_outputs and @merge_with_config_defaults The @can_return_tuple decorator (already present) continues to handle the return_dict=False tuple-conversion path. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: colqwen2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Applies the output tracing refactor to ColQwen2ForRetrieval as part of the broader effort tracked in issue #43979 to modernize output handling across all models in the library.
Changes in both modular_colqwen2.py and modeling_colqwen2.py:
The @can_return_tuple decorator (already present) continues to handle the return_dict=False tuple-conversion path.
What does this PR do?
Fixes # (issue)
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.