[MRV2] Support attention-free models (#52374)

Signed-off-by: Nick Hill <nickhill123@gmail.com>
This commit is contained in:
Nick Hill
2026-08-14 23:54:50 +00:00
committed by GitHub
parent 9df9b0b0a1
commit d6f17f3d53
3 changed files with 7 additions and 2 deletions
@@ -873,6 +873,10 @@ def get_mamba_prefix_cache_step_configs(
def _run_mamba_prefix_cache_mrv1( def _run_mamba_prefix_cache_mrv1(
monkeypatch: pytest.MonkeyPatch, async_scheduling: bool monkeypatch: pytest.MonkeyPatch, async_scheduling: bool
): ):
# This test patches the V1 model runner, so pin V1 explicitly: MoE/hybrid
# models like Qwen3-Next now default to the V2 runner.
monkeypatch.setenv("VLLM_USE_V2_MODEL_RUNNER", "0")
envs.disable_envs_cache()
global async_scheduling_mode global async_scheduling_mode
async_scheduling_mode = async_scheduling async_scheduling_mode = async_scheduling
run_ref_mamba_state_in_subprocess() run_ref_mamba_state_in_subprocess()
+2 -1
View File
@@ -372,7 +372,7 @@ class GPUModelRunner(LoRAModelRunnerMixin):
self.model_memory_usage = m.consumed_memory self.model_memory_usage = m.consumed_memory
logger.info( logger.info(
"Model loading took %s GiB and %.6f seconds", "Model loading took %s GiB memory and %.6f seconds",
format_gib(m.consumed_memory), format_gib(m.consumed_memory),
time_after_load - time_before_load, time_after_load - time_before_load,
) )
@@ -1889,6 +1889,7 @@ class GPUModelRunner(LoRAModelRunnerMixin):
"""Release GPU tensors (model weights, KV caches, workspace) so that """Release GPU tensors (model weights, KV caches, workspace) so that
memory is reclaimable when running in the same process.""" memory is reclaimable when running in the same process."""
torch.accelerator.synchronize() torch.accelerator.synchronize()
self.cudagraph_manager = None
if hasattr(self, "kv_caches"): if hasattr(self, "kv_caches"):
self.kv_caches.clear() self.kv_caches.clear()
if hasattr(self, "attn_groups"): if hasattr(self, "attn_groups"):
+1 -1
View File
@@ -33,7 +33,7 @@ def init_model_state(
return EncoderOnlyModelState(vllm_config, model, encoder_cache, device) return EncoderOnlyModelState(vllm_config, model, encoder_cache, device)
if vllm_config.model_config.is_hybrid: if vllm_config.model_config.is_hybrid or vllm_config.model_config.is_attention_free:
from vllm.v1.worker.gpu.model_states.mamba_hybrid import MambaHybridModelState from vllm.v1.worker.gpu.model_states.mamba_hybrid import MambaHybridModelState
return MambaHybridModelState(vllm_config, model, encoder_cache, device) return MambaHybridModelState(vllm_config, model, encoder_cache, device)