简体   繁体   中英

Attribute AttributeError: module 'tensorflow.compat.v2' has no attribute '_internal_'

Following the CARLA tutorials, I created a file to train my model; however, whenever I try to run it using Command prompt, this error shows up:

2021-06-20 19:39:30.429984: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2021-06-20 19:39:30.430242: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Using TensorFlow backend.
Traceback (most recent call last):
  File "CARtut5.py", line 10, in <module>
    from keras.applications.xception import Xception
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\_init_.py", line 12, in <module>
    from . import initializers
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\initializers\_init_.py", line 124, in <module>
    populate_deserializable_objects()
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\initializers\_init_.py", line 49, in populate_deserializable_objects
    LOCAL.GENERATED_WITH_V2 = tf._internal_.tf2.enabled()
AttributeError: module 'tensorflow.compat.v2' has no attribute '_internal_'

I tried to uninstall Keras and TensorFlow and reinstall them, but the error persists.

From comments

Try to revert to an older version of tf , that might help (paraphrased from StarShine)

Actually the above issue was due to incompatibility between latest Tensorflow version and standalone Keras . For more information you can refer here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM