Skip to content

[compat] gdn compat mcore main#34

Merged
Jintao-Huang merged 1 commit intomodelscope:mainfrom
Jintao-Huang:gdn_compat_mcore_main
Apr 16, 2026
Merged

[compat] gdn compat mcore main#34
Jintao-Huang merged 1 commit intomodelscope:mainfrom
Jintao-Huang:gdn_compat_mcore_main

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 a compatibility check in the GatedDeltaNet constructor to handle the cp_comm_type parameter based on the signature of the underlying _GatedDeltaNet class. A review comment suggests optimizing this implementation by moving the inspect.signature check to the module level to avoid redundant introspection calls for every layer instance during model initialization.

Comment on lines +97 to +98
if 'cp_comm_type' not in inspect.signature(_GatedDeltaNet).parameters:
kwargs.pop('cp_comm_type', None)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Calling inspect.signature inside the __init__ method is inefficient because it will be executed for every instance of GatedDeltaNet (e.g., for every layer in the model). It is recommended to perform this check once at the module level, right after _GatedDeltaNet is defined, and store the result in a boolean constant. This avoids redundant introspection during model initialization.

@Jintao-Huang Jintao-Huang merged commit 68b7458 into modelscope:main Apr 16, 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