# Deep copying PyTorch modules

**URL:** <https://discuss.pytorch.org/t/deep-copying-pytorch-modules/13514>\
**Category:** Uncategorized\
**Created:** [February 10, 2018, 12:08am UTC](https://discuss.pytorch.org/t/deep-copying-pytorch-modules/13514 "2018-02-10T00:08:50Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jpeg729](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/jpeg729/32/3464_2.png) [@jpeg729](https://discuss.pytorch.org/u/jpeg729)\
**Post date:** [February 10, 2018, 7:18am UTC](https://discuss.pytorch.org/t/deep-copying-pytorch-modules/13514/2 "2018-02-10T07:18:29Z")

</div>

If I had to deep copy a model, I would do something like this…

```auto
model_copy = type(mymodel)() # get a new instance
model_copy.load_state_dict(mymodel.state_dict()) # copy weights and stuff

```

I can’t see how that would help you “save it somewhere else in a database”. I assume you have read the [docs on serialising models](http://pytorch.org/docs/0.3.0/notes/serialization.html) and the recommendations and warnings on that page.

---

_[View the full topic](https://discuss.pytorch.org/t/deep-copying-pytorch-modules/13514)._
