I am working with autoencoders. My checkpoint contains the complete state of the network (i.e. the encoder, decoder, optimizer, etc). I want to fool around with the encodings. Therefore, I would only need the decoder part of the network in my evaluation mode.
How can I read only a few specific variables from the existing checkpoint, so that I can reuse their values in another model?
If you want to get all the trainable variables, you can get all of them inside of a list using tf. trainable_variables method.
ModelCheckpoint callback is used in conjunction with training using model. fit() to save a model or weights (in a checkpoint file) at some interval, so the model or weights can be loaded later to continue the training from the state saved.
You can view the saved variables in .ckpt file using,
import tensorflow as tf
variables_in_checkpoint = tf.train.list_variables('path.ckpt')
print("Variables found in checkpoint file",variables_in_checkpoint)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With