Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'tensorflow' has no attribute 'contrib' #9

Open
Humphreybas opened this issue Feb 19, 2021 · 1 comment
Open

Comments

@Humphreybas
Copy link

followed the instruction for installation but bumped into this error when running train.py

$ python3 train.py
2021-02-19 23:20:37.098330: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
2021-02-19 23:20:37.098358: 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.
Traceback (most recent call last):
  File "train.py", line 8, in <module>
    from model import DeepLab
  File ".../DeepLab-V3/model.py", line 6, in <module>
    from feature_extractor import MobileNet, Resnet, Vgg16
  File ".../DeepLab-V3/feature_extractor.py", line 2, in <module>
    from nets import resnet_v2
  File ".../DeepLab-V3/nets/resnet_v2.py", line 55, in <module>
    from nets import resnet_utils
  File ".../DeepLab-V3/nets/resnet_utils.py", line 43, in <module>
    slim = tf.contrib.slim
AttributeError: module 'tensorflow' has no attribute 'contrib'

I found some possible solutions here but couldn't figure it out..

@Humphreybas
Copy link
Author

Ok I tried this command:

tf_upgrade_v2 \
  --intree DeepLab-V3/ \
  --outtree DeepLab-V3_tf2/ \
  --reportfile report.txt

But still got the same error when running training.py in the converted folder.

So I tried to downgrade tensorflow to 1.x:
pip3 install tensorflow==1.15
pip gave me some errors about dependencies, so maybe I should have recreated my virtualenv completely with tensorflow==1.15 from the beginning instead of downgrading what was already installed.

But I run train.py anyway to see if it would work and it is running right now. So let's see if it finishes without problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant