@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 89e3c4e9b4
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 15, 01:00 UTC

[Misc] Avoid unnecessary import (#21106)

Signed-off-by: wangxiyuan <wangxiyuan1007@gmail.com>

wangxiyuan committed Jul 17, 2025 at 20:57 UTC 89e3c4e9b46745741ab6b364358449056e4f64dd
2 files changed +13 -9
vllm/entrypoints/openai/speech_to_text.py
+1 -1
@@ -24,7 +24,6 @@ from vllm.entrypoints.openai.serving_engine import (OpenAIServing,
24 from vllm.entrypoints.openai.serving_models import OpenAIServingModels
25 from vllm.inputs.data import PromptType
26 from vllm.logger import init_logger
27 -from vllm.model_executor.model_loader import get_model_cls
27 from vllm.model_executor.models import SupportsTranscription
28 from vllm.outputs import RequestOutput
29 from vllm.utils import PlaceholderModule
@@ -78,6 +77,7 @@ class OpenAISpeechToText(OpenAIServing):
77
78 @cached_property
79 def model_cls(self) -> type[SupportsTranscription]:
80 + from vllm.model_executor.model_loader import get_model_cls
81 model_cls = get_model_cls(self.model_config)
82 return cast(type[SupportsTranscription], model_cls)
83
vllm/lora/utils.py
+12 -8
@@ -2,7 +2,7 @@
2 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
4 import os
5 -from typing import Optional, Union
5 +from typing import TYPE_CHECKING, Optional, Union
6
7 import huggingface_hub
8 import regex as re
@@ -31,10 +31,14 @@ from vllm.lora.layers import (BaseLayerWithLoRA, ColumnParallelLinearWithLoRA,
31 RowParallelLinearWithLoRA,
32 VocabParallelEmbeddingWithLoRA)
33 from vllm.model_executor.layers.linear import LinearBase
34 +
35 # yapf: enable
35 -from vllm.model_executor.layers.logits_processor import LogitsProcessor
36 -from vllm.model_executor.layers.vocab_parallel_embedding import ParallelLMHead
37 -from vllm.model_executor.models.utils import WeightsMapper
36 +
37 +if TYPE_CHECKING:
38 + from vllm.model_executor.layers.logits_processor import LogitsProcessor
39 + from vllm.model_executor.layers.vocab_parallel_embedding import (
40 + ParallelLMHead)
41 + from vllm.model_executor.models.utils import WeightsMapper
42
43 logger = init_logger(__name__)
44
@@ -75,8 +79,8 @@ def from_layer(layer: nn.Module,
79
80
81 def from_layer_logits_processor(
78 - layer: LogitsProcessor,
79 - lm_head: ParallelLMHead,
82 + layer: "LogitsProcessor",
83 + lm_head: "ParallelLMHead",
84 max_loras: int,
85 lora_config: LoRAConfig,
86 model_config: Optional[PretrainedConfig] = None,
@@ -98,8 +102,8 @@ def replace_submodule(model: nn.Module, module_name: str,
102
103
104 def parse_fine_tuned_lora_name(
101 - name: str,
102 - weights_mapper: Optional[WeightsMapper] = None
105 + name: str,
106 + weights_mapper: Optional["WeightsMapper"] = None
107 ) -> tuple[str, bool, bool]:
108 """Parse the name of lora weights.
109