Generate a binary output from a serialized script module

I want to generate a binary output file from a serialized script module stored in a .pt file, no matter be in either python or c++. Can you guys help me ?