Skip to content

Commit

Permalink
put the code 'remove feature_configs for drop features' in add_fea_in…
Browse files Browse the repository at this point in the history
…fo_to_cfg.py
  • Loading branch information
wwxxzz committed Oct 23, 2023
1 parent 0108c22 commit 17f67b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 7 additions & 1 deletion easy_rec/python/tools/add_feature_info_to_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ def main(argv):
reader.close()
break

feature_configs = config_util.get_compatible_feature_configs(pipeline_config, drop_feature_names)
feature_configs = config_util.get_compatible_feature_configs(pipeline_config)
if drop_feature_names:
tmp_feature_configs = feature_configs[:]
for fea_cfg in tmp_feature_configs:
fea_name = fea_cfg.input_names[0]
if fea_name in drop_feature_names:
feature_configs.remove(fea_cfg)
for feature_config in feature_configs:
feature_name = feature_config.input_names[0]
if feature_name in feature_info_map:
Expand Down
8 changes: 1 addition & 7 deletions easy_rec/python/utils/config_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,17 +390,11 @@ def add_boundaries_to_config(pipeline_config, tables):
logging.info('edited %s' % feature_name)


def get_compatible_feature_configs(pipeline_config,drop_feature_names=None):
def get_compatible_feature_configs(pipeline_config):
if pipeline_config.feature_configs:
feature_configs = pipeline_config.feature_configs
else:
feature_configs = pipeline_config.feature_config.features
if drop_feature_names:
tmp_feature_configs = feature_configs[:]
for fea_cfg in tmp_feature_configs:
fea_name = fea_cfg.input_names[0]
if fea_name in drop_feature_names:
feature_configs.remove(fea_cfg)
return feature_configs

def parse_time(time_data):
Expand Down

0 comments on commit 17f67b1

Please sign in to comment.