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

Set weights_only in tests to avoid warnings in PyTorch 2.4 #20057

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

awaelchli
Copy link
Member

@awaelchli awaelchli commented Jul 7, 2024

What does this PR do?

PyTorch wants to flip the default of torch.load(..., weights_only=) to True in the future. In 2.4, they start raising a FutureWarning if you're not explicitly setting this argument to either True or False. This is the case in some of our tests. Since we have a strict setting that FutureWarning will fail tests, we have to set this flag now everywhere we call torch.load().

Part of #20010.

cc @Borda

@github-actions github-actions bot added fabric lightning.fabric.Fabric pl Generic label for PyTorch Lightning package labels Jul 7, 2024
@awaelchli awaelchli added tests and removed fabric lightning.fabric.Fabric pl Generic label for PyTorch Lightning package labels Jul 7, 2024
@awaelchli awaelchli added this to the 2.4 milestone Jul 7, 2024
Copy link
Contributor

github-actions bot commented Jul 7, 2024

⚡ Required checks status: All passing 🟢

Groups summary

🟢 pytorch_lightning: Tests workflow
Check ID Status
pl-cpu (macOS-13, lightning, 3.8, 2.1, oldest) success
pl-cpu (macOS-14, lightning, 3.10, 2.1) success
pl-cpu (macOS-14, lightning, 3.10, 2.2) success
pl-cpu (macOS-14, lightning, 3.10, 2.3) success
pl-cpu (ubuntu-20.04, lightning, 3.8, 2.1, oldest) success
pl-cpu (ubuntu-20.04, lightning, 3.10, 2.1) success
pl-cpu (ubuntu-20.04, lightning, 3.10, 2.2) success
pl-cpu (ubuntu-20.04, lightning, 3.10, 2.3) success
pl-cpu (windows-2022, lightning, 3.8, 2.1, oldest) success
pl-cpu (windows-2022, lightning, 3.10, 2.1) success
pl-cpu (windows-2022, lightning, 3.10, 2.2) success
pl-cpu (windows-2022, lightning, 3.10, 2.3) success
pl-cpu (macOS-14, pytorch, 3.8, 2.1) success
pl-cpu (ubuntu-20.04, pytorch, 3.8, 2.1) success
pl-cpu (windows-2022, pytorch, 3.8, 2.1) success
pl-cpu (macOS-12, pytorch, 3.11, 2.1) success
pl-cpu (ubuntu-22.04, pytorch, 3.11, 2.1) success
pl-cpu (windows-2022, pytorch, 3.11, 2.1) success

These checks are required after the changes to tests/tests_pytorch/accelerators/test_xla.py, tests/tests_pytorch/callbacks/test_early_stopping.py, tests/tests_pytorch/callbacks/test_pruning.py, tests/tests_pytorch/checkpointing/test_legacy_checkpoints.py, tests/tests_pytorch/checkpointing/test_model_checkpoint.py, tests/tests_pytorch/checkpointing/test_torch_saving.py, tests/tests_pytorch/core/test_datamodules.py, tests/tests_pytorch/core/test_metric_result_integration.py, tests/tests_pytorch/core/test_saving.py, tests/tests_pytorch/helpers/datasets.py, tests/tests_pytorch/helpers/test_datasets.py, tests/tests_pytorch/loggers/test_all.py, tests/tests_pytorch/loggers/test_logger.py, tests/tests_pytorch/loggers/test_wandb.py, tests/tests_pytorch/loops/test_loops.py, tests/tests_pytorch/models/test_hparams.py, tests/tests_pytorch/models/test_restore.py, tests/tests_pytorch/plugins/test_checkpoint_io_plugin.py, tests/tests_pytorch/strategies/test_deepspeed.py, tests/tests_pytorch/strategies/test_fsdp.py, tests/tests_pytorch/strategies/test_model_parallel_integration.py, tests/tests_pytorch/test_cli.py, tests/tests_pytorch/trainer/connectors/test_callback_connector.py, tests/tests_pytorch/trainer/test_trainer.py, tests/tests_pytorch/utilities/migration/test_migration.py, tests/tests_pytorch/utilities/migration/test_utils.py, tests/tests_pytorch/utilities/test_deepspeed_collate_checkpoint.py.

🟢 pytorch_lightning: Azure GPU
Check ID Status
pytorch-lightning (GPUs) (testing Lightning | latest) success
pytorch-lightning (GPUs) (testing PyTorch | latest) success

These checks are required after the changes to tests/tests_pytorch/accelerators/test_xla.py, tests/tests_pytorch/callbacks/test_early_stopping.py, tests/tests_pytorch/callbacks/test_pruning.py, tests/tests_pytorch/checkpointing/test_legacy_checkpoints.py, tests/tests_pytorch/checkpointing/test_model_checkpoint.py, tests/tests_pytorch/checkpointing/test_torch_saving.py, tests/tests_pytorch/core/test_datamodules.py, tests/tests_pytorch/core/test_metric_result_integration.py, tests/tests_pytorch/core/test_saving.py, tests/tests_pytorch/helpers/datasets.py, tests/tests_pytorch/helpers/test_datasets.py, tests/tests_pytorch/loggers/test_all.py, tests/tests_pytorch/loggers/test_logger.py, tests/tests_pytorch/loggers/test_wandb.py, tests/tests_pytorch/loops/test_loops.py, tests/tests_pytorch/models/test_hparams.py, tests/tests_pytorch/models/test_restore.py, tests/tests_pytorch/plugins/test_checkpoint_io_plugin.py, tests/tests_pytorch/strategies/test_deepspeed.py, tests/tests_pytorch/strategies/test_fsdp.py, tests/tests_pytorch/strategies/test_model_parallel_integration.py, tests/tests_pytorch/test_cli.py, tests/tests_pytorch/trainer/connectors/test_callback_connector.py, tests/tests_pytorch/trainer/test_trainer.py, tests/tests_pytorch/utilities/migration/test_migration.py, tests/tests_pytorch/utilities/migration/test_utils.py, tests/tests_pytorch/utilities/test_deepspeed_collate_checkpoint.py.

🟢 lightning_fabric: CPU workflow
Check ID Status
fabric-cpu (macOS-13, lightning, 3.8, 2.1, oldest) success
fabric-cpu (macOS-14, lightning, 3.11, 2.1) success
fabric-cpu (macOS-14, lightning, 3.11, 2.2) success
fabric-cpu (macOS-14, lightning, 3.10, 2.3) success
fabric-cpu (ubuntu-20.04, lightning, 3.8, 2.1, oldest) success
fabric-cpu (ubuntu-20.04, lightning, 3.11, 2.1) success
fabric-cpu (ubuntu-20.04, lightning, 3.11, 2.2) success
fabric-cpu (ubuntu-20.04, lightning, 3.11, 2.3) success
fabric-cpu (windows-2022, lightning, 3.8, 2.1, oldest) success
fabric-cpu (windows-2022, lightning, 3.11, 2.1) success
fabric-cpu (windows-2022, lightning, 3.11, 2.2) success
fabric-cpu (windows-2022, lightning, 3.11, 2.3) success
fabric-cpu (macOS-14, fabric, 3.8, 2.1) success
fabric-cpu (ubuntu-20.04, fabric, 3.8, 2.1) success
fabric-cpu (windows-2022, fabric, 3.8, 2.1) success
fabric-cpu (macOS-12, fabric, 3.11, 2.1) success
fabric-cpu (ubuntu-22.04, fabric, 3.11, 2.1) success
fabric-cpu (windows-2022, fabric, 3.11, 2.1) success

These checks are required after the changes to tests/tests_fabric/strategies/test_deepspeed_integration.py, tests/tests_fabric/strategies/test_fsdp_integration.py, tests/tests_fabric/strategies/test_model_parallel_integration.py.

🟢 lightning_fabric: Azure GPU
Check ID Status
lightning-fabric (GPUs) (testing Fabric | latest) success
lightning-fabric (GPUs) (testing Lightning | latest) success

These checks are required after the changes to tests/tests_fabric/strategies/test_deepspeed_integration.py, tests/tests_fabric/strategies/test_fsdp_integration.py, tests/tests_fabric/strategies/test_model_parallel_integration.py.


Thank you for your contribution! 💜

Note
This comment is automatically generated and updates for 60 minutes every 180 seconds. If you have any other questions, contact carmocca for help.

Copy link

codecov bot commented Jul 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90%. Comparing base (a6562b4) to head (1eff20f).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #20057   +/-   ##
=======================================
  Coverage      90%      90%           
=======================================
  Files         266      266           
  Lines       22939    22939           
=======================================
  Hits        20720    20720           
  Misses       2219     2219           

Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

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

LGTM !

@mergify mergify bot added the ready PRs ready to be merged label Jul 8, 2024
@awaelchli awaelchli merged commit 5829ef8 into master Jul 8, 2024
59 of 61 checks passed
@awaelchli awaelchli deleted the tests/weights-only branch July 8, 2024 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready PRs ready to be merged tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants