[Mini-VLLM] Remove LoRA, plugins, speech-to-text and scale-out surfaces

Production runs one static model behind the OpenAI-compatible API. Every
adapter path and non-OpenAI HTTP surface is unreachable there.

- Delete the LoRA stack: vllm/lora, LoRARequest on the engine wire, the
  scheduler, worker, cudagraph and MoE plumbing, LoRA metrics, the lora
  CLI group, and the LoRA tests.
- Drop the plugin loader in vllm/plugins. Platform resolution is now
  CUDA-only and the general/stat-logger plugin hooks are gone.
- Delete the speech-to-text and realtime entrypoints, the scale-out
  render routes, and vllm/config/speech_to_text.py. GenerationTask is
  generate-only.
- Cut DecodeBenchConnector and the disagg-prefill doc and image. The
  Multi, Offloading and Example connectors stay; production uses the
  CPU KV offload tier.
- Delete the ROCm-only fused KDA chunk kernel (2346 lines) with its CMake
  arch gate, declarations and op registrations. The CUDA build never
  defined the guard and no Python caller existed.
- Delete the orphan Mistral and Pixtral chat fixtures and examples/.
- Fix _check_model: removing the LoRA early return made every request
  fail with "The model ... does not exist. Valid aliases: ...".

Verified on an RTX 3090: import sweep reports 1242 modules with 7 known
optional-dependency failures; a live server answers chat, completions,
responses, tokenize and detokenize with zero log errors and 404 for the
removed surfaces; collection yields 8558 tests with the 3 pre-existing
errors; ruff adds no new finding; the incremental _C build succeeds.

Co-authored-by: Hinata <hinata@idihore.id>
Signed-off-by: MOVZX <movzx@yahoo.com>
This commit is contained in:
2026-10-19 21:06:19 +07:00
co-authored by Hinata
parent 5f3c7bd8ab
commit 5aa2ac64f8
269 changed files with 417 additions and 29932 deletions
+49 -117
View File
@@ -131,14 +131,7 @@ from vllm.v1.worker.gpu.kv_connector import (
KVConnector,
get_kv_connector,
)
from vllm.v1.worker.gpu.lora_utils import (
LoraState,
create_lora_capture_hook,
get_lora_capture_cases,
get_num_active_loras_for_dispatch,
)
from vllm.v1.worker.gpu.mm.encoder_cache import EncoderCache
from vllm.v1.worker.gpu.mm.lora import set_active_mm_loras
from vllm.v1.worker.gpu.model_states import init_model_state
from vllm.v1.worker.gpu.pool.pooling_runner import PoolingRunner
from vllm.v1.worker.gpu.pp_utils import PPHandler
@@ -182,7 +175,6 @@ from vllm.v1.worker.gpu.ubatch_utils import (
UBatchState,
maybe_build_ubatch_runner,
)
from vllm.v1.worker.lora_model_runner_mixin import LoRAModelRunnerMixin
from vllm.v1.worker.utils import (
KVBlockZeroer,
clear_layer_kv_caches,
@@ -194,13 +186,12 @@ from vllm.v1.worker.workspace import lock_workspace, use_workspace_lane
logger = init_logger(__name__)
class GPUModelRunner(LoRAModelRunnerMixin):
class GPUModelRunner:
def __init__(self, vllm_config: VllmConfig, device: torch.device):
self.vllm_config = vllm_config
self.model_config = vllm_config.model_config
self.cache_config = vllm_config.cache_config
self.compilation_config = vllm_config.compilation_config
self.lora_config = vllm_config.lora_config
self.load_config = vllm_config.load_config
self.parallel_config = vllm_config.parallel_config
self.scheduler_config = vllm_config.scheduler_config
@@ -344,14 +335,6 @@ class GPUModelRunner(LoRAModelRunnerMixin):
self.structured_outputs_worker: StructuredOutputsWorker | None = None
self.cudagraph_manager: ModelCudaGraphManager | None = None
# LoRA-related workers.
self.lora_state = LoraState(max_num_reqs=self.max_num_reqs)
self.lora_capture_cases = [0]
if self.lora_config:
self.lora_capture_cases = get_lora_capture_cases(
self.lora_config, self.compilation_config
)
# KV Connector if configured.
self.kv_connector: KVConnector = NO_OP_KV_CONNECTOR
@@ -402,10 +385,6 @@ class GPUModelRunner(LoRAModelRunnerMixin):
vllm_config=self.vllm_config,
model_config=self.vllm_config.model_config,
)
if self.lora_config:
self.model = self.load_lora_model(
self.model, self.vllm_config, self.device
)
if self.use_aux_hidden_state_outputs:
assert self.speculative_config is not None
@@ -572,8 +551,7 @@ class GPUModelRunner(LoRAModelRunnerMixin):
return None
return speculator.model
def reset_lora_state(self) -> None:
super().reset_lora_state()
def refresh_draft_weights(self) -> None:
# Called whenever the target's weights are replaced (reload, weight
# transfer), so draft weights derived from them must follow.
draft_model = self.get_draft_model()
@@ -593,7 +571,7 @@ class GPUModelRunner(LoRAModelRunnerMixin):
reload_weights(
vllm_config, model, weights_iterator, weights_path, is_checkpoint_format
)
self.reset_lora_state()
self.refresh_draft_weights()
self.reset_encoder_cache()
self.reset_mm_cache()
@@ -758,7 +736,6 @@ class GPUModelRunner(LoRAModelRunnerMixin):
self.device,
cudagraph_mode,
decode_query_len=self.decode_query_len,
lora_capture_cases=self.lora_capture_cases,
varlen_decode=self.adaptive_verification is not None,
ubatch_runner=self.ubatch_runner,
)
@@ -898,25 +875,17 @@ class GPUModelRunner(LoRAModelRunnerMixin):
assert self.intermediate_tensors is not None
intermediate_tensors = self.intermediate_tensors[:num_tokens]
max_loras = self.lora_config.max_loras if self.lora_config is not None else 0
with self.maybe_dummy_run_with_lora(
self.lora_config,
num_scheduled_tokens=np.array(num_tokens_per_request, dtype=np.int32),
num_sampled_tokens=None,
remove_lora=True,
num_active_loras=max_loras,
):
# Execute the model.
self.execute_model(
dummy_scheduler_output,
intermediate_tensors=intermediate_tensors,
dummy_run=True,
skip_attn_for_dummy_run=skip_attn,
is_profile=is_profile,
context_len=context_len,
valid_dummy_state_slots=valid_dummy_state_slots,
randomize_inputs=randomize_inputs,
)
# Execute the model.
self.execute_model(
dummy_scheduler_output,
intermediate_tensors=intermediate_tensors,
dummy_run=True,
skip_attn_for_dummy_run=skip_attn,
is_profile=is_profile,
context_len=context_len,
valid_dummy_state_slots=valid_dummy_state_slots,
randomize_inputs=randomize_inputs,
)
self.kv_connector.set_disabled(False)
# Non-last PP ranks don't produce output for sampling.
@@ -1085,46 +1054,41 @@ class GPUModelRunner(LoRAModelRunnerMixin):
torch.accelerator.empty_cache()
start_free_gpu_memory = torch.accelerator.get_memory_info()[0]
with self.maybe_setup_dummy_loras(self.lora_config):
if capture_encoder:
self.model_state.encoder_runner.capture()
if capture_encoder:
self.model_state.encoder_runner.capture()
if capture_decoder:
input_buffers = self.input_buffers
if self.pcp_manager is not None:
input_buffers = self.pcp_manager.input_buffers
self.cudagraph_manager.capture(
self.model,
self.model_state,
input_buffers,
self.intermediate_tensors,
self.block_tables,
self.attn_groups,
self.kv_cache_config,
pcp_manager=self.pcp_manager,
has_lora=self.lora_config is not None,
use_aux_hidden_state_outputs=self.use_aux_hidden_state_outputs,
lora_capture_hook=create_lora_capture_hook(
self.lora_config, self
),
)
self.model_state.capture_inner_cudagraphs(
input_buffers,
self.block_tables,
self.attn_groups,
self.kv_cache_config,
)
if self.speculator is not None:
with use_workspace_lane(self._draft_workspace_lane):
self.speculator.capture()
if self.adaptive_verification is not None:
with self.step_timing.collect() as timings:
for batch in self.adaptive_verification.batches_to_profile(
self.cudagraph_manager.captured_token_counts()
):
self._dummy_run(**batch)
self.adaptive_verification.set_initial_cost_curves(timings)
self.kv_connector.reset_capture_state()
if capture_decoder:
input_buffers = self.input_buffers
if self.pcp_manager is not None:
input_buffers = self.pcp_manager.input_buffers
self.cudagraph_manager.capture(
self.model,
self.model_state,
input_buffers,
self.intermediate_tensors,
self.block_tables,
self.attn_groups,
self.kv_cache_config,
pcp_manager=self.pcp_manager,
use_aux_hidden_state_outputs=self.use_aux_hidden_state_outputs,
)
self.model_state.capture_inner_cudagraphs(
input_buffers,
self.block_tables,
self.attn_groups,
self.kv_cache_config,
)
if self.speculator is not None:
with use_workspace_lane(self._draft_workspace_lane):
self.speculator.capture()
if self.adaptive_verification is not None:
with self.step_timing.collect() as timings:
for batch in self.adaptive_verification.batches_to_profile(
self.cudagraph_manager.captured_token_counts()
):
self._dummy_run(**batch)
self.adaptive_verification.set_initial_cost_curves(timings)
self.kv_connector.reset_capture_state()
end_free_gpu_memory = torch.accelerator.get_memory_info()[0]
@@ -1159,7 +1123,6 @@ class GPUModelRunner(LoRAModelRunnerMixin):
self.encoder_cache.remove_request(req_id)
if self.prompt_logprobs_worker is not None:
self.prompt_logprobs_worker.remove_request(req_id)
self.lora_state.remove_request(req_id)
return True
def finish_requests(self, scheduler_output: SchedulerOutput) -> None:
@@ -1230,7 +1193,6 @@ class GPUModelRunner(LoRAModelRunnerMixin):
self.block_tables.append_block_ids(
req_index, new_req_data.block_ids, overwrite=True
)
self.lora_state.add_request(req_id, req_index, new_req_data.lora_request)
if self.is_last_pp_rank and new_req_data.sampling_params is not None:
assert self.sampler is not None
@@ -1369,7 +1331,6 @@ class GPUModelRunner(LoRAModelRunnerMixin):
scheduler_output: SchedulerOutput,
batch_req_state: "BatchReqState",
batch_desc: BatchExecutionDescriptor,
num_active_loras: int,
) -> InputBatch:
num_tokens = batch_req_state.num_tokens
num_tokens_after_padding = max(num_tokens, batch_desc.num_tokens)
@@ -1503,7 +1464,6 @@ class GPUModelRunner(LoRAModelRunnerMixin):
cu_num_logits_np,
batch_req_state.has_prefill,
batch_desc,
num_active_loras=num_active_loras,
)
# CPU upper bound on seq_lens; padded entries left at zero.
@@ -1779,13 +1739,6 @@ class GPUModelRunner(LoRAModelRunnerMixin):
batch_req_state.is_prefilling_np,
)
num_active_loras = 0
if self.lora_config:
req_ids = list(scheduler_output.num_scheduled_tokens.keys())
num_active_loras = get_num_active_loras_for_dispatch(
self.lora_config, self.lora_state, req_ids, dummy_run
)
skip_compiled = False
if self.is_encoder_decoder and scheduler_output.scheduled_encoder_inputs:
# Encoder-decoder models such as Whisper should run eager/non-compiled
@@ -1802,7 +1755,6 @@ class GPUModelRunner(LoRAModelRunnerMixin):
self.dp_rank,
max_query_len=max_query_len,
need_eager=is_profile or skip_compiled,
num_active_loras=num_active_loras,
parallel_config=self.parallel_config,
allow_ubatching=(
self.ubatch_runner is not None and not skip_attn_for_dummy_run
@@ -1823,7 +1775,7 @@ class GPUModelRunner(LoRAModelRunnerMixin):
cudagraph_stats = make_cudagraph_stats(batch_desc, num_toks)
assert batch_req_state is not None
input_batch = self.prepare_inputs(
scheduler_output, batch_req_state, batch_desc, num_active_loras
scheduler_output, batch_req_state, batch_desc
)
block_tables, slot_mappings = self.prepare_attn(input_batch)
# Mamba "align" pre-copy: migrate recurrent state across block
@@ -1836,15 +1788,6 @@ class GPUModelRunner(LoRAModelRunnerMixin):
self.kv_cache_config,
self.req_states.num_computed_tokens.gpu,
)
if self.lora_config:
# Activate LoRA adapters.
lora_inputs = self.lora_state.make_lora_inputs(
input_batch.req_ids,
input_batch.idx_mapping_np,
input_batch.num_scheduled_tokens,
)
self._set_active_loras(*lora_inputs)
else:
# No actual tokens to run. A dummy run for DP or memory profiling.
dummy_num_reqs = batch_desc.num_reqs or num_reqs
@@ -1953,15 +1896,6 @@ class GPUModelRunner(LoRAModelRunnerMixin):
)
else:
scheduled_encoder_inputs = scheduler_output.scheduled_encoder_inputs
if self.supports_mm_inputs and self.lora_config is not None:
set_active_mm_loras(
model=self.model,
lora_manager=self.lora_manager,
encoder_cache=self.encoder_cache,
req_id_to_index=self.req_states.req_id_to_index,
lora_state=self.lora_state,
scheduled_encoder_inputs=scheduled_encoder_inputs,
)
with self.ec_connector.maybe_get_output(
scheduler_output
) as ec_connector_output:
@@ -2024,8 +1958,6 @@ class GPUModelRunner(LoRAModelRunnerMixin):
# For piecewise and eager mode, just call model().
batch_descriptor = BatchDescriptor(
num_tokens=input_batch.num_tokens_after_padding,
has_lora=self.lora_config is not None,
num_active_loras=batch_desc.num_active_loras,
)
with set_forward_context(