Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Adding tests for numpy>=2 #7756

Merged
merged 11 commits into from
Nov 1, 2024
Merged

ci: Adding tests for numpy>=2 #7756

merged 11 commits into from
Nov 1, 2024

Conversation

KrishnanPrash
Copy link
Contributor

@KrishnanPrash KrishnanPrash commented Oct 30, 2024

What does the PR do?

Modifying L0_backend_python/examples/test.sh to test the python backend when numpy>=2 is installed in the environment. This is achieved by:

  • Installing updated versions of numpy>=2.0, torch==2.5.0, and torchvision==0.20.0 at the start of the subtest
  • Running through the existing subtest in L0_backend_python/examples/test.sh
  • Uninstalling numpy>=2 and re-installing numpy<2 so future subtests will still use numpy 1.x

Reason for limited scope:
Support for numpy>=2 proved to be more complicated than intended because older version of packages like torch, torchvision, and tensorflow do not support for numpy 2.x.

Related PRs:

Python Backend PR: Link

Where should the reviewer start?

  • CI Pipeline ID: 19960045

Comment on lines 44 to 46
pip3 install torch==2.5.0 -f https://download.pytorch.org/whl/torch_stable.html torchvision==0.20.0
else
pip3 install torch==2.0.0 -f https://download.pytorch.org/whl/torch_stable.html torchvision==0.15.0
pip3 install torch==2.5.0 -f https://download.pytorch.org/whl/torch_stable.html torchvision==0.20.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that the if condition installed a +cu version, and the else did not. In your change you have both if/else installing the same thing. Please either match the install pattern with the correct +cuXXX variant, or double check whether this if/else is required if not. CC @fpetrini15 who might know a bit more about the if/else split here.

Copy link
Contributor

Choose a reason for hiding this comment

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

@rmccorm4 I think this is a code segment we discussed a few months back. It seems like since Jacky has fixed my original error here; 23a6c21. I think for non-Jetson Linux tests, we want to continue installing the cuda-enabled version. That said, these tests were passing fine even with my logical error from months ago, so it's unclear to me what we achieve by installing the cuda-enabled version.

Copy link
Contributor

Choose a reason for hiding this comment

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

If this doesn't break windows/jetson, I'm happy to keep it. If it might, we could also try making the change only on the linux non-jetson block. ex:

if not jetson/windows:
  pip install numpy 2
  pip install torch 2.5
else: # if windows/jetson
  pip install numpy 1
  pip install torch 2.0
fi

Let me know if you have a preference for minimal blast radius @fpetrini15

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should align with the original intention of the script and install the cuda-enabled version.

CC @Tabrizian if you have any insight into why we preferred it originally?

Copy link
Member

Choose a reason for hiding this comment

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

I believe PyTorch with CUDA was not supported on Jetson. We also don't support GPU tensors on Jetson with Python backend so it could be related to that.

@@ -440,4 +442,7 @@ else
echo -e "\n***\n*** Example verification test FAILED.\n***"
fi

pip3 uninstall -y numpy
pip3 install "numpy<2"
Copy link
Contributor Author

@KrishnanPrash KrishnanPrash Oct 31, 2024

Choose a reason for hiding this comment

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

In L0_backend_python, the way examples/test.sh is called is along the lines of:

    setup_virtualenv

    set +e
    (cd ${TEST} && bash -ex test.sh)

    if [ $? -ne 0 ]; then
        echo "Subtest ${TEST} FAILED"
        RET=1
    fi
    set -e

    deactivate_virtualenv

So re-installing a lower version of numpy is unnecessary here because the virtualenv created for the examples subtest is not re-used for future subtests.

rmccorm4

This comment was marked as duplicate.

rmccorm4
rmccorm4 previously approved these changes Nov 1, 2024
Copy link
Contributor

@rmccorm4 rmccorm4 left a comment

Choose a reason for hiding this comment

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

LGTM but let's make sure the variants like python3.8, etc don't fail from this change. If they do, we might need to better handle which torch version is installed for each python version.

Copy link
Contributor

@krishung5 krishung5 left a comment

Choose a reason for hiding this comment

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

LGTM. +1 on adding the comment for python 3.8.

@KrishnanPrash KrishnanPrash merged commit cdefc19 into main Nov 1, 2024
3 checks passed
@KrishnanPrash KrishnanPrash deleted the kprashanth-numpy2-test branch November 1, 2024 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants