[Cleanup] Replace bare print() with logger and use specific exception types#2228
Merged
lishunyang12 merged 2 commits intoApr 3, 2026
Conversation
… types Replace 8 bare print() calls in production code with proper logger calls (5 files), and replace 2 generic `raise Exception` with RuntimeError/TypeError (2 files). Benchmark code and intentional file I/O print(file=f) calls are left unchanged. Motivation: Bare print() bypasses vLLM's logging configuration (log levels, formatters, handlers). Bare Exception prevents callers from catching specific error types. Signed-off-by: Lidang Jiang <lidangjiang@gmail.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Lidang-Jiang <lidangjiang@gmail.com>
lishunyang12
reviewed
Apr 2, 2026
Collaborator
lishunyang12
left a comment
There was a problem hiding this comment.
looks good overall, one nit
| print(f"ERROR in _update_out_and_lse: {e}") | ||
| print(f"out: {out.shape}, lse: {lse.shape}") | ||
| print(f"block_out: {block_out.shape}, block_lse: {block_lse.shape}") | ||
| logger.error("ERROR in _update_out_and_lse: %s", e) |
Collaborator
There was a problem hiding this comment.
Nit: logger.error already tags the message as ERROR-level — the "ERROR" prefix is redundant.
Suggested change
| logger.error("ERROR in _update_out_and_lse: %s", e) | |
| logger.error("_update_out_and_lse failed: %s", e) |
Contributor
Author
There was a problem hiding this comment.
Good catch, fixed in d7fcb80 — removed the redundant "ERROR" prefix.
Signed-off-by: Lidang-Jiang <lidangjiang@gmail.com>
linyueqian
pushed a commit
to JuanPZuluaga/vllm-omni
that referenced
this pull request
Apr 3, 2026
… types (vllm-project#2228) Signed-off-by: Lidang Jiang <lidangjiang@gmail.com> Signed-off-by: Lidang-Jiang <lidangjiang@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: JuanPZuluaga <juanz9312@gmal.com>
skf-1999
pushed a commit
to Semmer2/vllm-omni
that referenced
this pull request
Apr 7, 2026
… types (vllm-project#2228) Signed-off-by: Lidang Jiang <lidangjiang@gmail.com> Signed-off-by: Lidang-Jiang <lidangjiang@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
vraiti
pushed a commit
to vraiti/vllm-omni
that referenced
this pull request
Apr 9, 2026
… types (vllm-project#2228) Signed-off-by: Lidang Jiang <lidangjiang@gmail.com> Signed-off-by: Lidang-Jiang <lidangjiang@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
lengrongfu
pushed a commit
to lengrongfu/vllm-omni
that referenced
this pull request
May 1, 2026
… types (vllm-project#2228) Signed-off-by: Lidang Jiang <lidangjiang@gmail.com> Signed-off-by: Lidang-Jiang <lidangjiang@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
clodaghwalsh17
pushed a commit
to clodaghwalsh17/nm-vllm-omni-ent
that referenced
this pull request
May 12, 2026
… types (vllm-project#2228) Signed-off-by: Lidang Jiang <lidangjiang@gmail.com> Signed-off-by: Lidang-Jiang <lidangjiang@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Replace 8 bare
print()calls in production code with properloggercalls (5 files), and replace 2 genericraise Exceptionwith specific exception types (2 files).Motivation: Bare
print()bypasses vLLM's logging configuration (log levels, formatters, handlers). GenericExceptionprevents callers from catching specific error types.Benchmark code and intentional file I/O
print(file=f)calls are left unchanged.Changes
Exception types (2 files)
diffusion/diffusion_engine.py:102raise Exception(...)→raise RuntimeError(...)model_executor/models/cosyvoice3/utils.py:183raise Exception(...)→raise TypeError(...)print() → logger (5 files, 8 calls)
diffusion/attention/backends/ring/ring_utils.pyprint(f"ERROR...")→logger.error(...)diffusion/models/dreamid_omni/fusion.pyprint("Warning:...")→logger.warning(...)diffusion/models/hunyuan_image_3/hunyuan_image_3_tokenizer.pyprint(vars)→logger.debug(...)diffusion/models/hunyuan_image_3/hunyuan_image_3_transformer.pyprint(f"Skipping...")→logger.warning(...)model_executor/models/qwen3_tts/tokenizer_25hz/vq/core_vq.pyprint(f"VQ expire...")→logger.info(...)All new loggers use
from vllm.logger import init_loggerconsistent with the rest of the codebase. Lazy%sformatting is used instead of f-strings.Test plan
ruff checkpasses on all 7 modified filesruff format --checkpasses on all 7 modified files🤖 Generated with Claude Code