{"id":16026948,"url":"https://github.com/techytushar/tf_notification_callback","last_synced_at":"2025-03-18T03:32:02.067Z","repository":{"id":54933132,"uuid":"240702766","full_name":"techytushar/tf_notification_callback","owner":"techytushar","description":"TensorFlow/Keras Callback for receiving notifications","archived":false,"fork":false,"pushed_at":"2021-01-20T21:23:24.000Z","size":5,"stargazers_count":9,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T06:51:35.390Z","etag":null,"topics":["deep-learning","keras","machine-learning","python3","tensorflow"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/tf-notification-callback/0.2/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/techytushar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-15T12:06:09.000Z","updated_at":"2025-01-10T00:06:21.000Z","dependencies_parsed_at":"2022-08-14T07:00:21.809Z","dependency_job_id":null,"html_url":"https://github.com/techytushar/tf_notification_callback","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techytushar%2Ftf_notification_callback","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techytushar%2Ftf_notification_callback/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techytushar%2Ftf_notification_callback/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techytushar%2Ftf_notification_callback/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/techytushar","download_url":"https://codeload.github.com/techytushar/tf_notification_callback/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243544662,"owners_count":20308169,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","keras","machine-learning","python3","tensorflow"],"created_at":"2024-10-08T20:04:14.714Z","updated_at":"2025-03-18T03:32:01.802Z","avatar_url":"https://github.com/techytushar.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TensorFlow Notification Callback\n\n[![forthebadge made-with-python](http://ForTheBadge.com/images/badges/made-with-python.svg)](https://www.python.org/)\n\n[![PyPI version](https://badge.fury.io/py/tf-notification-callback.svg)](https://badge.fury.io/py/tf-notification-callback)\n\nA Tensorflow/Keras callback which sends information about your model training, on various messaging platforms.\n\n## Installation\n\nUsing `pip`:\n\n```bash\npip install tf_notification_callback\n```\n\n## Usage\n\nImport the required module and add it to the list callbacks while training your model.\n\n**Example:**\n\n```python\n\u003e\u003e\u003e from tf_notification_callback import TelegramCallback\n\u003e\u003e\u003e telegram_callback = TelegramCallback('\u003cBotToken\u003e',\n                                         '\u003cChatID\u003e',\n\t                                 'CNN Model',\n\t                                 ['loss', 'val_loss'],\n\t                                 ['accuracy', 'val_accuracy'],\n\t                                 True)\n\u003e\u003e\u003e model.fit(x_train, y_train,\n              batch_size=32,\n              epochs=10,\n              validation_data=(x_test, y_test),\n              callbacks=[telegram_callback])\n```\n\n### Telegram\n\n1. Create a telegram bot using BotFather\n\t* Search for @BotFather on telegram.\n\t* Send `/help` to get list of all commands.\n\t* Send `/newbot` to create a new bot and complete the setup.\n\t* Copy the **bot token** after creating the bot.\n2. Get the **chat ID**\n\t* Search for the bot you created and send it any random message.\n\t* Go to this URL `https://api.telegram.org/bot\u003cBOT_TOKEN\u003e/getUpdates` (replace \u003cBOT_TOKEN\u003e with your bot token)\n\t* Copy the `chat id` of the user you want to send messages to.\n3. Use the `TelegramCallback()` class.\n\n```python\nTelegramCallback(bot_token=None, chat_id=None, modelName='model', loss_metrics=['loss'], acc_metrics=[], getSummary=False):\n```\n\n**Arguments:**\n\n* `bot_token` : unique token of Telegram bot `{str}`\n* `chat_id` : Telegram chat id you want to send message to `{str}`\n* `modelName` : name of your model `{str}`\n* `loss_metrics` : loss metrics you want in the loss graph `{list of strings}`\n* `acc_metrics` : accuracy metrics you want in the accuracy graphs `{list of strings}`\n* `getSummary` : Do you want message for each epoch (False) or a single message containing information about all epochs (True). `{bool}`\n\n### Slack\n\n1. Create a Slack workspace\n2. Create a new channel\n3. Search for the **Incoming Webhooks** in the Apps and install it.\n4. Copy the **Webhook URL**\n5. Use the `SlackCallback()` class.\n\n```python\nSlackCallback(bot_token=None, chat_id=None, modelName='model', loss_metrics=['loss'], acc_metrics=[], getSummary=False):\n```\n\n**Arguments:**\n\n* `webhookURL` : unique webhook URL of the app `{str}`\n* `channel` :  channel name or username you want to send message to `{str}`\n* `modelName` : name of your model `{str}`\n* `loss_metrics` : loss metrics you want in the loss graph `{list of strings}`\n* `acc_metrics` : accuracy metrics you want in the accuracy graph `{list of strings}`\n* `getSummary` : Do you want message for each epoch (False) or a single message containing information about all epochs (True). `{bool}`\n\n*Sending images in Slack is not supported currently.*\n\n## ToDo\n\n* WhatsApp\n* E-Mail\n* Zulip\n* Messages\n\n## Motivation\n\nAs 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechytushar%2Ftf_notification_callback","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechytushar%2Ftf_notification_callback","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechytushar%2Ftf_notification_callback/lists"}