tensorflow / tensorflow/probability

FFJORD Trace Computation during Training vs. Evaluation

Open
#1,192 0 comments 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

After training the model in the FFJORD demo: https://www.tensorflow.org/probability/examples/FFJORD_Demo, I use a checkpoint manager to save and load:

solver = tfp.math.ode.DormandPrince(atol=1e-5)
ode_solve_fn = solver.solve
trace_augmentation_fn = tfb.ffjord.trace_jacobian_hutchinson

bijectors = []

for _ in range(STACKED_FFJORDS):
  mlp_model = MLP_ODE(NUM_HIDDEN, NUM_LAYERS, NUM_OUTPUT)
  next_ffjord = tfb.FFJORD(
      state_time_derivative_fn=mlp_model,ode_solve_fn=ode_solve_fn,
      trace_augmentation_fn=trace_augmentation_fn)
  bijectors.append(next_ffjord)

stacked_ffjord = tfb.Chain(bijectors[::-1])
transformed_distribution = tfd.TransformedDistribution(
    distribution=base_distribution, bijector=stacked_ffjord)



learning_rate = tf.Variable(LR, trainable=False)
optimizer = tf.keras.optimizers.Adam(learning_rate)
checkpoint = tf.train.Checkpoint(step=tf.Variable(1),optimizer=optimizer, model=transformed_distribution)
manager = tf.train.CheckpointManager(
                checkpoint, directory="./models/", max_to_keep=5)

I would like to change the trace computation after training to use tfb.ffjord.trace_jacobian_exact instead of Hutchinson, but I can't load the model if I change the trace. Any ideas on how to do this?

Thanks

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

Start with the FFJORD demo and the checkpoint construction shown in the issue. Compare loading behavior when using trace_jacobian_hutchinson versus trace_jacobian_exact, then verify that a checkpoint created during training can be restored after the trace function is changed for evaluation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.