rasa: ValueError: bad input shape (1, 5)
Rasa NLU version: 0.13.5 Python version: 3.6
Operating system: Ubuntu:17.10 or Docker-Ubuntu:17.10
Content of model configuration file:
language: "en"
pipeline: spacy_sklearn
Content of python file:
from rasa_nlu.training_data import load_data
from rasa_nlu.model import Trainer, Interpreter
from rasa_nlu import config
training_data = load_data('nlu_data.md') #tried with different datafiles from various sources both md or json
trainer = Trainer(config.load("rasa-config.yml"))
trainer.train(training_data)
model_directory = trainer.persist('./rasa_model')
interpreter = Interpreter.load(model_directory)
#same error for both
interpreter.parse(u"The text I want to understand")
interpreter.parse("The text I want to understand")
Output:
Fitting 2 folds for each of 6 candidates, totalling 12 fits
[Parallel(n_jobs=1)]: Using backend SequentialBackend with 1 concurrent workers.
[Parallel(n_jobs=1)]: Done 12 out of 12 | elapsed: 0.1s finished
/usr/local/lib/python3.6/dist-packages/rasa_nlu/extractors/entity_synonyms.py:85: UserWarning: Failed to load synonyms file from '/datas/./rasa_model/default/model_20180930-201701/entity_synonyms.json'
"".format(entity_synonyms_file))
Traceback (most recent call last):
File "test.py", line 15, in <module>
interpreter.parse(u"The text I want to understand")
File "/usr/local/lib/python3.6/dist-packages/rasa_nlu/model.py", line 357, in parse
component.process(message, **self.context)
File "/usr/local/lib/python3.6/dist-packages/rasa_nlu/classifiers/sklearn_intent_classifier.py", line 176, in process
intents = self.transform_labels_num2str(intent_ids)
File "/usr/local/lib/python3.6/dist-packages/rasa_nlu/classifiers/sklearn_intent_classifier.py", line 112, in transform_labels_num2str
return self.le.inverse_transform(y)
File "/usr/local/lib/python3.6/dist-packages/sklearn/preprocessing/label.py", line 273, in inverse_transform
y = column_or_1d(y, warn=True)
File "/usr/local/lib/python3.6/dist-packages/sklearn/utils/validation.py", line 788, in column_or_1d
raise ValueError("bad input shape {0}".format(shape))
ValueError: bad input shape (1, 5)
Issue: Hello, im trying to run example from documentation https://rasa.com/docs/nlu/0.13.5/python/ but im getting ValueError: bad input shape (1, 5) is this issue or im doing something wrong ?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 16 (6 by maintainers)
Hello again. I just recreated the situation from scratch and ran your python script. I didn’t encounter this error, however I can see from your traceback that the model trained correctly which leads me to believe this may arise from another package. Have you ran
pip install -r requirements.txt
from the/starter-pack-rasa-nlu
directory?