Files
vllm-omni/vllm_omni/__init__.py
T

76 lines
2.7 KiB
Python
Raw Normal View History

# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
2025-09-11 14:32:51 +08:00
"""
2025-11-29 04:42:39 -08:00
vLLM-Omni: Multi-modality models inference and serving with
2025-10-24 12:16:48 +08:00
non-autoregressive structures.
2025-09-11 14:32:51 +08:00
2025-10-24 12:16:48 +08:00
This package extends vLLM beyond traditional text-based, autoregressive
generation to support multi-modality models with non-autoregressive
structures and non-textual outputs.
2025-09-11 14:32:51 +08:00
Architecture:
2025-10-24 12:16:48 +08:00
- 🟡 Modified: vLLM components modified for multimodal support
- 🔴 Added: New components for multimodal and non-autoregressive
processing
2025-09-11 14:32:51 +08:00
"""
# We import version early, because it will warn if vLLM / vLLM Omni
# are not using the same major + minor version (if vLLM is installed).
# We should do this before applying patch, because vLLM imports might
# throw in patch if the versions differ.
from .version import __version__, __version_tuple__ # isort:skip # noqa: F401
try:
from . import patch # noqa: F401
except ModuleNotFoundError as exc: # pragma: no cover - optional dependency
if exc.name != "vllm":
raise
# Allow importing vllm_omni without vllm (e.g., documentation builds)
patch = None # type: ignore
2025-11-30 04:44:01 +08:00
2026-03-04 22:52:56 +08:00
# Register custom configs (AutoConfig, AutoTokenizer) as early as possible.
2026-07-27 23:35:49 +08:00
try:
from vllm_omni.transformers_utils import configs as _configs # noqa: F401, E402
from vllm_omni.transformers_utils import parsers as _parsers # noqa: F401, E402
except ModuleNotFoundError as exc: # pragma: no cover - optional dependency
if exc.name != "vllm":
raise
# Allow importing vllm_omni without vllm (e.g., documentation builds)
pass
2026-01-22 18:09:55 +08:00
2025-10-25 12:09:19 +08:00
from .config import OmniModelConfig
2025-10-24 12:16:48 +08:00
# Apply the process-wide default at vllm_omni import; later backend policies
# take precedence.
from . import env_override as _env_override # isort:skip # noqa: F401, E402
2025-11-17 14:44:10 +08:00
def __getattr__(name: str):
# Lazy import for AsyncOmni and Omni to avoid pulling in heavy
# dependencies (vllm model_loader → fused_moe → pynvml) at package
# import time. This prevents crashes in lightweight subprocesses
# (e.g. model-architecture inspection) that lack a CUDA context.
# See: https://github.com/vllm-project/vllm-omni/issues/1793
if name == "AsyncOmni":
from .entrypoints.async_omni import AsyncOmni
return AsyncOmni
if name == "Omni":
from .entrypoints.omni import Omni
return Omni
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
2025-09-11 14:32:51 +08:00
__all__ = [
2025-11-27 17:41:22 +08:00
"__version__",
"__version_tuple__",
2025-09-11 14:32:51 +08:00
# Main components
"Omni",
"AsyncOmni",
# Configuration
2025-10-25 12:09:19 +08:00
"OmniModelConfig",
2025-09-11 14:32:51 +08:00
# All other components are available through their respective modules
# processors.*, schedulers.*, executors.*, etc.
2025-10-24 12:16:48 +08:00
]