1

I have a PyTorch model that I am trying to integrate federated learning for. In order to do this, I need to send the model weights back and forth between a server and a client. When I get the size of the model weights, it is approximately 6kb, but when I dill/pickle it to send over the network, it ends up being ~65mb, which takes a very long time, especially since this send/receive must be done for many rounds of training. I realize that there is always going to be extra overhead when serializing python objects, but is there a way I might be able to compress the weights further or use a different datastructure to transfer the model weights back and forth?

I tried dill.dumps(self.network.state_dict()), which results in a ~64mb string that must be transferred over internet, which is too large. I'ved tried compression via lzma and blosc, but they yield little compression.

ditty
  • 11
  • 1
  • I'm not sure if it will be smaller, but people typically use torch.save() instead of dill.dumps() for PyTorch model weights. – jtb Feb 23 '23 at 20:00

0 Answers0