Skip to main content

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


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)

The library is named after the wonderful work of Mori Calliope, DEAD BEATS.

Project details


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.2.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

deadbeats-0.2.2-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file deadbeats-0.2.2.tar.gz.

File metadata

  • Download URL: deadbeats-0.2.2.tar.gz
  • Upload date:
  • Size: 3.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

Hashes for deadbeats-0.2.2.tar.gz
Algorithm Hash digest
SHA256 d6a360f55020dd7f69dcfd1ee8a50c1eeafa0bd85e189e11c019847c5e74a382
MD5 07c8a2be6f72a92e2a016086dd199541
BLAKE2b-256 8bdcf3aa6b1f8d98158e6848e80418f654f91e616c28b3546277f4cc1dc2bb93

See more details on using hashes here.

File details

Details for the file deadbeats-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: deadbeats-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 3.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

Hashes for deadbeats-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f0cc8b9102b9774c8d5c548d14dd698e70f77b23227df1c065a8fb72b0dd0e83
MD5 237ff09f3869e6adda034e4f8d1992eb
BLAKE2b-256 b8d91eb1683fcc4b1ffd6922d6ea451eab1ca990273c1e3929719c93d2186a5d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page