# Save RNN model's cell and hidden state

**URL:** <https://discuss.ray.io/t/save-rnn-models-cell-and-hidden-state/4207>\
**Category:** RLlib\
**Created:** [November 22, 2021, 4:59pm UTC](https://discuss.ray.io/t/save-rnn-models-cell-and-hidden-state/4207 "2021-11-22T16:59:24Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Lars\_Simon\_Zehnder](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/lars_simon_zehnder/32/1185_2.png) [@Lars\_Simon\_Zehnder](https://discuss.ray.io/u/Lars_Simon_Zehnder)\
**Post date:** [November 22, 2021, 7:56pm UTC](https://discuss.ray.io/t/save-rnn-models-cell-and-hidden-state/4207/2 "2021-11-22T19:56:13Z")

</div>

Hi @klausk55 ,

this is correct the cell state and hidden state do not get stored by `trainer.save()`. A way to get your states stored is by using RLlib’s `Offline API`. Just add a file path to the parameter `output` in your trainer `config` and it stores all sample batches therein you get the `state_out_0` and `state_out_1` which should be your hidden and cell state.

Hope this helps

---

_[View the full topic](https://discuss.ray.io/t/save-rnn-models-cell-and-hidden-state/4207)._
