My model is training

How to use a script with Twilio to receive a notification when a data model is finished training.

Lucas A. Meyer


July 15, 2022

If you’re a data scientist, you’re probably very much used to wait for model training results.

Sometimes I wait for so long that I forget to check back. To help me with that, I wrote a tiny script that uses Twilio to text me when my model is done training.

Twilio is inexpensive. At the time I’m writing this, it costs $1 per month for a phone number. You can also use your own phone number for 50 cents per month, but I didn’t try that yet. Each text costs less than 1 cent. Even in a month when I am getting lots of notifications, I usually spend less than $2.

After importing the library, the code to send an update is an one-liner:

client.api.account.messages.create(to=, from_=, body=“Training done!”)

Here’s a simple example of how this already saved me time. During the development of a model, I frequently do something like a LIMIT(1000) in my data to make sure the whole program (inputs, outputs, diagnostics) is working before running the model on the full data. I thought I was ready to go and kicked off the model, closed my computer and was going out for the day, without knowing that I had forgotten to remove the LIMIT(1000). Almost immediately, I got a text telling me that training was complete. I logged back in, removed the LIMIT(1000) from the data acquisition, and kicked off the training again.

If I didn’t receive the text, I would realize what happened only on the day after, and would have to wait for the model to run instead of simply starting my next day analyzing the results.

That’s pretty good value for one line.