-
Notifications
You must be signed in to change notification settings - Fork 30
Description
We now save models using torch.save() and torch.load(). This is the recommended way for pytorch as far as I could find: https://pytorch.org/tutorials/beginner/saving_loading_models.html#:~:text=Saving%20the%20model%27s%20state_dict%20with,recommended%20method%20for%20saving%20models.
However, this method relies on pickle which poses a security issue. This is now picked up by sonarcloud as security issue https://sonarcloud.io/project/security_hotspots?id=matchms_ms2deepscore&branch=cleaning_refactoring_232&issueStatuses=OPEN%2CCONFIRMED&sinceLeakPeriod=true&tab=code
One solution for reducing the risk would be only loading the weights (see pytorch/pytorch#52181 ), however we need the settings too, so this is not really an option unless we separately store the settings in a json file, which I don't think is ideal.
So I currently don't see a good alternative for saving and loading. @florian-huber do you know an alternative way, that is common to use for pytorch?