|
8 | 8 |
|
9 | 9 | import torch
|
10 | 10 |
|
11 |
| -from vllm.engine.arg_utils import AsyncEngineArgs, EngineArgs |
12 |
| -from vllm.engine.async_llm_engine import AsyncLLMEngine |
13 |
| -from vllm.engine.llm_engine import LLMEngine |
14 |
| -from vllm.entrypoints.llm import LLM |
15 |
| -from vllm.executor.ray_utils import initialize_ray_cluster |
16 |
| -from vllm.inputs import PromptType, TextPrompt, TokensPrompt |
17 |
| -from vllm.model_executor.models import ModelRegistry |
18 |
| -from vllm.outputs import (ClassificationOutput, ClassificationRequestOutput, |
19 |
| - CompletionOutput, EmbeddingOutput, |
20 |
| - EmbeddingRequestOutput, PoolingOutput, |
21 |
| - PoolingRequestOutput, RequestOutput, ScoringOutput, |
22 |
| - ScoringRequestOutput) |
23 |
| -from vllm.pooling_params import PoolingParams |
24 |
| -from vllm.sampling_params import SamplingParams |
25 |
| - |
26 | 11 | # set some common config/environment variables that should be set
|
27 | 12 | # for all processes created by vllm and all processes
|
28 | 13 | # that interact with vllm workers.
|
|
36 | 21 | # see https://github.com/vllm-project/vllm/issues/10619
|
37 | 22 | torch._inductor.config.compile_threads = 1
|
38 | 23 |
|
| 24 | +_lazy_imports_module_list = { |
| 25 | + "LLM": "vllm.entrypoints.llm.LLM", |
| 26 | + "ModelRegistry": "vllm.model_executor.models.ModelRegistry", |
| 27 | + "PromptType": "vllm.inputs.PromptType", |
| 28 | + "TextPrompt": "vllm.inputs.TextPrompt", |
| 29 | + "TokensPrompt": "vllm.inputs.TokensPrompt", |
| 30 | + "SamplingParams": "vllm.sampling_params.SamplingParams", |
| 31 | + "RequestOutput": "vllm.outputs.RequestOutput", |
| 32 | + "CompletionOutput": "vllm.outputs.CompletionOutput", |
| 33 | + "PoolingOutput": "vllm.outputs.PoolingOutput", |
| 34 | + "PoolingRequestOutput": "vllm.outputs.PoolingRequestOutput", |
| 35 | + "EmbeddingOutput": "vllm.outputs.EmbeddingOutput", |
| 36 | + "EmbeddingRequestOutput": "vllm.outputs.EmbeddingRequestOutput", |
| 37 | + "ClassificationOutput": "vllm.outputs.ClassificationOutput", |
| 38 | + "ClassificationRequestOutput": "vllm.outputs.ClassificationRequestOutput", |
| 39 | + "ScoringOutput": "vllm.outputs.ScoringOutput", |
| 40 | + "ScoringRequestOutput": "vllm.outputs.ScoringRequestOutput", |
| 41 | + "LLMEngine": "vllm.engine.llm_engine.LLMEngine", |
| 42 | + "EngineArgs": "vllm.engine.arg_utils.EngineArgs", |
| 43 | + "AsyncLLMEngine": "vllm.engine.async_llm_engine.AsyncLLMEngine", |
| 44 | + "AsyncEngineArgs": "vllm.engine.arg_utils.AsyncEngineArgs", |
| 45 | + "initialize_ray_cluster": "vllm.executor.ray_utils.initialize_ray_cluster", |
| 46 | + "PoolingParams": "vllm.pooling_params.PoolingParams", |
| 47 | +} |
| 48 | + |
| 49 | + |
| 50 | +def __getattr__(name: str): |
| 51 | + if name in _lazy_imports_module_list: |
| 52 | + import importlib |
| 53 | + module_path, attr = _lazy_imports_module_list[name].rsplit(".", 1) |
| 54 | + mod = importlib.import_module(module_path) |
| 55 | + return getattr(mod, attr) |
| 56 | + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") |
| 57 | + |
| 58 | + |
39 | 59 | __all__ = [
|
40 | 60 | "__version__",
|
41 | 61 | "__version_tuple__",
|
|
0 commit comments