From 85192acc541fc1680a225b6104b8154033feea02 Mon Sep 17 00:00:00 2001 From: chengmengli06 <31561586+chengmengli06@users.noreply.github.com> Date: Fri, 2 Feb 2024 17:32:38 +0800 Subject: [PATCH] [bugfix] fix not support metric error not raised bug (#452) * fix not support metric error not raised bug * update eval metric for dssm test cases --- easy_rec/python/model/match_model.py | 4 ++-- .../dssm_neg_sampler_need_key_feature.config | 14 +++++++------- .../dssm_neg_sampler_sequence_feature.config | 14 +++++++------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/easy_rec/python/model/match_model.py b/easy_rec/python/model/match_model.py index 94e840813..294bb3dd4 100644 --- a/easy_rec/python/model/match_model.py +++ b/easy_rec/python/model/match_model.py @@ -231,7 +231,7 @@ def _build_list_wise_metric_graph(self, eval_config): label, logits[:, :batch_size], metric.recall_at_topk.topk) else: - ValueError('invalid metric type: %s' % str(metric)) + raise ValueError('invalid metric type: %s' % str(metric)) return metric_dict def _build_point_wise_metric_graph(self, eval_config): @@ -248,7 +248,7 @@ def _build_point_wise_metric_graph(self, eval_config): metric_dict['mean_absolute_error'] = metrics_tf.mean_absolute_error( tf.to_float(label), self._prediction_dict['y']) else: - ValueError('invalid metric type: %s' % str(metric)) + raise ValueError('invalid metric type: %s' % str(metric)) return metric_dict def get_outputs(self): diff --git a/samples/model_config/dssm_neg_sampler_need_key_feature.config b/samples/model_config/dssm_neg_sampler_need_key_feature.config index 12a8621cc..ea7cc8342 100644 --- a/samples/model_config/dssm_neg_sampler_need_key_feature.config +++ b/samples/model_config/dssm_neg_sampler_need_key_feature.config @@ -24,14 +24,14 @@ train_config { eval_config { metrics_set: { - auc { - } - } - metrics_set: { - gauc { - uid_field: "user_id" - } + recall_at_topk { topk: 3 } } + # currently not supported + # metrics_set: { + # gauc { + # uid_field: "user_id" + # } + # } } data_config { diff --git a/samples/model_config/dssm_neg_sampler_sequence_feature.config b/samples/model_config/dssm_neg_sampler_sequence_feature.config index df6896408..5ce0af37f 100644 --- a/samples/model_config/dssm_neg_sampler_sequence_feature.config +++ b/samples/model_config/dssm_neg_sampler_sequence_feature.config @@ -24,14 +24,14 @@ train_config { eval_config { metrics_set: { - auc { - } - } - metrics_set: { - gauc { - uid_field: "user_id" - } + recall_at_topk { topk: 3 } } + # currently not supported + # metrics_set: { + # gauc { + # uid_field: "user_id" + # } + # } } data_config {