Skip to content

Fix np.int deprecation causing AttributeError on NumPy 1.24+#73

Open
Mr-Neutr0n wants to merge 1 commit intoVchitect:mainfrom
Mr-Neutr0n:fix/numpy-deprecated-int-alias
Open

Fix np.int deprecation causing AttributeError on NumPy 1.24+#73
Mr-Neutr0n wants to merge 1 commit intoVchitect:mainfrom
Mr-Neutr0n:fix/numpy-deprecated-int-alias

Conversation

@Mr-Neutr0n
Copy link
Copy Markdown

Summary

  • np.int was a deprecated alias for the Python built-in int, removed in NumPy 1.24. Using it raises AttributeError: module 'numpy' has no attribute 'int'.
  • This breaks LossSecondMomentResampler (the "loss-second-moment" schedule sampler) on any modern NumPy version (>= 1.24).
  • Replaced np.int with np.int64 in both vsr/diffusion/timestep_sampler.py and interpolation/diffusion/timestep_sampler.py.

Relevant NumPy deprecation notice

np.int was a deprecated alias for the builtin int. To avoid this error in existing code, use int not np.int. (Deprecated NumPy 1.20)

https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Test plan

  • Verify LossSecondMomentResampler initializes without error on NumPy >= 1.24
  • Verify training with "loss-second-moment" schedule sampler completes normally

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant