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

ImportError: cannot import name 'backend' #1058

Open zhangzhen999 opened 6 years ago

zhangzhen999 commented 6 years ago

Description

ImportError: cannot import name 'backend'

environment

OS: ubuntu16.04+ python3.6.5+cuda9.0+cudnn7.0+tensorflow1.5

$ pip freeze | grep tensor
# your output here
tensor2tensor==1.9.0
tensorboard==1.10.0
tensorflow==1.5.0
tensorflow-gpu==1.10.1
tensorflow-hub==0.1.1
tensorflow-tensorboard==1.5.1

$ python -V
# your output here
```Python 3.6.5 :: Anaconda, Inc.

when I run this command:
t2t-trainer --registry_help

# Error logs:
...Traceback (most recent call last):
  File "/home/zhao/anaconda3/envs/tensorflow/bin/t2t-trainer", line 23, in <module>
    from tensor2tensor.bin import t2t_trainer
  File "/home/zhao/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensor2tensor/bin/t2t_trainer.py", line 23, in <module>
    from tensor2tensor import models  # pylint: disable=unused-import
  File "/home/zhao/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensor2tensor/models/__init__.py", line 21, in <module>
    from tensor2tensor.layers import modalities  # pylint: disable=g-import-not-at-top
  File "/home/zhao/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensor2tensor/layers/modalities.py", line 21, in <module>
    from tensor2tensor.layers import common_layers
  File "/home/zhao/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensor2tensor/layers/common_layers.py", line 30, in <module>
    import tensorflow as tf
  File "/home/zhao/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/__init__.py", line 22, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/home/zhao/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 81, in <module>
    from tensorflow.python import keras
  File "/home/zhao/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/keras/__init__.py", line 25, in <module>
    from tensorflow.python.keras import applications
  File "/home/zhao/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/keras/applications/__init__.py", line 24, in <module>
    from tensorflow.python.keras.applications.inception_resnet_v2 import InceptionResNetV2
  File "/home/zhao/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/keras/applications/inception_resnet_v2/__init__.py", line 21, in <module>
    from tensorflow.python.keras._impl.keras.applications.inception_resnet_v2 import decode_predictions
  File "/home/zhao/anaconda3/envs/tensorflow/lib/python3.6/site-packages/tensorflow/python/keras/_impl/keras/applications/inception_resnet_v2.py", line 28, in <module>
    from tensorflow.python.keras._impl.keras import backend as K
ImportError: cannot import name 'backend'

Thanks !

aasharma90 commented 5 years ago

Were you able to find a solution for this problem?

Thanks!