clipper icon indicating copy to clipboard operation
clipper copied to clipboard

Why not use torch.save(model, PATH) to serialize the entire model?

Open wnagchenghku opened this issue 7 years ago • 3 comments

Hi, in https://github.com/ucbrise/clipper/blob/develop/clipper_admin/clipper_admin/deployers/pytorch.py#L201, I found clipper serializes the model and weight separately using cloudpickle and torch.save(the_model.state_dict(), PATH). I'm curious why does clipper do this serialization separately? From https://pytorch.org/docs/stable/notes/serialization.html, pytorch can actually serialize the entire model in one step. I tested that loading the entire model using torch.load is much much much faster than cloudpickle.

wnagchenghku avatar Sep 08 '18 19:09 wnagchenghku

@simon-mo @withsmilo Any thought?

rkooo567 avatar May 28 '19 05:05 rkooo567

We should. Can you submit a PR?

simon-mo avatar May 28 '19 05:05 simon-mo

@simon-mo Yep sounds good. I will wait for the author for a couple days and start if he doesn't respond.

@wnagchenghku Would you want to create a PR for this?

rkooo567 avatar May 28 '19 05:05 rkooo567