Skip to content

Commit 89e3c4e

Browse files
authored
[Misc] Avoid unnecessary import (#21106)
Signed-off-by: wangxiyuan <[email protected]>
1 parent fe8a2c5 commit 89e3c4e

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

vllm/entrypoints/openai/speech_to_text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from vllm.entrypoints.openai.serving_models import OpenAIServingModels
2525
from vllm.inputs.data import PromptType
2626
from vllm.logger import init_logger
27-
from vllm.model_executor.model_loader import get_model_cls
2827
from vllm.model_executor.models import SupportsTranscription
2928
from vllm.outputs import RequestOutput
3029
from vllm.utils import PlaceholderModule
@@ -78,6 +77,7 @@ def __init__(
7877

7978
@cached_property
8079
def model_cls(self) -> type[SupportsTranscription]:
80+
from vllm.model_executor.model_loader import get_model_cls
8181
model_cls = get_model_cls(self.model_config)
8282
return cast(type[SupportsTranscription], model_cls)
8383

vllm/lora/utils.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
33

44
import os
5-
from typing import Optional, Union
5+
from typing import TYPE_CHECKING, Optional, Union
66

77
import huggingface_hub
88
import regex as re
@@ -31,10 +31,14 @@
3131
RowParallelLinearWithLoRA,
3232
VocabParallelEmbeddingWithLoRA)
3333
from vllm.model_executor.layers.linear import LinearBase
34+
3435
# 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
3842

3943
logger = init_logger(__name__)
4044

@@ -75,8 +79,8 @@ def from_layer(layer: nn.Module,
7579

7680

7781
def from_layer_logits_processor(
78-
layer: LogitsProcessor,
79-
lm_head: ParallelLMHead,
82+
layer: "LogitsProcessor",
83+
lm_head: "ParallelLMHead",
8084
max_loras: int,
8185
lora_config: LoRAConfig,
8286
model_config: Optional[PretrainedConfig] = None,
@@ -98,8 +102,8 @@ def replace_submodule(model: nn.Module, module_name: str,
98102

99103

100104
def parse_fine_tuned_lora_name(
101-
name: str,
102-
weights_mapper: Optional[WeightsMapper] = None
105+
name: str,
106+
weights_mapper: Optional["WeightsMapper"] = None
103107
) -> tuple[str, bool, bool]:
104108
"""Parse the name of lora weights.
105109

0 commit comments

Comments
 (0)