tensorflow / benchmarks

A benchmark framework for Tensorflow
Apache License 2.0
1.14k stars 632 forks source link

OP_REQUIRES failed at save_restore_v2_ops.cc:205 : Not found: Key grouping/TCN/res_0_1/layer_normalization_1/beta not found in checkpoint #515

Closed sekigh closed 3 years ago

sekigh commented 3 years ago

I had the error such as:

OP_REQUIRES failed at save_restore_v2_ops.cc:205 : Not found: Key grouping/TCN/res_0_1/layer_normalization_1/beta not found in checkpoint

when I am on the way to upgrade deep-casa codes from tensorflow 1.5.0 to tensorflow 2.4.1 and ran my deep-casa modified code with tf.compat.v1.disable_v2_behavior(), by referencing to "Migrate your TensorFlow 1 code to TensorFlow 2" in https://www.tensorflow.org/guide/migrate. Do you suggest how to workaround this problem?

Specifically, this error came out at executing tf.compat.v1.train.Saver.restore() in training on tensorflow 2.4.1 with GPU enabled by resuming model pretrained on 1.5.0 as follows:

saver = tf.compat.v1.train.Saver(max_to_keep = None) saver.restore(sess, os.getcwd()+"/exp/"+FLAGS.exp_name+"/models/"+FLAGS.time_stamp+'/'+FLAGS.exp_name+"_model.ckpt" + "step"+ str(step))

The original tensorflow 1.5.0 based deep-casa codes were downloaded from github(https://github.com/yuzhou-git/deep-casa) and ran sccessfully with GPU enabled.

One particular code change I made, relevant to the above error message, is to substitute tf.contrib.layers.layer_norm() with tf.keras.layers.LayerNormalization, like as follows;

layer_norm = tf.keras.layers.LayerNormalization() X1_NEW = layer_norm(X1_NEW)

I wonder if the usage of tf.keras.layers.LayerNormalization might be problem. I also try to disable option: beta is disabled by setting center=False but it gave me the same error.

end of statement