No project description provided
Project description
DEADBEATS
An easy to use Slack messaging library for research.
Usage
from deadbeats import DEADBEATS
# set environment variables as below
# SLACK_ACCESS_TOKEN=xxxx-xxxxxxxxxxxxx-xxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx (Get your own Slack API access token)
# SLACK_CHANNEL_ID=deadbeats (set slack channel id whatever you like!)
# or you can set configurations manually.
DEADBEATS.set_access_token("SLACK_ACCESS_TOKEN")
DEADBEATS.set_channel_id("SLACK_CHANNEL_ID")
# `DEADBEATS.wrap` sends a message at the beginning and the end of the wrapped function.
# `DEADBEATS.wrap` catch every errors and raise it after sending a error message.
@DEADBEATS.wrap
def main():
# A simple "heartbeating" message.
DEADBEATS.ping()
# Start threading!
# All subsequent messages will be sent to the thread.
DEADBEATS.start_thread()
# You can add extra information like below.
params = {"loss": 0.5, "val_loss": 1.6, "acc": 100.0}
DEADBEATS.ping(text="message whatever you like", params=params, additional="info", huga="huga")
# If you want to stop threading, you can use this method.
# This method reset "thread_ts" of a instance variable, which is a id of thread.
DEADBEATS.reset_thread()
With PyTorch Lightning
from deadbeats import DEADBEATS
class MyModel(pl.LightningModule):
...
def on_train_start(self):
DEADBEATS.start_thread()
...
def validation_epoch_end(self, outputs):
avg_loss = torch.stack([x['val_loss'] for x in outputs]).mean()
DEADBEATS.ping(val_loss = avg_loss, current_epoch = self.current_epoch)
return {'val_loss': avg_loss}
...
# custom training function
@DEADBEATS.wrap
def fit(self, trainer):
trainer.fit(self)
messages like below
This library is named after the wonderful work of Mori Calliope, DEAD BEATS, and inspired by hugginface/knockknock.
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
deadbeats-0.3.4.tar.gz
(4.0 kB
view details)
Built Distribution
File details
Details for the file deadbeats-0.3.4.tar.gz
.
File metadata
- Download URL: deadbeats-0.3.4.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.2 Darwin/19.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31df20c148a18ed3b028548bdc15c5f86ba4529836b1041d184d1d7d905fd372 |
|
MD5 | ef09a75b4e240775b46dd0269ed7a8b2 |
|
BLAKE2b-256 | a8d95a94466d432d3db90f3b403a9ab089c24a707ca1acef7832ab1b39fa4a55 |
File details
Details for the file deadbeats-0.3.4-py3-none-any.whl
.
File metadata
- Download URL: deadbeats-0.3.4-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.2 Darwin/19.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c033faf9d1d898a1e2ea934db2778f98880af0a9e698d8541b60faac8706cc80 |
|
MD5 | bcebe6f9553610b55891d030d85ad76d |
|
BLAKE2b-256 | bd11b6358bb48a4e03e72039219288d36fafbee2ca4aad0fa2131ce0e3db8c95 |