Conversation
ISEEKYAN
reviewed
Jan 19, 2026
| def __init__(self, hf_dir: str): | ||
| index_file = os.path.join(hf_dir, "model.safetensors.index.json") | ||
| config = AutoConfig.from_pretrained(hf_dir) | ||
| config = AutoConfig.from_pretrained(hf_dir, trust_remote_code=True) |
Owner
There was a problem hiding this comment.
we can't set trust_remove_code by default
| hf_model_path, trust_remote_code=trust_remote_code | ||
| ) | ||
|
|
||
| if hasattr(config, "num_nextn_predict_layers"): |
Owner
There was a problem hiding this comment.
why do we set this, is this a debug code?
Contributor
There was a problem hiding this comment.
@ArronHZG This should not be needed once the patches here are applied #62 (comment)
HollowMan6
suggested changes
Feb 14, 2026
Comment on lines
7
to
40
| @@ -27,9 +27,17 @@ def init_distributed(): | |||
|
|
|||
| def load_model(hf_model_path, trust_remote_code=False): | |||
| """Load model""" | |||
| bridge = AutoBridge.from_pretrained( | |||
|
|
|||
| # use AutoConfig to change hf config | |||
| config = AutoConfig.from_pretrained( | |||
| hf_model_path, trust_remote_code=trust_remote_code | |||
| ) | |||
|
|
|||
| if hasattr(config, "num_nextn_predict_layers"): | |||
| config.num_nextn_predict_layers = 0 | |||
|
|
|||
| bridge = AutoBridge.from_config(config) | |||
|
|
|||
Contributor
There was a problem hiding this comment.
These changes should not be needed
Comment on lines
84
to
92
| # Handle transformer components within MTP | ||
| # Check if this is a transformer_layer component | ||
| if "transformer_layer" in name: | ||
| # Create a proxy name to use with parent class methods | ||
| # Convert mtp.layers.{idx}.transformer_layer.* to decoder.layers.{idx}.* | ||
| proxy_name = name.replace( | ||
| f"mtp.layers.{mtp_layer_idx}.transformer_layer", | ||
| f"decoder.layers.{mtp_layer_idx}", | ||
| ) |
Contributor
There was a problem hiding this comment.
Need these changes (replace from Line 84 to Line 92 with these code) so that we don't need to disable num_nextn_predict_layers when loading from hf weights (so that MTP weights can be loaded correctly)
Suggested change
| # Handle transformer components within MTP. MCore may expose these under | |
| # either "...transformer_layer.*" or "...mtp_model_layer.*". | |
| layer_prefixes = ("transformer_layer", "mtp_model_layer") | |
| proxy_name = None | |
| for layer_prefix in layer_prefixes: | |
| mcore_prefix = f"mtp.layers.{mtp_layer_idx}.{layer_prefix}" | |
| if mcore_prefix in name: | |
| proxy_name = name.replace( | |
| mcore_prefix, | |
| f"decoder.layers.{mtp_layer_idx}", | |
| ) | |
| break | |
| if proxy_name is not None: |
5 tasks
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.
No description provided.