No project description provided
Project description
DEADBEATS
An easy to use Slack messaging library for research.
Usage
from deadbeats import DEADBEATS
# use environment variables implicitly
# 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 end of the function.
# `DEADBEATS.wrap` catch every errors and raise it after sending a error message.
@DEADBEATS.wrap
def main():
# A simple "heartbeating" message.
DEADBEATS.ping()
# 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")
# Start threading!
# All subsequent messages will be sent to the thread.
DEADBEATS.start_thread()
# 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()
Research Usage 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
The library is named after the wonderful work of Mori Calliope, DEAD BEATS.
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.2.5.tar.gz
(3.8 kB
view details)
Built Distribution
File details
Details for the file deadbeats-0.2.5.tar.gz
.
File metadata
- Download URL: deadbeats-0.2.5.tar.gz
- Upload date:
- Size: 3.8 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 | 6cdcafb3e79dcdca0c8bdf986200e2f15b64437962d991f3c1ff1826b0e456e1 |
|
MD5 | 5edc3f99d3eed6ddefeff051b53f15b6 |
|
BLAKE2b-256 | d08034627d4b66670a05028aa70a54a1263df5911e9660e700fd11230d0d426e |
File details
Details for the file deadbeats-0.2.5-py3-none-any.whl
.
File metadata
- Download URL: deadbeats-0.2.5-py3-none-any.whl
- Upload date:
- Size: 3.9 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 | 1636cd98a2676cea5df921e654a43c0a9e0088aa88f7e931c49705354bc2f854 |
|
MD5 | e5b9eb3f6faab77a5ec916b09a723c73 |
|
BLAKE2b-256 | 8c3e053ac4ca95a7cc8a2472c82b3fd1341578c81df276d62d8d3569915bd55a |