Trouble replacing new models through the API

(post refers to Rasa 2.4.0)

Aim: When I initiate a local rasa server, I am hoping to only use http requests to replace the model that is currently running. I would like to do this without having to take down the rasa server and retrain the model.

Attempt: Once I enabled the local server, using:

rasa run -m models --enable-api --log-file out.log -vv

When I try the PUT - replace the currently loaded model api from the docs by running:

curl -X PUT http://localhost:5005/model -H ‘Content-type: application/json’ --data-binary “@replaceModel.txt

Where the replaceModel.txt file is

{
  "model_file": "models/20210423-144222.tar.gz",
  "model_server": {
    "url": "http://localhost:5005/model/20210423-144222.tar.gz",
    "wait_time_between_pulls": 0
  },
  "remote_storage": "aws"
}

So it says that the model has been successfully loaded. However, I cannot seem to communicate with the bot once this change has been made. When I ping it:

$ curl -XPOST localhost:5005/webhooks/rest/webhook -d ‘{“sender”:“111”,“message”:“hi”}’

I get the following prompts from the server:

2021-05-06 11:57:54 DEBUG    rasa.server  - Successfully loaded model 'models/20210423-144222.tar.gz'.
2021-05-06 11:58:03 DEBUG    rasa.core.lock_store  - Issuing ticket for conversation '111'.
2021-05-06 11:58:03 DEBUG    rasa.core.lock_store  - Acquiring lock for conversation '111'.
2021-05-06 11:58:03 DEBUG    rasa.core.lock_store  - Acquired lock for conversation '111'.
2021-05-06 11:58:03 DEBUG    rasa.core.tracker_store  - Could not find tracker for conversation ID '111'.
2021-05-06 11:58:03 DEBUG    rasa.core.processor  - Starting a new session for conversation ID '111'.
2021-05-06 11:58:03 DEBUG    rasa.core.processor  - Policy prediction ended with events '[]'.
2021-05-06 11:58:03 DEBUG    rasa.core.processor  - Action 'action_session_start' ended with events '[<rasa.shared.core.events.SessionStarted object at 0x7f2f00451f60>, ActionExecuted(action: action_listen, policy: None, confidence: None)]'.
2021-05-06 11:58:03 DEBUG    rasa.core.processor  - Current slot values: 
        session_started_metadata: None
2021-05-06 11:58:03 DEBUG    rasa.core.processor  - Received user message 'hi' with intent '{'name': 'hi', 'confidence': 1.0}' and entities '[]'
2021-05-06 11:58:03 DEBUG    rasa.core.processor  - Logged UserUtterance - tracker now has 4 events.
/home/asugar/my_test/venv/lib/python3.6/site-packages/rasa/shared/utils/io.py:96: UserWarning: No policy ensemble or domain set. Skipping action prediction and execution.
  More info at https://rasa.com/docs/rasa/policies
2021-05-06 11:58:03 DEBUG    rasa.core.lock_store  - Deleted lock for conversation '111'.

Before I ran the “PUT replace loaded model” call, when the rasa server freshly initiated, I tried to communicate with the bot by pinging it:

$ curl -XPOST localhost:5005/webhooks/rest/webhook -d ‘{“sender”:“111”,“message”:“hi”}’

[{“recipient_id”:“111”,“text”:“Hello, this is the bot service, powered by Rasa. How could I help?”}]

I have tested the model separately using rasa interactive and feeding it that particular model through the -m flag. The “hi” input should work. So I think the way I am trying to replace the model is incorrect and I am unsure what I can do to fix this. Could I please get some guidance with this? Thank you.

That’s look like load model failed. When you initiate a POST request, how about the response? BTW, depend on the api doc. You can directly try this one, (if the model in your local dir):

curl -X PUT  \
  'http://localhost:5005/model' \
 \
  -d '{
  "model_file": "/models/20190512.tar.gz",
}'
1 Like