[ConfigRefactor] GLM-Image (#2977)
Signed-off-by: JaredforReal <w13431838023@gmail.com> Signed-off-by: Jared Wen <w13431838023@gmail.com> Co-authored-by: SYLAR <125541396+lishunyang12@users.noreply.github.com>
This commit is contained in:
1 parent
e1cdd0c23b
commit
554233208f
16 files changed
+142
-1491
No files matched your search
@@ -1,3 +1,16 @@
|
||||
from .glm_image_ar import GlmImageForConditionalGeneration
|
||||
def __getattr__(name: str):
|
||||
"""Lazy import to avoid importing transformers.models.glm_image at module init.
|
||||
|
||||
The AR model depends on ``transformers.models.glm_image`` which is only
|
||||
available when the model weights are present. Importing it eagerly in
|
||||
``__init__.py`` breaks the pipeline registry lookup for environments that
|
||||
don't have this custom transformers extension installed.
|
||||
"""
|
||||
if name == "GlmImageForConditionalGeneration":
|
||||
from .glm_image_ar import GlmImageForConditionalGeneration
|
||||
|
||||
return GlmImageForConditionalGeneration
|
||||
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
||||
|
||||
|
||||
__all__ = ["GlmImageForConditionalGeneration"]
|
||||
@@ -0,0 +1,47 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
"""GLM-Image pipeline topologies (frozen).
|
||||
Two-stage (default):
|
||||
Stage 0: AR — multimodal understanding + token_ids generation
|
||||
Stage 1: DiT — diffusion image generation
|
||||
"""
|
||||
|
||||
from vllm_omni.config.stage_config import (
|
||||
PipelineConfig,
|
||||
StageExecutionType,
|
||||
StagePipelineConfig,
|
||||
)
|
||||
|
||||
GLM_IMAGE_PIPELINE = PipelineConfig(
|
||||
model_type="glm_image",
|
||||
model_arch="GlmImageForConditionalGeneration",
|
||||
hf_architectures=("GlmImageForConditionalGeneration",),
|
||||
diffusers_class_name="GlmImagePipeline",
|
||||
stages=(
|
||||
StagePipelineConfig(
|
||||
stage_id=0,
|
||||
model_stage="ar",
|
||||
execution_type=StageExecutionType.LLM_AR,
|
||||
requires_multimodal_data=True,
|
||||
input_sources=(),
|
||||
final_output=False,
|
||||
owns_tokenizer=True,
|
||||
model_arch="GlmImageForConditionalGeneration",
|
||||
engine_output_type="token_ids",
|
||||
model_subdir="vision_language_encoder",
|
||||
tokenizer_subdir="processor",
|
||||
),
|
||||
StagePipelineConfig(
|
||||
stage_id=1,
|
||||
model_stage="dit",
|
||||
execution_type=StageExecutionType.DIFFUSION,
|
||||
input_sources=(0,),
|
||||
requires_multimodal_data=True,
|
||||
final_output=True,
|
||||
final_output_type="image",
|
||||
model_arch="GlmImagePipeline",
|
||||
custom_process_input_func="vllm_omni.model_executor.stage_input_processors.glm_image.ar2diffusion",
|
||||
omni_kv_config={"need_recv_cache": False},
|
||||
),
|
||||
),
|
||||
)
|
||||
Reference in new issue
Block a user