Skip to content

Commit c419dac

Browse files
Route non-interactive library messages through loggers (#14682)
* fix: route library messages through loggers * test: remove dedicated logging regressions
1 parent b27b69c commit c419dac

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

src/diffusers/models/autoencoders/vae.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import torch
1818
import torch.nn as nn
1919

20-
from ...utils import BaseOutput
20+
from ...utils import BaseOutput, logging
2121
from ...utils.torch_utils import randn_tensor
2222
from ..activations import get_activation
2323
from ..attention_processor import SpatialNorm
@@ -29,6 +29,9 @@
2929
)
3030

3131

32+
logger = logging.get_logger(__name__)
33+
34+
3235
@dataclass
3336
class EncoderOutput(BaseOutput):
3437
r"""
@@ -599,7 +602,7 @@ def __init__(
599602
if self.unknown_index == "extra":
600603
self.unknown_index = self.re_embed
601604
self.re_embed = self.re_embed + 1
602-
print(
605+
logger.info(
603606
f"Remapping {self.n_e} indices to {self.re_embed} indices. "
604607
f"Using {self.unknown_index} for unknown indices."
605608
)

src/diffusers/pipelines/longcat_image/pipeline_longcat_image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ def prepare_pos_ids(modality_id=0, type="text", start=(0, 0), num_token=None, he
110110
if type == "text":
111111
assert num_token
112112
if height or width:
113-
print('Warning: The parameters of height and width will be ignored in "text" type.')
113+
logger.warning('The parameters of height and width will be ignored in "text" type.')
114114
pos_ids = torch.zeros(num_token, 3)
115115
pos_ids[..., 0] = modality_id
116116
pos_ids[..., 1] = torch.arange(num_token) + start[0]
117117
pos_ids[..., 2] = torch.arange(num_token) + start[1]
118118
elif type == "image":
119119
assert height and width
120120
if num_token:
121-
print('Warning: The parameter of num_token will be ignored in "image" type.')
121+
logger.warning('The parameter of num_token will be ignored in "image" type.')
122122
pos_ids = torch.zeros(height, width, 3)
123123
pos_ids[..., 0] = modality_id
124124
pos_ids[..., 1] = pos_ids[..., 1] + torch.arange(height)[:, None] + start[0]

src/diffusers/pipelines/longcat_image/pipeline_longcat_image_edit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,15 @@ def prepare_pos_ids(modality_id=0, type="text", start=(0, 0), num_token=None, he
108108
if type == "text":
109109
assert num_token
110110
if height or width:
111-
print('Warning: The parameters of height and width will be ignored in "text" type.')
111+
logger.warning('The parameters of height and width will be ignored in "text" type.')
112112
pos_ids = torch.zeros(num_token, 3)
113113
pos_ids[..., 0] = modality_id
114114
pos_ids[..., 1] = torch.arange(num_token) + start[0]
115115
pos_ids[..., 2] = torch.arange(num_token) + start[1]
116116
elif type == "image":
117117
assert height and width
118118
if num_token:
119-
print('Warning: The parameter of num_token will be ignored in "image" type.')
119+
logger.warning('The parameter of num_token will be ignored in "image" type.')
120120
pos_ids = torch.zeros(height, width, 3)
121121
pos_ids[..., 0] = modality_id
122122
pos_ids[..., 1] = pos_ids[..., 1] + torch.arange(height)[:, None] + start[0]

src/diffusers/pipelines/wan/pipeline_wan_animate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ def prepare_prev_segment_cond_latents(
569569
latent_height = height // self.vae_scale_factor_spatial
570570
latent_width = width // self.vae_scale_factor_spatial
571571
if segment_height != height or segment_width != width:
572-
print(
572+
logger.warning(
573573
f"Interpolating prev segment cond video from ({segment_width}, {segment_height}) to ({width}, {height})"
574574
)
575575
# Perform a 4D (spatial) rather than a 5D (spatiotemporal) reshape, following the original code

0 commit comments

Comments
 (0)