Skip to content

Fixed failing tests on pytorch nightly using torch.load#3299

Merged
vfdev-5 merged 2 commits intomasterfrom
fix-tests-torch-load
Nov 7, 2024
Merged

Fixed failing tests on pytorch nightly using torch.load#3299
vfdev-5 merged 2 commits intomasterfrom
fix-tests-torch-load

Conversation

@vfdev-5
Copy link
Copy Markdown
Collaborator

@vfdev-5 vfdev-5 commented Nov 7, 2024

Description:

  • Fixed failing tests on pytorch nightly using torch.load

Ref: https://github.com/pytorch/ignite/actions/runs/11437373312/job/32648411373

=========================== short test summary info ============================
FAILED tests/ignite/engine/test_deterministic.py::test_gradients_on_resume_cpu - _pickle.UnpicklingError: Weights only load failed. This file can still be loaded, to do so you have two options, do those steps only if you trust the source of the checkpoint. 
	(1) Re-running `torch.load` with `weights_only` set to `False` will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.
	(2) Alternatively, to load with `weights_only=True` please check the recommended steps in the following error message.
	WeightsUnpickler error: Unsupported global: GLOBAL numpy.core.multiarray._reconstruct was not an allowed global by default. Please use `torch.serialization.add_safe_globals([_reconstruct])` or the `torch.serialization.safe_globals([_reconstruct])` context manager to allowlist this global if you trust this class/function.

Check the documentation of torch.load to learn more about types accepted by default with weights_only https://pytorch.org/docs/stable/generated/torch.load.html.
FAILED tests/ignite/handlers/test_state_param_scheduler.py::test_torch_save_load - _pickle.UnpicklingError: Weights only load failed. This file can still be loaded, to do so you have two options, do those steps only if you trust the source of the checkpoint. 
	(1) Re-running `torch.load` with `weights_only` set to `False` will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.
	(2) Alternatively, to load with `weights_only=True` please check the recommended steps in the following error message.
	WeightsUnpickler error: Unsupported global: GLOBAL ignite.handlers.state_param_scheduler.LambdaStateScheduler was not an allowed global by default. Please use `torch.serialization.add_safe_globals([LambdaStateScheduler])` or the `torch.serialization.safe_globals([LambdaStateScheduler])` context manager to allowlist this global if you trust this class/function.

Check the documentation of torch.load to learn more about types accepted by default with weights_only https://pytorch.org/docs/stable/generated/torch.load.html.

@vfdev-5 vfdev-5 force-pushed the fix-tests-torch-load branch from c50b777 to 61b67bb Compare November 7, 2024 11:32
@vfdev-5 vfdev-5 merged commit 0d8b8a1 into master Nov 7, 2024
@vfdev-5 vfdev-5 deleted the fix-tests-torch-load branch November 7, 2024 14:03
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.

1 participant