from keras import models File "/usr/local/python3/lib/python3.7/site-packages/keras/mo_tensorfl">
当前位置:   article > 正文

Tensorflow问题_tensorflow生成的v2文件是啥

tensorflow生成的v2文件是啥

Tensorflow问题

1、Another metric with the same name already exists

File "/usr/local/python3/lib/python3.7/site-packages/keras/__init__.py", line 25, in <module>
    from keras import models
  File "/usr/local/python3/lib/python3.7/site-packages/keras/models.py", line 20, in <module>
    from keras import metrics as metrics_module
  File "/usr/local/python3/lib/python3.7/site-packages/keras/metrics.py", line 26, in <module>
    from keras import activations
  File "/usr/local/python3/lib/python3.7/site-packages/keras/activations.py", line 20, in <module>
    from keras.layers import advanced_activations
  File "/usr/local/python3/lib/python3.7/site-packages/keras/layers/__init__.py", line 23, in <module>
    from keras.engine.input_layer import Input
  File "/usr/local/python3/lib/python3.7/site-packages/keras/engine/input_layer.py", line 21, in <module>
    from keras.engine import base_layer
  File "/usr/local/python3/lib/python3.7/site-packages/keras/engine/base_layer.py", line 43, in <module>
    from keras.mixed_precision import loss_scale_optimizer
  File "/usr/local/python3/lib/python3.7/site-packages/keras/mixed_precision/loss_scale_optimizer.py", line 18, in <module>
    from keras import optimizers
  File "/usr/local/python3/lib/python3.7/site-packages/keras/optimizers.py", line 26, in <module>
    from keras.optimizer_v2 import adadelta as adadelta_v2
  File "/usr/local/python3/lib/python3.7/site-packages/keras/optimizer_v2/adadelta.py", line 22, in <module>
    from keras.optimizer_v2 import optimizer_v2
  File "/usr/local/python3/lib/python3.7/site-packages/keras/optimizer_v2/optimizer_v2.py", line 37, in <module>
    "/tensorflow/api/keras/optimizers", "keras optimizer usage", "method")
  File "/usr/local/python3/lib/python3.7/site-packages/tensorflow/python/eager/monitoring.py", line 361, in __init__
    len(labels), name, description, *labels)
  File "/usr/local/python3/lib/python3.7/site-packages/tensorflow/python/eager/monitoring.py", line 135, in __init__
    self._metric = self._metric_methods[self._label_length].create(*args)
tensorflow.python.framework.errors_impl.AlreadyExistsError: Another metric with the same name already exists.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27

Tensorflow版本是2.6.1,keras版本是2.7
Tensorflow2.6 的发行说明中,Keras 被拆分为单独的 PIP 包(keras),其代码已移至 GitHub 存储库 keras-team/keras。tf.keras 的 API 端点保持不变,但现在由 keras PIP 包支持。tensorflow/python/keras 中的现有代码是一个陈旧的副本,将在未来版本 (2.7) 中删除。请删除对 tensorflow.python.keras 的任何导入,并将它们替换为公共 tf.keras API。

解决方案:pip install keras==2.6.0

参考:https://stackoverflow.com/questions/58012741/error-importing-tensorflow-alreadyexistserror-another-metric-with-the-same-nam

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/552352
推荐阅读
相关标签
  

闽ICP备14008679号