I get an error on tf.keras.Sequential
I get the following trace for the model creation code portion:
---------------------------------------------------------------------------
AlreadyExistsError Traceback (most recent call last)
<ipython-input-11-6d4ac95a1bef> in <module>
2 #Softmax to output a probability
3
----> 4 modela = tf.keras.Sequential([
5 tf.keras.layers.Conv2D(50,5,activation='relu', input_shape=(28,28,1)),
6 tf.keras.layers.MaxPooling2D(pool_size=(2,2)),
~\anaconda3\lib\site-packages\tensorflow\python\util\lazy_loader.py in __getattr__(self, item)
60
61 def __getattr__(self, item):
---> 62 module = self._load()
63 return getattr(module, item)
64
~\anaconda3\lib\site-packages\tensorflow\python\util\lazy_loader.py in _load(self)
43 """Load the module and insert it into the parent's globals."""
44 # Import the target module and insert it into the parent's namespace
---> 45 module = importlib.import_module(self.__name__)
46 self._parent_module_globals[self._local_name] = module
47
~\anaconda3\lib\importlib\__init__.py in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
128
129
~\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _load_unlocked(spec)
~\anaconda3\lib\importlib\_bootstrap_external.py in exec_module(self, module)
~\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\site-packages\keras\__init__.py in <module>
23
24 # See b/110718070#comment18 for more details about this import.
---> 25 from keras import models
26
27 from keras.engine.input_layer import Input
~\anaconda3\lib\site-packages\keras\models.py in <module>
18 import tensorflow.compat.v2 as tf
19 from keras import backend
---> 20 from keras import metrics as metrics_module
21 from keras import optimizer_v1
22 from keras.engine import functional
~\anaconda3\lib\site-packages\keras\metrics.py in <module>
24
25 import numpy as np
---> 26 from keras import activations
27 from keras import backend
28 from keras.engine import base_layer
~\anaconda3\lib\site-packages\keras\activations.py in <module>
18
19 from keras import backend
---> 20 from keras.layers import advanced_activations
21 from keras.utils.generic_utils import deserialize_keras_object
22 from keras.utils.generic_utils import serialize_keras_object
~\anaconda3\lib\site-packages\keras\layers\__init__.py in <module>
21
22 # Generic layers.
---> 23 from keras.engine.input_layer import Input
24 from keras.engine.input_layer import InputLayer
25 from keras.engine.input_spec import InputSpec
~\anaconda3\lib\site-packages\keras\engine\input_layer.py in <module>
19 from keras import backend
20 from keras.distribute import distributed_training_utils
---> 21 from keras.engine import base_layer
22 from keras.engine import keras_tensor
23 from keras.engine import node as node_module
~\anaconda3\lib\site-packages\keras\engine\base_layer.py in <module>
41 from keras.engine import node as node_module
42 from keras.mixed_precision import autocast_variable
---> 43 from keras.mixed_precision import loss_scale_optimizer
44 from keras.mixed_precision import policy
45 from keras.saving.saved_model import layer_serialization
~\anaconda3\lib\site-packages\keras\mixed_precision\loss_scale_optimizer.py in <module>
16
17 from keras import backend
---> 18 from keras import optimizers
19 from keras.mixed_precision import loss_scale as keras_loss_scale_module
20 from keras.optimizer_v2 import optimizer_v2
~\anaconda3\lib\site-packages\keras\optimizers.py in <module>
24 from keras.optimizer_v1 import Optimizer
25 from keras.optimizer_v1 import TFOptimizer
---> 26 from keras.optimizer_v2 import adadelta as adadelta_v2
27 from keras.optimizer_v2 import adagrad as adagrad_v2
28 from keras.optimizer_v2 import adam as adam_v2
~\anaconda3\lib\site-packages\keras\optimizer_v2\adadelta.py in <module>
20 import numpy as np
21 from keras import backend_config
---> 22 from keras.optimizer_v2 import optimizer_v2
23 from tensorflow.python.util.tf_export import keras_export
24
~\anaconda3\lib\site-packages\keras\optimizer_v2\optimizer_v2.py in <module>
34
35
---> 36 keras_optimizers_gauge = tf.__internal__.monitoring.BoolGauge(
37 "/tensorflow/api/keras/optimizers", "keras optimizer usage", "method")
38
~\anaconda3\lib\site-packages\tensorflow\python\eager\monitoring.py in __init__(self, name, description, *labels)
358 *labels: The label list of the new metric.
359 """
--> 360 super(BoolGauge, self).__init__('BoolGauge', _bool_gauge_methods,
361 len(labels), name, description, *labels)
362
~\anaconda3\lib\site-packages\tensorflow\python\eager\monitoring.py in __init__(self, metric_name, metric_methods, label_length, *args)
133 self._metric_name, len(self._metric_methods)))
134
--> 135 self._metric = self._metric_methods[self._label_length].create(*args)
136
137 def __del__(self):
AlreadyExistsError: Another metric with the same name already exists.
---------------------------------------------------------------------------
AlreadyExistsError Traceback (most recent call last)
<ipython-input-11-6d4ac95a1bef> in <module>
2 #Softmax to output a probability
3
----> 4 modela = tf.keras.Sequential([
5 tf.keras.layers.Conv2D(50,5,activation='relu', input_shape=(28,28,1)),
6 tf.keras.layers.MaxPooling2D(pool_size=(2,2)),
~\anaconda3\lib\site-packages\tensorflow\python\util\lazy_loader.py in __getattr__(self, item)
60
61 def __getattr__(self, item):
---> 62 module = self._load()
63 return getattr(module, item)
64
~\anaconda3\lib\site-packages\tensorflow\python\util\lazy_loader.py in _load(self)
43 """Load the module and insert it into the parent's globals."""
44 # Import the target module and insert it into the parent's namespace
---> 45 module = importlib.import_module(self.__name__)
46 self._parent_module_globals[self._local_name] = module
47
~\anaconda3\lib\importlib\__init__.py in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
128
129
~\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _load_unlocked(spec)
~\anaconda3\lib\importlib\_bootstrap_external.py in exec_module(self, module)
~\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\site-packages\keras\__init__.py in <module>
23
24 # See b/110718070#comment18 for more details about this import.
---> 25 from keras import models
26
27 from keras.engine.input_layer import Input
~\anaconda3\lib\site-packages\keras\models.py in <module>
18 import tensorflow.compat.v2 as tf
19 from keras import backend
---> 20 from keras import metrics as metrics_module
21 from keras import optimizer_v1
22 from keras.engine import functional
~\anaconda3\lib\site-packages\keras\metrics.py in <module>
24
25 import numpy as np
---> 26 from keras import activations
27 from keras import backend
28 from keras.engine import base_layer
~\anaconda3\lib\site-packages\keras\activations.py in <module>
18
19 from keras import backend
---> 20 from keras.layers import advanced_activations
21 from keras.utils.generic_utils import deserialize_keras_object
22 from keras.utils.generic_utils import serialize_keras_object
~\anaconda3\lib\site-packages\keras\layers\__init__.py in <module>
21
22 # Generic layers.
---> 23 from keras.engine.input_layer import Input
24 from keras.engine.input_layer import InputLayer
25 from keras.engine.input_spec import InputSpec
~\anaconda3\lib\site-packages\keras\engine\input_layer.py in <module>
19 from keras import backend
20 from keras.distribute import distributed_training_utils
---> 21 from keras.engine import base_layer
22 from keras.engine import keras_tensor
23 from keras.engine import node as node_module
~\anaconda3\lib\site-packages\keras\engine\base_layer.py in <module>
41 from keras.engine import node as node_module
42 from keras.mixed_precision import autocast_variable
---> 43 from keras.mixed_precision import loss_scale_optimizer
44 from keras.mixed_precision import policy
45 from keras.saving.saved_model import layer_serialization
~\anaconda3\lib\site-packages\keras\mixed_precision\loss_scale_optimizer.py in <module>
16
17 from keras import backend
---> 18 from keras import optimizers
19 from keras.mixed_precision import loss_scale as keras_loss_scale_module
20 from keras.optimizer_v2 import optimizer_v2
~\anaconda3\lib\site-packages\keras\optimizers.py in <module>
24 from keras.optimizer_v1 import Optimizer
25 from keras.optimizer_v1 import TFOptimizer
---> 26 from keras.optimizer_v2 import adadelta as adadelta_v2
27 from keras.optimizer_v2 import adagrad as adagrad_v2
28 from keras.optimizer_v2 import adam as adam_v2
~\anaconda3\lib\site-packages\keras\optimizer_v2\adadelta.py in <module>
20 import numpy as np
21 from keras import backend_config
---> 22 from keras.optimizer_v2 import optimizer_v2
23 from tensorflow.python.util.tf_export import keras_export
24
~\anaconda3\lib\site-packages\keras\optimizer_v2\optimizer_v2.py in <module>
34
35
---> 36 keras_optimizers_gauge = tf.__internal__.monitoring.BoolGauge(
37 "/tensorflow/api/keras/optimizers", "keras optimizer usage", "method")
38
~\anaconda3\lib\site-packages\tensorflow\python\eager\monitoring.py in __init__(self, name, description, *labels)
358 *labels: The label list of the new metric.
359 """
--> 360 super(BoolGauge, self).__init__('BoolGauge', _bool_gauge_methods,
361 len(labels), name, description, *labels)
362
~\anaconda3\lib\site-packages\tensorflow\python\eager\monitoring.py in __init__(self, metric_name, metric_methods, label_length, *args)
133 self._metric_name, len(self._metric_methods)))
134
--> 135 self._metric = self._metric_methods[self._label_length].create(*args)
136
137 def __del__(self):
AlreadyExistsError: Another metric with the same name already exists.
---------------------------------------------------------------------------
AlreadyExistsError Traceback (most recent call last)
<ipython-input-11-6d4ac95a1bef> in <module>
2 #Softmax to output a probability
3
----> 4 modela = tf.keras.Sequential([
5 tf.keras.layers.Conv2D(50,5,activation='relu', input_shape=(28,28,1)),
6 tf.keras.layers.MaxPooling2D(pool_size=(2,2)),
~\anaconda3\lib\site-packages\tensorflow\python\util\lazy_loader.py in __getattr__(self, item)
60
61 def __getattr__(self, item):
---> 62 module = self._load()
63 return getattr(module, item)
64
~\anaconda3\lib\site-packages\tensorflow\python\util\lazy_loader.py in _load(self)
43 """Load the module and insert it into the parent's globals."""
44 # Import the target module and insert it into the parent's namespace
---> 45 module = importlib.import_module(self.__name__)
46 self._parent_module_globals[self._local_name] = module
47
~\anaconda3\lib\importlib\__init__.py in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
128
129
~\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _load_unlocked(spec)
~\anaconda3\lib\importlib\_bootstrap_external.py in exec_module(self, module)
~\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\site-packages\keras\__init__.py in <module>
23
24 # See b/110718070#comment18 for more details about this import.
---> 25 from keras import models
26
27 from keras.engine.input_layer import Input
~\anaconda3\lib\site-packages\keras\models.py in <module>
18 import tensorflow.compat.v2 as tf
19 from keras import backend
---> 20 from keras import metrics as metrics_module
21 from keras import optimizer_v1
22 from keras.engine import functional
~\anaconda3\lib\site-packages\keras\metrics.py in <module>
24
25 import numpy as np
---> 26 from keras import activations
27 from keras import backend
28 from keras.engine import base_layer
~\anaconda3\lib\site-packages\keras\activations.py in <module>
18
19 from keras import backend
---> 20 from keras.layers import advanced_activations
21 from keras.utils.generic_utils import deserialize_keras_object
22 from keras.utils.generic_utils import serialize_keras_object
~\anaconda3\lib\site-packages\keras\layers\__init__.py in <module>
21
22 # Generic layers.
---> 23 from keras.engine.input_layer import Input
24 from keras.engine.input_layer import InputLayer
25 from keras.engine.input_spec import InputSpec
~\anaconda3\lib\site-packages\keras\engine\input_layer.py in <module>
19 from keras import backend
20 from keras.distribute import distributed_training_utils
---> 21 from keras.engine import base_layer
22 from keras.engine import keras_tensor
23 from keras.engine import node as node_module
~\anaconda3\lib\site-packages\keras\engine\base_layer.py in <module>
41 from keras.engine import node as node_module
42 from keras.mixed_precision import autocast_variable
---> 43 from keras.mixed_precision import loss_scale_optimizer
44 from keras.mixed_precision import policy
45 from keras.saving.saved_model import layer_serialization
~\anaconda3\lib\site-packages\keras\mixed_precision\loss_scale_optimizer.py in <module>
16
17 from keras import backend
---> 18 from keras import optimizers
19 from keras.mixed_precision import loss_scale as keras_loss_scale_module
20 from keras.optimizer_v2 import optimizer_v2
~\anaconda3\lib\site-packages\keras\optimizers.py in <module>
24 from keras.optimizer_v1 import Optimizer
25 from keras.optimizer_v1 import TFOptimizer
---> 26 from keras.optimizer_v2 import adadelta as adadelta_v2
27 from keras.optimizer_v2 import adagrad as adagrad_v2
28 from keras.optimizer_v2 import adam as adam_v2
~\anaconda3\lib\site-packages\keras\optimizer_v2\adadelta.py in <module>
20 import numpy as np
21 from keras import backend_config
---> 22 from keras.optimizer_v2 import optimizer_v2
23 from tensorflow.python.util.tf_export import keras_export
24
~\anaconda3\lib\site-packages\keras\optimizer_v2\optimizer_v2.py in <module>
34
35
---> 36 keras_optimizers_gauge = tf.__internal__.monitoring.BoolGauge(
37 "/tensorflow/api/keras/optimizers", "keras optimizer usage", "method")
38
~\anaconda3\lib\site-packages\tensorflow\python\eager\monitoring.py in __init__(self, name, description, *labels)
358 *labels: The label list of the new metric.
359 """
--> 360 super(BoolGauge, self).__init__('BoolGauge', _bool_gauge_methods,
361 len(labels), name, description, *labels)
362
~\anaconda3\lib\site-packages\tensorflow\python\eager\monitoring.py in __init__(self, metric_name, metric_methods, label_length, *args)
133 self._metric_name, len(self._metric_methods)))
134
--> 135 self._metric = self._metric_methods[self._label_length].create(*args)
136
137 def __del__(self):
AlreadyExistsError: Another metric with the same name already exists.
---------------------------------------------------------------------------
AlreadyExistsError Traceback (most recent call last)
<ipython-input-11-6d4ac95a1bef> in <module>
2 #Softmax to output a probability
3
----> 4 modela = tf.keras.Sequential([
5 tf.keras.layers.Conv2D(50,5,activation='relu', input_shape=(28,28,1)),
6 tf.keras.layers.MaxPooling2D(pool_size=(2,2)),
~\anaconda3\lib\site-packages\tensorflow\python\util\lazy_loader.py in __getattr__(self, item)
60
61 def __getattr__(self, item):
---> 62 module = self._load()
63 return getattr(module, item)
64
~\anaconda3\lib\site-packages\tensorflow\python\util\lazy_loader.py in _load(self)
43 """Load the module and insert it into the parent's globals."""
44 # Import the target module and insert it into the parent's namespace
---> 45 module = importlib.import_module(self.__name__)
46 self._parent_module_globals[self._local_name] = module
47
~\anaconda3\lib\importlib\__init__.py in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
128
129
~\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _load_unlocked(spec)
~\anaconda3\lib\importlib\_bootstrap_external.py in exec_module(self, module)
~\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\site-packages\keras\__init__.py in <module>
23
24 # See b/110718070#comment18 for more details about this import.
---> 25 from keras import models
26
27 from keras.engine.input_layer import Input
~\anaconda3\lib\site-packages\keras\models.py in <module>
18 import tensorflow.compat.v2 as tf
19 from keras import backend
---> 20 from keras import metrics as metrics_module
21 from keras import optimizer_v1
22 from keras.engine import functional
~\anaconda3\lib\site-packages\keras\metrics.py in <module>
24
25 import numpy as np
---> 26 from keras import activations
27 from keras import backend
28 from keras.engine import base_layer
~\anaconda3\lib\site-packages\keras\activations.py in <module>
18
19 from keras import backend
---> 20 from keras.layers import advanced_activations
21 from keras.utils.generic_utils import deserialize_keras_object
22 from keras.utils.generic_utils import serialize_keras_object
~\anaconda3\lib\site-packages\keras\layers\__init__.py in <module>
21
22 # Generic layers.
---> 23 from keras.engine.input_layer import Input
24 from keras.engine.input_layer import InputLayer
25 from keras.engine.input_spec import InputSpec
~\anaconda3\lib\site-packages\keras\engine\input_layer.py in <module>
19 from keras import backend
20 from keras.distribute import distributed_training_utils
---> 21 from keras.engine import base_layer
22 from keras.engine import keras_tensor
23 from keras.engine import node as node_module
~\anaconda3\lib\site-packages\keras\engine\base_layer.py in <module>
41 from keras.engine import node as node_module
42 from keras.mixed_precision import autocast_variable
---> 43 from keras.mixed_precision import loss_scale_optimizer
44 from keras.mixed_precision import policy
45 from keras.saving.saved_model import layer_serialization
~\anaconda3\lib\site-packages\keras\mixed_precision\loss_scale_optimizer.py in <module>
16
17 from keras import backend
---> 18 from keras import optimizers
19 from keras.mixed_precision import loss_scale as keras_loss_scale_module
20 from keras.optimizer_v2 import optimizer_v2
~\anaconda3\lib\site-packages\keras\optimizers.py in <module>
24 from keras.optimizer_v1 import Optimizer
25 from keras.optimizer_v1 import TFOptimizer
---> 26 from keras.optimizer_v2 import adadelta as adadelta_v2
27 from keras.optimizer_v2 import adagrad as adagrad_v2
28 from keras.optimizer_v2 import adam as adam_v2
~\anaconda3\lib\site-packages\keras\optimizer_v2\adadelta.py in <module>
20 import numpy as np
21 from keras import backend_config
---> 22 from keras.optimizer_v2 import optimizer_v2
23 from tensorflow.python.util.tf_export import keras_export
24
~\anaconda3\lib\site-packages\keras\optimizer_v2\optimizer_v2.py in <module>
34
35
---> 36 keras_optimizers_gauge = tf.__internal__.monitoring.BoolGauge(
37 "/tensorflow/api/keras/optimizers", "keras optimizer usage", "method")
38
~\anaconda3\lib\site-packages\tensorflow\python\eager\monitoring.py in __init__(self, name, description, *labels)
358 *labels: The label list of the new metric.
359 """
--> 360 super(BoolGauge, self).__init__('BoolGauge', _bool_gauge_methods,
361 len(labels), name, description, *labels)
362
~\anaconda3\lib\site-packages\tensorflow\python\eager\monitoring.py in __init__(self, metric_name, metric_methods, label_length, *args)
133 self._metric_name, len(self._metric_methods)))
134
--> 135 self._metric = self._metric_methods[self._label_length].create(*args)
136
137 def __del__(self):
AlreadyExistsError: Another metric with the same name already exists.
---------------------------------------------------------------------------
AlreadyExistsError Traceback (most recent call last)
<ipython-input-11-6d4ac95a1bef> in <module>
2 #Softmax to output a probability
3
----> 4 modela = tf.keras.Sequential([
5 tf.keras.layers.Conv2D(50,5,activation='relu', input_shape=(28,28,1)),
6 tf.keras.layers.MaxPooling2D(pool_size=(2,2)),
~\anaconda3\lib\site-packages\tensorflow\python\util\lazy_loader.py in __getattr__(self, item)
60
61 def __getattr__(self, item):
---> 62 module = self._load()
63 return getattr(module, item)
64
~\anaconda3\lib\site-packages\tensorflow\python\util\lazy_loader.py in _load(self)
43 """Load the module and insert it into the parent's globals."""
44 # Import the target module and insert it into the parent's namespace
---> 45 module = importlib.import_module(self.__name__)
46 self._parent_module_globals[self._local_name] = module
47
~\anaconda3\lib\importlib\__init__.py in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
128
129
~\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\anaconda3\lib\importlib\_bootstrap.py in _load_unlocked(spec)
~\anaconda3\lib\importlib\_bootstrap_external.py in exec_module(self, module)
~\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\anaconda3\lib\site-packages\keras\__init__.py in <module>
23
24 # See b/110718070#comment18 for more details about this import.
---> 25 from keras import models
26
27 from keras.engine.input_layer import Input
~\anaconda3\lib\site-packages\keras\models.py in <module>
18 import tensorflow.compat.v2 as tf
19 from keras import backend
---> 20 from keras import metrics as metrics_module
21 from keras import optimizer_v1
22 from keras.engine import functional
~\anaconda3\lib\site-packages\keras\metrics.py in <module>
24
25 import numpy as np
---> 26 from keras import activations
27 from keras import backend
28 from keras.engine import base_layer
~\anaconda3\lib\site-packages\keras\activations.py in <module>
18
19 from keras import backend
---> 20 from keras.layers import advanced_activations
21 from keras.utils.generic_utils import deserialize_keras_object
22 from keras.utils.generic_utils import serialize_keras_object
~\anaconda3\lib\site-packages\keras\layers\__init__.py in <module>
21
22 # Generic layers.
---> 23 from keras.engine.input_layer import Input
24 from keras.engine.input_layer import InputLayer
25 from keras.engine.input_spec import InputSpec
~\anaconda3\lib\site-packages\keras\engine\input_layer.py in <module>
19 from keras import backend
20 from keras.distribute import distributed_training_utils
---> 21 from keras.engine import base_layer
22 from keras.engine import keras_tensor
23 from keras.engine import node as node_module
~\anaconda3\lib\site-packages\keras\engine\base_layer.py in <module>
41 from keras.engine import node as node_module
42 from keras.mixed_precision import autocast_variable
---> 43 from keras.mixed_precision import loss_scale_optimizer
44 from keras.mixed_precision import policy
45 from keras.saving.saved_model import layer_serialization
~\anaconda3\lib\site-packages\keras\mixed_precision\loss_scale_optimizer.py in <module>
16
17 from keras import backend
---> 18 from keras import optimizers
19 from keras.mixed_precision import loss_scale as keras_loss_scale_module
20 from keras.optimizer_v2 import optimizer_v2
~\anaconda3\lib\site-packages\keras\optimizers.py in <module>
24 from keras.optimizer_v1 import Optimizer
25 from keras.optimizer_v1 import TFOptimizer
---> 26 from keras.optimizer_v2 import adadelta as adadelta_v2
27 from keras.optimizer_v2 import adagrad as adagrad_v2
28 from keras.optimizer_v2 import adam as adam_v2
~\anaconda3\lib\site-packages\keras\optimizer_v2\adadelta.py in <module>
20 import numpy as np
21 from keras import backend_config
---> 22 from keras.optimizer_v2 import optimizer_v2
23 from tensorflow.python.util.tf_export import keras_export
24
~\anaconda3\lib\site-packages\keras\optimizer_v2\optimizer_v2.py in <module>
34
35
---> 36 keras_optimizers_gauge = tf.__internal__.monitoring.BoolGauge(
37 "/tensorflow/api/keras/optimizers", "keras optimizer usage", "method")
38
~\anaconda3\lib\site-packages\tensorflow\python\eager\monitoring.py in __init__(self, name, description, *labels)
358 *labels: The label list of the new metric.
359 """
--> 360 super(BoolGauge, self).__init__('BoolGauge', _bool_gauge_methods,
361 len(labels), name, description, *labels)
362
~\anaconda3\lib\site-packages\tensorflow\python\eager\monitoring.py in __init__(self, metric_name, metric_methods, label_length, *args)
133 self._metric_name, len(self._metric_methods)))
134
--> 135 self._metric = self._metric_methods[self._label_length].create(*args)
136
137 def __del__(self):
AlreadyExistsError: Another metric with the same name already exists.
In [ ]:
modela.summary(line_
1 answers ( 0 marked as helpful)
The solution was to check the version of keras installed - apparently it can conflict with the Python version
This did the trick for me:
pip install keras~=2.6.0