ST-P3
ST-P3 copied to clipboard
Migrate Codebase to Latest PyTorch Lightning and NumPy
Description:
This PR updates the project to be compatible with the latest version of PyTorch Lightning and NumPy. The key changes include:
-
Remove Deprecated
compute_on_step
Argument from Metrics:- Updated metric classes to remove the deprecated
compute_on_step
argument, ensuring they work correctly with the latest TorchMetrics and PyTorch Lightning. - Refactored metric initialization and handling to follow current best practices.
- Updated metric classes to remove the deprecated
-
Replace Deprecated
np.int
Usage:- Replaced the deprecated use of
np.int
with the appropriate integer type, ensuring compatibility with newer versions of NumPy.
- Replaced the deprecated use of
-
Update Hyperparameter Handling in
TrainingModule
:- Refactored the
TrainingModule
class to useself.save_hyperparameters()
for managing hyperparameters, replacing the direct assignment ofself.hparams
. This aligns with the latest PyTorch Lightning guidelines and prevents potential errors.
- Refactored the
-
Migrate Classes to the Latest PyTorch Lightning:
- Updated several classes and methods to be compatible with the latest PyTorch Lightning API, ensuring smooth operation and future-proofing the codebase.
-
Add
requirements.txt
to Specify Project Dependencies:- Introduced a
requirements.txt
file to clearly define and manage the project's dependencies.
- Introduced a
Testing:
These changes have been tested and confirmed to work within containers based on the nvcr.io/nvidia/pytorch:24.07-py3
image. This ensures compatibility and smooth integration in the specified environment.