How do you save an artificial neural network to an inert file format, not pickle?

Is there a way to use something like JSON?

Pickles are a bad idea. pickle — Python object serialization — Python 3.10.2 documentation says:

It is possible to construct malicious pickle data which will execute arbitrary code during unpickling. Never unpickle data that could have come from an untrusted source, or that could have been tampered with.

use ONNX :slight_smile:

1 Like

Fickling can be used to do rudimentary checks on pickle files from unknown sources but I’m not sure how comprehensive that is. Apparently pytorch allows exporting the model state to a “dict” format which can be serialized to JSON.

Or, ONNX can be used as mentioned previously.

Cheers.