AttributeError: 'Model' object has no attribute 'target_tensors'
生活随笔
收集整理的這篇文章主要介紹了
AttributeError: 'Model' object has no attribute 'target_tensors'
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?使用TPU時候碰到的問題,
完整問題復現如下:
WARNING:tensorflow:Keras support is now deprecated in support of TPU Strategy. Please follow the distribution strategy guide on tensorflow.org to migrate to the 2.0 supported version. INFO:tensorflow:Querying Tensorflow master (grpc://10.94.17.170:8470) for TPU system metadata. INFO:tensorflow:Found TPU system: INFO:tensorflow:*** Num TPU Cores: 8 INFO:tensorflow:*** Num TPU Workers: 1 INFO:tensorflow:*** Num TPU Cores Per Worker: 8 INFO:tensorflow:*** Available Device: _DeviceAttributes(/job:worker/replica:0/task:0/device:CPU:0, CPU, -1, 5318427542844900690) INFO:tensorflow:*** Available Device: _DeviceAttributes(/job:worker/replica:0/task:0/device:TPU:0, TPU, 17179869184, 16868474098292505710) INFO:tensorflow:*** Available Device: _DeviceAttributes(/job:worker/replica:0/task:0/device:TPU:1, TPU, 17179869184, 7432862407376987853) INFO:tensorflow:*** Available Device: _DeviceAttributes(/job:worker/replica:0/task:0/device:TPU:2, TPU, 17179869184, 8452046943043630676) INFO:tensorflow:*** Available Device: _DeviceAttributes(/job:worker/replica:0/task:0/device:TPU:3, TPU, 17179869184, 4894794154746251569) INFO:tensorflow:*** Available Device: _DeviceAttributes(/job:worker/replica:0/task:0/device:TPU:4, TPU, 17179869184, 16242358405714188922) INFO:tensorflow:*** Available Device: _DeviceAttributes(/job:worker/replica:0/task:0/device:TPU:5, TPU, 17179869184, 15231011154896667063) INFO:tensorflow:*** Available Device: _DeviceAttributes(/job:worker/replica:0/task:0/device:TPU:6, TPU, 17179869184, 1938731572797274520) INFO:tensorflow:*** Available Device: _DeviceAttributes(/job:worker/replica:0/task:0/device:TPU:7, TPU, 17179869184, 9964760283833988398) INFO:tensorflow:*** Available Device: _DeviceAttributes(/job:worker/replica:0/task:0/device:TPU_SYSTEM:0, TPU_SYSTEM, 8589934592, 7014322032663729690) INFO:tensorflow:*** Available Device: _DeviceAttributes(/job:worker/replica:0/task:0/device:XLA_CPU:0, XLA_CPU, 17179869184, 5972651299852305070) WARNING:tensorflow:Keras support is now deprecated in support of TPU Strategy. Please follow the distribution strategy guide on tensorflow.org to migrate to the 2.0 supported version. --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-3-c61d3df0e1e3> in <module>()125 126 if __name__ == "__main__": --> 127 main(3, "tf_keras_tpu")4 frames /usr/local/lib/python3.6/dist-packages/tensorflow/contrib/tpu/python/tpu/keras_support.py in __init__(self, cpu_model, strategy)1426 self._cpu_model.sample_weight_mode,1427 self._cpu_model._compile_weighted_metrics, -> 1428 self._cpu_model.target_tensors,1429 )1430 AttributeError: 'Model' object has no attribute 'target_tensors'解決方案:
降低版本,
pip install tensorflow==1.13.1Reference:
[1]https://github.com/tensorflow/tensorflow/issues/30531
?
總結
以上是生活随笔為你收集整理的AttributeError: 'Model' object has no attribute 'target_tensors'的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: colab把数据放在content下面以
- 下一篇: TPU和GPU跑模型时间统计(持续更新中