Below is my configuration:
Rasa NLU version: 0.12.3 msgpack-python==0.5.6
Operating system : Macos
Content of model configuration file: language: “en” pipeline: spacy_sklearn
Code:
from rasa_nlu.training_data import load_data
from rasa_nlu.config import RasaNLUModelConfig
from rasa_nlu.model import Trainer
from rasa_nlu.model import Metadata, Interpreter
from rasa_nlu import config
from rasa_nlu.components import ComponentBuilder
builder = ComponentBuilder(use_cache=True)
def train_nlu(data, config_file, model_dir):
training_data = load_data(data)
trainer = Trainer(config.load(config_file), builder)
trainer.train(training_data)
model_directory = trainer.persist(model_dir, fixed_model_name = 'restaurantnlu')
def run_nlu():
interpreter = Interpreter.load('./models/nlu/default/restaurantnlu', builder)
print(interpreter.parse("can you please suggest food"))
if __name__ == '__main__':
train_nlu('./data/data.json', 'config_spacy.json', './models/nlu')
run_nlu()
Full stacktrace below:
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rasa_nlu/training_data/training_data.py:194: UserWarning: Entity 'people' has only 1 training examples! minimum is 2, training may fail.
self.MIN_EXAMPLES_PER_ENTITY))
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rasa_nlu/training_data/training_data.py:194: UserWarning: Entity 'price' has only 1 training examples! minimum is 2, training may fail.
self.MIN_EXAMPLES_PER_ENTITY))
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rasa_nlu/utils/ **init** .py:236: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
return yaml.load(read_file(filename, "utf-8"))
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:521: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:522: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/h5py/ **init** .py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type` .
from ._conv import register_converters as _register_converters
Traceback (most recent call last):
File "nlu_model.py", line 21, in
train_nlu('./data/data.json', 'config_spacy.json', './models/nlu')
File "nlu_model.py", line 12, in train_nlu
trainer = Trainer(config.load(config_file), builder)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rasa_nlu/model.py", line 149, in **init**
self.pipeline = self._build_pipeline(cfg, component_builder)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rasa_nlu/model.py", line 160, in _build_pipeline
component_name, cfg)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rasa_nlu/components.py", line 420, in create_component
cfg)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rasa_nlu/registry.py", line 140, in create_component_by_name
return component_clz.create(config)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rasa_nlu/utils/spacy_utils.py", line 73, in create
nlp = spacy.load(spacy_model_name, parser=False)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/ **init** .py", line 15, in load
return util.load_model(name, **overrides)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/util.py", line 112, in load_model
return load_model_from_link(name, **overrides)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/util.py", line 129, in load_model_from_link
return cls.load(**overrides)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/data/en/ **init** .py", line 12, in load
return load_model_from_init_py( **file** , **overrides)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/util.py", line 173, in load_model_from_init_py
return load_model_from_path(data_path, meta, **overrides)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/util.py", line 156, in load_model_from_path
return nlp.from_disk(model_path)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/language.py", line 653, in from_disk
util.from_disk(path, deserializers, exclude)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/util.py", line 511, in from_disk
reader(path / key)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/language.py", line 649, in
deserializers[name] = lambda p, proc=proc: proc.from_disk(p, vocab=False)
File "pipeline.pyx", line 643, in spacy.pipeline.Tagger.from_disk
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/util.py", line 511, in from_disk
reader(path / key)
File "pipeline.pyx", line 626, in spacy.pipeline.Tagger.from_disk.load_model
File "pipeline.pyx", line 627, in spacy.pipeline.Tagger.from_disk.load_model
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/thinc/neural/_classes/model.py", line 352, in from_bytes
copy_array(dest, param[b'value'])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/thinc/neural/util.py", line 48, in copy_array
dst[:] = src
ValueError: could not broadcast input array from shape (96) into shape (128)