https://github.com/twsl/whos-there
The spiritual successor to knockknock for PyTorch Lightning, get notified when your training ends
https://github.com/twsl/whos-there
deep-learning lightning machine-learning python pytorch pytorch-lightning
Last synced: 30 days ago
JSON representation
The spiritual successor to knockknock for PyTorch Lightning, get notified when your training ends
- Host: GitHub
- URL: https://github.com/twsl/whos-there
- Owner: twsl
- License: mit
- Created: 2021-11-03T18:16:03.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-13T01:36:56.000Z (about 1 year ago)
- Last Synced: 2024-05-14T00:15:39.093Z (about 1 year ago)
- Topics: deep-learning, lightning, machine-learning, python, pytorch, pytorch-lightning
- Language: Python
- Homepage: https://twsl.github.io/whos-there/
- Size: 2.88 MB
- Stars: 74
- Watchers: 3
- Forks: 5
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# Who's there?
[](https://github.com/twsl/whos-there/actions/workflows/build.yaml)
[](https://github.com/twsl/whos-there/actions/workflows/docs.yaml)

[](https://pypi.org/project/whos-there/)
[](https://pypi.org/project/whos-there/)
[](https://github.com/twsl/whos-there/pulls?utf8=%E2%9C%93&q=is:pr%20author:app/dependabot)
[](https://anaconda.org/conda-forge/whos-there)
[](https://anaconda.org/conda-forge/whos-there)
[](https://squidfunk.github.io/mkdocs-material/)
[](https://python-poetry.org/)
[](https://github.com/astral-sh/ruff)
[](.pre-commit-config.yaml)
[](https://microsoft.github.io/pyright/)
[](https://github.com/PyCQA/bandit)
[](https://github.com/twsl/whos-there/releases)
[](https://github.com/copier-org/copier)
[](LICENSE)The spiritual successor to [knockknock](https://github.com/huggingface/knockknock) for [PyTorch Lightning](https://github.com/PyTorchLightning/pytorch-lightning), to get a notification when your training is complete or when it crashes during the process with a single callback.
## Features
- Supports E-Mail, Discord, Slack, Teams, Telegram
## Installation
With `pip`:
```bash
python -m pip install whos-there
```With [`poetry`](https://python-poetry.org/):
```bash
poetry add whos-there
```With `conda`:
```bash
conda install conda-forge::whos-there
```
Check [here](https://github.com/conda-forge/whos-there-feedstock) for more information.## How to use it
```python
import lightning.pytorch as pl
from whos_there.callback import NotificationCallback
from whos_there.senders.debug import DebugSendertrainer = pl.Trainer(
callbacks=[
NotificationCallback(senders=[
# Add your senders here
DebugSender(),
])
]
)
```
Requires your e-mail provider specific SMTP settings.```python
from whos_there.senders.email import EmailSender
# ...
EmailSender(
host="smtp.example.de",
port=587,
sender_email="[email protected]",
password="*********",
recipient_emails=[
"[email protected]",
"[email protected]",
]
)
```### Discord
Requires your Discord channel's [webhook URL](https://support.discordapp.com/hc/en-us/articles/228383668-Intro-to-Webhooks).```python
from whos_there.senders.discord import DiscordSender
# ...
DiscordSender(
webhook_url="https://discord.com/api/webhooks/XXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
)
```### Slack
Requires your Slack room [webhook URL](https://api.slack.com/incoming-webhooks#create_a_webhook) and optionally your [user id](https://api.slack.com/methods/users.identity) (if you want to tag yourself or someone else).```python
from whos_there.senders.slack import SlackSender
# ...
SlackSender(
webhook_url="https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX", # gitleaks:allow
channel="channel_name",
user_mentions=[
"XXXXXXXX"
]
)
```### Teams
Requires your Team Channel [webhook URL](https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/connectors/connectors-using).```python
from whos_there.senders.teams import TeamsSender
# ...
TeamsSender(
webhook_url="https://XXXXX.webhook.office.com/",
user_mentions=[
"twsl"
]
)
```### Telegram
You can also use Telegram Messenger to get notifications. You'll first have to create your own notification bot by following the three steps provided by Telegram [here](https://core.telegram.org/bots#6-botfather) and save your API access `TOKEN`.
Telegram bots are shy and can't send the first message so you'll have to do the first step. By sending the first message, you'll be able to get the `chat_id` required (identification of your messaging room) by visiting `https://api.telegram.org/bot/getUpdates` and get the `int` under the key `message['chat']['id']`.```python
from whos_there.senders.telegram import TelegramSender
# ...
TelegramSender(
chat_id=1234567890,
token="XXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXX"
)
```## Docs
```bash
poetry run mkdocs build -f ./docs/mkdocs.yml -d ./_build/
```## Conda
The conda repository is maintained [here](https://github.com/conda-forge/whos-there-feedstock).
## Update template
```bash
copier update --trust
```## Credits
This project was generated with [](https://github.com/twsl/python-project-template)
Big thanks to [knockknock](https://github.com/huggingface/knockknock) for the idea and code snippets.