Skip to content

Commit

Permalink
setup and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
justanhduc committed Apr 21, 2021
1 parent a74942a commit 70a908e
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 0 deletions.
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Neural Monitor

Do your training. We will take care of the statistics.

## Installation

```
pip install git+https://github.com/justanhduc/neural-monitor
```

## Usages

The basic usage in most cases will be

```
from neural_monitor import monitor as mon
# Tensorboard is turned on by default
mon.initialize(model_name='foo-model', print_freq=100, use_tensorboard=True)
...
def calculate_loss(pred, gt):
...
training_loss = ...
mon.plot('training loss', loss, smooth=.99, filter_outliers=True)
def calculate_acc(pred, gt):
accuracy = ...
mon.plot('training acc', accuracy, smooth=.99, filter_outliers=True)
...
for epoch in mon.iter_epoch(range(n_epochs)):
for data in mon.iter_batch(data_loader):
pred = net(data)
calculate_loss(pred, gt)
calculate_acc(pred, gt)
mon.imwrite('input images', data['images'], latest_only=True)
mon.dump('checkpoint.pt', {
'model_state_dict': model.state_dict(),
'optimizer_state_dict': optimizer.state_dict(),
...
}, method='torch', keep=5) # keep only 5 latest checkpoints
...
```
For more details on Neural Monitor's functionality, please check the [documentation](https://neuralnet-pytorch.readthedocs.io/en/latest/).

## References

This project is inspired by [WGAN-GP](https://github.com/igul222/improved_wgan_training).

## Related repos

[Neuralnet-pytorch](https://github.com/justanhduc/neuralnet-pytorch)
49 changes: 49 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from setuptools import setup, find_packages
import os

VERSION = {
'ver': 0,
'major': 0,
'minor': 1
}

version = f'{VERSION["ver"]}.{VERSION["major"]}.{VERSION["minor"]}'


def setup_package():
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()

setup(
name='neural-monitor',
version=version,
description='Let me take care of your experiments statistics.',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/justanhduc/neural-monitor',
author='Duc Nguyen',
author_email='adnguyen@yonsei.ac.kr',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: End Users/Desktop',
'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)',
'Operating System :: Microsoft :: Windows :: Windows 10',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7'
],
platforms=['Windows', 'Linux'],
packages=find_packages(exclude=['docs']),
install_requires=['matplotlib', 'numpy', 'imageio', 'tensorboard', 'git-python'],
project_urls={
'Bug Reports': 'https://github.com/justanhduc/neural-monitor/issues',
'Source': 'https://github.com/justanhduc/neural-monitor',
},
)


if __name__ == '__main__':
setup_package()

0 comments on commit 70a908e

Please sign in to comment.