tensorflow / tensorflow/probability

Feature Request: Serialization/deserialization for Distribution class objects

Open
#1,494 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
4.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named. Start by reviewing the Distribution, Bijector, and DeferredTensor classes and the proposed getstate and setstate hooks, including tensor-to-NumPy conversion and variable.assign behavior. Done means these class objects can be serialized and restored reliably.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.