I’m following this tutorial:

  
      

      TensorFlow
  

  
    

TensorFlow Addons Networks : Sequence-to-Sequence NMT with Attention Mechanism



  

  
    
    
  

  


in which the encoder, decoder and optimiser are “checkpointed”. When I try to restore the checkpoint as follows:
encoder = Encoder(NUM_WORDS, EMBEDDING_DIM, UNITS, BATCH_SIZE)

decoder = Decoder(NUM_WORDS, 431, EMBEDDING_DIM, UNITS, BATCH_SIZE,
                  'luong')

optimiser = tf.keras.optimizers.Adam()

checkpoint = tf.train.Checkpoint(optimiser=optimiser,
                                 encoder=encoder,
                                 decoder=decoder)

checkpoint.restore(tf.train.latest_checkpoint(checkpoint_dirpath)).assert_consumed()

I have the following error:
AssertionError("Unresolved object in checkpoint {}: {}"
AssertionError: Unresolved object in checkpoint (root).optimiser.iter: attributes {
  name: "VARIABLE_VALUE"
  full_name: "Adam/iter"
  checkpoint_key: "optimiser/iter/.ATTRIBUTES/VARIABLE_VALUE"

Without assert_consumed(), I have no error but encoder, decoder and optimiser are empty, and in doing so, not “checkpointed”.
I tried the solution proposed here:

  

      stackoverflow.com
  

  
      
    
  


  TF2.0: Translation model: Error when restoring the saved model: Unresolved object in checkpoint (root).optimizer.iter: attributes 7



  python-3.x, tensorflow, nlp, tensorflow2.0



  asked by
  
  
    Hackerds
  
  on 03:17PM - 08 Oct 19 UTC


  

  
    
    
  

  


without success.
Thank you in advance for your help.