Skip to content

Commit

Permalink
Adding trained features to serving parse_fn by default (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
lastmansleeping authored Dec 30, 2021
1 parent eeb15c6 commit 0692022
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
6 changes: 6 additions & 0 deletions docs/source/misc/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.10] - 2021-12-29

### Changed

- Adding all trained features to serving parse fn by default

## [0.1.9] - 2021-11-29

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ features:
shape: null
serving_info:
name: qualityScore
required: true
default_value: 0.0
required: false
tfrecord_type: sequence
- name: name_match
node_name: name_match
Expand Down
6 changes: 3 additions & 3 deletions python/ml4ir/base/data/tfrecord_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,7 @@ def get_features_spec(self):
for feature_info in self.feature_config.get_all_features():
serving_info = feature_info["serving_info"]
if not self.required_fields_only or serving_info.get(
"required", feature_info["trainable"]
):
"required", feature_info["trainable"]) or feature_info["trainable"]:
feature_name = feature_info["name"]
dtype = feature_info["dtype"]
default_value = self.feature_config.get_default_value(feature_info)
Expand Down Expand Up @@ -456,7 +455,8 @@ def get_features_spec(self):
if feature_info.get("name") == self.feature_config.get_mask("name"):
continue
serving_info = feature_info["serving_info"]
if not self.required_fields_only or serving_info.get("required", feature_info["trainable"]):
if not self.required_fields_only or serving_info.get(
"required", feature_info["trainable"]) or feature_info["trainable"]:
feature_name = feature_info["name"]
dtype = feature_info["dtype"]
default_value = self.feature_config.get_default_value(
Expand Down
4 changes: 2 additions & 2 deletions python/ml4ir/base/features/feature_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1013,12 +1013,12 @@ def create_dummy_protobuf(self, num_records=1, required_only=False):
context_features = [
f
for f in self.get_context_features()
if ((not required_only) or (f["serving_info"].get("required", False)))
if ((not required_only) or (f["serving_info"].get("required", False)) or f["trainable"])
]
sequence_features = [
f
for f in self.get_sequence_features()
if ((not required_only) or (f["serving_info"].get("required", False)))
if ((not required_only) or (f["serving_info"].get("required", False)) or f["trainable"])
]

dummy_query = dict()
Expand Down
2 changes: 1 addition & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def getReadMe():
setup(
name="ml4ir",
packages=find_namespace_packages(include=["ml4ir.*"]),
version="0.1.9",
version="0.1.10",
description="Machine Learning libraries for Information Retrieval",
long_description=getReadMe(),
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 0692022

Please sign in to comment.