Skip to content

Option share_hidden_layers does not work as expected #6053

Closed
@tabergma

Description

Rasa version: current master
Python version: 3.7

Issue:
If the option share_hidden_layers is enabled in the DIETClassifier, we have a check which verifies that the feature dimension of the text and label features is the same. However, we also have an additional check that causes issues: That check compares the data_signature of the text and label features. data_signature stores the type of the feature and the shape of the first example. For example, it could be that the shape of text_features is 2x53 and the shape of label_features is 1x53. In this case the check fails, but it should not.

Error (including full traceback):

Traceback (most recent call last):
  File "/Users/tabergma/Repositories/rasa/rasa/__main__.py", line 119, in <module>
    main()
  File "/Users/tabergma/Repositories/rasa/rasa/__main__.py", line 108, in main
    cmdline_arguments.func(cmdline_arguments)
  File "/Users/tabergma/Repositories/rasa/rasa/cli/train.py", line 142, in train_nlu
    additional_arguments=extract_nlu_additional_arguments(args),
  File "/Users/tabergma/Repositories/rasa/rasa/train.py", line 431, in train_nlu
    additional_arguments,
  File "uvloop/loop.pyx", line 1456, in uvloop.loop.Loop.run_until_complete
  File "/Users/tabergma/Repositories/rasa/rasa/train.py", line 472, in _train_nlu_async
    additional_arguments=additional_arguments,
  File "/Users/tabergma/Repositories/rasa/rasa/train.py", line 506, in _train_nlu_with_validated_data
    **additional_arguments,
  File "/Users/tabergma/Repositories/rasa/rasa/nlu/train.py", line 90, in train
    interpreter = trainer.train(training_data, **kwargs)
  File "/Users/tabergma/Repositories/rasa/rasa/nlu/model.py", line 191, in train
    updates = component.train(working_data, self.config, **context)
  File "/Users/tabergma/Repositories/rasa/rasa/nlu/classifiers/diet_classifier.py", line 716, in train
    config=self.component_config,
  File "/Users/tabergma/Repositories/rasa/rasa/nlu/classifiers/diet_classifier.py", line 1032, in __init__
    self._check_data()
  File "/Users/tabergma/Repositories/rasa/rasa/nlu/classifiers/diet_classifier.py", line 1099, in _check_data
    "If hidden layer weights are shared, data signatures "
ValueError: If hidden layer weights are shared, data signatures for text_features and label_features must coincide.

Command or request that led to error:

rasa train

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

language: en
pipeline:
  - name: WhitespaceTokenizer
  - name: CountVectorsFeaturizer
    use_shared_vocab: True
  - name: DIETClassifier
    epochs: 100
    share_hidden_layers: True

Metadata

Assignees

Labels

area:rasa-oss 🎡Anything related to the open source Rasa frameworktype:bug 🐛Inconsistencies or issues which will cause an issue or problem for users or implementors.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions