[Bugfix][MLA] Read sparse model settings from text config (#56160)
Signed-off-by: Andy Lo <andy@mistral.ai>
This commit is contained in:
@@ -423,6 +423,7 @@ def test_sparse_backend_decode_correctness(
|
||||
)
|
||||
model_config = vllm_config.model_config
|
||||
model_config.hf_text_config = SimpleNamespace(
|
||||
index_topk=topk_tokens,
|
||||
q_lora_rank=None,
|
||||
kv_lora_rank=kv_lora_rank,
|
||||
qk_nope_head_dim=qk_nope_head_dim,
|
||||
@@ -430,6 +431,7 @@ def test_sparse_backend_decode_correctness(
|
||||
v_head_dim=v_head_dim,
|
||||
model_type="deepseek_v2",
|
||||
)
|
||||
del model_config.hf_config.index_topk # Composite configs only nest this field.
|
||||
model_config.dtype = dtype
|
||||
model_config.get_num_attention_heads = MethodType(
|
||||
lambda self, parallel_config: num_heads,
|
||||
@@ -591,7 +593,7 @@ def test_sparse_backend_decode_correctness(
|
||||
sdpa_reference = torch.cat(reference_outputs, dim=0)
|
||||
|
||||
vllm_config.cache_config.cache_dtype = kv_cache_dtype
|
||||
vllm_config.model_config.hf_config.index_topk = topk_tokens
|
||||
vllm_config.model_config.hf_text_config.index_topk = topk_tokens
|
||||
|
||||
common_attn_metadata = create_common_attn_metadata(
|
||||
batch_spec,
|
||||
@@ -1149,6 +1151,7 @@ def test_sparse_backend_prefill_correctness(
|
||||
)
|
||||
model_config = vllm_config.model_config
|
||||
model_config.hf_text_config = SimpleNamespace(
|
||||
index_topk=topk_tokens,
|
||||
q_lora_rank=None,
|
||||
kv_lora_rank=kv_lora_rank,
|
||||
qk_nope_head_dim=qk_nope_head_dim,
|
||||
@@ -1156,6 +1159,7 @@ def test_sparse_backend_prefill_correctness(
|
||||
v_head_dim=v_head_dim,
|
||||
model_type="deepseek_v2",
|
||||
)
|
||||
del model_config.hf_config.index_topk # Composite configs only nest this field.
|
||||
model_config.dtype = dtype
|
||||
model_config.model_arch_config.total_num_attention_heads = num_heads
|
||||
model_config.get_num_attention_heads = MethodType(
|
||||
@@ -1255,7 +1259,7 @@ def test_sparse_backend_prefill_correctness(
|
||||
ref_output = torch.cat(reference_outputs, dim=0)
|
||||
|
||||
vllm_config.cache_config.cache_dtype = kv_cache_dtype
|
||||
vllm_config.model_config.hf_config.index_topk = topk_tokens
|
||||
vllm_config.model_config.hf_text_config.index_topk = topk_tokens
|
||||
|
||||
common_attn_metadata = create_common_attn_metadata(
|
||||
batch_spec,
|
||||
@@ -1747,6 +1751,7 @@ def _build_sparse_dcp_vllm_config(
|
||||
model_config = vllm_config.model_config
|
||||
model_config.dtype = torch.bfloat16
|
||||
model_config.hf_text_config = SimpleNamespace(
|
||||
index_topk=topk_tokens,
|
||||
q_lora_rank=None,
|
||||
kv_lora_rank=kv_lora_rank,
|
||||
qk_nope_head_dim=qk_nope_head_dim,
|
||||
@@ -1754,6 +1759,7 @@ def _build_sparse_dcp_vllm_config(
|
||||
v_head_dim=v_head_dim,
|
||||
model_type="deepseek_v2",
|
||||
)
|
||||
del model_config.hf_config.index_topk # Composite configs only nest this field.
|
||||
model_config.get_num_attention_heads = MethodType(
|
||||
lambda self, parallel_config: local_heads, model_config
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user