Skip to content

[feat] Support multimodel mtp#14

Merged
Jintao-Huang merged 6 commits intomodelscope:mainfrom
Jintao-Huang:support_multimodel_mtp
Apr 5, 2026
Merged

[feat] Support multimodel mtp#14
Jintao-Huang merged 6 commits intomodelscope:mainfrom
Jintao-Huang:support_multimodel_mtp

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 introduces decoder_input propagation through the Multi-Token Prediction (MTP) layers and adds a _get_embeddings helper method to handle sequence rolling and embedding computation. Several critical issues need to be addressed: the forward method signature in patcher.py is missing the decoder_input parameter, which will cause a NameError; the MultiTokenPrediction container requires patching to accept the new argument and avoid a TypeError; the make_viewless_tensor function is used without being imported; and the logic in _get_embeddings should be updated to preserve pre-computed decoder_input values instead of unconditionally overwriting them.

@Jintao-Huang
Copy link
Copy Markdown
Collaborator Author

/gemini review

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 introduces support for multimodal Multi-Token Prediction (MTP) by modifying the GPT model's forward and post-processing logic to handle combined embedding and decoder inputs. It also adds a _get_embeddings method to the MultiTokenPredictionLayer to manage tensor rolling and sequence parallelism. Review feedback suggests addressing a potential IndexError in the _get_embeddings method by rolling along the sequence dimension directly instead of transposing, and improving type safety by adding Union to the imports and updating the embedding argument's type hint.

@Jintao-Huang Jintao-Huang merged commit 27066a2 into modelscope:main Apr 5, 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