MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / _update_mtp_config

Method _update_mtp_config

fastdeploy/spec_decode/mtp.py:137–153  ·  view source on GitHub ↗

Update config for MTP from global config

(self, main_model)

Source from the content-addressed store, hash-verified

135 self.forward_meta = None
136
137 def _update_mtp_config(self, main_model):
138 """
139 Update config for MTP from global config
140 """
141 self.forward_meta: ForwardMeta = None
142 self.model_config.architectures[0] = self.model_config.architectures[0].replace("Moe", "MTP")
143 self.speculative_config.sharing_model = main_model
144 # TODO (wangyanpeng): The number of MTP layers should be read from model config
145 self.model_config.num_hidden_layers = 1
146 self.model_config.model = self.speculative_config.model
147 if "Ernie" in self.model_config.architectures[0]:
148 self.model_config.pretrained_config.prefix_name = "ernie.mtp_block"
149 self.model_config.prefix_layer_name = "mtp_block"
150 if self.speculative_config.quantization != "":
151 self.model_config.quantization = self.speculative_config.quantization
152 self.model_config.start_layer_index = self.num_main_model_layers
153 self.speculative_config.model_type = "mtp"
154
155 def _load_model(self):
156 """

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected