Prerequisites | Installation | Usage | Development | Test | Contributing | License |
This Python package provides watchdog functions for Chainer.
Python 2.7, 3.4, 3.5, 3.6.
Install chainer-watchdog to the system:
pip install chainer-watchdog
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
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.
$ pip install -e .[dev]
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
$ 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 the source code.
$ pip install -e .[lint]
$ python setup.py flake8
$ open htmlflake8/index.html
$ mypy --py2 watchdog
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Copyright (c) 2018 Daisuke Taniwaki. See LICENSE for details.