diff --git a/src/diffusers/models/autoencoders/vae.py b/src/diffusers/models/autoencoders/vae.py index a65bca418175..4461d1540203 100644 --- a/src/diffusers/models/autoencoders/vae.py +++ b/src/diffusers/models/autoencoders/vae.py @@ -17,7 +17,7 @@ import torch import torch.nn as nn -from ...utils import BaseOutput +from ...utils import BaseOutput, logging from ...utils.torch_utils import randn_tensor from ..activations import get_activation from ..attention_processor import SpatialNorm @@ -29,6 +29,9 @@ ) +logger = logging.get_logger(__name__) + + @dataclass class EncoderOutput(BaseOutput): r""" @@ -599,7 +602,7 @@ def __init__( if self.unknown_index == "extra": self.unknown_index = self.re_embed self.re_embed = self.re_embed + 1 - print( + logger.info( f"Remapping {self.n_e} indices to {self.re_embed} indices. " f"Using {self.unknown_index} for unknown indices." ) diff --git a/src/diffusers/pipelines/longcat_image/pipeline_longcat_image.py b/src/diffusers/pipelines/longcat_image/pipeline_longcat_image.py index 4eaa858e41c1..41ca3eb54f83 100644 --- a/src/diffusers/pipelines/longcat_image/pipeline_longcat_image.py +++ b/src/diffusers/pipelines/longcat_image/pipeline_longcat_image.py @@ -110,7 +110,7 @@ def prepare_pos_ids(modality_id=0, type="text", start=(0, 0), num_token=None, he if type == "text": assert num_token if height or width: - print('Warning: The parameters of height and width will be ignored in "text" type.') + logger.warning('The parameters of height and width will be ignored in "text" type.') pos_ids = torch.zeros(num_token, 3) pos_ids[..., 0] = modality_id pos_ids[..., 1] = torch.arange(num_token) + start[0] @@ -118,7 +118,7 @@ def prepare_pos_ids(modality_id=0, type="text", start=(0, 0), num_token=None, he elif type == "image": assert height and width if num_token: - print('Warning: The parameter of num_token will be ignored in "image" type.') + logger.warning('The parameter of num_token will be ignored in "image" type.') pos_ids = torch.zeros(height, width, 3) pos_ids[..., 0] = modality_id pos_ids[..., 1] = pos_ids[..., 1] + torch.arange(height)[:, None] + start[0] diff --git a/src/diffusers/pipelines/longcat_image/pipeline_longcat_image_edit.py b/src/diffusers/pipelines/longcat_image/pipeline_longcat_image_edit.py index 119de3946fbc..9f35bb685d9f 100644 --- a/src/diffusers/pipelines/longcat_image/pipeline_longcat_image_edit.py +++ b/src/diffusers/pipelines/longcat_image/pipeline_longcat_image_edit.py @@ -108,7 +108,7 @@ def prepare_pos_ids(modality_id=0, type="text", start=(0, 0), num_token=None, he if type == "text": assert num_token if height or width: - print('Warning: The parameters of height and width will be ignored in "text" type.') + logger.warning('The parameters of height and width will be ignored in "text" type.') pos_ids = torch.zeros(num_token, 3) pos_ids[..., 0] = modality_id pos_ids[..., 1] = torch.arange(num_token) + start[0] @@ -116,7 +116,7 @@ def prepare_pos_ids(modality_id=0, type="text", start=(0, 0), num_token=None, he elif type == "image": assert height and width if num_token: - print('Warning: The parameter of num_token will be ignored in "image" type.') + logger.warning('The parameter of num_token will be ignored in "image" type.') pos_ids = torch.zeros(height, width, 3) pos_ids[..., 0] = modality_id pos_ids[..., 1] = pos_ids[..., 1] + torch.arange(height)[:, None] + start[0] diff --git a/src/diffusers/pipelines/wan/pipeline_wan_animate.py b/src/diffusers/pipelines/wan/pipeline_wan_animate.py index 5806032c0142..a923219a7550 100644 --- a/src/diffusers/pipelines/wan/pipeline_wan_animate.py +++ b/src/diffusers/pipelines/wan/pipeline_wan_animate.py @@ -569,7 +569,7 @@ def prepare_prev_segment_cond_latents( latent_height = height // self.vae_scale_factor_spatial latent_width = width // self.vae_scale_factor_spatial if segment_height != height or segment_width != width: - print( + logger.warning( f"Interpolating prev segment cond video from ({segment_width}, {segment_height}) to ({width}, {height})" ) # Perform a 4D (spatial) rather than a 5D (spatiotemporal) reshape, following the original code