[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
@@ -180,7 +180,7 @@ def log_mel_spectrogram(
|
||||
HOP_LENGTH = 160
|
||||
|
||||
if not torch.is_tensor(audio):
|
||||
raise Exception(f"audio is not tensor {type(audio)}")
|
||||
raise TypeError(f"audio is not tensor {type(audio)}")
|
||||
|
||||
if device is not None:
|
||||
audio = audio.to(device)
|
||||
|
||||
@@ -40,6 +40,9 @@ import torch
|
||||
import torch.nn.functional as F
|
||||
from einops import rearrange, repeat
|
||||
from torch import nn
|
||||
from vllm.logger import init_logger
|
||||
|
||||
logger = init_logger(__name__)
|
||||
|
||||
|
||||
def round_up_multiple(num, mult):
|
||||
@@ -175,7 +178,7 @@ class EuclideanCodebook(nn.Module):
|
||||
if not torch.any(expired_codes):
|
||||
return
|
||||
else:
|
||||
print(f"VQ expire infos: num_expire={sum(expired_codes)}, cluster_size[:5]={cluster_size[:5]}")
|
||||
logger.info("VQ expire infos: num_expire=%s, cluster_size[:5]=%s", sum(expired_codes), cluster_size[:5])
|
||||
|
||||
batch_samples = rearrange(batch_samples, "... d -> (...) d")
|
||||
self.replace_(batch_samples, mask=expired_codes)
|
||||
|
||||
Reference in new issue
Block a user