BelinskyDEV
BelinskyDEV

Reputation: 28

module 'tensorflow' has no attribute 'contrib' while

About OC: Ubuntu 16.04 LTS x86_64; GRX CUDA 10.2; cudnn ... etc.

TF: 2.1.0; Python 3.6

About the problem: When I launch module_main.py an error is displayed. When I launch it /legacy/train.py similarly, an error appears. Is it possible to fix this problem without downgrading the tensorflow version and without reinstalling the drivers? Is changing the code via a script the only way?

Logs below:

model_main.py
Traceback (most resent call last):
    File "models/research/object_detection/model_main.py", 
line 26, in <module> from object_detection import model_lib
    File "/root/ObjectDetection/models/research/object_detection/model_lib.py" 
line 27, in <module> from object_detection import eval_lib
    File "/root/ObjectDetection/models/research/object_detection/eval_util.py", 
line 40, in <module> slim = tf.contrib.slim
AttributeError: module 'tensorflow' has no attribute 'contrib'

Also using conda env thx, for some advice

Upvotes: 0

Views: 5048

Answers (1)

sdpshaw
sdpshaw

Reputation: 46

I faced the same issue. Tensorflow 2.0 has removed tf.contrib. I tried to fixed the error by changing the code. And it lead to many other error. I fixed this issue by downgrading tensorflow to 1.14.0 Run these commands on terminal: pip uninstall tensorflow pip install tensorflow==1.14.0

Upvotes: 2

Related Questions