experimental-design / bofire

Experimental design and (multi-objective) bayesian optimization.
https://experimental-design.github.io/bofire/
BSD 3-Clause "New" or "Revised" License
207 stars 22 forks source link

Use weights_only for load #429

Open kit1980 opened 3 weeks ago

kit1980 commented 3 weeks ago

torch.load without weights_only parameter is unsafe. Explicitly set weights_only to False only if you trust the data you load and full pickle functionality is needed, otherwise set weights_only=True.

If weights_only=True doesn't work for some cases, then explicit weights_only=False should be used.

Found with https://github.com/pytorch-labs/torchfix/

kit1980 commented 3 weeks ago

I ended up specifying weights_only=False in both places, as otherwise the tests fail. This is still valuable as in a future PyTorch release weights_only will default to True, so the tests will break if weights_only is not set explicitly.

Ideally investigation is needed if the full pickle functionality is logically required there, and if it's possible to change the code to make weights_only=True work.