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

Commit

Permalink
chore(release): fix duplicate release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhxiao committed Aug 20, 2019
1 parent f7beae7 commit ec1eb78
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 40 deletions.
31 changes: 0 additions & 31 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,3 @@

# Release Note (`v0.0.30`)
> Release time: 2019-08-19 14:13:31

🙇 We'd like to thank all contributors for this new release! In particular,
hanhxiao, 🙇


### 🆕 New Features

- [[```7b5cc86a```](https://github.com/gnes-ai/gnes/commit/7b5cc86a585c75965b224cb7f668cae2bb854885)] __-__ __contrib__: no need to give module name in advance (*hanhxiao*)

### 🐞 Bug fixes

- [[```b5b1a1e7```](https://github.com/gnes-ai/gnes/commit/b5b1a1e7877724851de8487de306b78d76b995ae)] __-__ __ci__: check if master is up-to-date before releasing (*hanhxiao*)
- [[```5f69c781```](https://github.com/gnes-ai/gnes/commit/5f69c7811376eba0d3724002724e0b30054447ed)] __-__ __contrib__: allowing dump for contribued module (*hanhxiao*)

### 🚧 Code Refactoring

- [[```ee61fcec```](https://github.com/gnes-ai/gnes/commit/ee61fcec49455417ef4694cfbabaa548b19ff03f)] __-__ __base__: parameter now names as parameters (*hanhxiao*)

### 🏁 Unit Test and CICD

- [[```435f7be7```](https://github.com/gnes-ai/gnes/commit/435f7be7096359437cf9c287eca780f775b9d341)] __-__ __drone__: fix drone links (*hanhxiao*)
- [[```cd8a5cc5```](https://github.com/gnes-ai/gnes/commit/cd8a5cc5bc0027f4f39d1a00ddfc854168365dcb)] __-__ __contrib__: test external modules with services (*hanhxiao*)

### 🍹 Other Improvements

- [[```565ef569```](https://github.com/gnes-ai/gnes/commit/565ef569b0ddfab2904c8b6f807f0ea88ddee429)] __-__ __changelog__: update change log to v0.0.29 (*hanhxiao*)

# Release Note (`v0.0.30`)
> Release time: 2019-08-19 14:13:03
Expand Down
31 changes: 31 additions & 0 deletions gnes/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ def arg_wrapper(self, *args, **kwargs):


class TrainableBase(metaclass=TrainableType):
"""
The base class for preprocessor, encoder, indexer and router
"""
store_args_kwargs = False

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

def post_init(self):
"""
Declare class attributes/members that can not be serialized in standard way
"""
pass

@classmethod
Expand All @@ -191,10 +199,19 @@ def pre_init(cls):

@property
def dump_full_path(self):
"""
Get the binary dump path
:return:
"""
return os.path.join(self.work_dir, '%s.bin' % self.name)

@property
def yaml_full_path(self):
"""
Get the file path of the yaml config
:return:
"""
return os.path.join(self.work_dir, '%s.yml' % self.name)

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

def train(self, *args, **kwargs):
"""
Train the model, need to be overrided
"""
pass

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

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

def close(self):
"""
Release the resources as model is destroyed
"""
pass

def __enter__(self):
Expand Down
9 changes: 0 additions & 9 deletions gnes/indexer/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ def add(self, keys: List[Tuple[int, int]], vectors: np.ndarray, weights: List[fl
def query(self, keys: np.ndarray, top_k: int, *args, **kwargs) -> List[List[Tuple]]:
pass

def normalize_score(self, *args, **kwargs):
pass


class BaseTextIndexer(BaseIndexer):

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

def normalize_score(self, *args, **kwargs):
pass


class BaseKeyIndexer(BaseIndexer):

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

def normalize_score(self, *args, **kwargs):
pass


class JointIndexer(CompositionalTrainableBase):

Expand Down
16 changes: 16 additions & 0 deletions gnes/router/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,17 @@


class BaseRouter(TrainableBase):
""" Base class for the router. Inherit from this class to create a new router.
Router forwards messages between services. Essentially, it receives a 'gnes_pb2.Message'
and call `apply()` method on it.
"""
def apply(self, msg: 'gnes_pb2.Message', *args, **kwargs):
"""
Modify the incoming message
:param msg: incoming message
"""
pass


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

class BaseReduceRouter(BaseRouter):
def apply(self, msg: 'gnes_pb2.Message', accum_msgs: List['gnes_pb2.Message'], *args, **kwargs) -> None:
"""
Modify the current message based on accumulated messages
:param msg: the current message
:param accum_msgs: accumulated messages
"""
merge_routes(msg, accum_msgs)
if len(msg.envelope.num_part) > 1:
msg.envelope.num_part.pop()
Expand Down

0 comments on commit ec1eb78

Please sign in to comment.