GraphComponentException if hidden_layers_size
used with only one (text) overwritten key #10391
Closed
Description
Rasa Open Source version
3.0.0
Rasa SDK version
3.0.0
Rasa X version
No response
Python version
3.8
What operating system are you using?
Windows
What happened?
I wanted to train a migrated AI with the following config for DIETClassifier
:
- name: DIETClassifier
random_seed: 42
loss_type: cross_entropy
model_confidence: softmax
constrain_similarities: True
intent_classification: True
entity_recognition: False
use_masked_language_model: True
epochs: 80
number_of_transformer_layers: 4
transformer_size: 256
drop_rate: 0.2
batch_size: [64, 256]
embedding_dimension: 50
hidden_layers_sizes:
text: [512, 128]
The result was the following error:
File "...rasa\nlu\classifiers\diet_classifier.py", line 1277, in __init__
self._prepare_layers()
File "...rasa\nlu\classifiers\diet_classifier.py", line 1437, in _prepare_layers
self.config[HIDDEN_LAYERS_SIZES][self.label_name],
File "...wrapt\wrappers.py", line 394, in __getitem__
return self.__wrapped__[key]
KeyError: 'label'
followed by
rasa.engine.exceptions.GraphComponentException: Error running graph component for node train_DIETClassifier5.
After digging into it, it seems to me, that even if the documentation sais:
hidden_layers_sizes: This parameter allows you to define the number of feed forward layers and their output dimensions for user messages and intents (default: text: [], label: []).
it is not enough to specify only one of the keys. After changing the config to:
hidden_layers_sizes:
text: [512, 128]
label: []
everything worked fine. I am not absolutely sure but this worked in Rasa 2.8.x
.
Command / Request
No response
Relevant log output
2021-11-25 14:36:48 INFO rasa.engine.training.hooks - Restored component 'LexicalSyntacticFeaturizer' from cache.
2021-11-25 14:36:48 INFO rasa.engine.training.hooks - Restored component 'CountVectorsFeaturizer' from cache.
2021-11-25 14:36:48 INFO rasa.engine.training.hooks - Restored component 'CountVectorsFeaturizer' from cache.
2021-11-25 14:36:48 INFO rasa.engine.training.hooks - Restored component 'MemoizationPolicy' from cache.
2021-11-25 14:36:48 INFO rasa.engine.training.hooks - Restored component 'RulePolicy' from cache.
2021-11-25 14:36:49 INFO rasa.engine.training.hooks - Starting to train component 'DIETClassifier'.
...
File "...rasa\nlu\classifiers\diet_classifier.py", line 1277, in __init__
self._prepare_layers()
File "...rasa\nlu\classifiers\diet_classifier.py", line 1437, in _prepare_layers
self.config[HIDDEN_LAYERS_SIZES][self.label_name],
File "...wrapt\wrappers.py", line 394, in __getitem__
return self.__wrapped__[key]
KeyError: 'label'
Definition of Done:
- Discovered the problem
- Fixed the problem
- Made sure the same problem does not exist for other parameters of the component and also other ML components like TEDPolicy, ResponseSelector and UnexpecTEDIntentPolicy
- Model regression tests run on the PR
- PR is merged to
3.0.x
- New micro version released after the bugfix is merged.