tensorflow / models

Models and examples built with TensorFlow
Other
76.94k stars 45.79k forks source link

AttributeError: module 'tensorflow._api.v1.distribute' has no attribute 'experimental' #6466

Closed aplusc98 closed 5 years ago

aplusc98 commented 5 years ago

I'm trying to use the tensorflow models specifically resnet and I'm getting the error of "AttributeError: module 'tensorflow._api.v1.distribute' has no attribute 'experimental'" on tensorflow 1.13 and Traceback (most recent call last): File "official/resnet/cifar10_main.py", line 28, in from official.resnet import resnet_run_loop File "/home/xyz/abc/models/official/resnet/resnet_run_loop.py", line 36, in from official.utils.flags import core as flags_core File "/home/xyz/abc/models/official/utils/flags/core.py", line 30, in from official.utils.flags import _base File "/home/xyz/abc/models/official/utils/flags/_base.py", line 25, in from official.utils.logs import hooks_helper File "/home/xyz/abc/models/official/utils/logs/hooks_helper.py", line 29, in from official.utils.logs import hooks File "/home/xyz/abc/models/official/utils/logs/hooks.py", line 28, in class ExamplesPerSecondHook(tf.estimator.SessionRunHook): AttributeError: module 'tensorflow.python.estimator.estimator_lib' has no attribute 'SessionRunHook' on the versions 1.4,1.5,1.12 OS Platform and Distribution = ubuntu 18.04 TensorFlow installed from = pip3 TensorFlow version = 1.4,1.5,1.12,1.13 CUDA/cuDNN version = nil/ using cpu Exact command to reproduce = python official.resnet/cifar10_main.py python 2 and 3

tensorflowbutler commented 5 years ago

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks. What is the top-level directory of the model you are using Have I written custom code Bazel version GPU model and memory

aplusc98 commented 5 years ago

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks. What is the top-level directory of the model you are using : :/home Have I written custom code - No, using the resnet model in the official tensorflow models Bazel version - Did not build from source GPU model and memory - NIL (No GPU) :https://github.com/tensorflow/models/tree/master/official/resnet

OgiueChika commented 5 years ago

I met the same problem like you Have you solve the problem?

aplusc98 commented 5 years ago

No..could not resolve it!

OgiueChika commented 5 years ago

Oh, actually i work it out, you can get TensorFlow official models here: https://github.com/tensorflow/models/releases replace the official folder with models 1.11 then it works, you can try

aplusc98 commented 5 years ago

It worked thanks!

raikarsagar commented 5 years ago

Traceback (most recent call last): File "deep_speech.py", line 33, in from official.utils.misc import distribution_utils File "/home/iiit_admin/models/official/utils/misc/distribution_utils.py", line 28, in None: tf.distribute.experimental.CollectiveCommunication.AUTO, AttributeError: module 'tensorflow._api.v1.distribute' has no attribute 'experimental'

I checked with updating tensorflow models, not working Please suggest any way out

PooyaAlamirpour commented 5 years ago

Traceback (most recent call last): File "deep_speech.py", line 33, in from official.utils.misc import distribution_utils File "/home/iiit_admin/models/official/utils/misc/distribution_utils.py", line 28, in None: tf.distribute.experimental.CollectiveCommunication.AUTO, AttributeError: module 'tensorflow._api.v1.distribute' has no attribute 'experimental'

I checked with updating tensorflow models, not working Please suggest any way out

I have the same problem. I solved my issue by using Conda instead of PIP. Pip is easy_install package management but these tools did not meet all of our specific requirements. The main problem is that they are focused around Python, neglecting non-Python library dependencies. But Conda is a package management tool and installer that aims to do more than what pip does. I suggest you, at first install some dependencies which are mentioned in the below link:

https://mc.ai/setting-up-a-ubuntu-18-04-1-lts-system-for-deep-learning-and-scientific-computing/

and then try to test mnist which exists inner of the official model 1.11 in the below link: https://github.com/tensorflow/models/releases

khashei commented 5 years ago

Do you know any of the non-python dependencies that is missed by PIP in this case?

PooyaAlamirpour commented 5 years ago

Some files such as HDF5, MKL, LLVM, etc, which do not have a setup.py in their source code.