Skip to content

Commit

Permalink
Revert "fixed signatures of decorated functions"
Browse files Browse the repository at this point in the history
This reverts commit 34fd15f.
  • Loading branch information
justanhduc committed Nov 18, 2021
1 parent 34fd15f commit cd21cae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
12 changes: 6 additions & 6 deletions neural_monitor/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from imageio import imwrite
from shutil import copyfile
from collections import namedtuple, deque
import functools
import torch.distributed
from typing import (
List,
Expand All @@ -29,7 +30,6 @@
)
import pandas as pd
from easydict import EasyDict
from decorator import decorator

try:
import visdom
Expand Down Expand Up @@ -184,8 +184,8 @@ def _spawn_defaultdict_ordereddict():
return collections.OrderedDict()


@decorator
def check_path_init(f):
@functools.wraps(f)
def set_default_path(self, *args, **kwargs):
if not self._initialized:
logger.info('Working folder not initialized! Initialize working folder to default.')
Expand All @@ -197,19 +197,19 @@ def set_default_path(self, *args, **kwargs):
return set_default_path


@decorator
def standardize_name(f):
@functools.wraps(f)
def func(self, name: str, *args, **kwargs):
if name is not None:
name = name.replace(' ', '-')

return f(self, name, *args, **kwargs)
f(self, name, *args, **kwargs)

return func


@decorator
def distributed_collect(f):
@functools.wraps(f)
def func(self, name: str, value: T.Tensor, *args, **kwargs):
if self.distributed:
assert isinstance(value, T.Tensor), 'value must be a Tensor in distributed mode'
Expand All @@ -220,8 +220,8 @@ def func(self, name: str, value: T.Tensor, *args, **kwargs):
return func


@decorator
def distributed_flush(f):
@functools.wraps(f)
def func(self, *args, **kwargs):
if self.distributed and self.rank != 0:
return
Expand Down
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ tensorboard
imageio
git-python
pandas
decorator
easydict
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ def setup_package():
'Programming Language :: Python :: 3.7'
],
platforms=['Windows', 'Linux'],
packages=find_packages(exclude=['docs', 'doc']),
install_requires=['matplotlib', 'numpy', 'imageio', 'tensorboard',
'git-python', 'easydict', 'pandas', 'decorator'],
packages=find_packages(exclude=['docs']),
install_requires=['matplotlib', 'numpy', 'imageio', 'tensorboard', 'git-python', 'easydict', 'pandas'],
project_urls={
'Bug Reports': 'https://github.com/justanhduc/neural-monitor/issues',
'Source': 'https://github.com/justanhduc/neural-monitor',
Expand Down

0 comments on commit cd21cae

Please sign in to comment.