sys:1: RuntimeWarning: coroutine 'Agent.load_data' was never awaited
See original GitHub issueRasa version: -e git+https://github.com/RasaHQ/rasa_core.git@41bb59fc934bb5a1ae4d8cebe412751038c3b2b9#egg=rasa rasa-core-sdk==0.13.1 rasa-nlu==0.15.0
Python version: Python 3.6.7
Operating system (windows, osx, …): Distributor ID: Ubuntu Description: Ubuntu 18.04.2 LTS Release: 18.04 Codename: bionic
Issue: I am getting following issue when I train the core model.
Traceback (most recent call last):
File "dialogue_management_model.py", line 54, in <module>
train_dialogue(interpreter=RasaNLUInterpreter)
File "dialogue_management_model.py", line 37, in train_dialogue
training_data)
File "/home/ubuntu/rasa_stack/rasa_core/rasa/core/agent.py", line 580, in train
**kwargs)
File "/home/ubuntu/rasa_stack/rasa_core/rasa/core/policies/ensemble.py", line 83, in train
policy.train(training_trackers, domain, **kwargs)
File "/home/ubuntu/rasa_stack/rasa_core/rasa/core/policies/memoization.py", line 139, in train
for t in training_trackers
TypeError: 'coroutine' object is not iterable
sys:1: RuntimeWarning: coroutine 'Agent.load_data' was never awaited
Please find the code in dialogue_management_model.py below:
from rasa.core.agent import Agent
from rasa.core.policies import FallbackPolicy, KerasPolicy, MemoizationPolicy, FormPolicy
from rasa.core.interpreter import RasaNLUInterpreter
from rasa.core.training import interactive
from rasa.core.utils import EndpointConfig
logger = logging.getLogger(__name__)
# this will catch predictions the model isn't very certain about
# there is a threshold for the NLU predictions as well as the action predictions
fallback = FallbackPolicy(fallback_action_name="utter_unclear",
core_threshold=0.2,
nlu_threshold=0.1)
def train_dialogue(interpreter,domain_file = 'domain.yml',
model_path = './models/dialogue',
training_data_file = './data/stories.md'):
#action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")
agent = Agent(domain_file, policies=[MemoizationPolicy(), KerasPolicy(), FormPolicy(), fallback])
training_data = agent.load_data('./data/stories.md')
agent.train(training_data)
agent.persist('models/dialogue')
return agent
def run_weather_bot(serve_forever=True):
nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/current')
action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")
agent = Agent.load('./models/dialogue', interpreter=nlu_interpreter, action_endpoint=action_endpoint)
#rasa_core.run.serve_application(agent ,channel='cmdline')
return agent
if __name__ == '__main__':
train_dialogue(interpreter=RasaNLUInterpreter)
run_weather_bot()
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
sys:1: RuntimeWarning: coroutine was never awaited
The warning you're seeing is telling you that the coroutine didn't run. it was only created, but not consumed. As to your code,...
Read more >coroutine 'main' was never awaited - You.com | The AI Search ...
i'm trying to mock an async function that is being called inside of a fastapi endpoint but i'm getting the runtime warning that...
Read more >Rasa shell (sys:1: RuntimeWarning: coroutine 'Loop ...
Rasa shell (sys:1: RuntimeWarning: coroutine 'Loop.create_server' was never awaited) Tried re-install tensorflow, didn't work.
Read more >[Example code]-RuntimeWarning: coroutine was never awaited
Been having a lot of trouble lately trying to make my Discord bot simply pull data from Pubg.op.gg and give the user its...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Nomiluks -
Add the following in imports import asyncio
Modify your code while using load_data training_data = asyncio.run(agent.load_data(‘./data/stories.md’))
This has worked for me. Please let me know if this works for you too.
No ❗️ Rasa is open-source and will always stay hackable / customizable. However, we will try to make it as easy usable as possible and to make everything important configurable without having to write custom code. This also makes it easier for you to upgrade and so on.