我收到以下错误ModuleNotFoundError:即使我安装了rasa_nlu和rasa,也没有名为“ rasa_nlu”的模块
我的代码:
from rasa_nlu.training_data import load_data
from rasa_nlu.config import RasaNLUConfig
from rasa_nlu.model import Trainer
def train_nlu(data, config, model_dir):
training_data = load_data(data)
trainer = Trainer(RasaNLUConfig(config))
trainer.train(training_data)
model_directory = trainer.persist(model_dir, fixed_model_name='weathernlu')
if __name__ == '__main__':
train_nlu('.data/data.json', 'config_spacy.json', './models/nlu')
错误消息:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-2-6ab2834ad68f> in <module>()
----> 1 from rasa_nlu.training_data import load_data
2 #from rasa_nlu.converters import load_data
3 from rasa_nlu.config import RasaNLUConfig
4 from rasa_nlu.model import Trainer
5
ModuleNotFoundError: No module named 'rasa_nlu'
请帮助我
答案 0 :(得分:0)
在Rasa> = 1.0中,没有单独安装NLU。只是rasa
,然后在代码中访问rasa.nlu
。确保您正在查看最新版本的文档,并已安装最新版本的rasa-https://rasa.com/docs/rasa/user-guide/installation/