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

Empty (or some spaces) input text causes Runtime error #10504

Closed
1 task
whustan opened this issue Dec 10, 2021 · 4 comments · Fixed by #10689
Closed
1 task

Empty (or some spaces) input text causes Runtime error #10504

whustan opened this issue Dec 10, 2021 · 4 comments · Fixed by #10689
Assignees
Labels
area:rasa-oss 🎡 Anything related to the open source Rasa framework effort:atom-squad/2 Label which is used by the Rasa Atom squad to do internal estimation of task sizes. type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@whustan
Copy link

whustan commented Dec 10, 2021

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?

Linux

What happened?

In NLU shell, when I input text="" or text=" "(some spaces), it gets error as follow (full details in 'Relevant log output') :
rasa.engine.exceptions.GraphComponentException: Error running graph component for node run_DIETClassifier4.

But in RASA-2.8.6, everything goes well and gets following response:
{ "text": "", "intent": { "name": null, "confidence": 0.0 }, "entities": [] }

I suppose this is a new bug.

Command / Request

No response

Relevant log output

Traceback (most recent call last):
File "~/venv/lib/python3.8/site-packages/rasa/engine/graph.py", line 461, in __call__
output = self._fn(self._component, **run_kwargs)
File "~/venv/lib/python3.8/site-packages/rasa/nlu/classifiers/diet_classifier.py", line 1003, in process
out = self._predict(message)
File "~/venv/lib/python3.8/site-packages/rasa/nlu/classifiers/diet_classifier.py", line 932, in _predict
return self.model.run_inference(model_data)
File "~/venv/lib/python3.8/site-packages/rasa/utils/tensorflow/models.py", line 318, in run_inference
] = self._rasa_predict(batch_in)
File "~/venv/lib/python3.8/site-packages/rasa/utils/tensorflow/models.py", line 280, in _rasa_predict
outputs = tf_utils.sync_to_numpy_or_python_type(self.predict_step(batch_in))
File "~/venv/lib/python3.8/site-packages/rasa/utils/tensorflow/models.py", line 228, in predict_step
return self.batch_predict(batch_in)
File "~/venv/lib/python3.8/site-packages/rasa/nlu/classifiers/diet_classifier.py", line 1721, in batch_predict
tf_batch_data = self.batch_to_model_data_format(
File "~/venv/lib/python3.8/site-packages/rasa/utils/tensorflow/models.py", line 473, in batch_to_model_data_format
tensor, idx = RasaModel._convert_sparse_features(
File "~/venv/lib/python3.8/site-packages/rasa/utils/tensorflow/models.py", line 518, in _convert_sparse_features
shape = [batch[idx + 2][i] for i in range(number_of_dimensions - 1)] + [
File "~/venv/lib/python3.8/site-packages/rasa/utils/tensorflow/models.py", line 518, in <listcomp>
shape = [batch[idx + 2][i] for i in range(number_of_dimensions - 1)] + [
IndexError: index 1 is out of bounds for axis 0 with size 1

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "~/venv/bin/rasa", line 8, in <module>
sys.exit(main())
File "~/venv/lib/python3.8/site-packages/rasa/__main__.py", line 121, in main
cmdline_arguments.func(cmdline_arguments)
File "~/venv/lib/python3.8/site-packages/rasa/cli/shell.py", line 91, in shell_nlu
rasa.nlu.run.run_cmdline(model)
File "~/venv/lib/python3.8/site-packages/rasa/nlu/run.py", line 25, in run_cmdline
result = asyncio.run(agent.parse_message(message))
File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "uvloop/loop.pyx", line 1456, in uvloop.loop.Loop.run_until_complete
File "~/venv/lib/python3.8/site-packages/rasa/core/agent.py", line 419, in parse_message
return await self.processor.parse_message(message)
File "~/venv/lib/python3.8/site-packages/rasa/core/processor.py", line 635, in parse_message
parse_data = self._parse_message_with_graph(message, only_output_properties)
File "~/venv/lib/python3.8/site-packages/rasa/core/processor.py", line 659, in _parse_message_with_graph
results = self.graph_runner.run(
File "~/venv/lib/python3.8/site-packages/rasa/engine/runner/dask.py", line 106, in run
dask_result = dask.get(run_graph, run_targets)
File "~/venv/lib/python3.8/site-packages/dask/local.py", line 560, in get_sync
return get_async(
File "~/venv/lib/python3.8/site-packages/dask/local.py", line 503, in get_async
for key, res_info, failed in queue_get(queue).result():
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 437, in result
return self.__get_result()
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
raise self._exception
File "~/venv/lib/python3.8/site-packages/dask/local.py", line 545, in submit
fut.set_result(fn(*args, **kwargs))
File "~/venv/lib/python3.8/site-packages/dask/local.py", line 237, in batch_execute_tasks
return [execute_task(*a) for a in it]
File "~/venv/lib/python3.8/site-packages/dask/local.py", line 237, in <listcomp>
return [execute_task(*a) for a in it]
File "~/venv/lib/python3.8/site-packages/dask/local.py", line 228, in execute_task
result = pack_exception(e, dumps)
File "~/venv/lib/python3.8/site-packages/dask/local.py", line 223, in execute_task
result = _execute_task(task, data)
File "~/venv/lib/python3.8/site-packages/dask/core.py", line 121, in _execute_task
return func(*(_execute_task(a, cache) for a in args))
File "~/venv/lib/python3.8/site-packages/rasa/engine/graph.py", line 468, in __call__
raise GraphComponentException(
rasa.engine.exceptions.GraphComponentException: Error running graph component for node run_DIETClassifier4.

Definition of done

  • Fix bug
@whustan whustan added 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. labels Dec 10, 2021
@whustan whustan changed the title Empty (or some spaces) input cause Runtime error Empty (or some spaces) input text causes Runtime error Dec 10, 2021
@sara-tagger
Copy link
Collaborator

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

@whustan
Copy link
Author

whustan commented Dec 17, 2021

@sara-tagger any progress??

@TyDunn TyDunn added the effort:atom-squad/2 Label which is used by the Rasa Atom squad to do internal estimation of task sizes. label Dec 17, 2021
@jupyterjazz
Copy link
Contributor

Hi @whusunny,
I couldn't reproduce the error.
Here's what I did:

rasa init
rasa train
rasa shell nlu

and when I write an empty string or some spaces I get the expected output with no errors.
here's my configuration:

Rasa Version      :         3.0.0
Minimum Compatible Version: 3.0.0
Rasa SDK Version  :         3.0.0
Python Version    :         3.8.12
Operating System  :         Linux-5.11.0-43-generic-x86_64-with-glibc2.17

Can you help me reproduce it? What should I do differently?

@whustan
Copy link
Author

whustan commented Dec 23, 2021

Hi, @jupyterjazz
Thanks for your feedback.

Using rasa init project, it indeed runs well. When I change the pipline config as follow then training, the error comes back.

language: zh
pipeline:
  - name: "MitieNLP"
    model: "total_word_feature_extractor_zh.dat"
  - name: "JiebaTokenizer"
  - name: "RegexFeaturizer"
  - name: "MitieFeaturizer"
  - name: "DIETClassifier"
    epochs: 30
  - name: "RegexEntityExtractor"
  - name: "EntitySynonymMapper"
  - name: "FallbackClassifier"
    threshold: 0.2
    ambiguity_threshold: 0.05

Yes, I am using rasa for Chinese:)

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 effort:atom-squad/2 Label which is used by the Rasa Atom squad to do internal estimation of task sizes. type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
4 participants