[Cleanup] Replace bare print() with logger and use specific exception types (#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 commit is contained in:
1 parent
cd71567b06
commit
515d15ef87
7 files changed
+22
-10
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
from vllm.logger import init_logger
|
||||
|
||||
from vllm_omni.diffusion.attention.layer import Attention
|
||||
|
||||
@@ -11,6 +12,8 @@ except ImportError:
|
||||
from vllm_omni.diffusion.distributed.utils import get_local_device
|
||||
from vllm_omni.diffusion.models.dreamid_omni.wan2_2 import WanModel, rope_apply
|
||||
|
||||
logger = init_logger(__name__)
|
||||
|
||||
|
||||
class FusionModel(nn.Module):
|
||||
def __init__(self, video_config=None, audio_config=None):
|
||||
@@ -22,14 +25,14 @@ class FusionModel(nn.Module):
|
||||
else:
|
||||
has_video = False
|
||||
self.video_model = None
|
||||
print("Warning: No video model is provided!")
|
||||
logger.warning("No video model is provided!")
|
||||
|
||||
if audio_config is not None:
|
||||
self.audio_model = WanModel(**audio_config)
|
||||
else:
|
||||
has_audio = False
|
||||
self.audio_model = None
|
||||
print("Warning: No audio model is provided!")
|
||||
logger.warning("No audio model is provided!")
|
||||
|
||||
if has_video and has_audio:
|
||||
assert len(self.video_model.blocks) == len(self.audio_model.blocks)
|
||||
|
||||
@@ -11,9 +11,12 @@ import torch
|
||||
import torch.nn.functional as F
|
||||
from diffusers.utils.outputs import BaseOutput
|
||||
from transformers import AutoTokenizer
|
||||
from vllm.logger import init_logger
|
||||
|
||||
from .hunyuan_image_3_transformer import ImageInfo, JointImageInfo, default
|
||||
|
||||
logger = init_logger(__name__)
|
||||
|
||||
|
||||
class TokenizerEncodeOutput(BaseOutput):
|
||||
tokens: torch.Tensor | None = None
|
||||
@@ -121,7 +124,7 @@ class TokenizerWrapper:
|
||||
elif isinstance(uncond_enabled, bool):
|
||||
uncond_enabled = [uncond_enabled] * len(texts)
|
||||
if len(uncond_enabled) != len(texts):
|
||||
print(uncond_enabled, texts)
|
||||
logger.debug("uncond_enabled=%s, texts=%s", uncond_enabled, texts)
|
||||
assert len(uncond_enabled) == len(texts), (
|
||||
f"Length of uncond_flags should be equal to the number of texts, "
|
||||
f"but got {len(uncond_enabled)} and {len(texts)}."
|
||||
|
||||
@@ -2036,7 +2036,7 @@ class HunyuanImage3Model(nn.Module):
|
||||
for name, loaded_weight in weights:
|
||||
# print(f"Loading weight name: {name}, tp_rank: {tp_rank}", flush=True)
|
||||
if contains_unexpected_keyword(name, unexpected_keywords):
|
||||
print(f"Skipping unexpected weight name: {name}")
|
||||
logger.warning("Skipping unexpected weight name: %s", name)
|
||||
continue
|
||||
if "rotary_emb.inv_freq" in name:
|
||||
continue
|
||||
|
||||
Reference in new issue
Block a user