From e148dded6f8ffa8c6d060065ce31e39828afd067 Mon Sep 17 00:00:00 2001 From: Pierre Colle Date: Wed, 23 Oct 2024 14:31:53 +0000 Subject: [PATCH] latent_diffusion.solver: fix assert msg --- src/refiners/foundationals/latent_diffusion/solvers/ddim.py | 2 +- src/refiners/foundationals/latent_diffusion/solvers/dpm.py | 2 +- src/refiners/foundationals/latent_diffusion/solvers/euler.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/refiners/foundationals/latent_diffusion/solvers/ddim.py b/src/refiners/foundationals/latent_diffusion/solvers/ddim.py index 77423de64..5f6c576fc 100644 --- a/src/refiners/foundationals/latent_diffusion/solvers/ddim.py +++ b/src/refiners/foundationals/latent_diffusion/solvers/ddim.py @@ -65,7 +65,7 @@ def __call__(self, x: Tensor, predicted_noise: Tensor, step: int, generator: Gen Returns: The denoised version of the input data `x`. """ - assert self.first_inference_step <= step < self.num_inference_steps, "invalid step {step}" + assert self.first_inference_step <= step < self.num_inference_steps, f"invalid step {step}" timestep, previous_timestep = ( self.timesteps[step], diff --git a/src/refiners/foundationals/latent_diffusion/solvers/dpm.py b/src/refiners/foundationals/latent_diffusion/solvers/dpm.py index b2296dc51..01caf3dff 100644 --- a/src/refiners/foundationals/latent_diffusion/solvers/dpm.py +++ b/src/refiners/foundationals/latent_diffusion/solvers/dpm.py @@ -308,7 +308,7 @@ def __call__( Returns: The denoised version of the input data `x`. """ - assert self.first_inference_step <= step < self.num_inference_steps, "invalid step {step}" + assert self.first_inference_step <= step < self.num_inference_steps, f"invalid step {step}" scale_factor = self.cumulative_scale_factors[step] noise_ratio = self.noise_std[step] diff --git a/src/refiners/foundationals/latent_diffusion/solvers/euler.py b/src/refiners/foundationals/latent_diffusion/solvers/euler.py index 1f2aa7cf4..4945a225e 100644 --- a/src/refiners/foundationals/latent_diffusion/solvers/euler.py +++ b/src/refiners/foundationals/latent_diffusion/solvers/euler.py @@ -89,7 +89,7 @@ def __call__(self, x: Tensor, predicted_noise: Tensor, step: int, generator: Gen Returns: The denoised version of the input data `x`. """ - assert self.first_inference_step <= step < self.num_inference_steps, "invalid step {step}" + assert self.first_inference_step <= step < self.num_inference_steps, f"invalid step {step}" if self.params.model_prediction_type == ModelPredictionType.SAMPLE: x0 = predicted_noise # the model does not actually predict the noise but x0