feat(engine): [image, audio] sglang image vllm asr engines#5121
Open
OliverBryant wants to merge 7 commits into
Open
feat(engine): [image, audio] sglang image vllm asr engines#5121OliverBryant wants to merge 7 commits into
OliverBryant wants to merge 7 commits into
Conversation
Contributor
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
…-dev Implement the SGLangImageModel stub with sglang-diffusion offline API (sglang.multimodal_gen.DiffGenerator) so text-to-image models can run on the SGLang engine on Linux with NVIDIA GPUs. Supported models: Qwen-Image, Qwen-Image-2512, Z-Image, Z-Image-Turbo and FLUX.1-dev, matching the sglang-diffusion compatibility matrix. Virtualenv specs install sglang[diffusion] when the SGLang engine is selected. Ref xorbitsai#4896
Add an engine abstraction layer for audio models (mirroring the image module design): AUDIO_ENGINES registry, engine matching and virtualenv marker support. Families without registered engines keep the legacy hardcoded dispatch, so existing behavior is unchanged. Qwen3-ASR-0.6B/1.7B register two engines: the default transformers engine and, on Linux with NVIDIA GPUs, a vLLM engine backed by qwen_asr's Qwen3ASRModel.LLM which shares the same transcribe API. /v1/engines/audio/<model_name> now returns engine params for audio models. Ref xorbitsai#4896
Show the engine select in the launch dialog for audio models that support engine selection (e.g. Qwen3-ASR on transformers/vLLM), and include audio in the model types that query /v1/engines. Audio models without registered engines keep the previous form unchanged. Ref xorbitsai#4896
OliverBryant
force-pushed
the
feat/sglang-image-vllm-asr-engines
branch
from
July 22, 2026 07:48
7e346ee to
77a64ad
Compare
qinxuye
reviewed
Jul 22, 2026
| self._device = device | ||
| self._model = None | ||
| self._model_spec = model_spec | ||
| self._abilities = model_spec.model_ability or [] # type: ignore |
Contributor
There was a problem hiding this comment.
The SGLang model copies the full ability list from the diffusers model spec, but this implementation only provides text_to_image. All five registered SGLang models advertise image2image, and three also advertise inpainting, so the running instance is reported as supporting endpoints that will fail with AttributeError (and may even be auto-selected by the image-edit API). Please either implement those methods for SGLang or expose only text2image for this engine.
Implement the vLLM image engine placeholder with a real engine backed by vllm-omni's Omni text-to-image entrypoint. The engine matches on Linux with NVIDIA GPUs for the same model set as the SGLang engine: Qwen-Image, Qwen-Image-2512, Z-Image, Z-Image-Turbo and FLUX.1-dev. Add vllm-omni virtualenv markers to the builtin specs so engine-scoped installs work. Ref xorbitsai#4896
vllm-omni does not declare vllm as a dependency but requires a vllm with the same major.minor version (its patch module imports private vllm APIs), so an unpinned marker resolved vllm-omni against whatever vllm the parent environment had and crashed on import. Pin the vllm-omni/vllm pair in the virtualenv packages, surface the original import error with the pairing requirement in the failure message, and assert the pins stay in sync in tests. Ref xorbitsai#4896
The vLLM image engine serialized all requests: VLLMDiffusionModel had no allow_batch flag, so ModelActor wrapped every text_to_image call in its per-model asyncio lock, and each call went through the blocking Omni.generate. The vllm-omni engine itself schedules requests from a queue and pipelines stages, so the serialization was purely on the xinference side. Omni.generate cannot simply be called concurrently: it drains the shared engine output queue and drops messages belonging to other requests, and per-request sampling params (seed, size, steps) cannot be expressed through one batched generate call since sampling_params_list is per-stage, not per-prompt. Set allow_batch = True and submit each request directly via engine.add_request with its own request_id and sampling params. A single dispatcher thread drains the engine output queue and routes messages back to per-request futures; a fatal ErrorMessage fails all in-flight requests, a per-request error fails only its own future. The dispatcher exits when idle and restarts on the next submission. When the running vllm-omni does not expose the needed engine internals, fall back to the previous serial Omni.generate path, now guarded by a model-level lock because the actor no longer serializes calls.
sglang pins its own torch stack (sglang 0.5.7 requires torch==2.9.1 exactly), so the unscoped #system_torch#/#system_numpy# placeholders in the vLLM/SGLang image model specs expand to the host torch (e.g. 2.11.0) and can never co-resolve with sglang[diffusion] in one virtualenv. Scope the system placeholders (and the transformers floor, which sglang also pins itself) to the diffusers and vLLM engines so the SGLang venv resolves sglang[diffusion] self-contained with its own torch. Note the SGLang install path additionally requires the xoscar skip_installed fix for requirements with extras: without it, sglang[diffusion] is treated as satisfied by a bare host sglang and the venv is left empty.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#4896