Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix update_config_remove_invalid_subseq_feature #475

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions easy_rec/python/tools/add_feature_info_to_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,28 @@ def main(argv):
logging.info('drop feature: %s' % feature_name)
feature_group.ClearField('feature_names')
feature_group.feature_names.extend(reserved_features)
for sequence_feature in feature_group.sequence_features:
seq_att_maps = sequence_feature.seq_att_map
for seq_att in seq_att_maps:
keys = seq_att.key
reserved_keys = []
for key in keys:
if key not in drop_feature_names:
reserved_keys.append(key)
else:
logging.info('drop sequence feature key: %s' % key)
seq_att.ClearField('key')
seq_att.key.extend(reserved_keys)

hist_seqs = seq_att.hist_seq
reserved_hist_seqs = []
for hist_seq in hist_seqs:
if hist_seq not in drop_feature_names:
reserved_hist_seqs.append(hist_seq)
else:
logging.info('drop sequence feature hist_seq: %s' % hist_seq)
seq_att.ClearField('hist_seq')
seq_att.hist_seq.extend(reserved_hist_seqs)

config_dir, config_name = os.path.split(FLAGS.output_config_path)
config_util.save_pipeline_config(pipeline_config, config_dir, config_name)
Expand Down
Loading