keras-deeplab-v3-plus icon indicating copy to clipboard operation
keras-deeplab-v3-plus copied to clipboard

module 'tensorflow._api.v2.train' has no attribute 'NewCheckpointReader'

Open ZhonghuaTian opened this issue 5 years ago • 5 comments

module 'tensorflow._api.v2.train' has no attribute 'NewCheckpointReader' when I try to extract weights from previous trained model this issue happened, My tensorflow version is 2.0alpha, and cuda is 10.1.

ZhonghuaTian avatar May 05 '19 06:05 ZhonghuaTian

use previous version dataset with tensorflow 1.13 and keras 2.24 this error will not occur

shubhaminnani avatar Jun 08 '19 09:06 shubhaminnani

@shubhaminnani that answer works, but a legit solution for TensorFlow 2.0+ is still required. Does anyone know of the new syntax? I couldn't find a clear explanation in the docs but will dive deeper

sachsbl avatar Jun 15 '19 22:06 sachsbl

From looking at the TF source for v2.0.0-beta1 here it looks like this should work as a drop-in:

reader = tf.train.load_checkpoint(filename)

gafrome avatar Jun 17 '19 16:06 gafrome

I just added the fix above to my PR that upgrades this repo to TensorFlow 2.0Beta-1:

https://github.com/bonlime/keras-deeplab-v3-plus/pull/109

sachsbl avatar Jun 18 '19 17:06 sachsbl

use tf.compat.v1.train.NewCheckpointReader and it works @ZhonghuaTian

shubhaminnani avatar Jul 12 '19 08:07 shubhaminnani