easy-cs-rec-custommodel 0.8.6__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of easy-cs-rec-custommodel might be problematic. Click here for more details.

Files changed (336) hide show
  1. easy_cs_rec_custommodel-0.8.6.dist-info/LICENSE +203 -0
  2. easy_cs_rec_custommodel-0.8.6.dist-info/METADATA +48 -0
  3. easy_cs_rec_custommodel-0.8.6.dist-info/RECORD +336 -0
  4. easy_cs_rec_custommodel-0.8.6.dist-info/WHEEL +6 -0
  5. easy_cs_rec_custommodel-0.8.6.dist-info/top_level.txt +2 -0
  6. easy_rec/__init__.py +114 -0
  7. easy_rec/python/__init__.py +0 -0
  8. easy_rec/python/builders/__init__.py +0 -0
  9. easy_rec/python/builders/hyperparams_builder.py +78 -0
  10. easy_rec/python/builders/loss_builder.py +333 -0
  11. easy_rec/python/builders/optimizer_builder.py +211 -0
  12. easy_rec/python/builders/strategy_builder.py +44 -0
  13. easy_rec/python/compat/__init__.py +0 -0
  14. easy_rec/python/compat/adam_s.py +245 -0
  15. easy_rec/python/compat/array_ops.py +229 -0
  16. easy_rec/python/compat/dynamic_variable.py +542 -0
  17. easy_rec/python/compat/early_stopping.py +653 -0
  18. easy_rec/python/compat/embedding_ops.py +162 -0
  19. easy_rec/python/compat/embedding_parallel_saver.py +316 -0
  20. easy_rec/python/compat/estimator_train.py +116 -0
  21. easy_rec/python/compat/exporter.py +473 -0
  22. easy_rec/python/compat/feature_column/__init__.py +0 -0
  23. easy_rec/python/compat/feature_column/feature_column.py +3675 -0
  24. easy_rec/python/compat/feature_column/feature_column_v2.py +5233 -0
  25. easy_rec/python/compat/feature_column/sequence_feature_column.py +648 -0
  26. easy_rec/python/compat/feature_column/utils.py +154 -0
  27. easy_rec/python/compat/layers.py +329 -0
  28. easy_rec/python/compat/ops.py +14 -0
  29. easy_rec/python/compat/optimizers.py +619 -0
  30. easy_rec/python/compat/queues.py +311 -0
  31. easy_rec/python/compat/regularizers.py +208 -0
  32. easy_rec/python/compat/sok_optimizer.py +440 -0
  33. easy_rec/python/compat/sync_replicas_optimizer.py +528 -0
  34. easy_rec/python/compat/weight_decay_optimizers.py +475 -0
  35. easy_rec/python/core/__init__.py +0 -0
  36. easy_rec/python/core/easyrec_metrics/__init__.py +24 -0
  37. easy_rec/python/core/easyrec_metrics/distribute_metrics_impl_pai.py +3702 -0
  38. easy_rec/python/core/easyrec_metrics/distribute_metrics_impl_tf.py +3768 -0
  39. easy_rec/python/core/learning_schedules.py +228 -0
  40. easy_rec/python/core/metrics.py +402 -0
  41. easy_rec/python/core/sampler.py +844 -0
  42. easy_rec/python/eval.py +102 -0
  43. easy_rec/python/export.py +150 -0
  44. easy_rec/python/feature_column/__init__.py +0 -0
  45. easy_rec/python/feature_column/feature_column.py +664 -0
  46. easy_rec/python/feature_column/feature_group.py +89 -0
  47. easy_rec/python/hpo/__init__.py +0 -0
  48. easy_rec/python/hpo/emr_hpo.py +140 -0
  49. easy_rec/python/hpo/generate_hpo_sql.py +71 -0
  50. easy_rec/python/hpo/pai_hpo.py +297 -0
  51. easy_rec/python/inference/__init__.py +0 -0
  52. easy_rec/python/inference/csv_predictor.py +189 -0
  53. easy_rec/python/inference/hive_parquet_predictor.py +200 -0
  54. easy_rec/python/inference/hive_predictor.py +166 -0
  55. easy_rec/python/inference/odps_predictor.py +70 -0
  56. easy_rec/python/inference/parquet_predictor.py +147 -0
  57. easy_rec/python/inference/parquet_predictor_v2.py +147 -0
  58. easy_rec/python/inference/predictor.py +621 -0
  59. easy_rec/python/inference/processor/__init__.py +0 -0
  60. easy_rec/python/inference/processor/test.py +170 -0
  61. easy_rec/python/inference/vector_retrieve.py +124 -0
  62. easy_rec/python/input/__init__.py +0 -0
  63. easy_rec/python/input/batch_tfrecord_input.py +117 -0
  64. easy_rec/python/input/criteo_binary_reader.py +259 -0
  65. easy_rec/python/input/criteo_input.py +107 -0
  66. easy_rec/python/input/csv_input.py +175 -0
  67. easy_rec/python/input/csv_input_ex.py +72 -0
  68. easy_rec/python/input/csv_input_v2.py +68 -0
  69. easy_rec/python/input/datahub_input.py +320 -0
  70. easy_rec/python/input/dummy_input.py +58 -0
  71. easy_rec/python/input/hive_input.py +123 -0
  72. easy_rec/python/input/hive_parquet_input.py +140 -0
  73. easy_rec/python/input/hive_rtp_input.py +174 -0
  74. easy_rec/python/input/input.py +1064 -0
  75. easy_rec/python/input/kafka_dataset.py +144 -0
  76. easy_rec/python/input/kafka_input.py +235 -0
  77. easy_rec/python/input/load_parquet.py +317 -0
  78. easy_rec/python/input/odps_input.py +101 -0
  79. easy_rec/python/input/odps_input_v2.py +110 -0
  80. easy_rec/python/input/odps_input_v3.py +132 -0
  81. easy_rec/python/input/odps_rtp_input.py +187 -0
  82. easy_rec/python/input/odps_rtp_input_v2.py +104 -0
  83. easy_rec/python/input/parquet_input.py +397 -0
  84. easy_rec/python/input/parquet_input_v2.py +180 -0
  85. easy_rec/python/input/parquet_input_v3.py +203 -0
  86. easy_rec/python/input/rtp_input.py +225 -0
  87. easy_rec/python/input/rtp_input_v2.py +145 -0
  88. easy_rec/python/input/tfrecord_input.py +100 -0
  89. easy_rec/python/layers/__init__.py +0 -0
  90. easy_rec/python/layers/backbone.py +571 -0
  91. easy_rec/python/layers/capsule_layer.py +176 -0
  92. easy_rec/python/layers/cmbf.py +390 -0
  93. easy_rec/python/layers/common_layers.py +192 -0
  94. easy_rec/python/layers/dnn.py +87 -0
  95. easy_rec/python/layers/embed_input_layer.py +25 -0
  96. easy_rec/python/layers/fm.py +26 -0
  97. easy_rec/python/layers/input_layer.py +396 -0
  98. easy_rec/python/layers/keras/__init__.py +34 -0
  99. easy_rec/python/layers/keras/activation.py +114 -0
  100. easy_rec/python/layers/keras/attention.py +267 -0
  101. easy_rec/python/layers/keras/auxiliary_loss.py +47 -0
  102. easy_rec/python/layers/keras/blocks.py +262 -0
  103. easy_rec/python/layers/keras/bst.py +119 -0
  104. easy_rec/python/layers/keras/custom_ops.py +250 -0
  105. easy_rec/python/layers/keras/data_augment.py +133 -0
  106. easy_rec/python/layers/keras/din.py +67 -0
  107. easy_rec/python/layers/keras/einsum_dense.py +598 -0
  108. easy_rec/python/layers/keras/embedding.py +81 -0
  109. easy_rec/python/layers/keras/fibinet.py +251 -0
  110. easy_rec/python/layers/keras/interaction.py +416 -0
  111. easy_rec/python/layers/keras/layer_norm.py +364 -0
  112. easy_rec/python/layers/keras/mask_net.py +166 -0
  113. easy_rec/python/layers/keras/multi_head_attention.py +717 -0
  114. easy_rec/python/layers/keras/multi_task.py +125 -0
  115. easy_rec/python/layers/keras/numerical_embedding.py +376 -0
  116. easy_rec/python/layers/keras/ppnet.py +194 -0
  117. easy_rec/python/layers/keras/transformer.py +192 -0
  118. easy_rec/python/layers/layer_norm.py +51 -0
  119. easy_rec/python/layers/mmoe.py +83 -0
  120. easy_rec/python/layers/multihead_attention.py +162 -0
  121. easy_rec/python/layers/multihead_cross_attention.py +749 -0
  122. easy_rec/python/layers/senet.py +73 -0
  123. easy_rec/python/layers/seq_input_layer.py +134 -0
  124. easy_rec/python/layers/sequence_feature_layer.py +249 -0
  125. easy_rec/python/layers/uniter.py +301 -0
  126. easy_rec/python/layers/utils.py +248 -0
  127. easy_rec/python/layers/variational_dropout_layer.py +130 -0
  128. easy_rec/python/loss/__init__.py +0 -0
  129. easy_rec/python/loss/circle_loss.py +82 -0
  130. easy_rec/python/loss/contrastive_loss.py +79 -0
  131. easy_rec/python/loss/f1_reweight_loss.py +38 -0
  132. easy_rec/python/loss/focal_loss.py +93 -0
  133. easy_rec/python/loss/jrc_loss.py +128 -0
  134. easy_rec/python/loss/listwise_loss.py +161 -0
  135. easy_rec/python/loss/multi_similarity.py +68 -0
  136. easy_rec/python/loss/pairwise_loss.py +307 -0
  137. easy_rec/python/loss/softmax_loss_with_negative_mining.py +110 -0
  138. easy_rec/python/loss/zero_inflated_lognormal.py +76 -0
  139. easy_rec/python/main.py +878 -0
  140. easy_rec/python/model/__init__.py +0 -0
  141. easy_rec/python/model/autoint.py +73 -0
  142. easy_rec/python/model/cmbf.py +47 -0
  143. easy_rec/python/model/collaborative_metric_learning.py +182 -0
  144. easy_rec/python/model/custom_model.py +323 -0
  145. easy_rec/python/model/dat.py +138 -0
  146. easy_rec/python/model/dbmtl.py +116 -0
  147. easy_rec/python/model/dcn.py +70 -0
  148. easy_rec/python/model/deepfm.py +106 -0
  149. easy_rec/python/model/dlrm.py +73 -0
  150. easy_rec/python/model/dropoutnet.py +207 -0
  151. easy_rec/python/model/dssm.py +154 -0
  152. easy_rec/python/model/dssm_senet.py +143 -0
  153. easy_rec/python/model/dummy_model.py +48 -0
  154. easy_rec/python/model/easy_rec_estimator.py +739 -0
  155. easy_rec/python/model/easy_rec_model.py +467 -0
  156. easy_rec/python/model/esmm.py +242 -0
  157. easy_rec/python/model/fm.py +63 -0
  158. easy_rec/python/model/match_model.py +357 -0
  159. easy_rec/python/model/mind.py +445 -0
  160. easy_rec/python/model/mmoe.py +70 -0
  161. easy_rec/python/model/multi_task_model.py +303 -0
  162. easy_rec/python/model/multi_tower.py +62 -0
  163. easy_rec/python/model/multi_tower_bst.py +190 -0
  164. easy_rec/python/model/multi_tower_din.py +130 -0
  165. easy_rec/python/model/multi_tower_recall.py +68 -0
  166. easy_rec/python/model/pdn.py +203 -0
  167. easy_rec/python/model/ple.py +120 -0
  168. easy_rec/python/model/rank_model.py +485 -0
  169. easy_rec/python/model/rocket_launching.py +203 -0
  170. easy_rec/python/model/simple_multi_task.py +54 -0
  171. easy_rec/python/model/uniter.py +46 -0
  172. easy_rec/python/model/wide_and_deep.py +121 -0
  173. easy_rec/python/ops/1.12/incr_record.so +0 -0
  174. easy_rec/python/ops/1.12/kafka.so +0 -0
  175. easy_rec/python/ops/1.12/libcustom_ops.so +0 -0
  176. easy_rec/python/ops/1.12/libembed_op.so +0 -0
  177. easy_rec/python/ops/1.12/libhiredis.so.1.0.0 +0 -0
  178. easy_rec/python/ops/1.12/librdkafka++.so.1 +0 -0
  179. easy_rec/python/ops/1.12/librdkafka.so.1 +0 -0
  180. easy_rec/python/ops/1.12/libredis++.so +0 -0
  181. easy_rec/python/ops/1.12/libredis++.so.1 +0 -0
  182. easy_rec/python/ops/1.12/libredis++.so.1.2.3 +0 -0
  183. easy_rec/python/ops/1.12/libstr_avx_op.so +0 -0
  184. easy_rec/python/ops/1.12/libwrite_sparse_kv.so +0 -0
  185. easy_rec/python/ops/1.15/incr_record.so +0 -0
  186. easy_rec/python/ops/1.15/kafka.so +0 -0
  187. easy_rec/python/ops/1.15/libcustom_ops.so +0 -0
  188. easy_rec/python/ops/1.15/libembed_op.so +0 -0
  189. easy_rec/python/ops/1.15/libhiredis.so.1.0.0 +0 -0
  190. easy_rec/python/ops/1.15/librdkafka++.so +0 -0
  191. easy_rec/python/ops/1.15/librdkafka++.so.1 +0 -0
  192. easy_rec/python/ops/1.15/librdkafka.so +0 -0
  193. easy_rec/python/ops/1.15/librdkafka.so.1 +0 -0
  194. easy_rec/python/ops/1.15/libredis++.so.1 +0 -0
  195. easy_rec/python/ops/1.15/libstr_avx_op.so +0 -0
  196. easy_rec/python/ops/2.12/libcustom_ops.so +0 -0
  197. easy_rec/python/ops/2.12/libload_embed.so +0 -0
  198. easy_rec/python/ops/2.12/libstr_avx_op.so +0 -0
  199. easy_rec/python/ops/__init__.py +0 -0
  200. easy_rec/python/ops/gen_kafka_ops.py +193 -0
  201. easy_rec/python/ops/gen_str_avx_op.py +28 -0
  202. easy_rec/python/ops/incr_record.py +30 -0
  203. easy_rec/python/predict.py +170 -0
  204. easy_rec/python/protos/__init__.py +0 -0
  205. easy_rec/python/protos/autoint_pb2.py +122 -0
  206. easy_rec/python/protos/backbone_pb2.py +1416 -0
  207. easy_rec/python/protos/cmbf_pb2.py +435 -0
  208. easy_rec/python/protos/collaborative_metric_learning_pb2.py +252 -0
  209. easy_rec/python/protos/custom_model_pb2.py +57 -0
  210. easy_rec/python/protos/dat_pb2.py +262 -0
  211. easy_rec/python/protos/data_source_pb2.py +422 -0
  212. easy_rec/python/protos/dataset_pb2.py +1920 -0
  213. easy_rec/python/protos/dbmtl_pb2.py +191 -0
  214. easy_rec/python/protos/dcn_pb2.py +197 -0
  215. easy_rec/python/protos/deepfm_pb2.py +163 -0
  216. easy_rec/python/protos/dlrm_pb2.py +163 -0
  217. easy_rec/python/protos/dnn_pb2.py +329 -0
  218. easy_rec/python/protos/dropoutnet_pb2.py +239 -0
  219. easy_rec/python/protos/dssm_pb2.py +262 -0
  220. easy_rec/python/protos/dssm_senet_pb2.py +282 -0
  221. easy_rec/python/protos/easy_rec_model_pb2.py +1672 -0
  222. easy_rec/python/protos/esmm_pb2.py +133 -0
  223. easy_rec/python/protos/eval_pb2.py +930 -0
  224. easy_rec/python/protos/export_pb2.py +379 -0
  225. easy_rec/python/protos/feature_config_pb2.py +1359 -0
  226. easy_rec/python/protos/fm_pb2.py +90 -0
  227. easy_rec/python/protos/hive_config_pb2.py +138 -0
  228. easy_rec/python/protos/hyperparams_pb2.py +624 -0
  229. easy_rec/python/protos/keras_layer_pb2.py +692 -0
  230. easy_rec/python/protos/layer_pb2.py +1936 -0
  231. easy_rec/python/protos/loss_pb2.py +1713 -0
  232. easy_rec/python/protos/mind_pb2.py +497 -0
  233. easy_rec/python/protos/mmoe_pb2.py +215 -0
  234. easy_rec/python/protos/multi_tower_pb2.py +295 -0
  235. easy_rec/python/protos/multi_tower_recall_pb2.py +198 -0
  236. easy_rec/python/protos/optimizer_pb2.py +2017 -0
  237. easy_rec/python/protos/pdn_pb2.py +293 -0
  238. easy_rec/python/protos/pipeline_pb2.py +516 -0
  239. easy_rec/python/protos/ple_pb2.py +231 -0
  240. easy_rec/python/protos/predict_pb2.py +1140 -0
  241. easy_rec/python/protos/rocket_launching_pb2.py +169 -0
  242. easy_rec/python/protos/seq_encoder_pb2.py +1084 -0
  243. easy_rec/python/protos/simi_pb2.py +54 -0
  244. easy_rec/python/protos/simple_multi_task_pb2.py +97 -0
  245. easy_rec/python/protos/tf_predict_pb2.py +630 -0
  246. easy_rec/python/protos/tower_pb2.py +661 -0
  247. easy_rec/python/protos/train_pb2.py +1197 -0
  248. easy_rec/python/protos/uniter_pb2.py +307 -0
  249. easy_rec/python/protos/variational_dropout_pb2.py +91 -0
  250. easy_rec/python/protos/wide_and_deep_pb2.py +131 -0
  251. easy_rec/python/test/__init__.py +0 -0
  252. easy_rec/python/test/csv_input_test.py +340 -0
  253. easy_rec/python/test/custom_early_stop_func.py +19 -0
  254. easy_rec/python/test/dh_local_run.py +104 -0
  255. easy_rec/python/test/embed_test.py +155 -0
  256. easy_rec/python/test/emr_run.py +119 -0
  257. easy_rec/python/test/eval_metric_test.py +107 -0
  258. easy_rec/python/test/excel_convert_test.py +64 -0
  259. easy_rec/python/test/export_test.py +513 -0
  260. easy_rec/python/test/fg_test.py +70 -0
  261. easy_rec/python/test/hive_input_test.py +311 -0
  262. easy_rec/python/test/hpo_test.py +235 -0
  263. easy_rec/python/test/kafka_test.py +373 -0
  264. easy_rec/python/test/local_incr_test.py +122 -0
  265. easy_rec/python/test/loss_test.py +110 -0
  266. easy_rec/python/test/odps_command.py +61 -0
  267. easy_rec/python/test/odps_local_run.py +86 -0
  268. easy_rec/python/test/odps_run.py +254 -0
  269. easy_rec/python/test/odps_test_cls.py +39 -0
  270. easy_rec/python/test/odps_test_prepare.py +198 -0
  271. easy_rec/python/test/odps_test_util.py +237 -0
  272. easy_rec/python/test/pre_check_test.py +54 -0
  273. easy_rec/python/test/predictor_test.py +394 -0
  274. easy_rec/python/test/rtp_convert_test.py +133 -0
  275. easy_rec/python/test/run.py +138 -0
  276. easy_rec/python/test/train_eval_test.py +1299 -0
  277. easy_rec/python/test/util_test.py +85 -0
  278. easy_rec/python/test/zero_inflated_lognormal_test.py +53 -0
  279. easy_rec/python/tools/__init__.py +0 -0
  280. easy_rec/python/tools/add_boundaries_to_config.py +67 -0
  281. easy_rec/python/tools/add_feature_info_to_config.py +145 -0
  282. easy_rec/python/tools/convert_config_format.py +48 -0
  283. easy_rec/python/tools/convert_rtp_data.py +79 -0
  284. easy_rec/python/tools/convert_rtp_fg.py +106 -0
  285. easy_rec/python/tools/create_config_from_excel.py +427 -0
  286. easy_rec/python/tools/criteo/__init__.py +0 -0
  287. easy_rec/python/tools/criteo/convert_data.py +157 -0
  288. easy_rec/python/tools/edit_lookup_graph.py +134 -0
  289. easy_rec/python/tools/faiss_index_pai.py +116 -0
  290. easy_rec/python/tools/feature_selection.py +316 -0
  291. easy_rec/python/tools/hit_rate_ds.py +223 -0
  292. easy_rec/python/tools/hit_rate_pai.py +138 -0
  293. easy_rec/python/tools/pre_check.py +120 -0
  294. easy_rec/python/tools/predict_and_chk.py +111 -0
  295. easy_rec/python/tools/read_kafka.py +55 -0
  296. easy_rec/python/tools/split_model_pai.py +286 -0
  297. easy_rec/python/tools/split_pdn_model_pai.py +272 -0
  298. easy_rec/python/tools/test_saved_model.py +80 -0
  299. easy_rec/python/tools/view_saved_model.py +39 -0
  300. easy_rec/python/tools/write_kafka.py +65 -0
  301. easy_rec/python/train_eval.py +325 -0
  302. easy_rec/python/utils/__init__.py +15 -0
  303. easy_rec/python/utils/activation.py +120 -0
  304. easy_rec/python/utils/check_utils.py +87 -0
  305. easy_rec/python/utils/compat.py +14 -0
  306. easy_rec/python/utils/config_util.py +652 -0
  307. easy_rec/python/utils/constant.py +43 -0
  308. easy_rec/python/utils/convert_rtp_fg.py +616 -0
  309. easy_rec/python/utils/dag.py +192 -0
  310. easy_rec/python/utils/distribution_utils.py +268 -0
  311. easy_rec/python/utils/ds_util.py +65 -0
  312. easy_rec/python/utils/embedding_utils.py +73 -0
  313. easy_rec/python/utils/estimator_utils.py +1036 -0
  314. easy_rec/python/utils/export_big_model.py +630 -0
  315. easy_rec/python/utils/expr_util.py +118 -0
  316. easy_rec/python/utils/fg_util.py +53 -0
  317. easy_rec/python/utils/hit_rate_utils.py +220 -0
  318. easy_rec/python/utils/hive_utils.py +183 -0
  319. easy_rec/python/utils/hpo_util.py +137 -0
  320. easy_rec/python/utils/hvd_utils.py +56 -0
  321. easy_rec/python/utils/input_utils.py +108 -0
  322. easy_rec/python/utils/io_util.py +282 -0
  323. easy_rec/python/utils/load_class.py +249 -0
  324. easy_rec/python/utils/meta_graph_editor.py +941 -0
  325. easy_rec/python/utils/multi_optimizer.py +62 -0
  326. easy_rec/python/utils/numpy_utils.py +18 -0
  327. easy_rec/python/utils/odps_util.py +79 -0
  328. easy_rec/python/utils/pai_util.py +86 -0
  329. easy_rec/python/utils/proto_util.py +90 -0
  330. easy_rec/python/utils/restore_filter.py +89 -0
  331. easy_rec/python/utils/shape_utils.py +432 -0
  332. easy_rec/python/utils/static_shape.py +71 -0
  333. easy_rec/python/utils/test_utils.py +866 -0
  334. easy_rec/python/utils/tf_utils.py +56 -0
  335. easy_rec/version.py +4 -0
  336. test/__init__.py +0 -0
@@ -0,0 +1,616 @@
1
+ # -*- encoding:utf-8 -*-
2
+ # Copyright (c) Alibaba, Inc. and its affiliates.
3
+ import json
4
+ import logging
5
+ import sys
6
+ import traceback
7
+
8
+ import tensorflow as tf
9
+ from google.protobuf import text_format
10
+
11
+ from easy_rec.python.protos.dataset_pb2 import DatasetConfig
12
+ from easy_rec.python.protos.feature_config_pb2 import FeatureConfig
13
+ from easy_rec.python.protos.feature_config_pb2 import FeatureGroupConfig
14
+ from easy_rec.python.protos.feature_config_pb2 import WideOrDeep
15
+ from easy_rec.python.protos.pipeline_pb2 import EasyRecConfig
16
+ from easy_rec.python.utils import config_util
17
+
18
+ if tf.__version__ >= '2.0':
19
+ tf = tf.compat.v1
20
+
21
+ MAX_HASH_BUCKET_SIZE = 9223372036854775807
22
+
23
+
24
+ def _gen_raw_config(feature, input_field, feature_config, is_multi,
25
+ curr_embed_dim):
26
+ if 'bucketize_boundaries' in feature:
27
+ if is_multi:
28
+ input_field.input_type = DatasetConfig.STRING
29
+ feature_config.feature_type = feature_config.TagFeature
30
+ else:
31
+ input_field.input_type = DatasetConfig.INT32
32
+ feature_config.feature_type = feature_config.IdFeature
33
+ feature_config.num_buckets = len(
34
+ feature['bucketize_boundaries'].split(',')) + 1
35
+ feature_config.embedding_dim = curr_embed_dim
36
+ else:
37
+ feature_config.feature_type = feature_config.RawFeature
38
+ input_field.default_val = str(feature.get('default_value', '0.0'))
39
+ raw_input_dim = feature.get('value_dimension', 1)
40
+ if raw_input_dim > 1:
41
+ feature_config.raw_input_dim = raw_input_dim
42
+ input_field.input_type = DatasetConfig.STRING
43
+ else:
44
+ input_field.input_type = DatasetConfig.DOUBLE
45
+ if 'boundaries' in feature:
46
+ feature_config.boundaries.extend(feature['boundaries'])
47
+ feature_config.embedding_dim = curr_embed_dim
48
+ if 'normalizer_fn' in feature:
49
+ feature_config.normalizer_fn = feature['normalizer_fn']
50
+
51
+
52
+ def _set_hash_bucket(feature, feature_config, input_field):
53
+ if 'max_partitions' in feature:
54
+ feature_config.max_partitions = feature['max_partitions']
55
+ if 'hash_bucket_size' in feature:
56
+ feature_config.hash_bucket_size = feature['hash_bucket_size']
57
+ if feature_config.hash_bucket_size > 10000000:
58
+ if 'max_partitions' not in feature:
59
+ logging.error(
60
+ 'it is suggested to set max_partitions > 1 for large hash buckets[%s]'
61
+ % feature['feature_name'])
62
+ sys.exit(1)
63
+ if feature.get('filter_freq', -1) >= 0:
64
+ feature_config.ev_params.filter_freq = feature['filter_freq']
65
+ feature_config.hash_bucket_size = MAX_HASH_BUCKET_SIZE
66
+ if feature.get('steps_to_live', -1) >= 0:
67
+ feature_config.ev_params.steps_to_live = feature['steps_to_live']
68
+ feature_config.hash_bucket_size = MAX_HASH_BUCKET_SIZE
69
+ elif 'vocab_file' in feature:
70
+ feature_config.vocab_file = feature['vocab_file']
71
+ elif 'vocab_list' in feature:
72
+ feature_config.vocab_list = feature['vocab_list']
73
+ elif 'num_buckets' in feature:
74
+ feature_config.num_buckets = feature['num_buckets']
75
+ input_field.default_val = feature.get('default_value', '0')
76
+ else:
77
+ assert False, 'one of hash_bucket_size,vocab_file,vocab_list,num_buckets must be set'
78
+
79
+
80
+ def process_features(feature_type,
81
+ feature_name,
82
+ feature,
83
+ pipeline_config,
84
+ embedding_dim,
85
+ incol_separator,
86
+ is_sequence=False):
87
+ feature_config = FeatureConfig()
88
+ feature_config.input_names.append(feature_name)
89
+ feature_config.separator = incol_separator
90
+ input_field = DatasetConfig.Field()
91
+ input_field.input_name = feature_name
92
+ curr_embed_dim = feature.get('embedding_dimension',
93
+ feature.get('embedding_dim', embedding_dim))
94
+ curr_combiner = feature.get('combiner', 'sum')
95
+ if feature.get('is_cache', False):
96
+ logging.info('will cache %s' % feature_name)
97
+ feature_config.is_cache = True
98
+ is_multi = feature.get('is_multi', False)
99
+ # is_seq = feature.get('is_seq', False)
100
+ if is_sequence:
101
+ feature_config.feature_type = feature_config.SequenceFeature
102
+ feature_config.embedding_dim = curr_embed_dim
103
+ if feature_type == 'raw_feature':
104
+ feature_config.sub_feature_type = feature_config.RawFeature
105
+ input_field.default_val = feature.get('default_value', '0.0')
106
+ raw_input_dim = feature.get('value_dimension', 1)
107
+ if 'boundaries' in feature:
108
+ feature_config.boundaries.extend(feature['boundaries'])
109
+ if raw_input_dim > 1:
110
+ feature_config.raw_input_dim = raw_input_dim
111
+ else:
112
+ feature_config.sub_feature_type = feature_config.IdFeature
113
+ _set_hash_bucket(feature, feature_config, input_field)
114
+ feature_config.combiner = curr_combiner
115
+ elif feature_type == 'id_feature':
116
+ if is_multi:
117
+ feature_config.feature_type = feature_config.TagFeature
118
+ kv_separator = feature.get('kv_separator', None)
119
+ if kv_separator:
120
+ feature_config.kv_separator = kv_separator
121
+ # elif is_seq:
122
+ # feature_config.feature_type = feature_config.SequenceFeature
123
+ else:
124
+ feature_config.feature_type = feature_config.IdFeature
125
+ feature_config.embedding_dim = curr_embed_dim
126
+ _set_hash_bucket(feature, feature_config, input_field)
127
+ feature_config.combiner = curr_combiner
128
+ elif feature_type == 'lookup_feature':
129
+ need_discrete = feature.get('needDiscrete', True)
130
+ if not need_discrete:
131
+ _gen_raw_config(feature, input_field, feature_config, is_multi,
132
+ curr_embed_dim)
133
+ else:
134
+ feature_config.feature_type = feature_config.TagFeature
135
+ if feature.get('needWeighting', False):
136
+ feature_config.kv_separator = ''
137
+ feature_config.embedding_dim = curr_embed_dim
138
+ _set_hash_bucket(feature, feature_config, input_field)
139
+ feature_config.combiner = curr_combiner
140
+ elif feature_type == 'raw_feature':
141
+ _gen_raw_config(feature, input_field, feature_config, is_multi,
142
+ curr_embed_dim)
143
+ elif feature_type == 'match_feature':
144
+ need_discrete = feature.get('needDiscrete', True)
145
+ if feature.get('matchType', '') == 'multihit':
146
+ is_multi = True
147
+ if need_discrete:
148
+ feature_config.feature_type = feature_config.TagFeature
149
+ if feature.get('needWeighting', False):
150
+ feature_config.kv_separator = ''
151
+ feature_config.embedding_dim = curr_embed_dim
152
+ _set_hash_bucket(feature, feature_config, input_field)
153
+ feature_config.combiner = curr_combiner
154
+ else:
155
+ assert 'bucketize_boundaries' not in feature
156
+ _gen_raw_config(feature, input_field, feature_config, is_multi,
157
+ curr_embed_dim)
158
+ elif feature_type == 'combo_feature':
159
+ feature_config.feature_type = feature_config.TagFeature
160
+ _set_hash_bucket(feature, feature_config, input_field)
161
+ feature_config.embedding_dim = curr_embed_dim
162
+ feature_config.combiner = curr_combiner
163
+ elif feature_type == 'overlap_feature':
164
+ if feature['method'] in ['common_word_divided', 'diff_word_divided']:
165
+ feature_config.feature_type = feature_config.TagFeature
166
+ else:
167
+ feature_config.feature_type = feature_config.IdFeature
168
+ _set_hash_bucket(feature, feature_config, input_field)
169
+ feature_config.embedding_dim = curr_embed_dim
170
+ feature_config.combiner = curr_combiner
171
+ else:
172
+ assert 'unknown feature type %s, currently not supported' % feature_type
173
+ if 'shared_name' in feature:
174
+ feature_config.embedding_name = feature['shared_name']
175
+ # pipeline_config.feature_configs.append(feature_config)
176
+ if pipeline_config.feature_configs:
177
+ pipeline_config.feature_configs.append(feature_config)
178
+ else:
179
+ pipeline_config.feature_config.features.append(feature_config)
180
+ pipeline_config.data_config.input_fields.append(input_field)
181
+
182
+ if 'extra_combo_info' in feature:
183
+ extra_combo_info = feature['extra_combo_info']
184
+ feature_names = extra_combo_info.get('feature_names', [])
185
+ assert len(
186
+ feature_names
187
+ ) >= 1, 'The feature number for ComboFeature must be greater than 2.'
188
+ combo_feature_config = FeatureConfig()
189
+ combo_feature_config.input_names.append(feature_name)
190
+
191
+ for fea_name in feature_names:
192
+ combo_feature_config.input_names.append(fea_name)
193
+
194
+ final_feature_name = 'combo__' + '_'.join(combo_feature_config.input_names)
195
+ final_feature_name = extra_combo_info.get('final_feature_name',
196
+ final_feature_name)
197
+ combo_feature_config.feature_name = final_feature_name
198
+ combo_feature_config.feature_type = combo_feature_config.ComboFeature
199
+ curr_embed_dim = extra_combo_info.get(
200
+ 'embedding_dimension',
201
+ extra_combo_info.get('embedding_dim', embedding_dim))
202
+ curr_combiner = extra_combo_info.get('combiner', 'mean')
203
+ combo_feature_config.embedding_dim = curr_embed_dim
204
+ combo_feature_config.combiner = curr_combiner
205
+ assert 'hash_bucket_size' in extra_combo_info, 'hash_bucket_size must be set in ComboFeature.'
206
+ _set_hash_bucket(extra_combo_info, combo_feature_config, None)
207
+
208
+ if pipeline_config.feature_configs:
209
+ pipeline_config.feature_configs.append(combo_feature_config)
210
+ else:
211
+ pipeline_config.feature_config.features.append(combo_feature_config)
212
+ return pipeline_config
213
+
214
+
215
+ def load_input_field_and_feature_config(rtp_fg,
216
+ label_fields,
217
+ embedding_dim=16,
218
+ incol_separator='\003'):
219
+ embedding_dim = rtp_fg.get('embedding_dim', embedding_dim)
220
+ logging.info('embedding_dim = %s' % embedding_dim)
221
+ logging.info('label_fields = %s' % ','.join(label_fields))
222
+
223
+ pipeline_config = EasyRecConfig()
224
+ for tmp_lbl in label_fields:
225
+ input_field = DatasetConfig.Field()
226
+ input_field.input_name = tmp_lbl
227
+ input_field.input_type = DatasetConfig.INT32
228
+ input_field.default_val = '0'
229
+ pipeline_config.data_config.input_fields.append(input_field)
230
+
231
+ rtp_features = rtp_fg['features']
232
+ for feature in rtp_features:
233
+ logging.info('feature type = %s' % type(feature))
234
+ logging.info('feature = %s' % feature)
235
+ logging.info('feature_type in feature %s' % ('feature_name' in feature))
236
+ try:
237
+ if 'feature_name' in feature:
238
+ feature_type = feature['feature_type']
239
+ feature_name = feature['feature_name']
240
+ pipeline_config = process_features(feature_type, feature_name, feature,
241
+ pipeline_config, embedding_dim,
242
+ incol_separator)
243
+ elif 'sequence_name' in feature:
244
+ logging.info('Set sequence_features group later.')
245
+ sequence_name = feature['sequence_name']
246
+ for sub_feature in feature['features']:
247
+ sub_feature_type = sub_feature['feature_type']
248
+ sub_feature_name = sub_feature['feature_name']
249
+ all_sub_feature_name = sequence_name + '_' + sub_feature_name
250
+ pipeline_config = process_features(
251
+ sub_feature_type,
252
+ all_sub_feature_name,
253
+ sub_feature,
254
+ pipeline_config,
255
+ embedding_dim,
256
+ incol_separator,
257
+ is_sequence=True)
258
+ except Exception:
259
+ logging.info('convert feature[%s] exception[%s]' %
260
+ (str(feature), traceback.format_exc()))
261
+ sys.exit(1)
262
+ return pipeline_config
263
+
264
+
265
+ def convert_rtp_fg(rtp_fg,
266
+ embedding_dim=16,
267
+ batch_size=1024,
268
+ label_fields=[],
269
+ num_steps=10,
270
+ model_type='',
271
+ separator='\002',
272
+ incol_separator='\003',
273
+ train_input_path=None,
274
+ eval_input_path=None,
275
+ selected_cols='',
276
+ input_type='OdpsRTPInput',
277
+ is_async=False):
278
+ with tf.gfile.GFile(rtp_fg, 'r') as fin:
279
+ rtp_fg = json.load(fin)
280
+
281
+ model_dir = rtp_fg.get('model_dir', 'experiments/rtp_fg_demo')
282
+ num_steps = rtp_fg.get('num_steps', num_steps)
283
+ model_type = rtp_fg.get('model_type', model_type)
284
+ label_fields = rtp_fg.get('label_fields', label_fields)
285
+ model_path = rtp_fg.get('model_path', '')
286
+ edit_config_json = rtp_fg.get('edit_config_json', None)
287
+ rtp_features = rtp_fg['features']
288
+
289
+ logging.info('model_dir = %s' % model_dir)
290
+ logging.info('num_steps = %d' % num_steps)
291
+ logging.info('model_type = %s' % model_type)
292
+ logging.info('model_path = %s' % model_path)
293
+ logging.info('edit_config_json = %s' % edit_config_json)
294
+
295
+ pipeline_config = load_input_field_and_feature_config(rtp_fg, label_fields,
296
+ embedding_dim,
297
+ incol_separator)
298
+ pipeline_config.model_dir = model_dir
299
+ pipeline_config.data_config.separator = separator
300
+ if selected_cols:
301
+ pipeline_config.data_config.selected_cols = selected_cols
302
+ if train_input_path is not None:
303
+ pipeline_config.train_input_path = train_input_path
304
+ if eval_input_path is not None:
305
+ pipeline_config.eval_input_path = eval_input_path
306
+
307
+ pipeline_config.data_config.batch_size = batch_size
308
+ pipeline_config.data_config.rtp_separator = ';'
309
+ pipeline_config.data_config.label_fields.extend(label_fields)
310
+
311
+ text_format.Merge('input_type: %s' % input_type, pipeline_config.data_config)
312
+
313
+ if model_path:
314
+ model_type = None
315
+ with tf.gfile.GFile(model_path, 'r') as fin:
316
+ model_config = fin.read()
317
+ text_format.Merge(model_config, pipeline_config)
318
+
319
+ if not pipeline_config.HasField('train_config'):
320
+ train_config_str = """
321
+ train_config {
322
+ log_step_count_steps: 200
323
+ optimizer_config: {
324
+ %s: {
325
+ learning_rate: {
326
+ exponential_decay_learning_rate {
327
+ initial_learning_rate: 0.0001
328
+ decay_steps: 100000
329
+ decay_factor: 0.5
330
+ min_learning_rate: 0.0000001
331
+ }
332
+ }
333
+ }
334
+ use_moving_average: false
335
+ }
336
+
337
+ sync_replicas: %s
338
+ }
339
+ """ % ('adam_optimizer' if not is_async else 'adam_async_optimizer',
340
+ 'true' if not is_async else 'false')
341
+ text_format.Merge(train_config_str, pipeline_config)
342
+
343
+ pipeline_config.train_config.num_steps = num_steps
344
+
345
+ if model_type == 'deepfm':
346
+ pipeline_config.model_config.model_class = 'DeepFM'
347
+ wide_group = FeatureGroupConfig()
348
+ wide_group.group_name = 'wide'
349
+ wide_group.wide_deep = WideOrDeep.WIDE
350
+ for feature in rtp_features:
351
+ feature_name = feature['feature_name']
352
+ wide_group.feature_names.append(feature_name)
353
+ pipeline_config.model_config.feature_groups.append(wide_group)
354
+ deep_group = FeatureGroupConfig()
355
+ deep_group.CopyFrom(wide_group)
356
+ deep_group.group_name = 'deep'
357
+ deep_group.wide_deep = WideOrDeep.DEEP
358
+ pipeline_config.model_config.feature_groups.append(deep_group)
359
+ deepfm_config_str = """
360
+ deepfm {
361
+ dnn {
362
+ hidden_units: [128, 64, 32]
363
+ }
364
+ final_dnn {
365
+ hidden_units: [128, 64]
366
+ }
367
+ wide_output_dim: 32
368
+ l2_regularization: 1e-5
369
+ }
370
+ """
371
+ text_format.Merge(deepfm_config_str, pipeline_config.model_config)
372
+ pipeline_config.model_config.embedding_regularization = 1e-5
373
+ elif model_type == 'wide_and_deep':
374
+ pipeline_config.model_config.model_class = 'WideAndDeep'
375
+ wide_group = FeatureGroupConfig()
376
+ wide_group.group_name = 'wide'
377
+ wide_group.wide_deep = WideOrDeep.WIDE
378
+ for feature in rtp_features:
379
+ feature_name = feature['feature_name']
380
+ group = feature.get('group', 'wide_and_deep')
381
+ if group not in ['wide', 'deep', 'wide_and_deep']:
382
+ logging.warning('invalid group %s for %s' % (group, feature_name))
383
+ group = 'wide_and_deep'
384
+ if group in ['wide', 'wide_and_deep']:
385
+ wide_group.feature_names.append(feature_name)
386
+ pipeline_config.model_config.feature_groups.append(wide_group)
387
+ deep_group = FeatureGroupConfig()
388
+ deep_group.group_name = 'deep'
389
+ deep_group.wide_deep = WideOrDeep.DEEP
390
+ for feature in rtp_features:
391
+ feature_name = feature['feature_name']
392
+ group = feature.get('group', 'wide_and_deep')
393
+ if group not in ['wide', 'deep', 'wide_and_deep']:
394
+ group = 'wide_and_deep'
395
+ if group in ['deep', 'wide_and_deep']:
396
+ deep_group.feature_names.append(feature_name)
397
+ pipeline_config.model_config.feature_groups.append(deep_group)
398
+ deepfm_config_str = """
399
+ wide_and_deep {
400
+ dnn {
401
+ hidden_units: [128, 64, 32]
402
+ }
403
+ l2_regularization: 1e-5
404
+ }
405
+ """
406
+ text_format.Merge(deepfm_config_str, pipeline_config.model_config)
407
+ pipeline_config.model_config.embedding_regularization = 1e-5
408
+ elif model_type == 'multi_tower':
409
+ pipeline_config.model_config.model_class = 'MultiTower'
410
+
411
+ feature_groups = {}
412
+ group_map = {
413
+ 'u': 'user',
414
+ 'i': 'item',
415
+ 'ctx': 'combo',
416
+ 'q': 'combo',
417
+ 'comb': 'combo'
418
+ }
419
+ for feature in rtp_features:
420
+ feature_name = feature['feature_name'].strip()
421
+ group_name = ''
422
+ if 'group' in feature:
423
+ group_name = feature['group']
424
+ else:
425
+ toks = feature_name.split('_')
426
+ group_name = toks[0]
427
+ if group_name in group_map:
428
+ group_name = group_map[group_name]
429
+ if group_name in feature_groups:
430
+ feature_groups[group_name].append(feature_name)
431
+ else:
432
+ feature_groups[group_name] = [feature_name]
433
+
434
+ logging.info(
435
+ 'if group is specified, group will be used as feature group name; '
436
+ 'otherwise, the prefix of feature_name in fg.json is used as feature group name'
437
+ )
438
+ logging.info('prefix map: %s' % str(group_map))
439
+ for group_name in feature_groups:
440
+ logging.info('add group = %s' % group_name)
441
+ group = FeatureGroupConfig()
442
+ group.group_name = group_name
443
+ for fea_name in feature_groups[group_name]:
444
+ group.feature_names.append(fea_name)
445
+ group.wide_deep = WideOrDeep.DEEP
446
+ pipeline_config.model_config.feature_groups.append(group)
447
+
448
+ multi_tower_config_str = ' multi_tower {\n'
449
+ for group_name in feature_groups:
450
+ multi_tower_config_str += """
451
+ towers {
452
+ input: "%s"
453
+ dnn {
454
+ hidden_units: [256, 192, 128]
455
+ }
456
+ }
457
+ """ % group_name
458
+
459
+ multi_tower_config_str = multi_tower_config_str + """
460
+ final_dnn {
461
+ hidden_units: [192, 128, 64]
462
+ }
463
+ l2_regularization: 1e-4
464
+ }
465
+ """
466
+ text_format.Merge(multi_tower_config_str, pipeline_config.model_config)
467
+ pipeline_config.model_config.embedding_regularization = 1e-5
468
+
469
+ elif model_type == 'esmm':
470
+ pipeline_config.model_config.model_class = 'ESMM'
471
+
472
+ feature_groups = {}
473
+ for feature in rtp_features:
474
+ feature_name = feature['feature_name']
475
+ group = feature.get('group', 'all')
476
+ if group in feature_groups:
477
+ feature_groups[group].append(feature_name)
478
+ else:
479
+ feature_groups[group] = [feature_name]
480
+
481
+ for group_name in feature_groups:
482
+ logging.info('add group = %s' % group_name)
483
+ group = FeatureGroupConfig()
484
+ group.group_name = group_name
485
+ for fea_name in feature_groups[group_name]:
486
+ group.feature_names.append(fea_name)
487
+ group.wide_deep = WideOrDeep.DEEP
488
+ pipeline_config.model_config.feature_groups.append(group)
489
+
490
+ esmm_config_str = ' esmm {\n'
491
+ for group_name in feature_groups:
492
+ esmm_config_str += """
493
+ groups {
494
+ input: "%s"
495
+ dnn {
496
+ hidden_units: [256, 128, 96, 64]
497
+ }
498
+ }""" % group_name
499
+
500
+ esmm_config_str += """
501
+ ctr_tower {
502
+ tower_name: "ctr"
503
+ label_name: "%s"
504
+ dnn {
505
+ hidden_units: [128, 96, 64, 32, 16]
506
+ }
507
+ num_class: 1
508
+ weight: 1.0
509
+ loss_type: CLASSIFICATION
510
+ metrics_set: {
511
+ auc {}
512
+ }
513
+ }
514
+ cvr_tower {
515
+ tower_name: "cvr"
516
+ label_name: "%s"
517
+ dnn {
518
+ hidden_units: [128, 96, 64, 32, 16]
519
+ }
520
+ num_class: 1
521
+ weight: 1.0
522
+ loss_type: CLASSIFICATION
523
+ metrics_set: {
524
+ auc {}
525
+ }
526
+ }
527
+ l2_regularization: 1e-6
528
+ }""" % (label_fields[0], label_fields[1])
529
+ text_format.Merge(esmm_config_str, pipeline_config.model_config)
530
+ pipeline_config.model_config.embedding_regularization = 5e-5
531
+ elif model_type == 'dbmtl':
532
+ pipeline_config.model_config.model_class = 'DBMTL'
533
+
534
+ feature_groups = {}
535
+ for feature in rtp_features:
536
+ feature_name = feature['feature_name']
537
+ group = 'all'
538
+ if group in feature_groups:
539
+ feature_groups[group].append(feature_name)
540
+ else:
541
+ feature_groups[group] = [feature_name]
542
+
543
+ for group_name in feature_groups:
544
+ logging.info('add group = %s' % group_name)
545
+ group = FeatureGroupConfig()
546
+ group.group_name = group_name
547
+ for fea_name in feature_groups[group_name]:
548
+ group.feature_names.append(fea_name)
549
+ group.wide_deep = WideOrDeep.DEEP
550
+ pipeline_config.model_config.feature_groups.append(group)
551
+
552
+ dbmtl_config_str = """
553
+ dbmtl {
554
+ bottom_dnn {
555
+ hidden_units: [1024]
556
+ }
557
+ expert_dnn {
558
+ hidden_units: [256, 128, 64, 32]
559
+ }
560
+ num_expert: 8
561
+ task_towers {
562
+ tower_name: "ctr"
563
+ label_name: "%s"
564
+ loss_type: CLASSIFICATION
565
+ metrics_set: {
566
+ auc {}
567
+ }
568
+ dnn {
569
+ hidden_units: [256, 128, 64, 32]
570
+ }
571
+ relation_dnn {
572
+ hidden_units: [32]
573
+ }
574
+ weight: 1.0
575
+ }
576
+ task_towers {
577
+ tower_name: "cvr"
578
+ label_name: "%s"
579
+ loss_type: CLASSIFICATION
580
+ metrics_set: {
581
+ auc {}
582
+ }
583
+ dnn {
584
+ hidden_units: [256, 128, 64, 32]
585
+ }
586
+ relation_tower_names: ["ctr"]
587
+ relation_dnn {
588
+ hidden_units: [32]
589
+ }
590
+ weight: 1.0
591
+ }
592
+ l2_regularization: 1e-6
593
+ }
594
+ """ % (label_fields[0], label_fields[1])
595
+ text_format.Merge(dbmtl_config_str, pipeline_config.model_config)
596
+ pipeline_config.model_config.embedding_regularization = 5e-6
597
+
598
+ if model_type in ['wide_and_deep', 'deepfm', 'multi_tower']:
599
+ text_format.Merge("""
600
+ metrics_set {
601
+ auc {}
602
+ }
603
+ """, pipeline_config.eval_config)
604
+
605
+ text_format.Merge(
606
+ """ export_config {
607
+ multi_placeholder: false
608
+ }
609
+ """, pipeline_config)
610
+
611
+ if edit_config_json:
612
+ for edit_obj in edit_config_json:
613
+ config_util.edit_config(pipeline_config, edit_obj)
614
+
615
+ pipeline_config.model_config.embedding_regularization = 1e-5
616
+ return pipeline_config