fix: fix MLA for ShardedModelLoader/RemoteModelLoader (#6287)
Signed-off-by: wangyu <wangyu.steph@bytedance.com>
This commit is contained in:
@@ -105,3 +105,15 @@ def get_model_architecture(model_config: ModelConfig) -> Tuple[Type[nn.Module],
|
||||
|
||||
def get_architecture_class_name(model_config: ModelConfig) -> str:
|
||||
return get_model_architecture(model_config)[1]
|
||||
|
||||
|
||||
def post_load_weights(model: nn.Module, model_config: ModelConfig):
|
||||
# Model weight loading consists of two stages:
|
||||
# 1. Initial weight loading.
|
||||
# 2. Post-processing of weights, including assigning specific member variables.
|
||||
# For `dummy_init`, only the second stage is required.
|
||||
if hasattr(model, "post_load_weights"):
|
||||
if model_config.hf_config.architectures[0] == "DeepseekV3ForCausalLMNextN":
|
||||
model.post_load_weights(is_nextn=True)
|
||||
else:
|
||||
model.post_load_weights()
|
||||
|
||||
Reference in New Issue
Block a user