probability icon indicating copy to clipboard operation
probability copied to clipboard

Feature Request: Serialization/deserialization for Distribution class objects

Open jcalifornia opened this issue 4 years ago • 1 comments

From here: https://groups.google.com/a/tensorflow.org/g/tfprobability/c/_9EuU3FnErY/m/cpNQENy6AQAJ

  1. Re: saving models: I think it'd be both advantageous and straightforward for us to implement setstate and getstate in Distributions, Bijectors, and DeferredTensor.

For Distributions I'm currently converting all tf.Tensor objects to numpy on getstate and then calling in setstate

variable.assign(
                    tf.cast(value, self.dtype)
                )

Don't know if you guys have a better way of doing this.

jcalifornia avatar Jan 13 '22 13:01 jcalifornia

:+1: I'd love to use the PixelCNN distribution from tfp but unfortunately it's not usable for me at the moment for lack of a model saving implementation. I don't have a fleet of GPUs at my disposal so I do model selection on a few hyperparameters and retrain the most promising one. But that requires me to save my models...

reinvantveer avatar Jul 14 '22 13:07 reinvantveer