una-dinosauria/3d-pose-baseline

AttributeError: module 'tensorflow' has no attribute 'layers'

YuktiADY opened this issue · 2 comments

I found this issue was raised before (149) and the fix was given to add

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()

after adding this i get this error:

stack trace of error:
2023-01-02 11:09:24.344243: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX512F FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-01-02 11:09:24.593698: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1934] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
Creating 2 bi-layers of 1024 units.
Traceback (most recent call last):
File "src/predict_3dpose.py", line 528, in
tf.compat.v1.app.run()
File "/home/yukti/anaconda3/lib/python3.7/site-packages/tensorflow/python/platform/app.py", line 36, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "/home/yukti/anaconda3/lib/python3.7/site-packages/absl/app.py", line 308, in run
_run_main(main, args)
File "/home/yukti/anaconda3/lib/python3.7/site-packages/absl/app.py", line 254, in _run_main
sys.exit(main(argv))
File "src/predict_3dpose.py", line 525, in main
train()
File "src/predict_3dpose.py", line 165, in train
model = create_model( sess, actions, FLAGS.batch_size )
File "src/predict_3dpose.py", line 103, in create_model
dtype=tf.float16 if FLAGS.use_fp16 else tf.float32)
File "/home/yukti/3d-pose-baseline/src/linear_model.py", line 106, in init
y3 = tf.layers.batch_normalization(y3,training=self.isTraining, name="batch_normalization")
AttributeError: module 'tensorflow' has no attribute 'layers'

Please let me know how to fix this .

I guess its version issue but I again tried to install tf 1.0.0 i get this below error.

ERROR: Could not find a version that satisfies the requirement tensorflow==1.0.0 (from versions: 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0rc0, 2.6.0rc1, 2.6.0rc2, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.7.0rc0, 2.7.0rc1, 2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.7.4, 2.8.0rc0, 2.8.0rc1, 2.8.0, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2, 2.9.0, 2.9.1, 2.9.2, 2.9.3, 2.10.0rc0, 2.10.0rc1, 2.10.0rc2, 2.10.0rc3, 2.10.0, 2.10.1, 2.11.0rc0, 2.11.0rc1, 2.11.0rc2, 2.11.0)
ERROR: No matching distribution found for tensorflow==1.0.0

The problem was the TF1.0 is not compatible with python 3.8.