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

Adding PyTorch support in data_utils #79

Merged
merged 9 commits into from
Feb 19, 2024

Conversation

jackmiller2003
Copy link
Contributor

@jackmiller2003 jackmiller2003 commented Feb 19, 2024

In this pull request, I add the option of using PyTorch for the data_utils class. This should allow users to get out a PyTorch dataset via the load_ncdata_with_generator function.

The following changes occurred:

  1. Modification of data_utils.py where one can choose an ml_backend (currently either PyTorch or Tensorflow, defaulting to Tensorflow) which will be used in load_ncdata_with_generator and thus elsewhere in the class.
  2. Modification of setup.py where one can now set an environment variable to install PyTorch over Tensorflow. Note that one can run setup.py naively as usual and it will install Tensorflow.
  3. Creation of testing_data_utils_with_backends.py which is a small script to test that one can indeed use the backends correctly and that one can still save things to NumPy arrays.

I was also informed that a new testing framework is coming -- I am happy to do another PR at that time with proper testing. For now, I have tested the logic in data_utils.py with the script testing_data_utils_with_backends.py (including a comparison of output arrays) and the changes to setup.py via the use of different virtual environments.

Copy link
Collaborator

@jerrylin96 jerrylin96 left a comment

Choose a reason for hiding this comment

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

This looks good to me! Thanks for adding it!

@jerrylin96 jerrylin96 merged commit 6c52b96 into leap-stc:main Feb 19, 2024
1 check passed
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.

2 participants