Skip to content

Support numpy 2, upgrade tests to support torch 2.6 #221

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

Merged
merged 12 commits into from
Feb 2, 2025
Merged

Conversation

stes
Copy link
Member

@stes stes commented Feb 2, 2025

Numpy was pinned to 1.x before. Checking if an upgrade to 2.x is possible.

Background: The dependency was pinned in #172 due to issues with sklearn and docs building. Given the updates we made to fix new sklearn versions (#205 etc.), let's explore if we can drop the constraint by now.

New insights: PyTables is the remaining root cause preventing us from upgrading fully. This is only the issue for the pd.read_hdf function. The proposed fix is to attempt loading with pandas via pytables, but if this fails we can manually load using h5py, and then construct the pandas dataframe from there.

There are new libraries like polars coming up, but it seems like these do not have hdf support yet (https://docs.pola.rs/api/python/stable/reference/io.html).


Current status:

@cla-bot cla-bot bot added the CLA signed label Feb 2, 2025
@stes
Copy link
Member Author

stes commented Feb 2, 2025

Pytables seems to be the issue (although the issue is closed PyTables/PyTables#1172)

@MMathisLab
Copy link
Member

MMathisLab commented Feb 2, 2025

ah, pytables is a pain ... we should consider moving to polars for the future; the work around that we also need in DLC is conda install pytables ...

conda install -c conda-forge pytables==3.8.0

@stes
Copy link
Member Author

stes commented Feb 2, 2025

Related: h5py/h5py#2420 (but also closed)

@stes stes force-pushed the stes/upgrade-numpy branch from 1ccc466 to a012229 Compare February 2, 2025 20:18
@stes
Copy link
Member Author

stes commented Feb 2, 2025

Ok, good call to upgrade the test suite to pytorch 2.6 (latest), causes the following to fail

image

I will push a fix

@stes stes mentioned this pull request Feb 2, 2025
16 tasks
Copy link
Member

@MMathisLab MMathisLab left a comment

Choose a reason for hiding this comment

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

🙏✨

@stes stes force-pushed the stes/upgrade-numpy branch from 8f30768 to f082cae Compare February 2, 2025 23:24
@stes stes changed the title Drop numpy constraint Support numpy 2, upgrade tests to support torch 2.6 Feb 2, 2025
@stes stes merged commit 3100730 into main Feb 2, 2025
13 checks passed
@stes stes deleted the stes/upgrade-numpy branch February 2, 2025 23:41
CeliaBenquet pushed a commit to CeliaBenquet/CEBRA that referenced this pull request Apr 23, 2025
…trolLab#221)

* Drop numpy constraint

* Implement workaround for pytables

* better error message

* pin numpy only for python 3.9

* update dependencies

* Upgrade torch version

* Fix based on python version

* Add support for torch.load with weights_only=True

* Implement safe loading for torch models starting in torch 2.6

* Fix windows specs

* fix docstring

* Revert changes to loading logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants