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
/helpto get list of all commands. - Send
/newbotto 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 idof 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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tf_notification_callback-0.2.tar.gz.
File metadata
- Download URL: tf_notification_callback-0.2.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37ecd8f6abd7f1a72edd59a6c0c62434d00be1e9069e5c65441a973dd4c9dcf8
|
|
| MD5 |
6c9ac55b6efe91876872c36e23d2a9d0
|
|
| BLAKE2b-256 |
9bd96de5893c6e1de7bf2dcff912fcdac627b43fefd593b89a880a4d0f7557fa
|
File details
Details for the file tf_notification_callback-0.2-py3-none-any.whl.
File metadata
- Download URL: tf_notification_callback-0.2-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
534af0f589fc08a1a71c26a133650f58dac24c716a8b869e449db9edcde15b46
|
|
| MD5 |
fb12e4c48c2f03d00358fa44b7ec3a1a
|
|
| BLAKE2b-256 |
8a2eaa4b4d04982f37bce230134e7187c21d49dd188bb9f6434a4e3bdf856e22
|