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

Commit ec1eb78

Browse files
author
hanhxiao
committed
chore(release): fix duplicate release notes
1 parent f7beae7 commit ec1eb78

File tree

4 files changed

+47
-40
lines changed

4 files changed

+47
-40
lines changed

CHANGELOG.md

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,3 @@
1-
2-
# Release Note (`v0.0.30`)
3-
> Release time: 2019-08-19 14:13:31
4-
5-
6-
🙇 We'd like to thank all contributors for this new release! In particular,
7-
hanhxiao, 🙇
8-
9-
10-
### 🆕 New Features
11-
12-
- [[```7b5cc86a```](https://github.com/gnes-ai/gnes/commit/7b5cc86a585c75965b224cb7f668cae2bb854885)] __-__ __contrib__: no need to give module name in advance (*hanhxiao*)
13-
14-
### 🐞 Bug fixes
15-
16-
- [[```b5b1a1e7```](https://github.com/gnes-ai/gnes/commit/b5b1a1e7877724851de8487de306b78d76b995ae)] __-__ __ci__: check if master is up-to-date before releasing (*hanhxiao*)
17-
- [[```5f69c781```](https://github.com/gnes-ai/gnes/commit/5f69c7811376eba0d3724002724e0b30054447ed)] __-__ __contrib__: allowing dump for contribued module (*hanhxiao*)
18-
19-
### 🚧 Code Refactoring
20-
21-
- [[```ee61fcec```](https://github.com/gnes-ai/gnes/commit/ee61fcec49455417ef4694cfbabaa548b19ff03f)] __-__ __base__: parameter now names as parameters (*hanhxiao*)
22-
23-
### 🏁 Unit Test and CICD
24-
25-
- [[```435f7be7```](https://github.com/gnes-ai/gnes/commit/435f7be7096359437cf9c287eca780f775b9d341)] __-__ __drone__: fix drone links (*hanhxiao*)
26-
- [[```cd8a5cc5```](https://github.com/gnes-ai/gnes/commit/cd8a5cc5bc0027f4f39d1a00ddfc854168365dcb)] __-__ __contrib__: test external modules with services (*hanhxiao*)
27-
28-
### 🍹 Other Improvements
29-
30-
- [[```565ef569```](https://github.com/gnes-ai/gnes/commit/565ef569b0ddfab2904c8b6f807f0ea88ddee429)] __-__ __changelog__: update change log to v0.0.29 (*hanhxiao*)
31-
321
# Release Note (`v0.0.30`)
332
> Release time: 2019-08-19 14:13:03
343

gnes/base/__init__.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ def arg_wrapper(self, *args, **kwargs):
160160

161161

162162
class TrainableBase(metaclass=TrainableType):
163+
"""
164+
The base class for preprocessor, encoder, indexer and router
165+
166+
"""
163167
store_args_kwargs = False
164168

165169
def __init__(self, *args, **kwargs):
@@ -183,6 +187,10 @@ def _post_init_wrapper(self):
183187
self._post_init_vars = {k for k in self.__dict__ if k not in _before}
184188

185189
def post_init(self):
190+
"""
191+
Declare class attributes/members that can not be serialized in standard way
192+
193+
"""
186194
pass
187195

188196
@classmethod
@@ -191,10 +199,19 @@ def pre_init(cls):
191199

192200
@property
193201
def dump_full_path(self):
202+
"""
203+
Get the binary dump path
204+
205+
:return:
206+
"""
194207
return os.path.join(self.work_dir, '%s.bin' % self.name)
195208

196209
@property
197210
def yaml_full_path(self):
211+
"""
212+
Get the file path of the yaml config
213+
:return:
214+
"""
198215
return os.path.join(self.work_dir, '%s.yml' % self.name)
199216

200217
def __getstate__(self):
@@ -214,10 +231,17 @@ def __setstate__(self, d):
214231
'which often can be solved by "pip install" relevant package.')
215232

216233
def train(self, *args, **kwargs):
234+
"""
235+
Train the model, need to be overrided
236+
"""
217237
pass
218238

219239
@profiling
220240
def dump(self, filename: str = None) -> None:
241+
"""
242+
Serialize the object to a binary file
243+
:param filename: file path of the serialized file, if not given then `self.dump_full_path` is used
244+
"""
221245
f = filename or self.dump_full_path
222246
if not f:
223247
f = tempfile.NamedTemporaryFile('w', delete=False, dir=os.environ.get('GNES_VOLUME', None)).name
@@ -227,6 +251,10 @@ def dump(self, filename: str = None) -> None:
227251

228252
@profiling
229253
def dump_yaml(self, filename: str = None) -> None:
254+
"""
255+
Serialize the object to a yaml file
256+
:param filename: file path of the yaml file, if not given then `self.dump_yaml_path` is used
257+
"""
230258
f = filename or self.yaml_full_path
231259
if not f:
232260
f = tempfile.NamedTemporaryFile('w', delete=False, dir=os.environ.get('GNES_VOLUME', None)).name
@@ -252,6 +280,9 @@ def load(filename: str = None) -> T:
252280
return pickle.load(fp)
253281

254282
def close(self):
283+
"""
284+
Release the resources as model is destroyed
285+
"""
255286
pass
256287

257288
def __enter__(self):

gnes/indexer/base.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ def add(self, keys: List[Tuple[int, int]], vectors: np.ndarray, weights: List[fl
4141
def query(self, keys: np.ndarray, top_k: int, *args, **kwargs) -> List[List[Tuple]]:
4242
pass
4343

44-
def normalize_score(self, *args, **kwargs):
45-
pass
46-
4744

4845
class BaseTextIndexer(BaseIndexer):
4946

@@ -53,9 +50,6 @@ def add(self, keys: List[int], docs: Any, weights: List[float], *args, **kwargs)
5350
def query(self, keys: List[int], *args, **kwargs) -> List[Any]:
5451
pass
5552

56-
def normalize_score(self, *args, **kwargs):
57-
pass
58-
5953

6054
class BaseKeyIndexer(BaseIndexer):
6155

@@ -65,9 +59,6 @@ def add(self, keys: List[Tuple[int, int]], weights: List[float], *args, **kwargs
6559
def query(self, keys: List[int], *args, **kwargs) -> List[Tuple[int, int, float]]:
6660
pass
6761

68-
def normalize_score(self, *args, **kwargs):
69-
pass
70-
7162

7263
class JointIndexer(CompositionalTrainableBase):
7364

gnes/router/base.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,17 @@
2121

2222

2323
class BaseRouter(TrainableBase):
24+
""" Base class for the router. Inherit from this class to create a new router.
25+
26+
Router forwards messages between services. Essentially, it receives a 'gnes_pb2.Message'
27+
and call `apply()` method on it.
28+
"""
2429
def apply(self, msg: 'gnes_pb2.Message', *args, **kwargs):
30+
"""
31+
Modify the incoming message
32+
33+
:param msg: incoming message
34+
"""
2535
pass
2636

2737

@@ -32,6 +42,12 @@ def apply(self, msg: 'gnes_pb2.Message', *args, **kwargs) -> Generator:
3242

3343
class BaseReduceRouter(BaseRouter):
3444
def apply(self, msg: 'gnes_pb2.Message', accum_msgs: List['gnes_pb2.Message'], *args, **kwargs) -> None:
45+
"""
46+
Modify the current message based on accumulated messages
47+
48+
:param msg: the current message
49+
:param accum_msgs: accumulated messages
50+
"""
3551
merge_routes(msg, accum_msgs)
3652
if len(msg.envelope.num_part) > 1:
3753
msg.envelope.num_part.pop()

0 commit comments

Comments
 (0)