Introducing slackker for ML model training monitoring 🔥

Siddhesh Gunjal
4 min readJan 13, 2023

--

slackker for ML training monitoring

In the world where DL models are getting larger and data on which they are trained is getting humongous day by day, we all know it takes considerate amount of time to train them and we cannot always sit in front of our machine to monitor it’s progress and then plot the final model performance manually to check whether it was all worth or not right? that’s not productive at all!

So let me introduce you to this simple python package I have made to make your life easy. “slackker” is Python package for monitoring your ML training status in real-time on slack your channel in real-time. Let me show we what we can achieve with slackker:

slackker in action — Training progress notification on smart watch through slack

So, even if you’re away from your machine, you can get real-time update about the progress of your model training.

Features:

  • Report training loss and validation loss at the end of every epoch
  • After training has finished report Total number of epoch model trained for, Best Epoch with lowest loss, Training & validation loss & Validation accuracy of best epoch.
  • Generate Graphs for Loss & Accuracy progress and export & save to format for your choice. (supported formats: eps, jpeg, jpg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff)
  • send generated graphs to slack after training has finished.

Getting started with slackker callbacks for keras

You can setup slackker with slack or telegram. please follwo below mentioned link for detailed setup guide.

Now we are ready to use slackker in your training flow! 😈

Install slackker in your environment with pip

pip install slackker

Import slackker.callbacks with following line:

from slackker.callbacks.keras import SlackUpdate

create slackker object with SlackUpdate

slack_update = SlackUpdate(token="xoxb-123234234235-123234234235-adedce74748c3844747aed",
channel="A04AAB77ABC",
ModelName='Simple_NN',
export='png',
SendPlot=True)

SlackUpdate takes following arguments:

  • token: (string) Slack app token
  • channel: (string) Slack channel where you want to receive updates (make sure you have added slack app to this same channel)
  • ModelName: (string) Name for your model. This same name will be used in future for title of the generated plots.
  • export: (string) default "png": Format for plots to be exported. (supported formats: eps, jpeg, jpg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff)
  • SendPlots: (Bool) default True: If set to True it will export history of model, both training and validation, save it in the format given in export argument and send graphs to slack channel when training ends. If set to False it will not send exported graphs to slack channel.
  • verbose: (int) default 0: You can sent the verbose level up to 3.

Now you can call slackker object into callbacks argument just like any other callbacks object.

history = model.fit(x_train, 
y_train,
epochs = 3,
batch_size = 16,
verbose=1,
validation_data=(x_val,y_val),
callbacks=[slack_update])

Final code looks something like this:

# Import library for keras
from slackker.callbacks.keras import SlackUpdate

# Train-Test split for your keras model
x_train, x_test, y_train, y_test = train_test_split(x, y, train_size=0.8)
x_train, x_val, y_train, y_val = train_test_split(x_train, y_train, train_size=0.8)

# Build keras model
model = Sequential()
model.add(Dense(8,activation='relu',input_shape = (IMG_WIDTH, IMG_HEIGHT, DEPTH)))
model.add(Dense(3,activation='softmax'))
model.compile(optimizer = 'rmsprop', loss='categorical_crossentropy', metrics=['accuracy'])

# Create Slackker object
slack_update = SlackUpdate(token="xoxb-123234234235-123234234235-adedce74748c3844747aed",
channel="A04AAB77ABC",
ModelName='Simple_NN',
export='png',
SendPlot=True)

# Call Slackker object in model.fit() callbacks
history = model.fit(x_train,
y_train,
epochs = 3,
batch_size = 16,
verbose=1,
validation_data=(x_val,y_val),
callbacks=[checkpoints, slack_update])

We’re now ready to use slackker 💪

If everything is setup right you’ll receive update like below in your slack channel.

I hope slackker you keep track of your ML training progress as it has for me. So now you can quickly go down and have coffee without having to worry about the progress of your ML model.

Future plans for slackker

  • ̶S̶u̶p̶p̶o̶r̶t̶ ̶f̶o̶r̶ ̶T̶e̶l̶e̶g̶r̶a̶m̶
  • ̶S̶u̶p̶p̶o̶r̶t̶ ̶f̶o̶r̶ ̶P̶y̶T̶o̶r̶c̶h̶-̶L̶i̶g̶h̶t̶n̶i̶n̶g̶
  • Support for Discord
  • Support for transformers
  • Support for MLOps workflows

Have anything in mind that can help become slackker better? or require any feature? Do visit the GitHub Repo for more details about contribution to the source code.

Would love to know your experience with slackker. Follow me & star the repo to get updates about the future releases of slackker.

--

--

Siddhesh Gunjal

ML Engineer | Creator of Slackker (PyPi pakage) | Former Adjunct Faculty @upGrad | Former Professor @BSE (Bombay stock exchange)