# Unable to save native torch model for a model implemented under ray.rllib.algorithms.\*

**URL:** https://discuss.ray.io/t/unable-to-save-native-torch-model-for-a-model-implemented-under-ray-rllib-algorithms/12178
**Category:** RLlib
**Created:** [September 19, 2023, 10:33am UTC](https://discuss.ray.io/t/unable-to-save-native-torch-model-for-a-model-implemented-under-ray-rllib-algorithms/12178 "2023-09-19T10:33:03Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![karstenddwx](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/karstenddwx/32/2548_2.png) [@karstenddwx](https://discuss.ray.io/u/karstenddwx)
#### Post date: [September 19, 2023, 10:33am UTC](https://discuss.ray.io/t/unable-to-save-native-torch-model-for-a-model-implemented-under-ray-rllib-algorithms/12178/1 "2023-09-19T10:33:03Z")

</div>

**How severe does this issue affect your experience of using Ray?**

- Medium: It contributes to significant difficulty to complete my task, but I can work around it.

Pickling of native torch model fails when saving for a ray.rllib.algorithms.\* model implementation.  
RLLIB error message: “”“Could not save torch model under self[TorchPolicy].model!  
This is most likely due to the fact that you are using an Algorithm that  
uses a Catalog-generated TorchModelV2 subclass, which is torch.save() cannot pickle.  
“””  
What is the recommended way of saving a native torch model for e.g. ray.rllib.algorithms.dqn.dqn\_torch\_model, which is not implemented under ray.rllib.models.\* ?

---

<div class="post-metadata">

### Author: ![dbk80](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/dbk80/32/1822_2.png) [@dbk80](https://discuss.ray.io/u/dbk80)
#### Post date: [December 1, 2023, 10:19am UTC](https://discuss.ray.io/t/unable-to-save-native-torch-model-for-a-model-implemented-under-ray-rllib-algorithms/12178/2 "2023-12-01T10:19:01Z")

</div>

I have a similar problem. Were you able to solve it?

---

<div class="post-metadata">

### Author: ![karstenddwx](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/karstenddwx/32/2548_2.png) [@karstenddwx](https://discuss.ray.io/u/karstenddwx)
#### Post date: [December 1, 2023, 3:24pm UTC](https://discuss.ray.io/t/unable-to-save-native-torch-model-for-a-model-implemented-under-ray-rllib-algorithms/12178/3 "2023-12-01T15:24:01Z")

</div>

No, I’ve used tensorflow native models instead.
