Extract eh_proj Layer from ParallelLMHead for MTP to Avoid Weight Transposition Issue (#2707)
Some checks failed
Deploy GitHub Pages / deploy (push) Has been cancelled

* fix mtp eh_proj layer

* fix mtp update_cfg function

* fix stringdoc

* simplify class name
This commit is contained in:
GoldPancake
2025-07-04 14:15:04 +08:00
committed by GitHub
parent a5ae88ded9
commit e7fa57ebae
3 changed files with 136 additions and 4 deletions

View File

@@ -26,7 +26,7 @@ from paddleformers.transformers import PretrainedModel
from paddleformers.utils.log import logger
from fastdeploy.config import FDConfig, ModelConfig
from fastdeploy.model_executor.layers.lm_head import ParallelLMHead
from fastdeploy.model_executor.layers.mtp_linear import ParallelEHProjection
from fastdeploy.model_executor.layers.normalization import RMSNorm
from fastdeploy.model_executor.models.ernie4_5_moe import Ernie4_5_DecoderLayer
from fastdeploy.model_executor.models.model_base import ModelForCasualLM
@@ -286,7 +286,7 @@ class Ernie4_5_MTPModel(nn.Layer):
prefix="ernie.mtp_hidden_norm.0",
)
self.eh_proj = ParallelLMHead(
self.eh_proj = ParallelEHProjection(
fd_config=fd_config,
num_embeddings=fd_config.model_config.hidden_size,
embedding_dim=fd_config.model_config.hidden_size * 2,