Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with Multi-Intents Rasa 1.7.0: Can not squeeze dim[1]... #5162

Closed
JulianGerhard21 opened this issue Jan 30, 2020 · 4 comments
Closed
Labels
area:rasa-oss 🎡 Anything related to the open source Rasa framework type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@JulianGerhard21
Copy link
Contributor

Rasa version: 1.7.0

Rasa SDK version (if used & relevant): 1.7.0

Python version: 3.6.8

Operating system (windows, osx, ...): Windows 10

Issue:
After updating to Rasa 1.7.0 I observed the below error and started to investigate the issue. After a couple of hours I narrowed the problem down to intents like:

## intent:greet+ask_weather

in combination with CountVectorsFeaturizer meaning that the problem only happens when using both in the same setup. I first thought that it had something to do with the transformers I sometimes use, but even with de_core_news_sm models it doesnt work.

I am not quite sure, if this is in any case intended and simply slipped through my attention so I wanted to bring it up.

Error (including full traceback):

2020-01-30 16:57:43 INFO     rasa.nlu.utils.spacy_utils  - Trying to load spacy model with name 'de_core_news_sm'
2020-01-30 16:57:44 INFO     transformers.file_utils  - PyTorch version 1.3.0+cpu available.
2020-01-30 16:57:44 INFO     transformers.modeling_xlnet  - Better speed can be achieved with apex installed from https://github.com/nvidia/apex .
2020-01-30 16:57:45 INFO     rasa.nlu.components  - Added 'SpacyNLP' to component cache. Key 'SpacyNLP-de_core_news_sm'.
2020-01-30 16:57:45 INFO     rasa.nlu.utils.spacy_utils  - Trying to load spacy model with name 'de_core_news_md'
2020-01-30 16:58:26 INFO     rasa.nlu.components  - Added 'SpacyNLP' to component cache. Key 'SpacyNLP-de_core_news_md'.
2020-01-30 16:58:26 INFO     rasa.nlu.training_data.training_data  - Training data stats:
        - intent examples: 347 (18 distinct intents)
        - Found intents: 'repeat_last_question', 'functions', 'deny+utter_mobilenumber', 'deny', 'utter_mobilenumber', 'confirm', 'reset_dialog', 'ask_outofscope', 'deny_appointment_suggestion', 'ask_repeat_contact', 'make_appointment', 'not_now', 'greet', 'goodbye', 'thankyou', 'ask_persisted_user_data', 'persist_purpose', 'select_appointment_slot'
        - Number of response examples: 0 (0 distinct response)
        - entity examples: 104 (7 distinct entities)
        - found entities: 'appointment_type', 'daytime', 'not_now_reason', 'slot_shift', 'mobilenumber', 'time', 'employee'

2020-01-30 16:58:26 INFO     rasa.nlu.model  - Starting to train component SpacyNLP
2020-01-30 16:58:26 INFO     rasa.nlu.model  - Finished training component.
2020-01-30 16:58:26 INFO     rasa.nlu.model  - Starting to train component SpacyTokenizer
2020-01-30 16:58:26 INFO     rasa.nlu.model  - Finished training component.
2020-01-30 16:58:26 INFO     rasa.nlu.model  - Starting to train component CountVectorsFeaturizer
2020-01-30 16:58:26 INFO     rasa.nlu.model  - Finished training component.
2020-01-30 16:58:26 INFO     rasa.nlu.model  - Starting to train component CountVectorsFeaturizer
2020-01-30 16:58:27 INFO     rasa.nlu.model  - Finished training component.
2020-01-30 16:58:27 INFO     rasa.nlu.model  - Starting to train component SpacyFeaturizer
2020-01-30 16:58:27 INFO     rasa.nlu.model  - Finished training component.
2020-01-30 16:58:27 INFO     rasa.nlu.model  - Starting to train component EmbeddingIntentClassifier
Tensor("mul:0", shape=(?, ?, 192), dtype=float32)
Tensor("mul_1:0", shape=(?, ?, 20), dtype=float32)
Tensor("mul_2:0", shape=(18, 2, 20), dtype=float32)
Traceback (most recent call last):
  File "c:\users\\envs\eva_env\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1607, in _create_c_op
    c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Can not squeeze dim[1], expected a dimension of 1, got 2 for 'Squeeze_2' (op: 'Squeeze') with input shapes: [18,2,20].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\\appdata\local\programs\python\python36\Lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\\appdata\local\programs\python\python36\Lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\\Envs\eva_env\Scripts\rasa.exe\__main__.py", line 7, in <module>
  File "c:\users\\envs\eva_env\lib\site-packages\rasa\__main__.py", line 76, in main
    cmdline_arguments.func(cmdline_arguments)
  File "c:\users\\envs\eva_env\lib\site-packages\rasa\cli\train.py", line 76, in train
    additional_arguments=extract_additional_arguments(args),
  File "c:\users\\envs\eva_env\lib\site-packages\rasa\train.py", line 50, in train
    additional_arguments=additional_arguments,
  File "c:\users\\appdata\local\programs\python\python36\Lib\asyncio\base_events.py", line 484, in run_until_complete
    return future.result()
  File "c:\users\\envs\eva_env\lib\site-packages\rasa\train.py", line 101, in train_async
    additional_arguments,
  File "c:\users\\envs\eva_env\lib\site-packages\rasa\train.py", line 188, in _train_async_internal
    additional_arguments=additional_arguments,
  File "c:\users\\envs\eva_env\lib\site-packages\rasa\train.py", line 245, in _do_training
    persist_nlu_training_data=persist_nlu_training_data,
  File "c:\users\\envs\eva_env\lib\site-packages\rasa\train.py", line 474, in _train_nlu_with_validated_data
    persist_nlu_training_data=persist_nlu_training_data,
  File "c:\users\\envs\eva_env\lib\site-packages\rasa\nlu\train.py", line 86, in train
    interpreter = trainer.train(training_data, **kwargs)
  File "c:\users\\envs\eva_env\lib\site-packages\rasa\nlu\model.py", line 191, in train
    updates = component.train(working_data, self.config, **context)
  File "c:\users\\envs\eva_env\lib\site-packages\rasa\nlu\classifiers\embedding_intent_classifier.py", line 769, in train
    loss, acc = self._build_tf_train_graph(session_data)
  File "c:\users\\envs\eva_env\lib\site-packages\rasa\nlu\classifiers\embedding_intent_classifier.py", line 571, in _build_tf_train_graph
    label_data["label_features"], label_data["label_mask"][0], "label"
  File "c:\users\\envs\eva_env\lib\site-packages\rasa\nlu\classifiers\embedding_intent_classifier.py", line 547, in _combine_sparse_dense_features
    output = tf.squeeze(output, axis=1)
  File "c:\users\\envs\eva_env\lib\site-packages\tensorflow_core\python\util\dispatch.py", line 180, in wrapper
    return target(*args, **kwargs)
  File "c:\users\\envs\eva_env\lib\site-packages\tensorflow_core\python\util\deprecation.py", line 507, in new_func
    return func(*args, **kwargs)
  File "c:\users\\envs\eva_env\lib\site-packages\tensorflow_core\python\ops\array_ops.py", line 3651, in squeeze
    return gen_array_ops.squeeze(input, axis, name)
  File "c:\users\\envs\eva_env\lib\site-packages\tensorflow_core\python\ops\gen_array_ops.py", line 10068, in squeeze
    "Squeeze", input=input, squeeze_dims=axis, name=name)
  File "c:\users\\envs\eva_env\lib\site-packages\tensorflow_core\python\framework\op_def_library.py", line 794, in _apply_op_helper
    op_def=op_def)
  File "c:\users\\envs\eva_env\lib\site-packages\tensorflow_core\python\util\deprecation.py", line 507, in new_func
    return func(*args, **kwargs)
  File "c:\users\\envs\eva_env\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3357, in create_op
    attrs, op_def, compute_device)
  File "c:\users\\envs\eva_env\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3426, in _create_op_internal
    op_def=op_def)
  File "c:\users\\envs\eva_env\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1770, in __init__
    control_input_ops)
  File "c:\users\\envs\eva_env\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1610, in _create_c_op
    raise ValueError(str(e))
ValueError: Can not squeeze dim[1], expected a dimension of 1, got 2 for 'Squeeze_2' (op: 'Squeeze') with input shapes: [18,2,20].

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

language: de
pipeline:
 - name: SpacyNLP
   case_sensitive: 1
   model: de_trf_bertbasecased_lg_smo_enhanced
 - name: SpacyTokenizer
   intent_tokenization_flag: true
   intent_split_symbol: "+"
 - name: CountVectorsFeaturizer
   strip_accents: "unicode"
 - name: CountVectorsFeaturizer
   strip_accents: "unicode"
   analyzer: "char_wb"
   min_ngram: 2
   max_ngram: 15
 - name: SpacyFeaturizer
 - name: "EmbeddingIntentClassifier"
 - name: SpacyNLP
   case_sensitive: 1
   model: de_core_news_md
 - name: SpacyTokenizer
 - name: SpacyFeaturizer
 - name: CRFEntityExtractor
 - name: EntitySynonymMapper
 - name: DucklingHTTPExtractor
   dimensions: ['time', 'duration', 'email']
   locale: de_DE
   timezone: Europe/Berlin
   url: http://localhost:8001
 - name: SpacyEntityExtractor
   dimensions: ['PER', 'LOC', 'CARDINAL']
policies:
 - name: EmbeddingPolicy
   batch_size: 50
   epochs: 500
   featurizer:
    - name: MaxHistoryTrackerFeaturizer
      max_history: 3
      state_featurizer:
       - name: LabelTokenizerSingleStateFeaturizer
 - name: FallbackPolicy
   nlu_threshold: 0.45
   ambiguity_threshold: 0.1
   core_threshold: 0.3
   fallback_action_name: 'utter_default_fallback'
 - name: MemoizationPolicy
   max_history: 5
 - name: FormPolicy
 - name: MappingPolicy
@JulianGerhard21 JulianGerhard21 added the type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors. label Jan 30, 2020
@sara-tagger
Copy link
Collaborator

Thanks for raising this issue, @tmbo 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 🤗

@tmbo
Copy link
Member

tmbo commented Feb 4, 2020

@tabergma any clue where this might be coming from?

@tmbo tmbo added the area:rasa-oss 🎡 Anything related to the open source Rasa framework label Feb 4, 2020
@tabergma
Copy link
Contributor

tabergma commented Feb 4, 2020

Could reproduce the problem, it is definitely a bug. Thanks for reporting it 👍Will take a closer look and work on a fix.

@tabergma
Copy link
Contributor

closed via #5184

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:rasa-oss 🎡 Anything related to the open source Rasa framework type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

No branches or pull requests

4 participants