Keras Notification Callback
A Keras callback which sends information about your model training, on various messaging platforms.
Installation
Using pip:
pip install keras-webhook-callback
Usage
Import the required module and add it to the list callbacks while training your model.
Example:
>>> from keras_webhook_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
- Use the
SlackCallback()class.
SlackCallback(bot_token=None, chat_id=None, modelName='model', loss_metrics=['loss'], acc_metrics=[], getSummary=False):
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.
Metadata
Release files for keras-webhook-callback 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| keras_webhook_callback-0.2.3.tar.gz | 4.0 kB | Without provenance | Details |
Release files / keras_webhook_callback-0.2.3.tar.gz
| Download URL | keras_webhook_callback-0.2.3.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dab7ba8a5b5db756b7b2a35d0f5e4bec90d113fe44a1307893d1f9820febf372
|
|
BLAKE2b-256 checksum How to use checksums |
cc9d7983172005aee831ff8793d81392fb1c4d1ea5d43eee902f96db542b7dcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0.post20200309 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
|
Security for keras-webhook-callback 0.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.