mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-15 13:15:34 +08:00
[Misc] Avoid unnecessary import (#21106)
Signed-off-by: wangxiyuan <wangxiyuan1007@gmail.com>
This commit is contained in:
parent
fe8a2c544a
commit
89e3c4e9b4
@ -24,7 +24,6 @@ from vllm.entrypoints.openai.serving_engine import (OpenAIServing,
|
|||||||
from vllm.entrypoints.openai.serving_models import OpenAIServingModels
|
from vllm.entrypoints.openai.serving_models import OpenAIServingModels
|
||||||
from vllm.inputs.data import PromptType
|
from vllm.inputs.data import PromptType
|
||||||
from vllm.logger import init_logger
|
from vllm.logger import init_logger
|
||||||
from vllm.model_executor.model_loader import get_model_cls
|
|
||||||
from vllm.model_executor.models import SupportsTranscription
|
from vllm.model_executor.models import SupportsTranscription
|
||||||
from vllm.outputs import RequestOutput
|
from vllm.outputs import RequestOutput
|
||||||
from vllm.utils import PlaceholderModule
|
from vllm.utils import PlaceholderModule
|
||||||
@ -78,6 +77,7 @@ class OpenAISpeechToText(OpenAIServing):
|
|||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def model_cls(self) -> type[SupportsTranscription]:
|
def model_cls(self) -> type[SupportsTranscription]:
|
||||||
|
from vllm.model_executor.model_loader import get_model_cls
|
||||||
model_cls = get_model_cls(self.model_config)
|
model_cls = get_model_cls(self.model_config)
|
||||||
return cast(type[SupportsTranscription], model_cls)
|
return cast(type[SupportsTranscription], model_cls)
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from typing import Optional, Union
|
from typing import TYPE_CHECKING, Optional, Union
|
||||||
|
|
||||||
import huggingface_hub
|
import huggingface_hub
|
||||||
import regex as re
|
import regex as re
|
||||||
@ -31,10 +31,14 @@ from vllm.lora.layers import (BaseLayerWithLoRA, ColumnParallelLinearWithLoRA,
|
|||||||
RowParallelLinearWithLoRA,
|
RowParallelLinearWithLoRA,
|
||||||
VocabParallelEmbeddingWithLoRA)
|
VocabParallelEmbeddingWithLoRA)
|
||||||
from vllm.model_executor.layers.linear import LinearBase
|
from vllm.model_executor.layers.linear import LinearBase
|
||||||
|
|
||||||
# yapf: enable
|
# yapf: enable
|
||||||
from vllm.model_executor.layers.logits_processor import LogitsProcessor
|
|
||||||
from vllm.model_executor.layers.vocab_parallel_embedding import ParallelLMHead
|
if TYPE_CHECKING:
|
||||||
from vllm.model_executor.models.utils import WeightsMapper
|
from vllm.model_executor.layers.logits_processor import LogitsProcessor
|
||||||
|
from vllm.model_executor.layers.vocab_parallel_embedding import (
|
||||||
|
ParallelLMHead)
|
||||||
|
from vllm.model_executor.models.utils import WeightsMapper
|
||||||
|
|
||||||
logger = init_logger(__name__)
|
logger = init_logger(__name__)
|
||||||
|
|
||||||
@ -75,8 +79,8 @@ def from_layer(layer: nn.Module,
|
|||||||
|
|
||||||
|
|
||||||
def from_layer_logits_processor(
|
def from_layer_logits_processor(
|
||||||
layer: LogitsProcessor,
|
layer: "LogitsProcessor",
|
||||||
lm_head: ParallelLMHead,
|
lm_head: "ParallelLMHead",
|
||||||
max_loras: int,
|
max_loras: int,
|
||||||
lora_config: LoRAConfig,
|
lora_config: LoRAConfig,
|
||||||
model_config: Optional[PretrainedConfig] = None,
|
model_config: Optional[PretrainedConfig] = None,
|
||||||
@ -98,8 +102,8 @@ def replace_submodule(model: nn.Module, module_name: str,
|
|||||||
|
|
||||||
|
|
||||||
def parse_fine_tuned_lora_name(
|
def parse_fine_tuned_lora_name(
|
||||||
name: str,
|
name: str,
|
||||||
weights_mapper: Optional[WeightsMapper] = None
|
weights_mapper: Optional["WeightsMapper"] = None
|
||||||
) -> tuple[str, bool, bool]:
|
) -> tuple[str, bool, bool]:
|
||||||
"""Parse the name of lora weights.
|
"""Parse the name of lora weights.
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user