Skip to content
Permalink
Browse files

refactor(score_fn): move normalize_fn and score_fn to the init

  • Loading branch information...
hanxiao committed Sep 3, 2019
1 parent 25c11df commit f406f8f06d6b5c4068f8473d3f9faedeffc32b9f
Showing with 3 additions and 3 deletions.
  1. +2 −2 gnes/base/__init__.py
  2. +1 −1 gnes/score_fn/base.py
@@ -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):
@@ -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". '
@@ -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

0 comments on commit f406f8f

Please sign in to comment.
You can’t perform that action at this time.