tensorflow / tensor2tensor

Library of deep learning models and datasets designed to make deep learning more accessible and accelerate ML research.
Apache License 2.0
15.5k stars 3.49k forks source link

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

Open newmluser opened 5 years ago

newmluser commented 5 years ago

Description

Error when importing problems. ...

Environment information

OS:  Windows10
$ pip freeze | grep tensor
mesh-tensorflow==0.0.5
tensor2tensor==1.14.0
tensor2tensor==1.14.0
tensorboard==1.14.0
tensorflow==2.0.0b1
tensorflow-datasets==1.2.0
tensorflow-estimator==1.14.0
tensorflow-gan==1.0.0.dev0
tensorflow-metadata==0.14.0
tensorflow-probability==0.7.0

python -V
Python 3.7.3```

### For bugs: reproduction and error logs

Steps to reproduce:

from tensor2tensor import problems Traceback (most recent call last): File "", line 1, in File "C:\Users\Anaconda3\lib\site-packages\tensor2tensor\problems.py", line 22, in from tensor2tensor.utils import registry File "C:\Users\Anaconda3\lib\site-packages\tensor2tensor\ut

I want to execute the given example program given.

Error logs:

...

newmluser commented 5 years ago

Can anyone help me , how I can see the problems() available,


from tensor2tensor import problems
problems.available()

Its giving Error from tensor2tensor import problems Traceback (most recent call last): File "", line 1, in File "C:\Users\Anaconda3\lib\site-packages\tensor2tensor\problems.py", line 22, in from tensor2tensor.utils import registry File "C:\Users\Anaconda3\lib\site-packages\tensor2tensor\utils\registry.py", line 551, in attacks = tf.contrib.framework.deprecated(None, "Use registry.attack")(attack) AttributeError: module 'tensorflow' has no attribute 'contrib'

DzakirinMD commented 4 years ago

i pray for your success in finding the solution

DzakirinMD commented 4 years ago

i've noticed that your tf version is tensorflow==2.0.0b1. please note that as of TF 2.0 the contrib is not available anymore.

current workaround for me is to install older version of TF. for me TF 1.15.0 works the best for now.

reference: https://github.com/tensorflow/community/pull/18 , https://github.com/tensorflow/models/issues/7036

Hamza5 commented 4 years ago

TF 2.0 is the latest official version now, yet tensor2tensor seems to not support it!