How to convert pytorch weights to bytes and back?

I want to convert the weights to bytes and transfer it using zeroMQ socket and after recieving at other end again want to convert it in original form so that the model can use it.

The weights are of the form <class “collections.OrderedDict”> and i am not able to convert it into bytes and further.
Can someone help me with this??