[Feature]: Enable directly use OmniLLM init AR model (#1821)
This commit is contained in:
4 files changed
+10
-17
No files matched your search
@@ -18,7 +18,7 @@ If users want to modify some part of it. The custom stage_configs file can be in
|
||||
For offline (Assume necessary dependencies have ben imported):
|
||||
```python
|
||||
model_name = "Qwen/Qwen2.5-Omni-7B"
|
||||
omni_llm = OmniLLM(model=model_name, stage_configs_path="/path/to/custom_stage_configs.yaml")
|
||||
omni_llm = Omni(model=model_name, stage_configs_path="/path/to/custom_stage_configs.yaml")
|
||||
```
|
||||
|
||||
For online serving:
|
||||
|
||||
@@ -48,7 +48,7 @@ class OmniModelConfig(ModelConfig):
|
||||
stage_id: int = 0
|
||||
async_chunk: bool = False
|
||||
model_stage: str = "thinker"
|
||||
model_arch: str = "Qwen2_5OmniForConditionalGeneration"
|
||||
model_arch: str | None = None
|
||||
worker_type: str | None = None
|
||||
engine_output_type: str | None = None
|
||||
hf_config_name: str | None = None
|
||||
@@ -69,7 +69,9 @@ class OmniModelConfig(ModelConfig):
|
||||
|
||||
@property
|
||||
def architectures(self) -> list[str]:
|
||||
return [self.model_arch]
|
||||
if self.model_arch is not None:
|
||||
return [self.model_arch]
|
||||
return super().architectures
|
||||
|
||||
@property
|
||||
def embedding_size(self):
|
||||
|
||||
@@ -71,7 +71,7 @@ class OmniEngineArgs(EngineArgs):
|
||||
|
||||
stage_id: int = 0
|
||||
model_stage: str = "thinker"
|
||||
model_arch: str = "Qwen2_5OmniForConditionalGeneration"
|
||||
model_arch: str | None = None
|
||||
engine_output_type: str | None = None
|
||||
hf_config_name: str | None = None
|
||||
custom_process_next_stage_input_func: str | None = None
|
||||
@@ -233,7 +233,7 @@ class AsyncOmniEngineArgs(AsyncEngineArgs):
|
||||
|
||||
stage_id: int = 0
|
||||
model_stage: str = "thinker"
|
||||
model_arch: str = "Qwen2_5OmniForConditionalGeneration"
|
||||
model_arch: str | None = None
|
||||
engine_output_type: str | None = None
|
||||
hf_config_name: str | None = None
|
||||
custom_process_next_stage_input_func: str | None = None
|
||||
|
||||
@@ -25,8 +25,6 @@ from vllm_omni.engine.input_processor import OmniInputProcessor, reinject_omni_f
|
||||
from vllm_omni.engine.output_processor import MultimodalOutputProcessor
|
||||
from vllm_omni.entrypoints.utils import (
|
||||
filter_dataclass_kwargs,
|
||||
load_stage_configs_from_model,
|
||||
load_stage_configs_from_yaml,
|
||||
resolve_model_config_path,
|
||||
)
|
||||
|
||||
@@ -43,8 +41,6 @@ class OmniLLM(LLM):
|
||||
|
||||
Args:
|
||||
model: Model name or path to load
|
||||
stage_configs_path: Optional path to YAML file containing stage
|
||||
configurations. If None, configurations are loaded from the model.
|
||||
log_stats: Whether to enable statistics logging
|
||||
compilation_config: Optional compilation configuration. Can be an
|
||||
integer (compilation level), dict, or CompilationConfig instance.
|
||||
@@ -68,7 +64,6 @@ class OmniLLM(LLM):
|
||||
def __init__(
|
||||
self,
|
||||
model: str,
|
||||
stage_configs_path: str | None = None,
|
||||
log_stats: bool = False,
|
||||
compilation_config: int | dict[str, Any] | CompilationConfig | None = None,
|
||||
hf_overrides: dict[str, Any] | None = None,
|
||||
@@ -86,13 +81,8 @@ class OmniLLM(LLM):
|
||||
self.batch_timeout = batch_timeout
|
||||
self.log_stats: bool = bool(log_stats)
|
||||
|
||||
# Load stage configurations
|
||||
if stage_configs_path is None:
|
||||
self.config_path = resolve_model_config_path(model)
|
||||
self.stage_configs = load_stage_configs_from_model(model)
|
||||
else:
|
||||
self.config_path = stage_configs_path
|
||||
self.stage_configs = load_stage_configs_from_yaml(stage_configs_path)
|
||||
# Resolve model config path for connectors
|
||||
self.config_path = resolve_model_config_path(model)
|
||||
|
||||
# Initialize connectors
|
||||
self.omni_transfer_config, self.connectors = initialize_orchestrator_connectors(
|
||||
@@ -154,6 +144,7 @@ class OmniLLM(LLM):
|
||||
compilation_config=compilation_config_instance,
|
||||
structured_outputs_config=structured_outputs_instance,
|
||||
omni_kv_config=omni_kv_config,
|
||||
hf_overrides=hf_overrides or {},
|
||||
**filter_dataclass_kwargs(OmniEngineArgs, kwargs),
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user