I’m running a bot that relies on a lot of custom actions, after one particular action where the bot uses spacy to extract information from the user message, the actions server quits without throwing an error.
server log:
extracting verb type
2023-11-06 13:12:24 INFO simpletransformers.classification.classification_utils - Converting to features started. Cache is not used.
100%|██████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 9.27it/s]
100%|██████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 8.84it/s]
can be used 1
2023-11-06 13:12:25 INFO simpletransformers.classification.classification_utils - Converting to features started. Cache is not used.
100%|██████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 12.22it/s]
100%|██████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 8.89it/s]
simulate 1
2023-11-06 13:12:26 INFO simpletransformers.classification.classification_utils - Converting to features started. Cache is not used.
100%|██████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 11.34it/s]
100%|██████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 6.19it/s]
utilizing 1
2023-11-06 13:12:27 INFO simpletransformers.classification.classification_utils - Converting to features started. Cache is not used.
100%|██████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 10.39it/s]
100%|██████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 8.87it/s]
consolidate 1
2023-11-06 13:12:28 INFO simpletransformers.classification.classification_utils - Converting to features started. Cache is not used.
100%|██████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 13.02it/s]
100%|██████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 8.62it/s]
be downlinked 0
2023-11-06 13:12:29 INFO simpletransformers.classification.classification_utils - Converting to features started. Cache is not used.
100%|██████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 11.27it/s]
100%|██████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 10.20it/s]
scheduled 1
2023-11-06 13:12:29 INFO simpletransformers.classification.classification_utils - Converting to features started. Cache is not used.
100%|██████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 11.31it/s]
100%|██████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 12.58it/s]
schedules 1
2023-11-06 13:12:30 INFO simpletransformers.classification.classification_utils - Converting to features started. Cache is not used.
100%|██████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 11.72it/s]
100%|██████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 14.22it/s]
observing 1
2023-11-06 13:12:31 INFO simpletransformers.classification.classification_utils - Converting to features started. Cache is not used.
100%|██████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 11.25it/s]
100%|██████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 15.00it/s]
changing 1
finished extracting verb type
finished creating components
finished insert_data
(venv) user@server_host:~/chatbot$
action code:
class ActionInsertData(Action):
def name(self) -> Text:
return "action_insert_data"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
communicator.insert_data(tracker.get_slot("insert_data_option"),
[tracker.get_slot("topic"), tracker.get_slot("lesson"), tracker.get_slot("background")]) # check background slot name
print('finished insert_data')
return []
def add_data(option, data):
verb_data = extract_verb_type(data[1])
print('finished creating components')
return []
def extract_verb_type(text):
print('extracting verb type')
model = ClassificationModel(
"roberta", "silkski/verb-class", use_cuda=False
)
nlp = spacy.load('en_core_web_sm')
pattern = [{'POS': 'VERB', 'OP': '?'},
{'POS': 'ADV', 'OP': '*'},
{'POS': 'AUX', 'OP': '*'},
{'POS': 'VERB', 'OP': '+'}]
# instantiate a Matcher instance
matcher = Matcher(nlp.vocab)
matcher.add("Verb phrase", [pattern])
doc = nlp(text)
# call the matcher to find matches
final = []
for sent in doc.sents:
type_def, type_act = 0, 0
matches = matcher(sent)
spans = [sent[start:end] for _, start, end in matches]
for verb in filter_spans(spans):
predictions, raw_outputs = model.predict([str(verb)])
print(verb, predictions[0])
if str(predictions[0]) == '0':
type_def += 1
elif str(predictions[0]) == '1':
type_act += 1
if type_def > type_act:
final.append([sent, 'Definition'])
else:
final.append([sent, 'Action'])
print('finished extracting verb type')
return final
what is strange is that all of the print commands show up fine, then after the action completes the action server just stops.