Need help while performing Interactive Learning

Hello Rasa Team,

Raising this query because I need some help in understanding what is the process to code the “Interactive Learning” feature using the latest Rasa 1.0.7. I do acknowledge the fact that this update focuses heavily on using the CLI (using rasa interactive) but I need to code the entire project just like the previous versions for delivery to the client.

I have fairly managed to code the NLU and Core training sections and are working perfectly but, the main concern is with the “run_interactive_learning” and “_serve_application” section. Both of which are throwing errors which I am not able to comprehend (seems like to be using the async-awaiting properties)

Running all of this on Windows 10

Python: 3.7.3

rasa 1.0.7
rasa-core 0.14.5
rasa-core-sdk 0.14.0
rasa-nlu 0.15.1
rasa-sdk 1.0.0
rasa-x 0.19.0

Here’s the code:

from rasa.core.agent import Agent
from rasa.core.featurizers import MaxHistoryTrackerFeaturizer
from rasa.core.featurizers import BinarySingleStateFeaturizer
from rasa.core.interpreter import RasaNLUInterpreter
from rasa.core.policies import FallbackPolicy, KerasPolicy, MemoizationPolicy
from rasa.core.training import interactive

log.info(f'Interpreting NLU model from {highlight_info(nlu_path)}')
nlu_interpreter = RasaNLUInterpreter(nlu_path)
log.info('Configuring agent, endpoint and setting up policies...')
action_endpoint = EndpointConfig(url='http://localhost:5055/webhook')
memoization_policy = MemoizationPolicy(max_history=5)
fallback_policy = FallbackPolicy(
    fallback_action_name='action_default_fallback',
    nlu_threshold=0.4,
    core_threshold=0.3)
model_featurizer = MaxHistoryTrackerFeaturizer(
    max_history=5, state_featurizer=BinarySingleStateFeaturizer())
keras_policy = KerasPolicy(max_history=5,
                           epochs=150,
                           batch_size=64,
                           validation_split=0.2,
                           featurizer=model_featurizer)
agent = Agent(domain_file,
              policies=[memoization_policy,
                        fallback_policy,
                        keras_policy],
              interpreter=nlu_interpreter,
              action_endpoint=action_endpoint)

interactive.run_interactive_learning(agent, stories_file)
return agent

And this is the error:

Z:\charlotte_beta\utils>py train.py 2019-06-11 00:25:33.000012 INFO train.py:129 NLU model found, no need to train NLU data 2019-06-11 00:25:33.000018 INFO train.py:215 Interpreting NLU model from Z:\charlotte_beta\models\nlu 2019-06-11 00:25:35.000567 INFO train.py:217 Configuring agent, endpoint and setting up policies… [2019-06-11 00:25:35 +0530] [20828] [ERROR] Experienced exception while trying to serve Traceback (most recent call last): File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\site-packages\sanic\app.py”, line 1096, in run serve(**server_settings) File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\site-packages\sanic\server.py”, line 742, in serve trigger_events(before_start, loop) File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\site-packages\sanic\server.py”, line 604, in trigger_events loop.run_until_complete(result) File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\asyncio\base_events.py”, line 584, in run_until_complete return future.result() File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\site-packages\rasa\core\training\interactive.py”, line 1478, in train_agent_on_start args.get(“config”)[0], TypeError: ‘NoneType’ object is not subscriptable Traceback (most recent call last): File “train.py”, line 336, in cook_core() File “train.py”, line 248, in cook_core interactive.run_interactive_learning(agent, stories_file) File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\site-packages\rasa\core\training\interactive.py”, line 1552, in run_interactive_learning _serve_application(app, stories, finetune, skip_visualization) File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\site-packages\rasa\core\training\interactive.py”, line 1431, in _serve_application app.run(host=“0.0.0.0”, port=DEFAULT_SERVER_PORT) File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\site-packages\sanic\app.py”, line 1096, in run serve(**server_settings) File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\site-packages\sanic\server.py”, line 742, in serve trigger_events(before_start, loop) File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\site-packages\sanic\server.py”, line 604, in trigger_events loop.run_until_complete(result) File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\asyncio\base_events.py”, line 584, in run_until_complete return future.result() File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\site-packages\rasa\core\training\interactive.py”, line 1478, in train_agent_on_start args.get(“config”)[0], TypeError: ‘NoneType’ object is not subscriptable 2019-06-11 00:25:39.000444 INFO train.py:129 NLU model found, no need to train NLU data 2019-06-11 00:25:39.000447 INFO train.py:215 Interpreting NLU model from Z:\charlotte_beta\models\nlu 2019-06-11 00:25:44.000243 INFO train.py:217 Configuring agent, endpoint and setting up policies… Traceback (most recent call last): File “”, line 1, in File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py”, line 105, in spawn_main exitcode = _main(fd) File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py”, line 114, in _main prepare(preparation_data) File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py”, line 225, in prepare _fixup_main_from_path(data[‘init_main_from_path’]) File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py”, line 277, in _fixup_main_from_path run_name=“mp_main”) File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\runpy.py”, line 263, in run_path pkg_name=pkg_name, script_name=fname) File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\runpy.py”, line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\runpy.py”, line 85, in _run_code exec(code, run_globals) File “Z:\charlotte_beta\utils\train.py”, line 336, in cook_core() File “Z:\charlotte_beta\utils\train.py”, line 248, in cook_core interactive.run_interactive_learning(agent, stories_file) File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\site-packages\rasa\core\training\interactive.py”, line 1532, in run_interactive_learning p.start() File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\multiprocessing\process.py”, line 112, in start self._popen = self._Popen(self) File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\multiprocessing\context.py”, line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\multiprocessing\context.py”, line 322, in _Popen return Popen(process_obj) File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\multiprocessing\popen_spawn_win32.py”, line 46, in init prep_data = spawn.get_preparation_data(process_obj._name) File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py”, line 143, in get_preparation_data _check_not_importing_main() File “C:\Users\XA\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py”, line 136, in _check_not_importing_main is not going to be frozen to produce an executable.’’’) RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.

sys:1: RuntimeWarning: coroutine ‘BaseEventLoop.create_server’ was never awaited

Also the code seems to run twice, but no success in either attempts. Kindly assist on this, please. Thanks in advance!!

Hi @xames3, did you solve this error?