Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Prerequisites | Installation | Usage | Development | Test | Contributing | License |

chainer-watchdog

PyPI GitHub license PyVersions Build Status codecov

This Python package provides watchdog functions for Chainer.

Prerequisites

Python 2.7, 3.4, 3.5, 3.6.

Installation

Install chainer-watchdog to the system:

pip install chainer-watchdog

Installation from GitHub

git clone https://github.com/dtaniwaki/chainer-watchdog
cd chainer-watchdog
python setup.py install

or use pip.

pip install git+https://github.com/dtaniwaki/chainer-watchdog.git

Usage

Extend your Chainer trainer with this extension. You can make any combination of an action and an estimator. See actions and estimators for available watchdog items.

from watchdog import WatchDog
from watchdog.estimators import SimpleEstimator, StaticEstimator
from watchdog.actions import Abort, WarningMessage, SlackNotification

slack_token = os.environ['SLACK_TOKEN']
slack_channel = os.environ['SLACK_CHANNEL']

trainer.extend(WatchDog(watch_items=[
    (WarningMessage(), SimpleEstimator(factor=2.0)),
    (SlackNotification(
        token=slack_token,
        channel=slack_channel,
    ), SimpleEstimator(factor=3.0)),
    (Abort(), StaticEstimator(duration=60)),
]))

With this example code, the training process will show warning message if training speed becomes 2 times slower than usual. Then, it will notify you in Slack if training speed becomes 3 times slower than usual. Finally, it will terminate your training process if it doesn't get any update for 60 seconds.

Development

$ pip install -e .[dev]

Documentation

Generate the documentation.

$ pip install -e .[docs]
$ sphinx-apidoc -f -o docs/source/ watchdog
$ make -C docs -f Makefile html

You can check the generate docs by:

$ open docs/_build/html/index.html

Test

$ pip install -e .[test]
$ pytest

You can check the test coverage as HTML by:

$ open htmlcov/index.html

Or use tox to test this package in multiple python versions.

$ tox

Run all the Python version tests in parallel,

$ detox

Lint

Lint the source code.

$ pip install -e .[lint]
$ python setup.py flake8
$ open htmlflake8/index.html

Type Check

$ mypy --py2 watchdog

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Copyright

Copyright (c) 2018 Daisuke Taniwaki. See LICENSE for details.

About

Watchdog extension for Chainer

Resources

License

Packages

No packages published

Languages