From 3f27ffbd4de71df4bede265bcf4f8212e6bfa07a Mon Sep 17 00:00:00 2001 From: wuhang Date: Mon, 11 May 2026 20:16:05 +0800 Subject: [PATCH] [Misc] Clean logs for image gen task (#3414) Signed-off-by: wuhang --- vllm_omni/diffusion/diffusion_engine.py | 8 ++++---- vllm_omni/diffusion/inline_stage_diffusion_client.py | 4 ++-- vllm_omni/diffusion/models/z_image/pipeline_z_image.py | 6 ++++-- vllm_omni/diffusion/worker/diffusion_model_runner.py | 2 +- .../distributed/omni_connectors/kv_transfer_manager.py | 10 +++++----- vllm_omni/engine/orchestrator.py | 2 +- vllm_omni/entrypoints/openai/api_server.py | 8 ++++---- 7 files changed, 21 insertions(+), 19 deletions(-) diff --git a/vllm_omni/diffusion/diffusion_engine.py b/vllm_omni/diffusion/diffusion_engine.py index f2c3f4eed..1e421316a 100644 --- a/vllm_omni/diffusion/diffusion_engine.py +++ b/vllm_omni/diffusion/diffusion_engine.py @@ -147,7 +147,7 @@ class DiffusionEngine: preprocess_start_time = time.perf_counter() request = self.pre_process_func(request) preprocess_time = time.perf_counter() - preprocess_start_time - logger.info(f"Pre-processing completed in {preprocess_time:.4f} seconds") + logger.debug("Pre-processing completed in %.4f seconds", preprocess_time) exec_start_time = time.perf_counter() output = await self.async_add_req_and_wait_for_response(request) @@ -157,7 +157,7 @@ class DiffusionEngine: raise DiffusionRequestAbortedError(output.abort_message or "Diffusion request aborted.") if output.error: raise RuntimeError(output.error) - logger.info("Generation completed successfully.") + logger.debug("Generation completed successfully.") if output.output is None: logger.warning("Output is None, returning empty OmniRequestOutput") @@ -204,10 +204,10 @@ class DiffusionEngine: model_fps = outputs.get("fps") outputs = outputs.get("video", outputs) postprocess_time = time.perf_counter() - postprocess_start_time - logger.info(f"Post-processing completed in {postprocess_time:.4f} seconds") + logger.debug("Post-processing completed in %.4f seconds", postprocess_time) step_total_ms = (time.perf_counter() - diffusion_engine_start_time) * 1000 - logger.info( + logger.debug( "DiffusionEngine.step breakdown: preprocess=%.2f ms, " "add_req_and_wait=%.2f ms, postprocess=%.2f ms, total=%.2f ms", preprocess_time * 1000, diff --git a/vllm_omni/diffusion/inline_stage_diffusion_client.py b/vllm_omni/diffusion/inline_stage_diffusion_client.py index 75dcb247a..07256a264 100644 --- a/vllm_omni/diffusion/inline_stage_diffusion_client.py +++ b/vllm_omni/diffusion/inline_stage_diffusion_client.py @@ -86,7 +86,7 @@ class InlineStageDiffusionClient: sampling_params: OmniDiffusionSamplingParams, kv_sender_info: dict[int, dict[str, Any]] | None = None, ) -> None: - logger.info( + logger.debug( "[InlineStageDiffusionClient] stage-%s [rep-%s] add request: %s", self.stage_id, self.replica_id, @@ -144,7 +144,7 @@ class InlineStageDiffusionClient: sampling_params: OmniDiffusionSamplingParams, kv_sender_info: dict[int, dict[str, Any]] | None = None, ) -> None: - logger.info( + logger.debug( "[InlineStageDiffusionClient] stage-%s [rep-%s] add batch request: %s (%d prompts)", self.stage_id, self.replica_id, diff --git a/vllm_omni/diffusion/models/z_image/pipeline_z_image.py b/vllm_omni/diffusion/models/z_image/pipeline_z_image.py index 5ead64566..345ccca65 100644 --- a/vllm_omni/diffusion/models/z_image/pipeline_z_image.py +++ b/vllm_omni/diffusion/models/z_image/pipeline_z_image.py @@ -536,8 +536,10 @@ class ZImagePipeline(nn.Module, DiffusionPipelineProfilerMixin): image = PIL.Image.open(raw_image) if isinstance(raw_image, str) else raw_image # strength is currently only applicable for Z-Image I2I; other pipelines ignore this parameter - strength = req.sampling_params.strength if req.sampling_params.strength is not None else strength - if strength is not None and image is None: + explicit_strength = req.sampling_params.strength is not None + if explicit_strength: + strength = req.sampling_params.strength + if explicit_strength and image is None: logger.warning( "strength parameter (%.2f) is only applicable for image-to-image (I2I) generation. " "It will be ignored for text-to-image (T2I) generation.", diff --git a/vllm_omni/diffusion/worker/diffusion_model_runner.py b/vllm_omni/diffusion/worker/diffusion_model_runner.py index cc2d00f1a..79f6c4467 100644 --- a/vllm_omni/diffusion/worker/diffusion_model_runner.py +++ b/vllm_omni/diffusion/worker/diffusion_model_runner.py @@ -212,7 +212,7 @@ class DiffusionModelRunner(OmniConnectorModelRunnerMixin): peak_allocated_gb = peak_allocated_bytes / (1024**3) pool_overhead_gb = peak_reserved_gb - peak_allocated_gb - logger.info( + logger.debug( "Peak GPU memory (this request): %.2f GB reserved, %.2f GB allocated, %.2f GB pool overhead (%.1f%%)", peak_reserved_gb, peak_allocated_gb, diff --git a/vllm_omni/distributed/omni_connectors/kv_transfer_manager.py b/vllm_omni/distributed/omni_connectors/kv_transfer_manager.py index d673ad166..0525e9440 100644 --- a/vllm_omni/distributed/omni_connectors/kv_transfer_manager.py +++ b/vllm_omni/distributed/omni_connectors/kv_transfer_manager.py @@ -981,6 +981,11 @@ class OmniKVTransferManager: Returns: Tuple of (data dict, size) if successful, (None, 0) otherwise """ + # Check if we should receive KV cache based on config + if not self.config.need_recv_cache: + logger.debug("Skip receiving KV cache for %s (need_recv_cache=False)", request_id) + return None, 0 + if not self.connector: logger.warning("No connector available for receiving KV cache") return None, 0 @@ -990,11 +995,6 @@ class OmniKVTransferManager: logger.warning("Receive stages not configured") return None, 0 - # Check if we should receive KV cache based on config - if not self.config.need_recv_cache: - logger.info(f"Skip receiving KV cache for {request_id} (need_recv_cache=False)") - return None, 0 - # Skip during warmup dummy run — no sender is available. if request_id == "dummy_req_id": logger.info("Skip receiving KV cache for dummy warmup request") diff --git a/vllm_omni/engine/orchestrator.py b/vllm_omni/engine/orchestrator.py index 584ea6c5d..2d2ac47cb 100644 --- a/vllm_omni/engine/orchestrator.py +++ b/vllm_omni/engine/orchestrator.py @@ -227,7 +227,7 @@ class Orchestrator: raise ValueError(f"Missing sampling params for stage 0. Got {len(sampling_params_list)} stage params.") final_stage_id = msg["final_stage_id"] - logger.info( + logger.debug( "[Orchestrator] _handle_add_request: stage=%s req=%s " "prompt_type=%s original_prompt_type=%s final_stage=%s " "num_sampling_params=%d", diff --git a/vllm_omni/entrypoints/openai/api_server.py b/vllm_omni/entrypoints/openai/api_server.py index 380dde2e5..06fb0a7f4 100644 --- a/vllm_omni/entrypoints/openai/api_server.py +++ b/vllm_omni/entrypoints/openai/api_server.py @@ -1606,7 +1606,7 @@ async def generate_images(request: ImageGenerationRequest, raw_request: Request) request_id = f"img_gen-{random_uuid()}" raw_request.state.request_metadata = RequestResponseMetadata(request_id=request_id) - logger.info(f"Generating {request.n} image(s) {size_str}") + logger.debug(f"Generating {request.n} image(s) {size_str}") # Generate images using AsyncOmni (multi-stage mode) result = await _generate_with_async_omni( @@ -1626,7 +1626,7 @@ async def generate_images(request: ImageGenerationRequest, raw_request: Request) # Extract images from result images = _extract_images_from_result(result) - logger.info(f"Successfully generated {len(images)} image(s)") + logger.debug(f"Successfully generated {len(images)} image(s)") # Determine output format (default to png) output_format = _choose_output_format(request.output_format or "png", None) @@ -1854,7 +1854,7 @@ async def edit_images( # 4. Generate images request_id = f"img_edit-{random_uuid()}" raw_request.state.request_metadata = RequestResponseMetadata(request_id=request_id) - logger.info(f"Generating {n} image(s) {size_str}") + logger.debug(f"Generating {n} image(s) {size_str}") if len(stage_configs) > 1: # Multi-stage pipeline (e.g. GLM-Image AR+Diffusion): route through @@ -1932,7 +1932,7 @@ async def edit_images( ) images = _extract_images_from_result(result) - logger.info(f"Successfully generated {len(images)} image(s)") + logger.debug(f"Successfully generated {len(images)} image(s)") # Encode images to base64 image_data = [