Hi guys,
I'm adding chatterbot to a server, so people can interact with it from my website. The server which will host the chatterbot (2 GB RAM, 2 cores) runs much slower than my home computer, and the kernel seems to kill my chatbot after a few minutes of use. (It usually responds to about 3-4 statements before getting killed.) Further, I'm having a hard time profiling my chatterbot to find out exactly where the CPU resources are causing the kernel to pull the plug on it. I'm relatively new to python, and I'd like to know what kind of tools you guys have been using to profile performance issues. This is how I'm initializing my instance:
# Create a new ChatBot instance
bot = ChatBot('Ava',
logic_adapters=[
{
"import_path": "chatterbot.logic.BestMatch",
"statement_comparison_function": "chatterbot.comparisons.levenshtein_distance",
"response_selection_method": "chatterbot.response_selection.get_first_response"
}
],
filters=[
'chatterbot.filters.RepetitiveResponseFilter'
],
# Gitter information
input_adapter="chatterbot.input.Gitter",
gitter_api_token="***",
gitter_room="59434886d73408ce4f67af23",
gitter_only_respond_to_mentions=False,
output_adapter="chatterbot.output.Gitter",
storage_adapter='chatterbot.storage.MongoDatabaseAdapter',
database='ava_movie',
database_uri='127.0.0.1:27017',
trainer='chatterbot.trainers.ListTrainer'
)
The chatbot will take a good amount of time to respond, and after a few minutes of slow responses, the kernel kills my bot. I trained the bot with the Cornell Movie Dialog Corpus (https://www.cs.cornell.edu/~cristian/Cornell_Movie-Dialogs_Corpus.html), which contains roughly 220k conversations, and I don't think the problem is with the amount of conversations used.
I've tried toggling some of the logic adapters, but those don't seem to have much of an effect.
Is there any profiling tools/debug configs you guys use specifically for chatterbot? If not, is there some general tools for profiling python programs?
I am using only cProfile, you could try like this
python -m cProfile -o output_file.log examples/terminal_example.py
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
I am using only cProfile, you could try like this