From eafc7c44c32747fe51b3356f137cfc57d64462d2 Mon Sep 17 00:00:00 2001 From: Gaohan123 Date: Fri, 24 Oct 2025 14:07:04 +0800 Subject: [PATCH] fix error for pre-commit --- .gitignore | 1 - .pre-commit-config.yaml | 8 +-- CONTRIBUTING.md | 19 ++++++++ vllm_omni/entrypoints/api_server.py | 6 +-- vllm_omni/model_executor/models/__init__.py | 0 vllm_omni/model_executor/models/registry.py | 54 +++++++++++++++++++++ 6 files changed, 80 insertions(+), 8 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 vllm_omni/model_executor/models/__init__.py create mode 100644 vllm_omni/model_executor/models/registry.py diff --git a/.gitignore b/.gitignore index 3e00ad242..7fb302410 100644 --- a/.gitignore +++ b/.gitignore @@ -176,7 +176,6 @@ tests/ # vLLM-omni specific # Model files and checkpoints -models/ checkpoints/ *.bin *.safetensors diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 93e843ae5..85a7d1527 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.6.0 hooks: # list of supported hooks: https://pre-commit.com/hooks.html - id: check-yaml @@ -13,17 +13,17 @@ repos: args: ["--markdown-linebreak-ext=md"] - repo: https://github.com/PyCQA/isort - rev: 5.11.5 + rev: 5.13.2 hooks: - id: isort - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 24.10.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8 - rev: 4.0.1 + rev: 7.1.1 hooks: - id: flake8 args: ["--max-line-length=88", "--extend-ignore=E203,W503"] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..486b2b10a --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,19 @@ +# Contributing to vLLM + +## Getting Started + +Setup environment with uv +```bash +uv venv --python 3.12 --seed +source .venv/bin/activate +``` + +Pre-commit has been linked to git commit. For run checks locally, please install pre-commit: +```bash +uv pip install pre-commit +``` + +Then run: +```bash +pre-commit run --show-diff-on-failure --color=always --all-files +``` diff --git a/vllm_omni/entrypoints/api_server.py b/vllm_omni/entrypoints/api_server.py index 8bfb48067..11721723a 100644 --- a/vllm_omni/entrypoints/api_server.py +++ b/vllm_omni/entrypoints/api_server.py @@ -116,9 +116,9 @@ async def get_info(): return { "service": "vllm-omni", "version": "0.1.0", - "num_stages": omni_llm.get_num_stages() - if hasattr(omni_llm, "get_num_stages") - else 0, + "num_stages": ( + omni_llm.get_num_stages() if hasattr(omni_llm, "get_num_stages") else 0 + ), "stage_configs": [ { "stage_id": config.stage_id, diff --git a/vllm_omni/model_executor/models/__init__.py b/vllm_omni/model_executor/models/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/vllm_omni/model_executor/models/registry.py b/vllm_omni/model_executor/models/registry.py new file mode 100644 index 000000000..b01e17fa0 --- /dev/null +++ b/vllm_omni/model_executor/models/registry.py @@ -0,0 +1,54 @@ +from vllm.model_executor.models.registry import ( + _VLLM_MODELS, + _LazyRegisteredModel, + _ModelRegistry, +) + +_OMNI_MODELS = { + "Qwen2_5OmniForConditionalGeneration": ( + "qwen2_5_omni", + "Qwen2_5OmniForConditionalGeneration", + ), + "Qwen2_5OmniThinkerModel": ( + "qwen2_5_omni_thinker", + "Qwen2_5OmniThinkerForConditionalGeneration", + ), # noqa: E501 + "Qwen2_5OmniTalkerModel": ( + "qwen2_5_omni_talker", + "Qwen2_5OmniTalkerForConditionalGeneration", + ), # noqa: E501 + "Qwen2_5OmniToken2WavModel": ( + "qwen2_5_omni_token2wav", + "Qwen2_5OmniToken2WavForConditionalGenerationVLLM", + ), + "Qwen2_5OmniToken2WavDiTModel": ( + "qwen2_5_omni_token2wav", + "Qwen2_5OmniToken2WavModel", + ), + "Qwen2ForCausalLM_old": ("qwen2_old", "Qwen2ForCausalLM"), # need to discuss +} + +_VLLM_OMNI_MODELS = { + **_VLLM_MODELS, + **_OMNI_MODELS, +} + + +OmniModelRegistry = _ModelRegistry( + { + **{ + model_arch: _LazyRegisteredModel( + module_name=f"vllm.model_executor.models.{mod_relname}", + class_name=cls_name, + ) + for model_arch, (mod_relname, cls_name) in _VLLM_MODELS.items() + }, + **{ + model_arch: _LazyRegisteredModel( + module_name=f"vllm_omni.model_executor.models.{mod_relname}", + class_name=cls_name, + ) + for model_arch, (mod_relname, cls_name) in _OMNI_MODELS.items() + }, + } +)