Receive notifications about your model training anywhere you want!
Project description
TensorFlow Notification Callback
A Tensorflow/Keras callback which sends information about your model training, on various messaging platforms.
Installation
Using pip
:
pip install tf_notification_callback
Usage
Import the required module and add it to the list callbacks while training your model.
Example:
>>> from tf_notification_callback import TelegramCallback
>>> telegram_callback = TelegramCallback('<BotToken>',
'<ChatID>',
'CNN Model',
['loss', 'val_loss'],
['accuracy', 'val_accuracy'],
True)
>>> model.fit(x_train, y_train,
batch_size=32,
epochs=10,
validation_data=(x_test, y_test),
callbacks=[telegram_callback])
Telegram
- Create a telegram bot using BotFather
- Search for @BotFather on telegram.
- Send
/help
to get list of all commands. - Send
/newbot
to create a new bot and complete the setup. - Copy the bot token after creating the bot.
- Get the chat ID
- Search for the bot you created and send it any random message.
- Go to this URL
https://api.telegram.org/bot<BOT_TOKEN>/getUpdates
(replace <BOT_TOKEN> with your bot token) - Copy the
chat id
of the user you want to send messages to.
- Use the
TelegramCallback()
class.
TelegramCallback(bot_token=None, chat_id=None, modelName='model', loss_metrics=['loss'], acc_metrics=[], getSummary=False):
Arguments:
bot_token
: unique token of Telegram bot {str}
chat_id
: Telegram chat id you want to send message to {str}
modelName
: name of your model {str}
loss_metrics
: loss metrics you want in the loss graph {list of strings}
acc_metrics
: accuracy metrics you want in the accuracy graphs {list of strings}
getSummary
: Do you want message for each epoch (False) or a single message containing information about all epochs (True). {bool}
Slack
- Create a Slack workspace
- Create a new channel
- Search for the Incoming Webhooks in the Apps and install it.
- Copy the Webhook URL
- Import the
SlackCallback()
class. It takes in the following arguments
webhookURL
: unique webhook URL of the app {str}
channel
: channel name or username you want to send message to {str}
modelName
: name of your model {str}
loss_metrics
: loss metrics you want in the loss graph {list of strings}
acc_metrics
: accuracy metrics you want in the accuracy graph {list of strings}
getSummary
: Do you want message for each epoch (False) or a single message containing information about all epochs (True). {bool}
Sending images in Slack is not supported currently.
ToDo
- Zulip
- Messages
Motivation
As the Deep Learning models are getting more and more complex and computationally heavy, they take a very long time to train. During my internship, people used to start the model training and left it overnight. They could only check its progress the next day. So I thought it would be great if there was a simple way to get the training info remotely on their devices.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for tf_notification_callback-0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 392c53f97bb3556facede143a936470b39cf5d26594184393d282ab666044319 |
|
MD5 | bc7f70b8248b3cad0e0afe2e08ad2227 |
|
BLAKE2b-256 | 5e23598955b328f398f4063214c849c3abf010920d1984a6ce92769bf9cbf578 |
Hashes for tf_notification_callback-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55a7e17e22c9d46a2229457ce231be9feb322c8e3e4d59e12eb2a934361e5ff6 |
|
MD5 | 5e67bd22bceff48964c67cbb49856b93 |
|
BLAKE2b-256 | 0a3593e734aa951c2e2492ca1fc15fe6116b92411f412e809f897b5af85ffc3b |