gpt4 book ai didi

python-3.x - 已存在另一个同名指标

转载 作者:行者123 更新时间:2023-12-05 08:25:03 24 4
gpt4 key购买 nike

我对这段代码有疑问:

from tensorflow.keras.models import Sequential

并得到了这个错误:

Traceback (most recent call last):
File "K:\test.py", line 1, in <module>
from tensorflow.keras.models import Sequential
File "G:\Program Files\Python37\lib\site-packages\keras\api\_v2\keras\__init__.py", line 10, in <module>
from keras import __version__
File "G:\Program Files\Python37\lib\site-packages\keras\__init__.py", line 25, in <module>
from keras import models
File "G:\Program Files\Python37\lib\site-packages\keras\models.py", line 20, in <module>
from keras import metrics as metrics_module
File "G:\Program Files\Python37\lib\site-packages\keras\metrics.py", line 26, in <module>
from keras import activations
File "G:\Program Files\Python37\lib\site-packages\keras\activations.py", line 20, in <module>
from keras.layers import advanced_activations
File "G:\Program Files\Python37\lib\site-packages\keras\layers\__init__.py", line 23, in <module>
from keras.engine.input_layer import Input
File "G:\Program Files\Python37\lib\site-packages\keras\engine\input_layer.py", line 21, in <module>
from keras.engine import base_layer
File "G:\Program Files\Python37\lib\site-packages\keras\engine\base_layer.py", line 43, in <module>
from keras.mixed_precision import loss_scale_optimizer
File "G:\Program Files\Python37\lib\site-packages\keras\mixed_precision\loss_scale_optimizer.py", line 18, in <module>
from keras import optimizers
File "G:\Program Files\Python37\lib\site-packages\keras\optimizers.py", line 26, in <module>
from keras.optimizer_v2 import adadelta as adadelta_v2
File "G:\Program Files\Python37\lib\site-packages\keras\optimizer_v2\adadelta.py", line 22, in <module>
from keras.optimizer_v2 import optimizer_v2
File "G:\Program Files\Python37\lib\site-packages\keras\optimizer_v2\optimizer_v2.py", line 37, in <module>
"/tensorflow/api/keras/optimizers", "keras optimizer usage", "method")
File "G:\Program Files\Python37\lib\site-packages\tensorflow\python\eager\monitoring.py", line 361, in __init__
len(labels), name, description, *labels)
File "G:\Program Files\Python37\lib\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

我见过 this post并没有明白

的意思

never import twice

最佳答案

你可以通过将 Keras 版本降级到 2.6.0 来解决这个问题,即使您只安装了 TensorFlow,它也会将 Keras==2.7.1 安装为部分依赖项。简单来说就是这个版本差异导致的错误。
IPython 内核 或在事件环境中,
pip install keras==2.6.0在部署环境中,比如 docker,
requirements.txt 的最后一行添加 keras==2.6.0 行。

关于python-3.x - 已存在另一个同名指标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68970841/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com