JustinaPetr / Weatherbot_Tutorial

275 stars 447 forks source link

ImportError: cannot import name 'ConsoleInputChannel' #60

Closed raymundlabs closed 5 years ago

raymundlabs commented 5 years ago

I'm following up your tutorial but I'm getting this error.

(tensorflow_gpuenv) F:\global_2019\chatbot\agent01>python train_online.py Traceback (most recent call last): File "train_online.py", line 9, in from rasa_core.channels.console import ConsoleInputChannel ImportError: cannot import name 'ConsoleInputChannel'

Anyone solve this?

AfrahAsif commented 5 years ago

hey @raymund07 ,were you able to solve this? I am facing the same error.

JustinaPetr commented 5 years ago

I suppose you both are using Rasa Core version >= 0.11. In that case, please use the code from the directory which contains the code compatible with the latest versions of Rasa NLU and Rasa Core. That should solve the issue.

Nikhileshorg commented 5 years ago

Rasa core version : 0.14.0a1 Rasa nlu version : 0.14.4

For newer versions of rasa nlu and rasa core. Can we follow the same steps followed in your video tutorial. Because I have noticed that in the older version of your video tutorial. I can see in the online_train.py file doesn't have action_endpoint but in the new version of your online train file. It has action_endpoint. As you told, I have tried using the code from your repository. When I am using that updated code. I am getting this error.

Traceback (most recent call last): File "training_online.py", line 35, in nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/weathernlu') File "c:\users\kastu\chatbot\rasa_core\rasa_core\interpreter.py", line 231, in init self._load_interpreter() File "c:\users\kastu\chatbot\rasa_core\rasa_core\interpreter.py", line 247, in _load_interpreter self.interpreter = Interpreter.load(self.model_directory) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\rasa_nlu\model.py", line 293, in load skip_validation) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\rasa_nlu\model.py", line 320, in create model_metadata, context) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\rasa_nlu\components.py", line 419, in load_component cached_component, context) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\rasa_nlu\registry.py", line 133, in load_component_by_name return component_clz.load(model_dir, metadata, cached_component, kwargs) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\rasa_nlu\utils\spacy_utils.py", line 126, in load nlp = spacy.load(model_name, parser=False) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\spacy__init__.py", line 21, in load return util.load_model(name, overrides) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\spacy\util.py", line 119, in load_model raise IOError(Errors.E050.format(name=name)) OSError: [E050] Can't find model 'None'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.

Please help me. Let me know where I am going wrong. Thanks.

The content of the online_train.py file :

from future import absolute_import from future import division from future import print_function from future import unicode_literals

import logging

from rasa_core.agent import Agent from rasa_core.policies.keras_policy import KerasPolicy from rasa_core.policies.memoization import MemoizationPolicy from rasa_core.interpreter import RasaNLUInterpreter from rasa_core.train import interactive from rasa_core.utils import EndpointConfig

logger = logging.getLogger(name)

def run_weather_online(interpreter, domain_file="weather_domain.yml", training_data_file='data/stories.md'): action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")
agent = Agent(domain_file, policies=[MemoizationPolicy(max_history=2), KerasPolicy(max_history=3, epochs=3, batch_size=50)], interpreter=interpreter, action_endpoint=action_endpoint)

data = agent.load_data(training_data_file)             
agent.train(data)
interactive.run_interactive_learning(agent, training_data_file)
return agent

if name == 'main': logging.basicConfig(level="INFO") nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/weathernlu') run_weather_online(nlu_interpreter)