0

The error mentioned in the title is happening due to the call

FLAGS = tf.app.flags.FLAGS

There are multiple questions related to this:

How could I solve the flags=tensorflow.app.flags error

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

It can be learned that it is error caused due to the change in Tensorflow version. But, I don't want to downgrade the Tensorflow version as mentioned in almost all answers since it is causing further error in the code I want to run.

The answer provided here suggested the following solution

from absl import app

if __name__ == '__main__':
    
    app.run(main)

But, it is not working.

Is there any way to modify mode without downgrading Tensorflow version?

hanugm
  • 1,127
  • 3
  • 13
  • 44

1 Answers1

1

you can still use version 1.x features without downgrading by adding below two lines to your code.

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

FLAGS = tf.app.flags.FLAGS