Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
refactor(score_fn): move normalize_fn and score_fn to the init
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhxiao committed Sep 3, 2019
1 parent 25c11df commit f406f8f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions gnes/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class TrainableType(type):
'work_dir': os.environ.get('GNES_VOLUME', os.getcwd()),
'name': None,
'on_gpu': False,
'unnamed_warning': True
'warn_unnamed': True
}

def __new__(cls, *args, **kwargs):
Expand Down Expand Up @@ -181,7 +181,7 @@ def _post_init_wrapper(self):
if not getattr(self, 'name', None) and os.environ.get('GNES_WARN_UNNAMED_COMPONENT', '1') == '1':
_id = str(uuid.uuid4()).split('-')[0]
_name = '%s-%s' % (self.__class__.__name__, _id)
if self.unnamed_warning:
if self.warn_unnamed:
self.logger.warning(
'this object is not named ("name" is not found under "gnes_config" in YAML config), '
'i will call it "%s". '
Expand Down
2 changes: 1 addition & 1 deletion gnes/score_fn/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get_unary_score(value: float, **kwargs):


class BaseScoreFn(TrainableBase):
unnamed_warning = False
warn_unnamed = False

def __call__(self, *args, **kwargs) -> 'gnes_pb2.Response.QueryResponse.ScoredResult.Score':
raise NotImplementedError
Expand Down

0 comments on commit f406f8f

Please sign in to comment.