Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,33 @@ def fake_parse(
assert config.architectures == ["Qwen3MoeForCausalLM"]


def test_gguf_config_parser_fallback_to_config_architectures(tmp_path, monkeypatch):
gguf_path = tmp_path / "model.gguf"
gguf_path.write_bytes(b"GGUF")

def fake_parse(
self, model, trust_remote_code, revision=None, code_revision=None, **kwargs
):
cfg = PretrainedConfig(model_type="custom_or_new_model")
cfg.architectures = ["DeepseekV4ForCausalLM"]
return {}, cfg

monkeypatch.setattr(
gguf_config_parser_module.HFConfigParser,
"parse",
fake_parse,
)
monkeypatch.setattr(
gguf_config_parser_module,
"maybe_patch_hf_config_from_gguf",
lambda model, config: config,
)

config_dict, config = GGUFConfigParser().parse(gguf_path, trust_remote_code=False)
assert config_dict["architectures"] == ["DeepseekV4ForCausalLM"]
assert config.architectures == ["DeepseekV4ForCausalLM"]


def test_register_sets_engine_args_for_gguf_model(monkeypatch):
register()
captured = {}
Expand Down
2 changes: 2 additions & 0 deletions vllm_gguf_plugin/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def parse(
and config.model_type in MODEL_FOR_CAUSAL_LM_MAPPING_NAMES
):
architecture = MODEL_FOR_CAUSAL_LM_MAPPING_NAMES[config.model_type]
if architecture is None and getattr(config, "architectures", None):
architecture = config.architectures[0]
if architecture is None:
raise RuntimeError(f"Can't get gguf config for {config.model_type}.")

Expand Down
2 changes: 1 addition & 1 deletion vllm_gguf_plugin/weights_adapter/transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def build_name_map(
model_type = "command-r"
if model_type == "gemma3_text":
model_type = "gemma3"
if model_type in ("deepseek_v3", "deepseek_v2"):
if model_type in ("deepseek_v4", "deepseek_v3", "deepseek_v2"):
model_type = "deepseek2"
for idx in range(config.num_hidden_layers):
gguf_to_hf_name_map[f"blk.{idx}.exp_probs_b.bias"] = (
Expand Down