TypeError: 'NoneType' object is not callable (while exiting interactive learning)

Hi,

My bot trains fine and runs fine in the interactive learning mode, but while exiting the this mode I get the error-

Traceback (most recent call last):
  File "my_train.py", line 12, in <module>
    agent.train_online(stories_data,epochs=200,model_path=output_path,validation_split = 0.1) # Just use whatever you had before for args to this function
  File "/home/zensar/.local/lib/python3.5/site-packages/rasa_core/agent.py", line 305, in train_online
    input_channel)
  File "/home/zensar/.local/lib/python3.5/site-packages/rasa_core/policies/online_trainer.py", line 76, in run_online_training
    input_channel if input_channel else ConsoleInputChannel())
  File "/home/zensar/.local/lib/python3.5/site-packages/rasa_core/agent.py", line 165, in handle_channel
    processor.handle_channel(input_channel)
  File "/home/zensar/.local/lib/python3.5/site-packages/rasa_core/processor.py", line 72, in handle_channel
    input_channel.start_sync_listening(self.handle_message)
  File "/home/zensar/.local/lib/python3.5/site-packages/rasa_core/channels/console.py", line 60, in start_sync_listening
    self._record_messages(message_handler)
  File "/home/zensar/.local/lib/python3.5/site-packages/rasa_core/channels/console.py", line 53, in _record_messages
    self.sender_id))
  File "/home/zensar/.local/lib/python3.5/site-packages/rasa_core/processor.py", line 95, in handle_message
    self._predict_and_execute_next_action(message, tracker)
  File "/home/zensar/.local/lib/python3.5/site-packages/rasa_core/processor.py", line 269, in _predict_and_execute_next_action
    action = self._get_next_action(tracker)
  File "/home/zensar/.local/lib/python3.5/site-packages/rasa_core/processor.py", line 415, in _get_next_action
    idx = self.policy_ensemble.predict_next_action(tracker, self.domain)
  File "/home/zensar/.local/lib/python3.5/site-packages/rasa_core/policies/ensemble.py", line 88, in predict_next_action
    probabilities = self.probabilities_using_best_policy(tracker, domain)
  File "/home/zensar/.local/lib/python3.5/site-packages/rasa_core/policies/online_trainer.py", line 138, in probabilities_using_best_policy
    intent = self._request_intent(tracker, domain)
  File "/home/zensar/.local/lib/python3.5/site-packages/rasa_core/policies/online_trainer.py", line 205, in _request_intent
    utils.str_range_list(0, len(domain.intents))))
  File "/home/zensar/.local/lib/python3.5/site-packages/rasa_core/utils.py", line 204, in request_input
    input_value = input(prompt) if prompt else input()
KeyboardInterrupt
Exception ignored in: <bound method BaseSession.__del__ of <tensorflow.python.client.session.Session object at 0x7f10b0f65278>>
Traceback (most recent call last):
  File "/home/zensar/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 707, in __del__
TypeError: 'NoneType' object is not callable

This my train file-

from rasa_core.agent import Agent
from rasa_core.policies.fallback import FallbackPolicy
from rasa_core.policies.keras_policy import KerasPolicy
from rasa_core.policies.memoization import MemoizationPolicy

output_path = "models\current\dialog"
fallback = FallbackPolicy(fallback_action_name="utter_oops", core_threshold=0.30, nlu_threshold=0.30)
agent = Agent("domain.yml", policies = [MemoizationPolicy(max_history = 3), KerasPolicy(), fallback],interpreter="./models/current/nlu") # all you're doing here is adding the fallback everything else should be the same as before
stories_file = "data/stories.md"
stories_data = agent.load_data(stories_file)

agent.train_online(stories_data,epochs=200,model_path=output_path,validation_split = 0.1)

I am using RASA 0.10.4 Please let me know if any more information is needed.

Thank you, Shruti

I think you need to pass NaturalLanguageInterpreter for interpreter in this case. Try:

from rasa_core.interpreter import RasaNLUInterpreter
interpreter = RasaNLUInterpreter("./models/current/nlu")
agent = Agent("domain.yml", policies = [MemoizationPolicy(max_history = 3), KerasPolicy(), fallback],interpreter=interpreter)

Hi Cuong,

Apologies for the late reply. Thank you. It worked!

Best, Shruti

Hi Cuong,

Sorry correction. It works sometimes, but sometimes it again gives the above error.

Best, Shruti

I don’t think problem happen in your code, can you try update to rasa core 0.11 to see if problem happen again. If yes so please report to them in rasa core github repo.