question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GraphComponentException if `hidden_layers_size` used with only one (text) overwritten key

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
mleimeistercommented, Dec 6, 2021

Scheduled for next upcoming micro release with Enable squat.

1reaction
mleimeistercommented, Nov 30, 2021

Hi, thanks for the feedback! In that case I’ll also check the CountVectorsFeaturizer config. I added some documentation on the potential cause I think I found and steps I implemented for a possible fix in the second PR’s comment. Since it would touch a core part of the components, it would be great though to discuss if this is actually the correct root cause, and if so a viable fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found