How to encrypt in Pytorch?

I am using pytorch in real life. So I want to hide the model details. Is there any way to achieve this?

1 Like

Why are you trying to hide the model details?

I suspect OP wants to obfuscate a PyTorch model they are shipping to users. PyTorch doesn’t have any such capabilities, you may have better luck looking for general purpose obfuscator.

Yes, exactly. Is Caffe2 a solution?

Caffe2 stores it’s models in protobuf, so no.

Actually you can probably ship the model file as python bytecode instead of .py file. For example:
https://liftoff.github.io/pyminifier/

1 Like