From 1117e29262d6d1ae04851034b8a6e55e7d340f62 Mon Sep 17 00:00:00 2001 From: weisu Date: Mon, 30 Jan 2023 17:11:51 +0800 Subject: [PATCH 1/4] [bug fix]: fix bug of multiple losses of rank model --- .git_bin_url | 5 +---- easy_rec/version.py | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.git_bin_url b/.git_bin_url index dde02f4c0..da4f7404d 100644 --- a/.git_bin_url +++ b/.git_bin_url @@ -37,8 +37,5 @@ {"leaf_path": "data/test/movielens_1m", "sig": "99badbeec64f2fcabe0dfa1d2bfd8fb5", "remote_path": "data/git_oss_sample_data/data_test_movielens_1m_99badbeec64f2fcabe0dfa1d2bfd8fb5"} {"leaf_path": "data/test/mt_ckpt", "sig": "803499f48e2df5e51ce5606e9649c6d4", "remote_path": "data/git_oss_sample_data/data_test_mt_ckpt_803499f48e2df5e51ce5606e9649c6d4"} {"leaf_path": "data/test/rtp", "sig": "76cda60582617ddbb7cd5a49eb68a4b9", "remote_path": "data/git_oss_sample_data/data_test_rtp_76cda60582617ddbb7cd5a49eb68a4b9"} -{"leaf_path": "data/test/tb_data", "sig": "f1279ca42de1734be321e88f85775d5f", "remote_path": "data/git_oss_sample_data/data_test_tb_data_f1279ca42de1734be321e88f85775d5f"} -{"leaf_path": "data/test/tb_data/hard_negative_sampler_edge", "sig": "48f994681d719a2546ec4003fcbc638c", "remote_path": "data/git_oss_sample_data/data_test_tb_data_hard_negative_sampler_edge_48f994681d719a2546ec4003fcbc638c"} -{"leaf_path": "data/test/tb_data/hard_negative_sampler_item", "sig": "f23a9eb9457c14a8e57b455804b1f013", "remote_path": "data/git_oss_sample_data/data_test_tb_data_hard_negative_sampler_item_f23a9eb9457c14a8e57b455804b1f013"} -{"leaf_path": "data/test/tb_data/hard_negative_sampler_user", "sig": "23514156eae5a4250ac1d0a118883430", "remote_path": "data/git_oss_sample_data/data_test_tb_data_hard_negative_sampler_user_23514156eae5a4250ac1d0a118883430"} +{"leaf_path": "data/test/tb_data", "sig": "126c375d6aa666633fb3084aa27ff9f7", "remote_path": "data/git_oss_sample_data/data_test_tb_data_126c375d6aa666633fb3084aa27ff9f7"} {"leaf_path": "data/test/tb_data_with_time", "sig": "1a7648f4ae55faf37855762bccbb70cc", "remote_path": "data/git_oss_sample_data/data_test_tb_data_with_time_1a7648f4ae55faf37855762bccbb70cc"} diff --git a/easy_rec/version.py b/easy_rec/version.py index 8127003c0..6e00ca21f 100644 --- a/easy_rec/version.py +++ b/easy_rec/version.py @@ -1,3 +1,3 @@ # -*- encoding:utf-8 -*- # Copyright (c) Alibaba, Inc. and its affiliates. -__version__ = '0.6.0' +__version__ = '0.6.1' From 1b4c9c5c66eeba4d6b99325e7d896f730accbf0a Mon Sep 17 00:00:00 2001 From: weisu Date: Mon, 30 Jan 2023 21:05:11 +0800 Subject: [PATCH 2/4] [bug fix]: fix bug of embedding regularization --- .git_bin_url | 5 ++++- easy_rec/python/layers/input_layer.py | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.git_bin_url b/.git_bin_url index da4f7404d..dde02f4c0 100644 --- a/.git_bin_url +++ b/.git_bin_url @@ -37,5 +37,8 @@ {"leaf_path": "data/test/movielens_1m", "sig": "99badbeec64f2fcabe0dfa1d2bfd8fb5", "remote_path": "data/git_oss_sample_data/data_test_movielens_1m_99badbeec64f2fcabe0dfa1d2bfd8fb5"} {"leaf_path": "data/test/mt_ckpt", "sig": "803499f48e2df5e51ce5606e9649c6d4", "remote_path": "data/git_oss_sample_data/data_test_mt_ckpt_803499f48e2df5e51ce5606e9649c6d4"} {"leaf_path": "data/test/rtp", "sig": "76cda60582617ddbb7cd5a49eb68a4b9", "remote_path": "data/git_oss_sample_data/data_test_rtp_76cda60582617ddbb7cd5a49eb68a4b9"} -{"leaf_path": "data/test/tb_data", "sig": "126c375d6aa666633fb3084aa27ff9f7", "remote_path": "data/git_oss_sample_data/data_test_tb_data_126c375d6aa666633fb3084aa27ff9f7"} +{"leaf_path": "data/test/tb_data", "sig": "f1279ca42de1734be321e88f85775d5f", "remote_path": "data/git_oss_sample_data/data_test_tb_data_f1279ca42de1734be321e88f85775d5f"} +{"leaf_path": "data/test/tb_data/hard_negative_sampler_edge", "sig": "48f994681d719a2546ec4003fcbc638c", "remote_path": "data/git_oss_sample_data/data_test_tb_data_hard_negative_sampler_edge_48f994681d719a2546ec4003fcbc638c"} +{"leaf_path": "data/test/tb_data/hard_negative_sampler_item", "sig": "f23a9eb9457c14a8e57b455804b1f013", "remote_path": "data/git_oss_sample_data/data_test_tb_data_hard_negative_sampler_item_f23a9eb9457c14a8e57b455804b1f013"} +{"leaf_path": "data/test/tb_data/hard_negative_sampler_user", "sig": "23514156eae5a4250ac1d0a118883430", "remote_path": "data/git_oss_sample_data/data_test_tb_data_hard_negative_sampler_user_23514156eae5a4250ac1d0a118883430"} {"leaf_path": "data/test/tb_data_with_time", "sig": "1a7648f4ae55faf37855762bccbb70cc", "remote_path": "data/git_oss_sample_data/data_test_tb_data_with_time_1a7648f4ae55faf37855762bccbb70cc"} diff --git a/easy_rec/python/layers/input_layer.py b/easy_rec/python/layers/input_layer.py index caeda193d..45d81f8ac 100644 --- a/easy_rec/python/layers/input_layer.py +++ b/easy_rec/python/layers/input_layer.py @@ -17,7 +17,8 @@ from easy_rec.python.utils import shape_utils from easy_rec.python.compat.feature_column.feature_column import _SharedEmbeddingColumn # NOQA -from easy_rec.python.compat.feature_column.feature_column_v2 import EmbeddingColumn # NOQA +from easy_rec.python.compat.feature_column.feature_column_v2 import EmbeddingColumn +from easy_rec.python.compat.feature_column.feature_column_v2 import SharedEmbeddingColumn class InputLayer(object): @@ -167,7 +168,11 @@ def single_call_input_layer(self, group_columns, cols_to_output_tensors=cols_to_output_tensors, feature_name_to_output_tensors=feature_name_to_output_tensors) - embedding_reg_lst = [output_features] + # embedding_reg_lst = [output_features] + embedding_reg_lst = [] + for col, val in cols_to_output_tensors.items(): + if isinstance(col, EmbeddingColumn) or isinstance(col, SharedEmbeddingColumn): + embedding_reg_lst.append(val) builder = feature_column._LazyBuilder(features) seq_features = [] for column in sorted(group_seq_columns, key=lambda x: x.name): From 3568c1d5f4667550c6a6897418e1ef4dfc46eaf5 Mon Sep 17 00:00:00 2001 From: weisu Date: Tue, 31 Jan 2023 10:51:10 +0800 Subject: [PATCH 3/4] [bug fix]: fix bug of embedding regularization --- easy_rec/python/layers/input_layer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/easy_rec/python/layers/input_layer.py b/easy_rec/python/layers/input_layer.py index 45d81f8ac..a5fe5101a 100644 --- a/easy_rec/python/layers/input_layer.py +++ b/easy_rec/python/layers/input_layer.py @@ -232,7 +232,8 @@ def single_call_input_layer(self, group_features = [cols_to_output_tensors[x] for x in group_columns] + \ [cols_to_output_tensors[x] for x in group_seq_columns] - regularizers.apply_regularization( + if embedding_reg_lst: + regularizers.apply_regularization( self._embedding_regularizer, weights_list=embedding_reg_lst) return concat_features, group_features From c72436c1d0358d927af1493dd7f118a85f49a629 Mon Sep 17 00:00:00 2001 From: weisu Date: Tue, 31 Jan 2023 11:26:15 +0800 Subject: [PATCH 4/4] [bug fix]: fix bug of embedding regularization --- easy_rec/python/layers/input_layer.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/easy_rec/python/layers/input_layer.py b/easy_rec/python/layers/input_layer.py index a5fe5101a..731f47c82 100644 --- a/easy_rec/python/layers/input_layer.py +++ b/easy_rec/python/layers/input_layer.py @@ -16,9 +16,10 @@ from easy_rec.python.protos.feature_config_pb2 import WideOrDeep from easy_rec.python.utils import shape_utils +from easy_rec.python.compat.feature_column.feature_column_v2 import EmbeddingColumn # NOQA +from easy_rec.python.compat.feature_column.feature_column_v2 import SharedEmbeddingColumn # NOQA + from easy_rec.python.compat.feature_column.feature_column import _SharedEmbeddingColumn # NOQA -from easy_rec.python.compat.feature_column.feature_column_v2 import EmbeddingColumn -from easy_rec.python.compat.feature_column.feature_column_v2 import SharedEmbeddingColumn class InputLayer(object): @@ -171,7 +172,8 @@ def single_call_input_layer(self, # embedding_reg_lst = [output_features] embedding_reg_lst = [] for col, val in cols_to_output_tensors.items(): - if isinstance(col, EmbeddingColumn) or isinstance(col, SharedEmbeddingColumn): + if isinstance(col, EmbeddingColumn) or isinstance(col, + SharedEmbeddingColumn): embedding_reg_lst.append(val) builder = feature_column._LazyBuilder(features) seq_features = [] @@ -234,7 +236,7 @@ def single_call_input_layer(self, if embedding_reg_lst: regularizers.apply_regularization( - self._embedding_regularizer, weights_list=embedding_reg_lst) + self._embedding_regularizer, weights_list=embedding_reg_lst) return concat_features, group_features def get_wide_deep_dict(self):