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

Commit f406f8f

Browse files
author
hanhxiao
committed
refactor(score_fn): move normalize_fn and score_fn to the init
1 parent 25c11df commit f406f8f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

gnes/base/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class TrainableType(type):
6767
'work_dir': os.environ.get('GNES_VOLUME', os.getcwd()),
6868
'name': None,
6969
'on_gpu': False,
70-
'unnamed_warning': True
70+
'warn_unnamed': True
7171
}
7272

7373
def __new__(cls, *args, **kwargs):
@@ -181,7 +181,7 @@ def _post_init_wrapper(self):
181181
if not getattr(self, 'name', None) and os.environ.get('GNES_WARN_UNNAMED_COMPONENT', '1') == '1':
182182
_id = str(uuid.uuid4()).split('-')[0]
183183
_name = '%s-%s' % (self.__class__.__name__, _id)
184-
if self.unnamed_warning:
184+
if self.warn_unnamed:
185185
self.logger.warning(
186186
'this object is not named ("name" is not found under "gnes_config" in YAML config), '
187187
'i will call it "%s". '

gnes/score_fn/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def get_unary_score(value: float, **kwargs):
1818

1919

2020
class BaseScoreFn(TrainableBase):
21-
unnamed_warning = False
21+
warn_unnamed = False
2222

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

0 commit comments

Comments
 (0)