dopamine icon indicating copy to clipboard operation
dopamine copied to clipboard

How to load checkpoint as an independent TF/Keras model for utilizing?

Open xinghua-qu opened this issue 4 years ago • 1 comments

Hi,

Is there any example code about how to load the checkpoint (https://github.com/google/dopamine/tree/master/docs#downloads) that can be utilized independently? For instance, I use openAI gym to create an environment and utilize your checkpoint model to predict actions.

Many thanks and stay safe.

xinghua-qu avatar May 14 '20 02:05 xinghua-qu

I've been working on the same thing. Try this, changing the paths and the "24" (the iteration checkpoint to use) as necessary:

import tensorflow.compat.v1 as tf
with tf.Session() as sess:
    saver = tf.train.import_meta_graph('{path/to/base/dir}/checkpoints/tf_ckpt-24.meta', clear_devices=True)
    saver.restore(sess, tf.train.latest_checkpoint('{path/to/base/dir}/checkpoints'))

Using Dopamine is my first trial-by-fire with Tensorflow, so I'm not sure of meaningful next steps yet after opening the session, but hopefully this first step can help you some.

nhewitt99 avatar Jul 28 '20 18:07 nhewitt99