[Engine] Add entrypoint class and stage management#13
[Engine] Add entrypoint class and stage management#13hsliuustc0106 merged 6 commits intovllm-project:mainfrom
Conversation
Summary of ChangesHello @Gaohan123, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request lays the foundational infrastructure for multi-stage model execution within the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This PR introduces the OmniLLM class for managing multi-stage models, along with stage management and configuration loading. It also includes a StageLLM class and updates to configuration and input data structures. The review focuses on correctness and potential issues in the new implementation.
|
|
||
| return combined | ||
| stage = Stage(stage_config) | ||
| omni_llm = OmniLLM(model=model, **stage_config.engine_args) |
There was a problem hiding this comment.
| @config | ||
| @dataclass(config=ConfigDict(arbitrary_types_allowed=True)) |
| parser.add_argument("--model-stage", type=str, default=EngineArgs.model_stage, | ||
| help="Declare model stage (e.g., 'thinker', 'talker', 'token2wav'). This will be written into model_config.model_stage for schedulers to use.") |
There was a problem hiding this comment.
The help message for --model-stage uses EngineArgs.model_stage as the default value, but it should reference OmniEngineArgs.model_stage to be accurate.
| parser.add_argument("--model-stage", type=str, default=EngineArgs.model_stage, | |
| help="Declare model stage (e.g., 'thinker', 'talker', 'token2wav'). This will be written into model_config.model_stage for schedulers to use.") | |
| parser.add_argument("--model-stage", type=str, default=OmniEngineArgs.model_stage, | |
| help="Declare model stage (e.g., 'thinker', 'talker', 'token2wav'). This will be written into model_config.model_stage for schedulers to use.") |
| engine_inputs = stage.process_engine_inputs(self.stage_list, prompts) | ||
| else: | ||
| engine_inputs = prompts | ||
| engine_outputs = self._run_generation(stage, sampling_params_list[stage_id], engine_inputs) |
| if len(self.engine_input_source) == 0: | ||
| raise ValueError("engine_input_source is empty") |
| """ | ||
| Configuration module for vLLM-omni. | ||
| """ | ||
| from vllm.config import ModelConfig |
There was a problem hiding this comment.
import order should be reconfigrated, maybe we need to add precommit
There was a problem hiding this comment.
fixed. Later I think we can uniformly build a precommit and submit a PR to recheck all existing codes.
| engine_args: | ||
| model_stage: thinker | ||
| model_arch: Qwen2_5OmniForConditionalGeneration | ||
| worker_cls: vllm_omni.worker.AR_gpu_worker.ARGPUWorker |
There was a problem hiding this comment.
the worker file and class name should be renamed
| engine_output_type: latent | ||
| engine_input_source: [0] | ||
| custom_process_input_func: vllm_omni.model_executor.stage_input_processors.qwen2_5_omni.thinker2talker | ||
|
|
| raise IndexError(f"Stage config {stage_id} not found. Available stages: 0-{len(self.stage_configs)-1}") | ||
|
|
||
| return self.stage_configs[stage_id] | ||
| class Stage: |
There was a problem hiding this comment.
Stage -> OmniStage
does it only process one stage?
There was a problem hiding this comment.
if so, the stage_manager.py file name should be changed
There was a problem hiding this comment.
Yes it only process one. Personally I think the name "Stage" is simple and clear. vLLM main doesn't have this concept. Also I modify stage_manager.py to stage.py
| @@ -0,0 +1,32 @@ | |||
| from vllm.inputs import TextPrompt | |||
There was a problem hiding this comment.
imports should be reordered
| return engine_outputs | ||
|
|
||
|
|
||
| class StageLLM(LLM): |
There was a problem hiding this comment.
in this file, OmniLLM, StageLLM, LLM, these relateionships between them are not clear
There was a problem hiding this comment.
After thinking, OmniLLM is the main entry class, which keeps consistent usage habit with LLM in vLLM main branch. And StageLLM inherited from LLM to process each stage with one engine. Specifically, One OmniLLM includes multiple StageLLMs, which inherits from LLM.
|
Fix necessary reviews from #23 , other reviews for future development |
|
lgtm |
[Engine] Add entrypoint class and stage management
Purpose
This PR implements Phase 1 features of #10 . It adds entrypoint class OmniLLM for vLLM-omni. And it also builds the stage management of multiple modules within a model.
Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.BEFORE SUBMITTING, PLEASE READ https://github.com/hsliuustc0106/vllm-omni/blob/main/CONTRIBUTING.md (anything written below this line will be removed by GitHub Actions)