[Model] Add native Dots3 NOTE multimodal support (#51255)
Signed-off-by: KurodaKanbei <mistergalahad@gmail.com> Signed-off-by: Jee Jee Li <jeejeelee@inferact.ai> Co-authored-by: OpenAI Codex <codex@openai.com> Co-authored-by: Jee Jee Li <jeejeelee@inferact.ai> Co-authored-by: Jee Jee Li <pandaleefree@gmail.com>
This commit is contained in:
co-authored by
OpenAI Codex
Jee Jee Li
Jee Jee Li
parent
b1b752042f
commit
9035151d6c
@@ -36,6 +36,7 @@ logger = init_logger(__name__)
|
||||
|
||||
MTPModelTypes = Literal[
|
||||
"deepseek_mtp",
|
||||
"dots3_note_mtp",
|
||||
"mimo_mtp",
|
||||
"mimo_v2_mtp",
|
||||
"glm4_moe_mtp",
|
||||
@@ -336,6 +337,21 @@ class SpeculativeConfig:
|
||||
@staticmethod
|
||||
def hf_config_override(hf_config: PretrainedConfig) -> PretrainedConfig:
|
||||
initial_architecture = hf_config.architectures[0]
|
||||
if hf_config.model_type == "dots3_note":
|
||||
n_predict = getattr(hf_config, "num_nextn_predict_layers", 1)
|
||||
mtp_layer_types = getattr(hf_config, "mtp_layer_types", None)
|
||||
if mtp_layer_types is None:
|
||||
mtp_layer_types = ["sliding_attention"] * n_predict
|
||||
if len(mtp_layer_types) != n_predict:
|
||||
raise ValueError(
|
||||
"mtp_layer_types must have one entry per MTP layer: "
|
||||
f"got {len(mtp_layer_types)} for {n_predict} layers"
|
||||
)
|
||||
hf_config.layer_types = [*hf_config.layer_types, *mtp_layer_types]
|
||||
hf_config.model_type = "dots3_note_mtp"
|
||||
hf_config.update(
|
||||
{"n_predict": n_predict, "architectures": ["Dots3NoteMTPModel"]}
|
||||
)
|
||||
if hf_config.model_type in (
|
||||
"deepseek_v3",
|
||||
"deepseek_v32",
|
||||
|
||||
Reference in New Issue
Block a user