Skip to content

Conversation

@JanuszL
Copy link
Contributor

@JanuszL JanuszL commented Dec 17, 2025

  • Removes standalone numpy>=2 package entry
  • Removes numpy<2 dependency constraints from jupyter,
    tensorflow, jaxlib, flax, and numba packages
  • Updates numba from 0.61.2 to 0.63.1

Category:

Other (e.g. Documentation, Tests, Configuration)

Description:

  • Removes standalone numpy>=2 package entry
  • Removes numpy<2 dependency constraints from jupyter,
    tensorflow, jaxlib, flax, and numba packages
  • Updates numba from 0.61.2 to 0.63.1

Additional information:

Affected modules and functionalities:

  • setup_pacakges.py

Key points relevant for the review:

  • NA

Tests:

  • Existing tests apply
    • all tests involving python
  • New tests added
    • Python tests
    • GTests
    • Benchmark
    • Other
  • N/A

Checklist

Documentation

  • Existing documentation applies
  • Documentation updated
    • Docstring
    • Doxygen
    • RST
    • Jupyter
    • Other
  • N/A

DALI team only

Requirements

  • Implements new requirements
  • Affects existing requirements
  • N/A

REQ IDs: N/A

JIRA TASK: N/A

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40348302]: BUILD STARTED

@greptile-apps
Copy link

greptile-apps bot commented Dec 17, 2025

Greptile Summary

This PR relaxes numpy version constraints to support both numpy 1.x and 2.x across the DALI codebase.

Key changes:

  • Removed standalone numpy>=2 package entry from package list
  • Removed numpy<2 dependency constraints from jupyter, tensorflow, flax, and clu packages
  • Updated numba from 0.61.2 to 0.63.1 (which supports numpy 2.x) for Python 3.10+
  • Fixed multiple test files to handle numpy 2.x behavior changes (type coercion, overflow handling, deprecated constants)
  • Added backward compatibility testing with numpy<2 to ensure both versions work

Packages still constrained to numpy<2:

  • paddlepaddle-gpu (2.6.1) - external dependency limitation
  • jax (0.4.16) - old version with comment "ToDo update to newer JAX version some day"
  • numba (0.59.1) for Python 3.9 only
  • numba-cuda (all versions) - external dependency limitation

The test fixes address numpy 2.x stricter type checking and behavioral changes around integer overflow, type coercion in array creation, and deprecated constants.

Confidence Score: 4/5

  • This PR is safe to merge with minor considerations around JAX version constraints
  • The changes are well-structured and address numpy 2.x compatibility systematically. All test fixes follow correct patterns for handling numpy 2.x behavioral changes. The backward compatibility testing is a good addition. Score reflects one potential improvement: JAX 0.4.16 still has numpy<2 constraint and there's a TODO comment suggesting it should be updated
  • Pay attention to qa/setup_packages.py - verify that keeping numpy<2 for JAX 0.4.16 is intentional given the TODO comment about updating JAX

Important Files Changed

Filename Overview
qa/setup_packages.py Removed standalone numpy>=2 package entry and numpy<2 constraints from jupyter, tensorflow, flax, clu packages; updated numba 0.61.2 to 0.63.1 with numpy<2 constraint removed
dali/test/python/operator_1/test_cast.py Fixed numpy 2.x compatibility by adding explicit float64 cast after rounding and replacing np.Infinity with np.inf
dali/test/python/operator_2/test_reduce.py Fixed overflow handling by using int64 intermediate type to prevent numpy 2.x integer overflow behavior change
qa/TL0_python-self-test-core/test_body.sh Added new test_different_numpy_versions function to verify compatibility with numpy<2 by running core pipeline tests

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant Setup as setup_packages.py
    participant Tests as Test Suite
    participant Numpy as NumPy (1.x/2.x)
    
    Dev->>Setup: Update package constraints
    Setup->>Setup: Remove standalone numpy>=2 entry
    Setup->>Setup: Remove numpy<2 from jupyter, tensorflow, flax, clu
    Setup->>Setup: Update numba 0.61.2 → 0.63.1
    Setup->>Setup: Keep numpy<2 for paddlepaddle, jax, numba-cuda
    
    Dev->>Tests: Fix numpy 2.x compatibility issues
    Tests->>Tests: Update test_cast.py (float64 cast, np.inf)
    Tests->>Tests: Update test_inflate.py (int64 intermediate)
    Tests->>Tests: Update test_python_function.py (numpy.float64)
    Tests->>Tests: Update test_reduce.py (overflow handling)
    Tests->>Tests: Update test_backend_impl.py (float intermediate)
    Tests->>Tests: Update test_random_resized_crop.py (explicit casts)
    
    Dev->>Tests: Add backward compatibility tests
    Tests->>Tests: Add test_different_numpy_versions()
    Tests->>Numpy: Install numpy<2
    Tests->>Tests: Run core pipeline tests
    Numpy-->>Tests: Verify compatibility
    
    Tests->>Numpy: Also test with numpy>=2
    Numpy-->>Tests: Verify compatibility
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Comments (1)

  1. qa/setup_packages.py, line 680-682 (link)

    style: numba 0.59.1 for Python 3.9 still has numpy<2 constraint - consider updating if this version supports numpy 2

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40356541]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40348302]: BUILD FAILED

@JanuszL JanuszL marked this pull request as draft December 17, 2025 21:05
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40394275]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40394275]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40415495]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40415495]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40432108]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40432108]: BUILD FAILED

- Removes standalone numpy>=2 package entry
- Removes numpy<2 dependency constraints from jupyter,
  tensorflow, jax, jaxlib, flax, and numba packages
- Updates numba from 0.61.2 to 0.63.1

Signed-off-by: Janusz Lisiecki <[email protected]>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40432727]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40432727]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40432727]: BUILD PASSED

@JanuszL JanuszL marked this pull request as ready for review December 18, 2025 18:21
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Comments (1)

  1. dali/test/python/operator_1/test_cast.py, line 34 (link)

    syntax: typo: "sing" should be "sign"

7 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Signed-off-by: Janusz Lisiecki <[email protected]>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40489685]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40489685]: BUILD FAILED

Signed-off-by: Janusz Lisiecki <[email protected]>
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Comments (3)

  1. qa/setup_packages.py, line 640 (link)

    logic: PR description claims to remove numpy<2 dependency constraints from jax, but the constraint remains here

  2. qa/setup_packages.py, line 619 (link)

    style: paddlepaddle-gpu still has numpy<2 constraint - verify if this should also be removed per the PR objectives

  3. qa/setup_packages.py, line 701-728 (link)

    style: numba-cuda still has numpy<2 constraints on all versions (Python 3.9 and 3.10+, CUDA 120 and 130). Verify if these should also be removed.

7 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

Signed-off-by: Janusz Lisiecki <[email protected]>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40497112]: BUILD STARTED

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Comments (2)

  1. qa/setup_packages.py, line 640 (link)

    logic: JAX 0.4.16 is incompatible with numpy 2.x - it was released before numpy 2.0 (Feb 2024 vs June 2024) and uses deprecated APIs removed in numpy 2.0 like numpy.Infinity and numpy.float_. This will break all JAX plugin tests.

    Per JAX maintainers (GitHub Issue #18779), numpy 2.0 support requires JAX 0.4.25+. Either:

    • Upgrade JAX/jaxlib to 0.4.25+ and update flax/clu constraints accordingly
    • Keep "numpy<2" in dependencies for JAX 0.4.16

    Test files that will fail: dali/test/python/jax_plugin/test_jax_operator.py

  2. qa/setup_packages.py, line 685-688 (link)

    style: The comment "Free-threaded Python build is incompatible with numpy<2" is now misleading after removing the numpy<2 constraint. If numpy 2.x is now allowed, but python_free_threaded=False blocks free-threaded builds, the constraint relationship is unclear.

    Update comment to clarify what's actually being blocked (e.g., "numba 0.63.1 free-threading support is experimental" or similar)

7 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40497490]: BUILD STARTED

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Comments (5)

  1. qa/setup_packages.py, line 640 (link)

    logic: JAX 0.4.16 was released in mid-2024, around the same time as numpy 2.0. This old version likely lacks proper numpy 2.x support and may have compatibility issues. The PR description removes numpy<2 constraints, but this specific JAX version may not be fully compatible.

    Check if JAX 0.4.16 actually supports numpy 2.x, or consider either:

    • Keeping "numpy<2" in dependencies here
    • Updating to a newer JAX version with verified numpy 2.x support
  2. qa/setup_packages.py, line 619 (link)

    logic: Paddlepaddle-gpu still has "numpy<2" constraint while the PR aims to relax numpy version constraints. This creates an inconsistency where some packages support numpy 2.x while paddlepaddle forces numpy<2.

  3. qa/setup_packages.py, line 701-708 (link)

    logic: All numba-cuda versions still have "numpy<2" constraints. This contradicts the PR's goal to relax numpy version constraints and creates dependency conflicts when other packages now allow numpy 2.x.

  4. qa/setup_packages.py, line 680 (link)

    logic: Numba 0.59.1 for Python 3.9 still has "numpy<2" constraint. This creates inconsistency where Python 3.10+ gets numba 0.63.1 with numpy 2.x support, but Python 3.9 is restricted to numpy<2.

  5. dali/test/python/operator_1/test_cast.py, line 117 (link)

    style: np.Infinity was deprecated and removed in numpy 2.x, replaced with np.inf

9 files reviewed, 5 comments

Edit Code Review Agent Settings | Greptile

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40497919]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40489685]: BUILD PASSED

@mzient mzient assigned mzient and unassigned stiepan Dec 19, 2025
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40497919]: BUILD FAILED

Signed-off-by: Janusz Lisiecki <[email protected]>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40501672]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40507599]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40501672]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40501672]: BUILD PASSED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40507599]: BUILD PASSED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [40497490]: BUILD FAILED

@JanuszL JanuszL merged commit cb65d67 into NVIDIA:main Dec 19, 2025
6 of 7 checks passed
@JanuszL JanuszL deleted the relax_numpy branch December 19, 2025 18:28
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.

5 participants