RasaHQ / rasa

💬 Open source machine learning framework to automate text- and voice-based conversations: NLU, dialogue management, connect to Slack, Facebook, and more - Create chatbots and voice assistants
https://rasa.com/docs/rasa/
Apache License 2.0
18.94k stars 4.64k forks source link

Rasa 1.8.0 bug xlnet "entity_recognition": true #5353

Closed MatthewRaza closed 4 years ago

MatthewRaza commented 4 years ago

Rasa version: 1.8.0

Rasa SDK version (if used & relevant):1.8.0

Python version: 3.6

Operating system (windows, osx, ...): centos amazon ami

Issue: Bug during training rasa DIETclassifier, xlnet model. Training crash when use "entity_recognition": true. But if we set "entity_recognition": false on the config.yml the DIETclassifier training well. And BERT train just fine when both "entity_recognition" and "intent_classification" are set to true.

Error (including full traceback):

Traceback (most recent call last):
  File "/home/ec2-user/anaconda3/envs/rasa/bin/rasa", line 11, in <module>
    load_entry_point('rasa', 'console_scripts', 'rasa')()
  File "/home/ec2-user/rasa/rasa/__main__.py", line 91, in main
    cmdline_arguments.func(cmdline_arguments)
  File "/home/ec2-user/rasa/rasa/cli/train.py", line 140, in train_nlu
    persist_nlu_training_data=args.persist_nlu_data,
  File "/home/ec2-user/rasa/rasa/train.py", line 414, in train_nlu
    persist_nlu_training_data,
  File "uvloop/loop.pyx", line 1456, in uvloop.loop.Loop.run_until_complete
  File "/home/ec2-user/rasa/rasa/train.py", line 445, in _train_nlu_async
    persist_nlu_training_data=persist_nlu_training_data,
  File "/home/ec2-user/rasa/rasa/train.py", line 474, in _train_nlu_with_validated_data
    persist_nlu_training_data=persist_nlu_training_data,
  File "/home/ec2-user/rasa/rasa/nlu/train.py", line 86, in train
    interpreter = trainer.train(training_data, **kwargs)
  File "/home/ec2-user/rasa/rasa/nlu/model.py", line 191, in train
    updates = component.train(working_data, self.config, **context)
  File "/home/ec2-user/rasa/rasa/nlu/classifiers/diet_classifier.py", line 643, in train
    self.component_config[BATCH_STRATEGY],
  File "/home/ec2-user/rasa/rasa/utils/tensorflow/models.py", line 81, in fit
    ) = self._get_tf_train_functions(eager, model_data, batch_strategy)
  File "/home/ec2-user/rasa/rasa/utils/tensorflow/models.py", line 241, in _get_tf_train_functions
    train_dataset_function, self.train_on_batch, eager, "train"
  File "/home/ec2-user/rasa/rasa/utils/tensorflow/models.py", line 223, in _get_tf_call_model_function
    tf_call_model_function(next(iter(init_dataset)))
  File "/home/ec2-user/anaconda3/envs/rasa/lib/python3.6/site-packages/tensorflow_core/python/eager/def_function.py", line 568, in __call__
    result = self._call(*args, **kwds)
  File "/home/ec2-user/anaconda3/envs/rasa/lib/python3.6/site-packages/tensorflow_core/python/eager/def_function.py", line 632, in _call
    return self._stateless_fn(*args, **kwds)
  File "/home/ec2-user/anaconda3/envs/rasa/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 2363, in __call__
    return graph_function._filtered_call(args, kwargs)  # pylint: disable=protected-access
  File "/home/ec2-user/anaconda3/envs/rasa/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 1611, in _filtered_call
    self.captured_inputs)
  File "/home/ec2-user/anaconda3/envs/rasa/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 1692, in _call_flat
    ctx, args, cancellation_manager=cancellation_manager))
  File "/home/ec2-user/anaconda3/envs/rasa/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 545, in call
    ctx=ctx)
  File "/home/ec2-user/anaconda3/envs/rasa/lib/python3.6/site-packages/tensorflow_core/python/eager/execute.py", line 67, in quick_execute
    six.raise_from(core._status_to_exception(e.code, message), None)
  File "<string>", line 3, in raise_from
tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found.
  (0) Invalid argument:  Incompatible shapes: [1,6] vs. [1,7]
         [[{{node cond/else/_83/add_1}}]]
         [[crf/cond/else/_72/rnn/transpose_2/_260]]
  (1) Invalid argument:  Incompatible shapes: [1,6] vs. [1,7]
         [[{{node cond/else/_83/add_1}}]]
0 successful operations.
0 derived errors ignored. [Op:__inference_train_on_batch_36091]

Function call stack:
train_on_batch -> train_on_batch

Command or request that led to error:

rasa train nlu -u training_data.md

Content of configuration file (config.yml) (if relevant):

language: fr
pipeline:
  - name: HFTransformersNLP
    model_name: "xlnet"
  - name: "LanguageModelTokenizer"
  - name: "LanguageModelFeaturizer"
  - name: "DIETClassifier"
    "batch_size": 44
    "epochs": 40
    "entity_recognition": true
sara-tagger commented 4 years ago

Thanks for raising this issue, @dakshvar22 will get back to you about it soon✨

Please also check out the docs and the forum in case your issue was raised there too 🤗
dakshvar22 commented 4 years ago

@MatthewRaza Thanks for bringing this up. Working on a fix.

MatthewRaza commented 4 years ago

Okay thank you for your response. I'm gonna take a look at your fix #5354 and I'll get back to you afterwards

MatthewRaza commented 4 years ago

Just tested it and it works fine thanks for your responsivness