Custom actions strange behaviour

rasa-core==0.11.3
rasa-core-sdk==0.11.3
rasa-nlu==0.13.2

Behave differently while running on CPU and GPU.

GPU: When I run the rasa_core.train is does not complain about endpoints server and runs without exception

2018-09-13 17:46:11 INFO     root  - Rasa process starting
2018-09-13 17:46:16 INFO     rasa_nlu.components  - Added 'nlp_spacy' to component cache. Key 'nlp_spacy-en'.
2018-09-13 17:46:16 WARNING  py.warnings  - /home/imran/mecosProviderBot/.provider/lib/python3.5/site-packages/rasa_nlu/extractors/entity_synonyms.py:85: UserWarning: Failed to load synonyms file from 'models/mecosProvider/current/mecosProviderModel/entity_synonyms.json'
  "".format(entity_synonyms_file))

2018-09-13 17:46:17.122743: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:897] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2018-09-13 17:46:17.123544: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1405] Found device 0 with properties: 
name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.721
pciBusID: 0000:03:00.0
totalMemory: 10.92GiB freeMemory: 10.46GiB
2018-09-13 17:46:17.123577: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1484] Adding visible gpu devices: 0
2018-09-13 17:46:17.596420: I tensorflow/core/common_runtime/gpu/gpu_device.cc:965] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-09-13 17:46:17.596475: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971]      0 
2018-09-13 17:46:17.596490: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] 0:   N 
2018-09-13 17:46:17.596911: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10120 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:03:00.0, compute capability: 6.1)
2018-09-13 17:46:18 INFO     tensorflow  - Restoring parameters from models/mecosProvider/current/mecosProviderModel/intent_classifier_tensorflow_embedding.ckpt
Using TensorFlow backend.
2018-09-13 17:46:20.078089: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1484] Adding visible gpu devices: 0
2018-09-13 17:46:20.078162: I tensorflow/core/common_runtime/gpu/gpu_device.cc:965] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-09-13 17:46:20.078174: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971]      0 
2018-09-13 17:46:20.078182: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] 0:   N 
2018-09-13 17:46:20.078376: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10120 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:03:00.0, compute capability: 6.1)
2018-09-13 17:46:20 WARNING  py.warnings  - /home/imran/mecosProviderBot/.provider/lib/python3.5/site-packages/pykwalify/core.py:99: UnsafeLoaderWarning: 
The default 'Loader' for 'load(stream)' without further arguments can be unsafe.
Use 'load(stream, Loader=ruamel.yaml.Loader)' explicitly if that is OK.
Alternatively include the following in your code:

  import warnings
  warnings.simplefilter('ignore', ruamel.yaml.error.UnsafeLoaderWarning)

In most other cases you should consider using 'safe_load(stream)'
  data = yaml.load(stream)

2018-09-13 17:46:20 INFO     root  - Finished loading agent, starting input channel & server.
Bot loaded. Type a message and press enter: 
open settings
2018-09-13 17:46:29 DEBUG    rasa_core.tracker_store  - Creating a new tracker for id 'default'.
2018-09-13 17:46:29 DEBUG    rasa_core.processor  - Received user message 'open settings' with intent '{'confidence': 0.9467852711677551, 'name': 'navigate.settings'}' and entities '[{'value': 'open', 'confidence': 0.9867447939418127, 'end': 4, 'extractor': 'ner_crf', 'entity': 'command', 'start': 0}, {'value': 'settings', 'confidence': 0.9034592359664564, 'end': 13, 'extractor': 'ner_crf', 'entity': 'settings', 'start': 5}]'
2018-09-13 17:46:29 DEBUG    rasa_core.processor  - Logged UserUtterance - tracker now has 4 events
2018-09-13 17:46:29 DEBUG    rasa_core.processor  - Current slot values: 
	settings: settings
	weight_value: None
	calendar: None
	height: None
	temperature_unit: Celsius
	height_unit: in
	inbox: None
	waist_unit: in
	measure_unit: None
	height_length: None
	waist_length: None
	head_unit: None
	diastolic: None
	weight: None
	pulse: None
	pulse_rate: None
	refill_requests: None
	head_length: None
	medication: None
	systolic: None
	head_circumference: None
	command: open
	number: None
	waist: None
	temperature_value: None
	weight_unit: lbs
	temperature_method: None
	respiration_rate: None
	respiration: None
	patient-name: None
2018-09-13 17:46:29 DEBUG    rasa_core.policies.memoization  - Current tracker state [None, None, None, {'slot_waist_unit_0': 1.0, 'slot_height_unit_0': 1.0, 'slot_temperature_unit_0': 1.0, 'slot_weight_unit_0': 1.0}, {'slot_waist_unit_0': 1.0, 'entity_settings': 1.0, 'slot_command_0': 1.0, 'slot_weight_unit_0': 1.0, 'intent_navigate.settings': 1.0, 'entity_command': 1.0, 'slot_settings_0': 1.0, 'slot_height_unit_0': 1.0, 'slot_temperature_unit_0': 1.0, 'prev_action_listen': 1.0}]
2018-09-13 17:46:29 DEBUG    rasa_core.policies.memoization  - There is a memorised next action '5'
2018-09-13 17:46:29 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_0_MemoizationPolicy
2018-09-13 17:46:29 DEBUG    rasa_core.policies.ensemble  - Predicted next action 'utter_navigate_settings' with prob 1.00.
2018-09-13 17:46:29 DEBUG    rasa_core.processor  - Action 'utter_navigate_settings' ended with events '[]'
2018-09-13 17:46:29 DEBUG    rasa_core.processor  - Bot utterance 'BotUttered(text: Opening settings., data: null)'
Opening settings.
2018-09-13 17:46:29 DEBUG    rasa_core.policies.memoization  - Current tracker state [None, None, {'slot_waist_unit_0': 1.0, 'slot_height_unit_0': 1.0, 'slot_temperature_unit_0': 1.0, 'slot_weight_unit_0': 1.0}, {'slot_waist_unit_0': 1.0, 'entity_settings': 1.0, 'slot_command_0': 1.0, 'slot_weight_unit_0': 1.0, 'intent_navigate.settings': 1.0, 'entity_command': 1.0, 'slot_settings_0': 1.0, 'slot_height_unit_0': 1.0, 'slot_temperature_unit_0': 1.0, 'prev_action_listen': 1.0}, {'slot_waist_unit_0': 1.0, 'entity_settings': 1.0, 'slot_command_0': 1.0, 'slot_weight_unit_0': 1.0, 'intent_navigate.settings': 1.0, 'entity_command': 1.0, 'slot_settings_0': 1.0, 'slot_height_unit_0': 1.0, 'slot_temperature_unit_0': 1.0, 'prev_utter_navigate_settings': 1.0}]
2018-09-13 17:46:29 DEBUG    rasa_core.policies.memoization  - There is a memorised next action '29'
2018-09-13 17:46:29 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_0_MemoizationPolicy
2018-09-13 17:46:29 DEBUG    rasa_core.policies.ensemble  - Predicted next action 'action_slot_reset' with prob 1.00.
2018-09-13 17:46:29 DEBUG    rasa_core.processor  - Action 'action_slot_reset' ended with events '['AllSlotsReset()']'
2018-09-13 17:46:29 DEBUG    rasa_core.policies.memoization  - Current tracker state [None, {'slot_waist_unit_0': 1.0, 'slot_height_unit_0': 1.0, 'slot_temperature_unit_0': 1.0, 'slot_weight_unit_0': 1.0}, {'slot_waist_unit_0': 1.0, 'entity_settings': 1.0, 'slot_command_0': 1.0, 'slot_weight_unit_0': 1.0, 'intent_navigate.settings': 1.0, 'entity_command': 1.0, 'slot_settings_0': 1.0, 'slot_height_unit_0': 1.0, 'slot_temperature_unit_0': 1.0, 'prev_action_listen': 1.0}, {'slot_waist_unit_0': 1.0, 'entity_settings': 1.0, 'slot_command_0': 1.0, 'slot_weight_unit_0': 1.0, 'intent_navigate.settings': 1.0, 'entity_command': 1.0, 'slot_settings_0': 1.0, 'slot_height_unit_0': 1.0, 'slot_temperature_unit_0': 1.0, 'prev_utter_navigate_settings': 1.0}, {'slot_waist_unit_0': 1.0, 'entity_settings': 1.0, 'slot_weight_unit_0': 1.0, 'intent_navigate.settings': 1.0, 'entity_command': 1.0, 'slot_temperature_unit_0': 1.0, 'slot_height_unit_0': 1.0, 'prev_action_slot_reset': 1.0}]
2018-09-13 17:46:29 DEBUG    rasa_core.policies.memoization  - There is no memorised next action
2018-09-13 17:46:29 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_1_KerasPolicy
2018-09-13 17:46:29 DEBUG    rasa_core.policies.ensemble  - Predicted next action 'action_listen' with prob 1.00.
2018-09-13 17:46:29 DEBUG    rasa_core.processor  - Action 'action_listen' ended with events '[]'`

CPU: rasa_core.train throws error

Bot loaded. Type a message and press enter (use '/stop' to exit): 
open settings
2018-09-13 17:55:18 DEBUG    rasa_core.tracker_store  - Creating a new tracker for id 'default'.
2018-09-13 17:55:18 DEBUG    rasa_core.processor  - Received user message 'open settings' with intent '{'name': 'navigate.settings', 'confidence': 0.9427257180213928}' and entities '[{'start': 0, 'end': 4, 'value': 'open', 'entity': 'command', 'confidence': 0.9867447939418135, 'extractor': 'ner_crf'}, {'start': 5, 'end': 13, 'value': 'settings', 'entity': 'settings', 'confidence': 0.9034592359664569, 'extractor': 'ner_crf'}]'
2018-09-13 17:55:18 DEBUG    rasa_core.processor  - Logged UserUtterance - tracker now has 4 events
2018-09-13 17:55:18 DEBUG    rasa_core.processor  - Current slot values: 
	calendar: None
	command: open
	diastolic: None
	head_circumference: None
	head_length: None
	head_unit: None
	height: None
	height_length: None
	height_unit: in
	inbox: None
	measure_unit: None
	medication: None
	number: None
	patient-name: None
	pulse: None
	pulse_rate: None
	refill_requests: None
	respiration: None
	respiration_rate: None
	settings: settings
	systolic: None
	temperature_method: None
	temperature_unit: Celsius
	temperature_value: None
	waist: None
	waist_length: None
	waist_unit: in
	weight: None
	weight_unit: lbs
	weight_value: None
2018-09-13 17:55:18 DEBUG    rasa_core.policies.memoization  - Current tracker state [None, None, None, {'slot_weight_unit_0': 1.0, 'slot_waist_unit_0': 1.0, 'slot_height_unit_0': 1.0, 'slot_temperature_unit_0': 1.0}, {'slot_height_unit_0': 1.0, 'intent_navigate.settings': 1.0, 'slot_command_0': 1.0, 'slot_weight_unit_0': 1.0, 'entity_settings': 1.0, 'slot_settings_0': 1.0, 'slot_waist_unit_0': 1.0, 'slot_temperature_unit_0': 1.0, 'entity_command': 1.0, 'prev_action_listen': 1.0}]
2018-09-13 17:55:18 DEBUG    rasa_core.policies.memoization  - There is a memorised next action '5'
2018-09-13 17:55:18 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_1_MemoizationPolicy
2018-09-13 17:55:18 DEBUG    rasa_core.processor  - Predicted next action 'utter_navigate_settings' with prob 1.00.
2018-09-13 17:55:18 DEBUG    rasa_core.processor  - Action 'utter_navigate_settings' ended with events '[]'
2018-09-13 17:55:18 DEBUG    rasa_core.processor  - Bot utterance 'BotUttered(text: Opening settings., data: {
  "elements": null,
  "buttons": null,
  "attachment": null
})'
2018-09-13 17:55:18 DEBUG    rasa_core.policies.memoization  - Current tracker state [None, None, {'slot_weight_unit_0': 1.0, 'slot_waist_unit_0': 1.0, 'slot_height_unit_0': 1.0, 'slot_temperature_unit_0': 1.0}, {'slot_height_unit_0': 1.0, 'intent_navigate.settings': 1.0, 'slot_command_0': 1.0, 'slot_weight_unit_0': 1.0, 'entity_settings': 1.0, 'slot_settings_0': 1.0, 'slot_waist_unit_0': 1.0, 'slot_temperature_unit_0': 1.0, 'entity_command': 1.0, 'prev_action_listen': 1.0}, {'slot_height_unit_0': 1.0, 'intent_navigate.settings': 1.0, 'slot_command_0': 1.0, 'slot_weight_unit_0': 1.0, 'entity_settings': 1.0, 'slot_settings_0': 1.0, 'slot_waist_unit_0': 1.0, 'slot_temperature_unit_0': 1.0, 'entity_command': 1.0, 'prev_utter_navigate_settings': 1.0}]
2018-09-13 17:55:18 DEBUG    rasa_core.policies.memoization  - There is a memorised next action '29'
Opening settings.
2018-09-13 17:55:18 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_1_MemoizationPolicy
2018-09-13 17:55:18 DEBUG    rasa_core.processor  - Predicted next action 'action_slot_reset' with prob 1.00.
2018-09-13 17:55:18 ERROR    rasa_core.processor  - Encountered an exception while running action 'action_slot_reset'. Bot will continue, but the actions events are lost. Make sure to fix the exception in your custom code.
2018-09-13 17:55:18 ERROR    rasa_core.processor  - The model predicted the custom action 'action_slot_reset' but you didn't configure an endpoint to run this custom action. Please take a look at the docs and set an endpoint configuration. https://rasa.com/docs/core/customactions/
Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rasa_core/processor.py", line 319, in _run_action
    events = action.run(dispatcher, tracker, self.domain)
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rasa_core/actions/action.py", line 306, in run
    "".format(self.name(), DOCS_BASE_URL))
Exception: The model predicted the custom action 'action_slot_reset' but you didn't configure an endpoint to run this custom action. Please take a look at the docs and set an endpoint configuration. https://rasa.com/docs/core/customactions/
2018-09-13 17:55:18 DEBUG    rasa_core.processor  - Action 'action_slot_reset' ended with events '[]'
2018-09-13 17:55:18 DEBUG    rasa_core.policies.memoization  - Current tracker state [None, {'slot_weight_unit_0': 1.0, 'slot_waist_unit_0': 1.0, 'slot_height_unit_0': 1.0, 'slot_temperature_unit_0': 1.0}, {'slot_height_unit_0': 1.0, 'intent_navigate.settings': 1.0, 'slot_command_0': 1.0, 'slot_weight_unit_0': 1.0, 'entity_settings': 1.0, 'slot_settings_0': 1.0, 'slot_waist_unit_0': 1.0, 'slot_temperature_unit_0': 1.0, 'entity_command': 1.0, 'prev_action_listen': 1.0}, {'slot_height_unit_0': 1.0, 'intent_navigate.settings': 1.0, 'slot_command_0': 1.0, 'slot_weight_unit_0': 1.0, 'entity_settings': 1.0, 'slot_settings_0': 1.0, 'slot_waist_unit_0': 1.0, 'slot_temperature_unit_0': 1.0, 'entity_command': 1.0, 'prev_utter_navigate_settings': 1.0}, {'slot_height_unit_0': 1.0, 'intent_navigate.settings': 1.0, 'slot_command_0': 1.0, 'slot_weight_unit_0': 1.0, 'entity_settings': 1.0, 'slot_settings_0': 1.0, 'slot_waist_unit_0': 1.0, 'prev_action_slot_reset': 1.0, 'slot_temperature_unit_0': 1.0, 'entity_command': 1.0}]
2018-09-13 17:55:18 DEBUG    rasa_core.policies.memoization  - There is a memorised next action '0'
2018-09-13 17:55:18 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_1_MemoizationPolicy
2018-09-13 17:55:18 DEBUG    rasa_core.processor  - Predicted next action 'action_listen' with prob 1.00.
2018-09-13 17:55:18 DEBUG    rasa_core.processor  - Action 'action_listen' ended with events '[]'
127.0.0.1 - - [2018-09-13 17:55:18] "POST /webhooks/rest/webhook?stream=true&token= HTTP/1.1" 200 185 0.320074

did you forget to pass the --endpoints file?

Yup thanks.

Please need help for this I do exactly (I guess) as is said to get it work but didn’t work for me. Before I was using late version of rasa_core and when updating I had to change the way I do custom actions.

So I start the server of my actions (name of actions file is: actions.py) like:

python -m rasa_core_sdk.ednpoint --actions actions

I get:

INFO:__main__:Starting action endpoint server...
INFO:__main__:Action endpoint is up and running. on ('0.0.0.0', 5055)

And then I do :

python -m rasa_core.run -d models/dialogue --endpoints endpoints.yml

I have a file enpoints.yml like this:

action_endpoint:
  url: http://localhost:5055/webhook

When testing my bot, it listen first to the user and then this senario happen:

User: Bonjour
Bot: Bonjour, voulez vous que je vous aide ?
2018-11-27 09:35:40 ERROR    rasa_core.actions.action  - Failed to run custom action 'action_listen'. 
Action server responded with a non 200 status code of 500. Make sure your action server properly runs 
actions and returns a 200 once the action is executed. Error: 500 Server Error: INTERNAL SERVER 
ERROR for url: http://localhost:5055/webhook
2018-11-27 09:35:40 ERROR    rasa_core.processor  - Encountered an exception while running action 
'action_listen'. Bot will continue, but the actions events are lost. Make sure to fix the exception in your 
custom code.
2018-11-27 09:35:40 ERROR    rasa_core.processor  - Failed to execute custom action.
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\rasa_core\actions\action.py", line 338, in run
response.raise_for_status()
 File "C:\ProgramData\Anaconda3\lib\site-packages\requests\models.py", line 940, in raise_for_status
 raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: INTERNAL SERVER ERROR for url: 
http://localhost:5055/webhook

Don’t know why, need help please.

EDIT: Now by removing action_listen from domain.yml It worked for action_listen. but now my custom actions are not working. The bot Instead try to do : action_default_fallback

And when saying to the bot (interactive training) that I want him to execute my custom function I got the same error as above (my custom action is ‘action_SendIntentProblemeSite’) :

2018-11-27 09:48:46 ERROR    rasa_core.actions.action  - Failed to run custom action 
'action_SendIntentProblemeSite'. Action server responded with a non 200 status code of 500. Make sure 
your action server properly runs actions and returns a 200 once the action is executed. Error: 500 Server    
Error: INTERNAL SERVER ERROR for url: http://localhost:5055/webhook
2018-11-27 09:48:46 ERROR    rasa_core.processor  - Encountered an exception while running action ' 
action_SendIntentProblemeSite'. Bot will continue, but the actions events are lost. Make sure to fix the 
exception in your custom code.
2018-11-27 09:48:46 ERROR    rasa_core.processor  - Failed to execute custom action. 

in actions.py I have:

class action_SendIntentProblemeSite(Action):
    def name(self):
        return 'action_SendIntentProblemeSite'
    def run(self, dispatcher, tracker, domain):
        message = tracker.latest_message.text
        #print(message)
        return [SlotSet('intent_probleme_site', message)]

In my stories.md In th part were I call this action I do :

* bonjour
    - utter_bonjour
* confirmer
    - utter_etape1
* probleme_site
    - action_SendIntentProblemeSite

In domain.yml :

actions:
     - action_SendIntentProblemeSite

What do the logs of the action server look like? Are you running it in a seperate terminal window?