Skip to content

update gpt_model#71

Merged
Jintao-Huang merged 1 commit into
modelscope:mainfrom
Jintao-Huang:update_gpt_model
May 9, 2026
Merged

update gpt_model#71
Jintao-Huang merged 1 commit into
modelscope:mainfrom
Jintao-Huang:update_gpt_model

Conversation

@Jintao-Huang
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the forward methods in GPTModel and MMGPTModel by removing generic **kwargs in favor of more explicit argument handling. A high-severity issue was identified in MMGPTModel where passing the unfiltered kwargs dictionary as extra_block_kwargs could cause a TypeError due to duplicate arguments like input_ids and packed_seq_params. A code suggestion was provided to filter these keys to ensure compatibility.

inference_params=inference_params,
packed_seq_params=packed_seq_params,
**kwargs,
extra_block_kwargs=kwargs,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Passing kwargs directly as extra_block_kwargs is problematic because kwargs is mutated at line 85 to include input_ids and packed_seq_params. If self.visual is None, these keys are not removed, leading to a TypeError (multiple values for argument) when calling the language model, as it already receives these arguments explicitly. Additionally, the current logic at line 51 clears kwargs if a visual encoder is present, which would cause any other legitimate extra arguments to be lost. Filtering the dictionary is a safer approach to avoid conflicts with explicit arguments.

Suggested change
extra_block_kwargs=kwargs,
extra_block_kwargs={k: v for k, v in kwargs.items() if k not in ['input_ids', 'packed_seq_params']},

@Jintao-Huang Jintao-Huang merged commit a9faec4 into modelscope:main May 9, 2026
1 check passed
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