Why can't I train model in Rasa with a version higher than 2.8.8?

Dear all,

I have created a new Rasa project with version 2.8.8, and below, and they worked fine. But the higher version does not work on my system (Windows 10). It can run without any error, but I couldn’t train the model. I could simply go with the old version of Rasa, but I want to keep up to date with all technologies in common.

Below I have pasted the issue and additional information. Thank you.

Training an initial model...
2021-11-08 11:22:37.602263: E tensorflow/core/lib/monitoring/collection_registry.cc:77] Cannot register 2 metrics with the same name: /tensorflow/api/keras/optimizers
Traceback (most recent call last):
  File "C:\Users\user\anaconda3\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\user\anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\user\Desktop\tasf\env\Scripts\rasa.exe\__main__.py", line 7, in <module>
  File "c:\users\user\desktop\tasf\env\lib\site-packages\rasa\__main__.py", line 118, in main
    cmdline_arguments.func(cmdline_arguments)
  File "c:\users\user\desktop\tasf\env\lib\site-packages\rasa\cli\scaffold.py", line 235, in run
    init_project(args, path)
  File "c:\users\user\desktop\tasf\env\lib\site-packages\rasa\cli\scaffold.py", line 130, in init_project
    print_train_or_instructions(args, path)
  File "c:\users\user\desktop\tasf\env\lib\site-packages\rasa\cli\scaffold.py", line 69, in print_train_or_instructions
    training_result = rasa.train(domain, config, training_files, output)
  File "c:\users\user\desktop\tasf\env\lib\site-packages\rasa\api.py", line 106, in train
    from rasa.model_training import train_async
  File "c:\users\user\desktop\tasf\env\lib\site-packages\rasa\model_training.py", line 22, in <module>
    from rasa.nlu.model import Interpreter
  File "c:\users\user\desktop\tasf\env\lib\site-packages\rasa\nlu\model.py", line 14, in <module>
    from rasa.nlu import components, utils
  File "c:\users\user\desktop\tasf\env\lib\site-packages\rasa\nlu\components.py", line 7, in <module>
    import rasa.utils.train_utils
  File "c:\users\user\desktop\tasf\env\lib\site-packages\rasa\utils\train_utils.py", line 39, in <module>
    from rasa.utils.tensorflow.callback import RasaTrainingLogger, RasaModelCheckpoint
  File "c:\users\user\desktop\tasf\env\lib\site-packages\rasa\utils\tensorflow\callback.py", line 13, in <module>
    class RasaTrainingLogger(tf.keras.callbacks.Callback):
  File "c:\users\user\desktop\tasf\env\lib\site-packages\tensorflow\python\util\lazy_loader.py", line 62, in __getattr__
    module = self._load()
  File "c:\users\user\desktop\tasf\env\lib\site-packages\tensorflow\python\util\lazy_loader.py", line 45, in _load
    module = importlib.import_module(self.__name__)
  File "C:\Users\user\anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "c:\users\user\desktop\tasf\env\lib\site-packages\keras\__init__.py", line 25, in <module>
    from keras import models
  File "c:\users\user\desktop\tasf\env\lib\site-packages\keras\models.py", line 20, in <module>
    from keras import metrics as metrics_module
  File "c:\users\user\desktop\tasf\env\lib\site-packages\keras\metrics.py", line 26, in <module>
    from keras import activations
  File "c:\users\user\desktop\tasf\env\lib\site-packages\keras\activations.py", line 20, in <module>
    from keras.layers import advanced_activations
  File "c:\users\user\desktop\tasf\env\lib\site-packages\keras\layers\__init__.py", line 23, in <module>
    from keras.engine.input_layer import Input
  File "c:\users\user\desktop\tasf\env\lib\site-packages\keras\engine\input_layer.py", line 21, in <module>
    from keras.engine import base_layer
  File "c:\users\user\desktop\tasf\env\lib\site-packages\keras\engine\base_layer.py", line 43, in <module>
    from keras.mixed_precision import loss_scale_optimizer
  File "c:\users\user\desktop\tasf\env\lib\site-packages\keras\mixed_precision\loss_scale_optimizer.py", line 18, in <module>
    from keras import optimizers
  File "c:\users\user\desktop\tasf\env\lib\site-packages\keras\optimizers.py", line 26, in <module>
    from keras.optimizer_v2 import adadelta as adadelta_v2
  File "c:\users\user\desktop\tasf\env\lib\site-packages\keras\optimizer_v2\adadelta.py", line 22, in <module>
    from keras.optimizer_v2 import optimizer_v2
  File "c:\users\user\desktop\tasf\env\lib\site-packages\keras\optimizer_v2\optimizer_v2.py", line 36, in <module>
    keras_optimizers_gauge = tf.__internal__.monitoring.BoolGauge(
  File "c:\users\user\desktop\tasf\env\lib\site-packages\tensorflow\python\eager\monitoring.py", line 360, in __init__
    super(BoolGauge, self).__init__('BoolGauge', _bool_gauge_methods,
  File "c:\users\user\desktop\tasf\env\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.

Additional info:

  • Rasa Version : 2.8.12
  • Rasa SDK Version : 2.8.2
  • Rasa X Version : None
  • Python version : 3.8.11
  • pip version : 21.3.1
  • Tensorflow version : 2.6.1

Rasa has upgraded Tensorflow as of 2.8.9, so this is the culprit.

Try asking your question in this thread.

1 Like

Thank you! It finally works now after I upgrade the Tensorflow with this command in the virtual environment.

pip install --upgrade tensorflow
1 Like