From 448436549a491ef01f1a251d079abe61634509e3 Mon Sep 17 00:00:00 2001 From: Mr-Neutr0n <64578610+Mr-Neutr0n@users.noreply.github.com> Date: Thu, 12 Feb 2026 00:05:30 +0530 Subject: [PATCH] Fix np.int deprecation causing AttributeError on NumPy 1.24+ np.int was a deprecated alias for the Python built-in int. It was deprecated in NumPy 1.20 and removed in NumPy 1.24, causing an AttributeError when using the LossSecondMomentResampler (i.e., the "loss-second-moment" schedule sampler) on any modern NumPy version. Replace np.int with np.int64 in both vsr and interpolation timestep samplers. --- interpolation/diffusion/timestep_sampler.py | 2 +- vsr/diffusion/timestep_sampler.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/interpolation/diffusion/timestep_sampler.py b/interpolation/diffusion/timestep_sampler.py index a3f36984..072bdbab 100644 --- a/interpolation/diffusion/timestep_sampler.py +++ b/interpolation/diffusion/timestep_sampler.py @@ -125,7 +125,7 @@ def __init__(self, diffusion, history_per_term=10, uniform_prob=0.001): self._loss_history = np.zeros( [diffusion.num_timesteps, history_per_term], dtype=np.float64 ) - self._loss_counts = np.zeros([diffusion.num_timesteps], dtype=np.int) + self._loss_counts = np.zeros([diffusion.num_timesteps], dtype=np.int64) def weights(self): if not self._warmed_up(): diff --git a/vsr/diffusion/timestep_sampler.py b/vsr/diffusion/timestep_sampler.py index a3f36984..072bdbab 100644 --- a/vsr/diffusion/timestep_sampler.py +++ b/vsr/diffusion/timestep_sampler.py @@ -125,7 +125,7 @@ def __init__(self, diffusion, history_per_term=10, uniform_prob=0.001): self._loss_history = np.zeros( [diffusion.num_timesteps, history_per_term], dtype=np.float64 ) - self._loss_counts = np.zeros([diffusion.num_timesteps], dtype=np.int) + self._loss_counts = np.zeros([diffusion.num_timesteps], dtype=np.int64) def weights(self): if not self._warmed_up():