nextrec 0.4.18__tar.gz → 0.4.34__tar.gz

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.
Files changed (202) hide show
  1. {nextrec-0.4.18 → nextrec-0.4.34}/.gitignore +1 -0
  2. {nextrec-0.4.18 → nextrec-0.4.34}/LICENSE +1 -1
  3. {nextrec-0.4.18 → nextrec-0.4.34}/PKG-INFO +84 -68
  4. {nextrec-0.4.18 → nextrec-0.4.34}/README.md +81 -67
  5. {nextrec-0.4.18 → nextrec-0.4.34}/README_en.md +79 -65
  6. {nextrec-0.4.18 → nextrec-0.4.34}/docs/en/Getting started guide.md +2 -1
  7. {nextrec-0.4.18 → nextrec-0.4.34}/docs/rtd/conf.py +2 -2
  8. {nextrec-0.4.18 → nextrec-0.4.34}/docs/rtd/index.md +3 -2
  9. {nextrec-0.4.18 → nextrec-0.4.34}/docs/rtd/nextrec.utils.rst +0 -8
  10. {nextrec-0.4.18 → nextrec-0.4.34}/docs/zh//345/277/253/351/200/237/344/270/212/346/211/213.md +2 -1
  11. nextrec-0.4.34/nextrec/__version__.py +1 -0
  12. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/basic/activation.py +21 -18
  13. nextrec-0.4.34/nextrec/basic/asserts.py +51 -0
  14. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/basic/callback.py +39 -87
  15. nextrec-0.4.34/nextrec/basic/features.py +234 -0
  16. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/basic/heads.py +15 -1
  17. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/basic/layers.py +421 -114
  18. nextrec-0.4.34/nextrec/basic/loggers.py +432 -0
  19. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/basic/metrics.py +210 -115
  20. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/basic/model.py +556 -449
  21. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/basic/session.py +2 -2
  22. nextrec-0.4.34/nextrec/basic/summary.py +462 -0
  23. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/cli.py +91 -58
  24. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/data/batch_utils.py +23 -3
  25. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/data/data_processing.py +42 -4
  26. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/data/dataloader.py +32 -12
  27. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/data/preprocessor.py +524 -44
  28. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/loss/__init__.py +0 -4
  29. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/loss/grad_norm.py +81 -79
  30. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/loss/listwise.py +19 -6
  31. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/loss/pairwise.py +6 -4
  32. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/loss/pointwise.py +8 -6
  33. nextrec-0.4.34/nextrec/models/multi_task/[pre]aitm.py +173 -0
  34. nextrec-0.4.34/nextrec/models/multi_task/[pre]snr_trans.py +232 -0
  35. nextrec-0.4.34/nextrec/models/multi_task/[pre]star.py +192 -0
  36. nextrec-0.4.34/nextrec/models/multi_task/apg.py +330 -0
  37. nextrec-0.4.34/nextrec/models/multi_task/cross_stitch.py +229 -0
  38. nextrec-0.4.34/nextrec/models/multi_task/escm.py +290 -0
  39. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/multi_task/esmm.py +11 -49
  40. nextrec-0.4.34/nextrec/models/multi_task/hmoe.py +203 -0
  41. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/multi_task/mmoe.py +23 -55
  42. nextrec-0.4.34/nextrec/models/multi_task/pepnet.py +340 -0
  43. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/multi_task/ple.py +49 -83
  44. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/multi_task/poso.py +31 -64
  45. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/multi_task/share_bottom.py +20 -55
  46. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/ranking/afm.py +10 -31
  47. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/ranking/autoint.py +12 -44
  48. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/ranking/dcn.py +12 -32
  49. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/ranking/dcn_v2.py +13 -39
  50. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/ranking/deepfm.py +10 -35
  51. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/ranking/dien.py +16 -38
  52. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/ranking/din.py +17 -38
  53. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/ranking/eulernet.py +10 -35
  54. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/ranking/ffm.py +7 -31
  55. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/ranking/fibinet.py +15 -37
  56. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/ranking/fm.py +6 -32
  57. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/ranking/lr.py +6 -33
  58. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/ranking/masknet.py +14 -37
  59. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/ranking/pnn.py +10 -32
  60. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/ranking/widedeep.py +10 -38
  61. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/ranking/xdeepfm.py +13 -38
  62. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/representation/rqvae.py +4 -4
  63. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/retrieval/dssm.py +22 -60
  64. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/retrieval/dssm_v2.py +15 -52
  65. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/retrieval/mind.py +13 -45
  66. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/retrieval/sdm.py +40 -63
  67. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/retrieval/youtube_dnn.py +20 -55
  68. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/sequential/hstu.py +3 -23
  69. nextrec-0.4.34/nextrec/models/tree_base/__init__.py +15 -0
  70. nextrec-0.4.34/nextrec/models/tree_base/base.py +693 -0
  71. nextrec-0.4.34/nextrec/models/tree_base/catboost.py +97 -0
  72. nextrec-0.4.34/nextrec/models/tree_base/lightgbm.py +69 -0
  73. nextrec-0.4.34/nextrec/models/tree_base/xgboost.py +61 -0
  74. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/utils/__init__.py +23 -16
  75. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/utils/config.py +18 -5
  76. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/utils/console.py +2 -2
  77. nextrec-0.4.18/nextrec/loss/loss_utils.py → nextrec-0.4.34/nextrec/utils/loss.py +21 -36
  78. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/utils/model.py +31 -5
  79. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/utils/torch_utils.py +97 -134
  80. nextrec-0.4.34/nextrec/utils/types.py +143 -0
  81. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec_cli_preset/NextRec-CLI.md +51 -130
  82. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec_cli_preset/NextRec-CLI_zh.md +50 -129
  83. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec_cli_preset/feature_config.yaml +13 -13
  84. nextrec-0.4.34/nextrec_cli_preset/model_configs/apg.yaml +14 -0
  85. nextrec-0.4.34/nextrec_cli_preset/model_configs/cross_stitch.yaml +25 -0
  86. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec_cli_preset/model_configs/dcn.yaml +1 -1
  87. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec_cli_preset/model_configs/deepfm.yaml +1 -1
  88. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec_cli_preset/model_configs/din.yaml +4 -3
  89. nextrec-0.4.34/nextrec_cli_preset/model_configs/escm.yaml +21 -0
  90. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec_cli_preset/model_configs/esmm.yaml +4 -4
  91. nextrec-0.4.34/nextrec_cli_preset/model_configs/fibinet.yaml +16 -0
  92. nextrec-0.4.34/nextrec_cli_preset/model_configs/hmoe.yaml +35 -0
  93. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec_cli_preset/model_configs/masknet.yaml +1 -1
  94. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec_cli_preset/model_configs/mmoe.yaml +5 -5
  95. nextrec-0.4.34/nextrec_cli_preset/model_configs/pepnet.yaml +26 -0
  96. nextrec-0.4.34/nextrec_cli_preset/model_configs/ple.yaml +33 -0
  97. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec_cli_preset/model_configs/pnn.yaml +1 -1
  98. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec_cli_preset/model_configs/poso.yaml +3 -4
  99. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec_cli_preset/model_configs/share_bottom.yaml +5 -5
  100. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec_cli_preset/model_configs/widedeep.yaml +1 -1
  101. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec_cli_preset/model_configs/xdeepfm.yaml +1 -1
  102. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec_cli_preset/predict_config.yaml +4 -3
  103. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec_cli_preset/predict_config_template.yaml +3 -2
  104. nextrec-0.4.34/nextrec_cli_preset/train_config.yaml +53 -0
  105. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec_cli_preset/train_config_template.yaml +18 -2
  106. {nextrec-0.4.18 → nextrec-0.4.34}/pyproject.toml +3 -1
  107. {nextrec-0.4.18 → nextrec-0.4.34}/requirements.txt +3 -0
  108. {nextrec-0.4.18 → nextrec-0.4.34}/test/conftest.py +3 -3
  109. {nextrec-0.4.18 → nextrec-0.4.34}/test/run_tests.py +1 -0
  110. {nextrec-0.4.18 → nextrec-0.4.34}/test/test_layers.py +72 -10
  111. {nextrec-0.4.18 → nextrec-0.4.34}/test/test_losses.py +54 -1
  112. {nextrec-0.4.18 → nextrec-0.4.34}/test/test_match_models.py +15 -15
  113. {nextrec-0.4.18 → nextrec-0.4.34}/test/test_multitask_models.py +238 -95
  114. {nextrec-0.4.18 → nextrec-0.4.34}/test/test_ranking_models.py +60 -45
  115. {nextrec-0.4.18 → nextrec-0.4.34}/tutorials/example_match.py +2 -3
  116. {nextrec-0.4.18 → nextrec-0.4.34}/tutorials/example_multitask.py +35 -29
  117. {nextrec-0.4.18 → nextrec-0.4.34}/tutorials/example_ranking_din.py +10 -11
  118. nextrec-0.4.34/tutorials/example_tree.py +97 -0
  119. {nextrec-0.4.18 → nextrec-0.4.34}/tutorials/movielen_match_dssm.py +3 -3
  120. {nextrec-0.4.18 → nextrec-0.4.34}/tutorials/movielen_ranking_deepfm.py +5 -4
  121. nextrec-0.4.34/tutorials/notebooks/en/Hands on nextrec.ipynb +1687 -0
  122. {nextrec-0.4.18 → nextrec-0.4.34}/tutorials/notebooks/zh//344/275/277/347/224/250RQ-VAE/346/236/204/345/273/272/350/257/255/344/271/211ID.ipynb +65 -46
  123. {nextrec-0.4.18 → nextrec-0.4.34}/tutorials/notebooks/zh//345/246/202/344/275/225/344/275/277/347/224/250DataProcessor/350/277/233/350/241/214/351/242/204/345/244/204/347/220/206.ipynb +115 -61
  124. nextrec-0.4.34/tutorials/notebooks/zh//345/277/253/351/200/237/345/205/245/351/227/250nextrec.ipynb +1987 -0
  125. {nextrec-0.4.18 → nextrec-0.4.34}/tutorials/run_all_match_models.py +25 -11
  126. nextrec-0.4.34/tutorials/run_all_multitask_models.py +285 -0
  127. {nextrec-0.4.18 → nextrec-0.4.34}/tutorials/run_all_ranking_models.py +12 -10
  128. nextrec-0.4.18/nextrec/__version__.py +0 -1
  129. nextrec-0.4.18/nextrec/basic/features.py +0 -144
  130. nextrec-0.4.18/nextrec/basic/loggers.py +0 -217
  131. nextrec-0.4.18/nextrec/models/representation/autorec.py +0 -0
  132. nextrec-0.4.18/nextrec/models/representation/bpr.py +0 -0
  133. nextrec-0.4.18/nextrec/models/representation/cl4srec.py +0 -0
  134. nextrec-0.4.18/nextrec/models/representation/lightgcn.py +0 -0
  135. nextrec-0.4.18/nextrec/models/representation/mf.py +0 -0
  136. nextrec-0.4.18/nextrec/models/representation/s3rec.py +0 -0
  137. nextrec-0.4.18/nextrec/models/sequential/sasrec.py +0 -0
  138. nextrec-0.4.18/nextrec/utils/feature.py +0 -29
  139. nextrec-0.4.18/nextrec_cli_preset/model_configs/fibinet.yaml +0 -14
  140. nextrec-0.4.18/nextrec_cli_preset/model_configs/ple.yaml +0 -30
  141. nextrec-0.4.18/nextrec_cli_preset/train_config.yaml +0 -37
  142. nextrec-0.4.18/tutorials/notebooks/en/Hands on nextrec.ipynb +0 -1652
  143. nextrec-0.4.18/tutorials/notebooks/zh//345/277/253/351/200/237/345/205/245/351/227/250nextrec.ipynb +0 -1647
  144. nextrec-0.4.18/tutorials/run_all_multitask_models.py +0 -179
  145. {nextrec-0.4.18 → nextrec-0.4.34}/.github/workflows/publish.yml +0 -0
  146. {nextrec-0.4.18 → nextrec-0.4.34}/.github/workflows/tests.yml +0 -0
  147. {nextrec-0.4.18 → nextrec-0.4.34}/.readthedocs.yaml +0 -0
  148. {nextrec-0.4.18 → nextrec-0.4.34}/CODE_OF_CONDUCT.md +0 -0
  149. {nextrec-0.4.18 → nextrec-0.4.34}/CONTRIBUTING.md +0 -0
  150. {nextrec-0.4.18 → nextrec-0.4.34}/MANIFEST.in +0 -0
  151. {nextrec-0.4.18 → nextrec-0.4.34}/assets/Feature Configuration.png +0 -0
  152. {nextrec-0.4.18 → nextrec-0.4.34}/assets/Model Parameters.png +0 -0
  153. {nextrec-0.4.18 → nextrec-0.4.34}/assets/Training Configuration.png +0 -0
  154. {nextrec-0.4.18 → nextrec-0.4.34}/assets/Training logs.png +0 -0
  155. {nextrec-0.4.18 → nextrec-0.4.34}/assets/logo.png +0 -0
  156. {nextrec-0.4.18 → nextrec-0.4.34}/assets/mmoe_tutorial.png +0 -0
  157. {nextrec-0.4.18 → nextrec-0.4.34}/assets/nextrec_diagram.png +0 -0
  158. {nextrec-0.4.18 → nextrec-0.4.34}/assets/test data.png +0 -0
  159. {nextrec-0.4.18 → nextrec-0.4.34}/dataset/ctcvr_task.csv +0 -0
  160. {nextrec-0.4.18 → nextrec-0.4.34}/dataset/ecommerce_task.csv +0 -0
  161. {nextrec-0.4.18 → nextrec-0.4.34}/dataset/match_task.csv +0 -0
  162. {nextrec-0.4.18 → nextrec-0.4.34}/dataset/movielens_100k.csv +0 -0
  163. {nextrec-0.4.18 → nextrec-0.4.34}/dataset/multitask_task.csv +0 -0
  164. {nextrec-0.4.18 → nextrec-0.4.34}/dataset/ranking_task.csv +0 -0
  165. {nextrec-0.4.18 → nextrec-0.4.34}/docs/rtd/Makefile +0 -0
  166. {nextrec-0.4.18 → nextrec-0.4.34}/docs/rtd/make.bat +0 -0
  167. {nextrec-0.4.18 → nextrec-0.4.34}/docs/rtd/modules.rst +0 -0
  168. {nextrec-0.4.18 → nextrec-0.4.34}/docs/rtd/nextrec.basic.rst +0 -0
  169. {nextrec-0.4.18 → nextrec-0.4.34}/docs/rtd/nextrec.data.rst +0 -0
  170. {nextrec-0.4.18 → nextrec-0.4.34}/docs/rtd/nextrec.loss.rst +0 -0
  171. {nextrec-0.4.18 → nextrec-0.4.34}/docs/rtd/nextrec.rst +0 -0
  172. {nextrec-0.4.18 → nextrec-0.4.34}/docs/rtd/requirements.txt +0 -0
  173. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/__init__.py +0 -0
  174. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/basic/__init__.py +0 -0
  175. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/data/__init__.py +0 -0
  176. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/data/data_utils.py +0 -0
  177. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/generative/__init__.py +0 -0
  178. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/generative/tiger.py +0 -0
  179. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/multi_task/__init__.py +0 -0
  180. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/ranking/__init__.py +0 -0
  181. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/representation/__init__.py +0 -0
  182. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/models/retrieval/__init__.py +0 -0
  183. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/utils/data.py +0 -0
  184. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec/utils/embedding.py +0 -0
  185. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec_cli_preset/model_configs/afm.yaml +0 -0
  186. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec_cli_preset/model_configs/autoint.yaml +0 -0
  187. {nextrec-0.4.18 → nextrec-0.4.34}/nextrec_cli_preset/model_configs/fm.yaml +0 -0
  188. {nextrec-0.4.18 → nextrec-0.4.34}/pytest.ini +0 -0
  189. {nextrec-0.4.18 → nextrec-0.4.34}/scripts/format_code.py +0 -0
  190. {nextrec-0.4.18 → nextrec-0.4.34}/test/__init__.py +0 -0
  191. {nextrec-0.4.18 → nextrec-0.4.34}/test/helpers.py +0 -0
  192. {nextrec-0.4.18 → nextrec-0.4.34}/test/test_base_model_regularization.py +0 -0
  193. {nextrec-0.4.18 → nextrec-0.4.34}/test/test_generative_models.py +0 -0
  194. {nextrec-0.4.18 → nextrec-0.4.34}/test/test_preprocessor.py +0 -0
  195. {nextrec-0.4.18 → nextrec-0.4.34}/test/test_utils_console.py +0 -0
  196. {nextrec-0.4.18 → nextrec-0.4.34}/test/test_utils_data.py +0 -0
  197. {nextrec-0.4.18 → nextrec-0.4.34}/test/test_utils_embedding.py +0 -0
  198. {nextrec-0.4.18 → nextrec-0.4.34}/test_requirements.txt +0 -0
  199. {nextrec-0.4.18 → nextrec-0.4.34}/tutorials/distributed/example_distributed_training.py +0 -0
  200. {nextrec-0.4.18 → nextrec-0.4.34}/tutorials/distributed/example_distributed_training_large_dataset.py +0 -0
  201. {nextrec-0.4.18 → nextrec-0.4.34}/tutorials/notebooks/en/Build semantic ID with RQ-VAE.ipynb +0 -0
  202. {nextrec-0.4.18 → nextrec-0.4.34}/tutorials/notebooks/en/Hands on dataprocessor.ipynb +0 -0
@@ -72,6 +72,7 @@ uv.lock
72
72
  logs/
73
73
  *.log
74
74
  nextrec_logs/
75
+ swanlog/
75
76
 
76
77
  # Checkpoints
77
78
  checkpoints/
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 NextRec
3
+ Copyright (c) 2026 NextRec
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nextrec
3
- Version: 0.4.18
3
+ Version: 0.4.34
4
4
  Summary: A comprehensive recommendation library with match, ranking, and multi-task learning models
5
5
  Project-URL: Homepage, https://github.com/zerolovesea/NextRec
6
6
  Project-URL: Repository, https://github.com/zerolovesea/NextRec
@@ -42,9 +42,11 @@ Requires-Dist: scipy<1.12,>=1.8; sys_platform == 'linux' and python_version < '3
42
42
  Requires-Dist: scipy>=1.10.0; sys_platform == 'darwin'
43
43
  Requires-Dist: scipy>=1.10.0; sys_platform == 'win32'
44
44
  Requires-Dist: scipy>=1.11.0; sys_platform == 'linux' and python_version >= '3.12'
45
+ Requires-Dist: swanlab>=0.7.2
45
46
  Requires-Dist: torch>=2.0.0
46
47
  Requires-Dist: torchvision>=0.15.0
47
48
  Requires-Dist: transformers>=4.38.0
49
+ Requires-Dist: wandb>=0.23.1
48
50
  Provides-Extra: dev
49
51
  Requires-Dist: jupyter>=1.0.0; extra == 'dev'
50
52
  Requires-Dist: matplotlib>=3.7.0; extra == 'dev'
@@ -63,12 +65,12 @@ Description-Content-Type: text/markdown
63
65
 
64
66
  <div align="center">
65
67
 
66
- [![PyPI Downloads](https://static.pepy.tech/personalized-badge/nextrec?period=total&units=NONE&left_color=BLACK&right_color=GREEN&left_text=PyPI-downloads)](https://pypistats.org/packages/nextrec)
68
+ [![PyPI Downloads](https://static.pepy.tech/personalized-badge/nextrec?period=total&units=NONE&left_color=grey&right_color=GREEN&left_text=PyPI-downloads)](https://pypistats.org/packages/nextrec)
67
69
  ![Python](https://img.shields.io/badge/Python-3.10+-blue.svg)
68
70
  ![PyTorch](https://img.shields.io/badge/PyTorch-1.10+-ee4c2c.svg)
69
71
  ![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)
70
- ![Version](https://img.shields.io/badge/Version-0.4.18-orange.svg)
71
-
72
+ ![Version](https://img.shields.io/badge/Version-0.4.34-orange.svg)
73
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/zerolovesea/NextRec)
72
74
 
73
75
  中文文档 | [English Version](README_en.md)
74
76
 
@@ -100,13 +102,14 @@ NextRec是一个基于PyTorch的现代推荐系统框架,旨在为研究工程
100
102
  - **高效训练与评估**:内置多种优化器、学习率调度、早停、模型检查点与详细的日志管理,开箱即用。
101
103
 
102
104
  ## NextRec近期进展
103
-
105
+ - **01/01/2026** 新年好,在v0.4.27中加入了多个多目标模型的支持:[APG](nextrec/models/multi_task/apg.py), [ESCM](nextrec/models/multi_task/escm.py), [HMoE](nextrec/models/multi_task/hmoe.py), [Cross Stitch](nextrec/models/multi_task/cross_stitch.py)
106
+ - **28/12/2025** 在v0.4.21中加入了对SwanLab和Wandb的支持,通过model的`fit`方法进行配置:`use_swanlab=True, swanlab_kwargs={"project": "NextRec","name":"tutorial_movielens_deepfm"},`
104
107
  - **21/12/2025** 在v0.4.16中加入了对[GradNorm](/nextrec/loss/grad_norm.py)的支持,通过compile的`loss_weight='grad_norm'`进行配置
105
108
  - **12/12/2025** 在v0.4.9中加入了[RQ-VAE](/nextrec/models/representation/rqvae.py)模块。配套的[数据集](/dataset/ecommerce_task.csv)和[代码](tutorials/notebooks/zh/使用RQ-VAE构建语义ID.ipynb)已经同步在仓库中
106
109
  - **07/12/2025** 发布了NextRec CLI命令行工具,它允许用户根据配置文件进行一键训练和推理,我们提供了相关的[教程](/nextrec_cli_preset/NextRec-CLI_zh.md)和[教学代码](/nextrec_cli_preset)
107
110
  - **03/12/2025** NextRec获得了100颗🌟!感谢大家的支持
108
111
  - **06/12/2025** 在v0.4.1中支持了单机多卡的分布式DDP训练,并且提供了配套的[代码](tutorials/distributed)
109
- - **11/11/2025** NextRec v0.1.0发布,我们提供了10余种Ranking模型,4种多任务模型和4种召回模型,以及统一的训练/日志/指标管理系统
112
+ - **11/11/2025** NextRec v0.1.0发布,我们提供了10余种Ranking模型,11种多任务模型和4种召回模型,以及统一的训练/日志/指标管理系统
110
113
 
111
114
  ## 架构
112
115
 
@@ -180,7 +183,7 @@ sequence_features = [
180
183
  SequenceFeature(name='sequence_1', vocab_size=int(df['sequence_1'].apply(lambda x: max(x)).max() + 1), embedding_dim=16, padding_idx=0, embedding_name='sparse_0_emb'),]
181
184
 
182
185
  mlp_params = {
183
- "dims": [256, 128, 64],
186
+ "hidden_dims": [256, 128, 64],
184
187
  "activation": "relu",
185
188
  "dropout": 0.3,
186
189
  }
@@ -189,20 +192,20 @@ model = DIN(
189
192
  dense_features=dense_features,
190
193
  sparse_features=sparse_features,
191
194
  sequence_features=sequence_features,
195
+ behavior_feature_name="sequence_0",
196
+ candidate_feature_name="item_id",
192
197
  mlp_params=mlp_params,
193
- attention_hidden_units=[80, 40],
194
- attention_activation='sigmoid',
198
+ attention_mlp_params={
199
+ "hidden_dims": [80, 40],
200
+ "activation": "sigmoid",
201
+ },
195
202
  attention_use_softmax=True,
196
- target=['label'], # 目标变量
197
- device='mps',
198
- embedding_l1_reg=1e-6,
199
- embedding_l2_reg=1e-5,
200
- dense_l1_reg=1e-5,
201
- dense_l2_reg=1e-4,
203
+ target='label', # 目标变量
204
+ device='cpu',
202
205
  session_id="din_tutorial", # 实验id,用于存放训练日志
203
206
  )
204
207
 
205
- # 编译模型,设置优化器和损失函数
208
+ # 编译模型,优化器/损失/学习率调度器统一在 compile 中设置
206
209
  model.compile(
207
210
  optimizer = "adam",
208
211
  optimizer_params = {"lr": 1e-3, "weight_decay": 1e-5},
@@ -216,7 +219,13 @@ model.fit(
216
219
  epochs=3,
217
220
  batch_size=512,
218
221
  shuffle=True,
219
- user_id_column='user_id' # 用于计算GAUC的id列
222
+ user_id_column='user_id', # 用于计算GAUC的id列
223
+ valid_ratio=0.2, # 自动划分验证集(可选)
224
+ num_workers=4, # DataLoader 并行数
225
+ use_wandb=False, # 启用 Wandb(可选)
226
+ wandb_kwargs={"project": "NextRec", "name": "din_tutorial"},
227
+ use_swanlab=False, # 启用 SwanLab(可选)
228
+ swanlab_kwargs={"project": "NextRec", "name": "din_tutorial"},
220
229
  )
221
230
 
222
231
  # 训练完成后进行指标评估
@@ -243,11 +252,13 @@ nextrec --mode=train --train_config=path/to/train_config.yaml
243
252
  nextrec --mode=predict --predict_config=path/to/predict_config.yaml
244
253
  ```
245
254
 
246
- > 截止当前版本0.4.18,NextRec CLI支持单机训练,分布式训练相关功能尚在开发中。
255
+ 预测结果固定保存到 `{checkpoint_path}/predictions/{name}.{save_data_format}`。
256
+
257
+ > 截止当前版本0.4.34,NextRec CLI支持单机训练,分布式训练相关功能尚在开发中。
247
258
 
248
259
  ## 兼容平台
249
260
 
250
- 当前最新版本为0.4.18,所有模型和测试代码均已在以下平台通过验证,如果开发者在使用中遇到兼容问题,请在issue区提出错误报告及系统版本:
261
+ 当前最新版本为0.4.34,所有模型和测试代码均已在以下平台通过验证,如果开发者在使用中遇到兼容问题,请在issue区提出错误报告及系统版本:
251
262
 
252
263
  | 平台 | 配置 |
253
264
  |------|------|
@@ -260,69 +271,74 @@ nextrec --mode=predict --predict_config=path/to/predict_config.yaml
260
271
 
261
272
  ### 排序模型
262
273
 
263
- | 模型 | 论文 | 年份 | 状态 |
264
- |------|------|------|------|
265
- | [FM](nextrec/models/ranking/fm.py) | Factorization Machines | ICDM 2010 | 已支持 |
266
- | [LR](nextrec/models/ranking/lr.py) | Logistic Regression | - | 已支持 |
267
- | [AFM](nextrec/models/ranking/afm.py) | Attentional Factorization Machines: Learning the Weight of Feature Interactions via Attention Networks | IJCAI 2017 | 已支持 |
268
- | [FFM](nextrec/models/ranking/ffm.py) | Field-aware Factorization Machines | RecSys 2016 | 已支持 |
269
- | [DeepFM](nextrec/models/ranking/deepfm.py) | DeepFM: A Factorization-Machine based Neural Network for CTR Prediction | IJCAI 2017 | 已支持 |
270
- | [Wide&Deep](nextrec/models/ranking/widedeep.py) | Wide & Deep Learning for Recommender Systems | DLRS 2016 | 已支持 |
271
- | [xDeepFM](nextrec/models/ranking/xdeepfm.py) | xDeepFM: Combining Explicit and Implicit Feature Interactions | KDD 2018 | 已支持 |
272
- | [FiBiNET](nextrec/models/ranking/fibinet.py) | FiBiNET: Combining Feature Importance and Bilinear Feature Interaction for CTR Prediction | RecSys 2019 | 已支持 |
273
- | [PNN](nextrec/models/ranking/pnn.py) | Product-based Neural Networks for User Response Prediction | ICDM 2016 | 已支持 |
274
- | [AutoInt](nextrec/models/ranking/autoint.py) | AutoInt: Automatic Feature Interaction Learning | CIKM 2019 | 已支持 |
275
- | [DCN](nextrec/models/ranking/dcn.py) | Deep & Cross Network for Ad Click Predictions | ADKDD 2017 | 已支持 |
276
- | [DCN v2](nextrec/models/ranking/dcn_v2.py) | DCN V2: Improved Deep & Cross Network and Practical Lessons for Web-scale Learning to Rank Systems | KDD 2021 | 已支持 |
277
- | [DIN](nextrec/models/ranking/din.py) | Deep Interest Network for Click-Through Rate Prediction | KDD 2018 | 已支持 |
278
- | [DIEN](nextrec/models/ranking/dien.py) | Deep Interest Evolution Network for Click-Through Rate Prediction | AAAI 2019 | 已支持 |
279
- | [MaskNet](nextrec/models/ranking/masknet.py) | MaskNet: Introducing Feature-wise Gating Blocks for High-dimensional Sparse Recommendation Data | 2020 | 已支持 |
280
- | [EulerNet](nextrec/models/ranking/eulernet.py) | EulerNet: Efficient and Effective Feature Interaction Modeling with Euler's Formula | SIGIR 2021 | 已支持 |
274
+ | 模型 | 论文 | 状态 |
275
+ | ------ | ------ | ------ |
276
+ | [FM](nextrec/models/ranking/fm.py) | Factorization machines | 已支持 |
277
+ | [LR](nextrec/models/ranking/lr.py) | Applied Logistic Regression | 已支持 |
278
+ | [AFM](nextrec/models/ranking/afm.py) | Attentional Factorization Machines: Learning the Weight of Feature Interactions via Attention Networks | 已支持 |
279
+ | [FFM](nextrec/models/ranking/ffm.py) | Field-aware Factorization Machines for CTR Prediction | 已支持 |
280
+ | [DeepFM](nextrec/models/ranking/deepfm.py) | DeepFM: A factorization-machine based neural network for CTR prediction | 已支持 |
281
+ | [Wide&Deep](nextrec/models/ranking/widedeep.py) | Wide & Deep learning for recommender systems | 已支持 |
282
+ | [xDeepFM](nextrec/models/ranking/xdeepfm.py) | xdeepfm: Combining explicit and implicit feature interactions for recommender systems | 已支持 |
283
+ | [FiBiNET](nextrec/models/ranking/fibinet.py) | FiBiNET: Combining feature importance and bilinear feature interaction for click-through rate prediction | 已支持 |
284
+ | [PNN](nextrec/models/ranking/pnn.py) | Product-based neural networks for user response prediction | 已支持 |
285
+ | [AutoInt](nextrec/models/ranking/autoint.py) | AutoInt: Automatic feature interaction learning via self-attentive neural networks | 已支持 |
286
+ | [DCN](nextrec/models/ranking/dcn.py) | Deep & cross network for ad click predictions | 已支持 |
287
+ | [DCN v2](nextrec/models/ranking/dcn_v2.py) | DCN V2: Improved Deep & Cross Network and Practical Lessons for Web-scale Learning to Rank Systems | 已支持 |
288
+ | [DIN](nextrec/models/ranking/din.py) | Deep interest network for click-through rate prediction | 已支持 |
289
+ | [DIEN](nextrec/models/ranking/dien.py) | Deep interest evolution network for click-through rate prediction | 已支持 |
290
+ | [MaskNet](nextrec/models/ranking/masknet.py) | MaskNet: Introducing Feature-Wise Multiplication to CTR Ranking Models by Instance-Guided Mask | 已支持 |
291
+ | [EulerNet](nextrec/models/ranking/eulernet.py) | EulerNet: Efficient and Effective Feature Interaction Modeling with Euler's Formula | 已支持 |
281
292
 
282
293
  ### 召回模型
283
294
 
284
- | 模型 | 论文 | 年份 | 状态 |
285
- |------|------|------|------|
286
- | [DSSM](nextrec/models/retrieval/dssm.py) | Learning Deep Structured Semantic Models | CIKM 2013 | 已支持 |
287
- | [DSSM v2](nextrec/models/retrieval/dssm_v2.py) | DSSM with pairwise BPR-style optimization | - | 已支持 |
288
- | [YouTube DNN](nextrec/models/retrieval/youtube_dnn.py) | Deep Neural Networks for YouTube Recommendations | RecSys 2016 | 已支持 |
289
- | [MIND](nextrec/models/retrieval/mind.py) | Multi-Interest Network with Dynamic Routing | CIKM 2019 | 已支持 |
290
- | [SDM](nextrec/models/retrieval/sdm.py) | Sequential Deep Matching Model | - | 已支持 |
295
+ | 模型 | 论文 | 状态 |
296
+ | ------ | ------ | ------ |
297
+ | [DSSM](nextrec/models/retrieval/dssm.py) | Learning deep structured semantic models for web search using clickthrough data | 已支持 |
298
+ | [DSSM v2](nextrec/models/retrieval/dssm_v2.py) | DSSM v2 - DSSM with pairwise training using BPR loss | 已支持 |
299
+ | [YouTube DNN](nextrec/models/retrieval/youtube_dnn.py) | Deep neural networks for youtube recommendations | 已支持 |
300
+ | [MIND](nextrec/models/retrieval/mind.py) | Multi-interest network with dynamic routing for recommendation at Tmall | 已支持 |
301
+ | [SDM](nextrec/models/retrieval/sdm.py) | Sequential recommender system based on hierarchical attention networks | 已支持 |
291
302
 
292
303
  ### 序列推荐模型
293
304
 
294
- | 模型 | 论文 | 年份 | 状态 |
295
- |------|------|------|------|
296
- | [SASRec](nextrec/models/sequential/sasrec.py) | Self-Attentive Sequential Recommendation | KDD 2018 | 开发中 |
297
- | [HSTU](nextrec/models/sequential/hstu.py) | Actions speak louder than words: Trillion-parameter sequential transducers for generative recommendations | arXiv 2024 | 已支持 |
305
+ | 模型 | 论文 | 状态 |
306
+ | ------ | ------ | ------ |
307
+ | [SASRec](nextrec/models/sequential/sasrec.py) | Self-Attentive Sequential Recommendation | 开发中 |
308
+ | [HSTU](nextrec/models/sequential/hstu.py) | Actions speak louder than words: Trillion-parameter sequential transducers for generative recommendations | 已支持 |
298
309
 
299
310
  ### 多任务模型
300
311
 
301
- | 模型 | 论文 | 年份 | 状态 |
302
- |------|------|------|------|
303
- | [MMOE](nextrec/models/multi_task/mmoe.py) | Modeling Task Relationships in Multi-task Learning | KDD 2018 | 已支持 |
304
- | [PLE](nextrec/models/multi_task/ple.py) | Progressive Layered Extraction | RecSys 2020 | 已支持 |
305
- | [ESMM](nextrec/models/multi_task/esmm.py) | Entire Space Multi-Task Model | SIGIR 2018 | 已支持 |
306
- | [ShareBottom](nextrec/models/multi_task/share_bottom.py) | Multitask Learning | - | 已支持 |
307
- | [POSO](nextrec/models/multi_task/poso.py) | POSO: Personalized Cold-start Modules for Large-scale Recommender Systems | 2021 | 已支持 |
312
+ | 模型 | 论文 | 状态 |
313
+ | ------ | ------ | ------ |
314
+ | [MMOE](nextrec/models/multi_task/mmoe.py) | Modeling Task Relationships in Multi-task Learning with Multi-gate Mixture-of-Experts | 已支持 |
315
+ | [PLE](nextrec/models/multi_task/ple.py) | Progressive Layered Extraction (PLE): A Novel Multi-Task Learning (MTL) Model for Personalized Recommendations | 已支持 |
316
+ | [ESMM](nextrec/models/multi_task/esmm.py) | Entire Space Multi-Task Model: An Effective Approach for Estimating Post-Click Conversion Rate | 已支持 |
317
+ | [ShareBottom](nextrec/models/multi_task/share_bottom.py) | Multitask Learning | 已支持 |
318
+ | [POSO](nextrec/models/multi_task/poso.py) | POSO: Personalized Cold Start Modules for Large-scale Recommender Systems | 已支持 |
319
+ | [PEPNet](nextrec/models/multi_task/pepnet.py) | PEPNet: Parameter and Embedding Personalized Network for Infusing with Personalized Prior Information | 已支持 |
320
+ | [APG](nextrec/models/multi_task/apg.py) | APG: Adaptive Parameter Generation Network for Click-Through Rate Prediction | 已支持 |
321
+ | [CrossStitch](nextrec/models/multi_task/cross_stitch.py) | Cross-Stitch Networks for Multi-Task Learning | 已支持 |
322
+ | [ESCM](nextrec/models/multi_task/escm.py) | ESCM²: Entire Space Counterfactual Multi-Task Model for Post-Click Conversion Rate Estimation | 已支持 |
323
+ | [HMOE](nextrec/models/multi_task/hmoe.py) | Improving multi-scenario learning to rank in e-commerce by exploiting task relationships in the label space | 已支持 |
308
324
 
309
325
  ### 生成式模型
310
326
 
311
- | 模型 | 论文 | 年份 | 状态 |
312
- |------|------|------|------|
313
- | [TIGER](nextrec/models/generative/tiger.py) | Recommender Systems with Generative Retrieval | NeurIPS 2023 | 开发中 |
327
+ | 模型 | 论文 | 状态 |
328
+ | ------ | ------ | ------ |
329
+ | [TIGER](nextrec/models/generative/tiger.py) | Recommender Systems with Generative Retrieval | 开发中 |
314
330
 
315
331
  ### 表征模型
316
332
 
317
- | 模型 | 论文 | 年份 | 状态 |
318
- |------|------|------|------|
319
- | [RQ-VAE](nextrec/models/representation/rqvae.py) | RQ-VAE: RQVAE for Generative Retrieval | - | 已支持 |
320
- | [BPR](nextrec/models/representation/bpr.py) | Bayesian Personalized Ranking | UAI 2009 | 开发中 |
321
- | [MF](nextrec/models/representation/mf.py) | Matrix Factorization Techniques for Recommender Systems | - | 开发中 |
322
- | [AutoRec](nextrec/models/representation/autorec.py) | AutoRec: Autoencoders Meet Collaborative Filtering | WWW 2015 | 开发中 |
323
- | [LightGCN](nextrec/models/representation/lightgcn.py) | LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation | SIGIR 2020 | 开发中 |
324
- | [S3Rec](nextrec/models/representation/s3rec.py) | S3-Rec: Self-Supervised Learning for Sequential Recommendation | CIKM 2020 | 开发中 |
325
- | [CL4SRec](nextrec/models/representation/cl4srec.py) | CL4SRec: Contrastive Learning for Sequential Recommendation | 2021 | 开发中 |
333
+ | 模型 | 论文 | 状态 |
334
+ | ------ | ------ | ------ |
335
+ | [RQ-VAE](nextrec/models/representation/rqvae.py) | Autoregressive Image Generation using Residual Quantization | 已支持 |
336
+ | [BPR](nextrec/models/representation/bpr.py) | Bayesian Personalized Ranking | 开发中 |
337
+ | [MF](nextrec/models/representation/mf.py) | Matrix Factorization Techniques for Recommender Systems | 开发中 |
338
+ | [AutoRec](nextrec/models/representation/autorec.py) | AutoRec: Autoencoders Meet Collaborative Filtering | 开发中 |
339
+ | [LightGCN](nextrec/models/representation/lightgcn.py) | LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation | 开发中 |
340
+ | [S3Rec](nextrec/models/representation/s3rec.py) | S3-Rec: Self-Supervised Learning for Sequential Recommendation | 开发中 |
341
+ | [CL4SRec](nextrec/models/representation/cl4srec.py) | CL4SRec: Contrastive Learning for Sequential Recommendation | 开发中 |
326
342
 
327
343
  ---
328
344
 
@@ -384,7 +400,7 @@ NextRec 的开发受到以下优秀项目的启发:
384
400
  @misc{nextrec,
385
401
  title = {NextRec},
386
402
  author = {Yang Zhou},
387
- year = {2025},
403
+ year = {2026},
388
404
  publisher = {GitHub},
389
405
  journal = {GitHub repository},
390
406
  howpublished = {\url{https://github.com/zerolovesea/NextRec}},
@@ -4,12 +4,12 @@
4
4
 
5
5
  <div align="center">
6
6
 
7
- [![PyPI Downloads](https://static.pepy.tech/personalized-badge/nextrec?period=total&units=NONE&left_color=BLACK&right_color=GREEN&left_text=PyPI-downloads)](https://pypistats.org/packages/nextrec)
7
+ [![PyPI Downloads](https://static.pepy.tech/personalized-badge/nextrec?period=total&units=NONE&left_color=grey&right_color=GREEN&left_text=PyPI-downloads)](https://pypistats.org/packages/nextrec)
8
8
  ![Python](https://img.shields.io/badge/Python-3.10+-blue.svg)
9
9
  ![PyTorch](https://img.shields.io/badge/PyTorch-1.10+-ee4c2c.svg)
10
10
  ![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)
11
- ![Version](https://img.shields.io/badge/Version-0.4.18-orange.svg)
12
-
11
+ ![Version](https://img.shields.io/badge/Version-0.4.34-orange.svg)
12
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/zerolovesea/NextRec)
13
13
 
14
14
  中文文档 | [English Version](README_en.md)
15
15
 
@@ -41,13 +41,14 @@ NextRec是一个基于PyTorch的现代推荐系统框架,旨在为研究工程
41
41
  - **高效训练与评估**:内置多种优化器、学习率调度、早停、模型检查点与详细的日志管理,开箱即用。
42
42
 
43
43
  ## NextRec近期进展
44
-
44
+ - **01/01/2026** 新年好,在v0.4.27中加入了多个多目标模型的支持:[APG](nextrec/models/multi_task/apg.py), [ESCM](nextrec/models/multi_task/escm.py), [HMoE](nextrec/models/multi_task/hmoe.py), [Cross Stitch](nextrec/models/multi_task/cross_stitch.py)
45
+ - **28/12/2025** 在v0.4.21中加入了对SwanLab和Wandb的支持,通过model的`fit`方法进行配置:`use_swanlab=True, swanlab_kwargs={"project": "NextRec","name":"tutorial_movielens_deepfm"},`
45
46
  - **21/12/2025** 在v0.4.16中加入了对[GradNorm](/nextrec/loss/grad_norm.py)的支持,通过compile的`loss_weight='grad_norm'`进行配置
46
47
  - **12/12/2025** 在v0.4.9中加入了[RQ-VAE](/nextrec/models/representation/rqvae.py)模块。配套的[数据集](/dataset/ecommerce_task.csv)和[代码](tutorials/notebooks/zh/使用RQ-VAE构建语义ID.ipynb)已经同步在仓库中
47
48
  - **07/12/2025** 发布了NextRec CLI命令行工具,它允许用户根据配置文件进行一键训练和推理,我们提供了相关的[教程](/nextrec_cli_preset/NextRec-CLI_zh.md)和[教学代码](/nextrec_cli_preset)
48
49
  - **03/12/2025** NextRec获得了100颗🌟!感谢大家的支持
49
50
  - **06/12/2025** 在v0.4.1中支持了单机多卡的分布式DDP训练,并且提供了配套的[代码](tutorials/distributed)
50
- - **11/11/2025** NextRec v0.1.0发布,我们提供了10余种Ranking模型,4种多任务模型和4种召回模型,以及统一的训练/日志/指标管理系统
51
+ - **11/11/2025** NextRec v0.1.0发布,我们提供了10余种Ranking模型,11种多任务模型和4种召回模型,以及统一的训练/日志/指标管理系统
51
52
 
52
53
  ## 架构
53
54
 
@@ -121,7 +122,7 @@ sequence_features = [
121
122
  SequenceFeature(name='sequence_1', vocab_size=int(df['sequence_1'].apply(lambda x: max(x)).max() + 1), embedding_dim=16, padding_idx=0, embedding_name='sparse_0_emb'),]
122
123
 
123
124
  mlp_params = {
124
- "dims": [256, 128, 64],
125
+ "hidden_dims": [256, 128, 64],
125
126
  "activation": "relu",
126
127
  "dropout": 0.3,
127
128
  }
@@ -130,20 +131,20 @@ model = DIN(
130
131
  dense_features=dense_features,
131
132
  sparse_features=sparse_features,
132
133
  sequence_features=sequence_features,
134
+ behavior_feature_name="sequence_0",
135
+ candidate_feature_name="item_id",
133
136
  mlp_params=mlp_params,
134
- attention_hidden_units=[80, 40],
135
- attention_activation='sigmoid',
137
+ attention_mlp_params={
138
+ "hidden_dims": [80, 40],
139
+ "activation": "sigmoid",
140
+ },
136
141
  attention_use_softmax=True,
137
- target=['label'], # 目标变量
138
- device='mps',
139
- embedding_l1_reg=1e-6,
140
- embedding_l2_reg=1e-5,
141
- dense_l1_reg=1e-5,
142
- dense_l2_reg=1e-4,
142
+ target='label', # 目标变量
143
+ device='cpu',
143
144
  session_id="din_tutorial", # 实验id,用于存放训练日志
144
145
  )
145
146
 
146
- # 编译模型,设置优化器和损失函数
147
+ # 编译模型,优化器/损失/学习率调度器统一在 compile 中设置
147
148
  model.compile(
148
149
  optimizer = "adam",
149
150
  optimizer_params = {"lr": 1e-3, "weight_decay": 1e-5},
@@ -157,7 +158,13 @@ model.fit(
157
158
  epochs=3,
158
159
  batch_size=512,
159
160
  shuffle=True,
160
- user_id_column='user_id' # 用于计算GAUC的id列
161
+ user_id_column='user_id', # 用于计算GAUC的id列
162
+ valid_ratio=0.2, # 自动划分验证集(可选)
163
+ num_workers=4, # DataLoader 并行数
164
+ use_wandb=False, # 启用 Wandb(可选)
165
+ wandb_kwargs={"project": "NextRec", "name": "din_tutorial"},
166
+ use_swanlab=False, # 启用 SwanLab(可选)
167
+ swanlab_kwargs={"project": "NextRec", "name": "din_tutorial"},
161
168
  )
162
169
 
163
170
  # 训练完成后进行指标评估
@@ -184,11 +191,13 @@ nextrec --mode=train --train_config=path/to/train_config.yaml
184
191
  nextrec --mode=predict --predict_config=path/to/predict_config.yaml
185
192
  ```
186
193
 
187
- > 截止当前版本0.4.18,NextRec CLI支持单机训练,分布式训练相关功能尚在开发中。
194
+ 预测结果固定保存到 `{checkpoint_path}/predictions/{name}.{save_data_format}`。
195
+
196
+ > 截止当前版本0.4.34,NextRec CLI支持单机训练,分布式训练相关功能尚在开发中。
188
197
 
189
198
  ## 兼容平台
190
199
 
191
- 当前最新版本为0.4.18,所有模型和测试代码均已在以下平台通过验证,如果开发者在使用中遇到兼容问题,请在issue区提出错误报告及系统版本:
200
+ 当前最新版本为0.4.34,所有模型和测试代码均已在以下平台通过验证,如果开发者在使用中遇到兼容问题,请在issue区提出错误报告及系统版本:
192
201
 
193
202
  | 平台 | 配置 |
194
203
  |------|------|
@@ -201,69 +210,74 @@ nextrec --mode=predict --predict_config=path/to/predict_config.yaml
201
210
 
202
211
  ### 排序模型
203
212
 
204
- | 模型 | 论文 | 年份 | 状态 |
205
- |------|------|------|------|
206
- | [FM](nextrec/models/ranking/fm.py) | Factorization Machines | ICDM 2010 | 已支持 |
207
- | [LR](nextrec/models/ranking/lr.py) | Logistic Regression | - | 已支持 |
208
- | [AFM](nextrec/models/ranking/afm.py) | Attentional Factorization Machines: Learning the Weight of Feature Interactions via Attention Networks | IJCAI 2017 | 已支持 |
209
- | [FFM](nextrec/models/ranking/ffm.py) | Field-aware Factorization Machines | RecSys 2016 | 已支持 |
210
- | [DeepFM](nextrec/models/ranking/deepfm.py) | DeepFM: A Factorization-Machine based Neural Network for CTR Prediction | IJCAI 2017 | 已支持 |
211
- | [Wide&Deep](nextrec/models/ranking/widedeep.py) | Wide & Deep Learning for Recommender Systems | DLRS 2016 | 已支持 |
212
- | [xDeepFM](nextrec/models/ranking/xdeepfm.py) | xDeepFM: Combining Explicit and Implicit Feature Interactions | KDD 2018 | 已支持 |
213
- | [FiBiNET](nextrec/models/ranking/fibinet.py) | FiBiNET: Combining Feature Importance and Bilinear Feature Interaction for CTR Prediction | RecSys 2019 | 已支持 |
214
- | [PNN](nextrec/models/ranking/pnn.py) | Product-based Neural Networks for User Response Prediction | ICDM 2016 | 已支持 |
215
- | [AutoInt](nextrec/models/ranking/autoint.py) | AutoInt: Automatic Feature Interaction Learning | CIKM 2019 | 已支持 |
216
- | [DCN](nextrec/models/ranking/dcn.py) | Deep & Cross Network for Ad Click Predictions | ADKDD 2017 | 已支持 |
217
- | [DCN v2](nextrec/models/ranking/dcn_v2.py) | DCN V2: Improved Deep & Cross Network and Practical Lessons for Web-scale Learning to Rank Systems | KDD 2021 | 已支持 |
218
- | [DIN](nextrec/models/ranking/din.py) | Deep Interest Network for Click-Through Rate Prediction | KDD 2018 | 已支持 |
219
- | [DIEN](nextrec/models/ranking/dien.py) | Deep Interest Evolution Network for Click-Through Rate Prediction | AAAI 2019 | 已支持 |
220
- | [MaskNet](nextrec/models/ranking/masknet.py) | MaskNet: Introducing Feature-wise Gating Blocks for High-dimensional Sparse Recommendation Data | 2020 | 已支持 |
221
- | [EulerNet](nextrec/models/ranking/eulernet.py) | EulerNet: Efficient and Effective Feature Interaction Modeling with Euler's Formula | SIGIR 2021 | 已支持 |
213
+ | 模型 | 论文 | 状态 |
214
+ | ------ | ------ | ------ |
215
+ | [FM](nextrec/models/ranking/fm.py) | Factorization machines | 已支持 |
216
+ | [LR](nextrec/models/ranking/lr.py) | Applied Logistic Regression | 已支持 |
217
+ | [AFM](nextrec/models/ranking/afm.py) | Attentional Factorization Machines: Learning the Weight of Feature Interactions via Attention Networks | 已支持 |
218
+ | [FFM](nextrec/models/ranking/ffm.py) | Field-aware Factorization Machines for CTR Prediction | 已支持 |
219
+ | [DeepFM](nextrec/models/ranking/deepfm.py) | DeepFM: A factorization-machine based neural network for CTR prediction | 已支持 |
220
+ | [Wide&Deep](nextrec/models/ranking/widedeep.py) | Wide & Deep learning for recommender systems | 已支持 |
221
+ | [xDeepFM](nextrec/models/ranking/xdeepfm.py) | xdeepfm: Combining explicit and implicit feature interactions for recommender systems | 已支持 |
222
+ | [FiBiNET](nextrec/models/ranking/fibinet.py) | FiBiNET: Combining feature importance and bilinear feature interaction for click-through rate prediction | 已支持 |
223
+ | [PNN](nextrec/models/ranking/pnn.py) | Product-based neural networks for user response prediction | 已支持 |
224
+ | [AutoInt](nextrec/models/ranking/autoint.py) | AutoInt: Automatic feature interaction learning via self-attentive neural networks | 已支持 |
225
+ | [DCN](nextrec/models/ranking/dcn.py) | Deep & cross network for ad click predictions | 已支持 |
226
+ | [DCN v2](nextrec/models/ranking/dcn_v2.py) | DCN V2: Improved Deep & Cross Network and Practical Lessons for Web-scale Learning to Rank Systems | 已支持 |
227
+ | [DIN](nextrec/models/ranking/din.py) | Deep interest network for click-through rate prediction | 已支持 |
228
+ | [DIEN](nextrec/models/ranking/dien.py) | Deep interest evolution network for click-through rate prediction | 已支持 |
229
+ | [MaskNet](nextrec/models/ranking/masknet.py) | MaskNet: Introducing Feature-Wise Multiplication to CTR Ranking Models by Instance-Guided Mask | 已支持 |
230
+ | [EulerNet](nextrec/models/ranking/eulernet.py) | EulerNet: Efficient and Effective Feature Interaction Modeling with Euler's Formula | 已支持 |
222
231
 
223
232
  ### 召回模型
224
233
 
225
- | 模型 | 论文 | 年份 | 状态 |
226
- |------|------|------|------|
227
- | [DSSM](nextrec/models/retrieval/dssm.py) | Learning Deep Structured Semantic Models | CIKM 2013 | 已支持 |
228
- | [DSSM v2](nextrec/models/retrieval/dssm_v2.py) | DSSM with pairwise BPR-style optimization | - | 已支持 |
229
- | [YouTube DNN](nextrec/models/retrieval/youtube_dnn.py) | Deep Neural Networks for YouTube Recommendations | RecSys 2016 | 已支持 |
230
- | [MIND](nextrec/models/retrieval/mind.py) | Multi-Interest Network with Dynamic Routing | CIKM 2019 | 已支持 |
231
- | [SDM](nextrec/models/retrieval/sdm.py) | Sequential Deep Matching Model | - | 已支持 |
234
+ | 模型 | 论文 | 状态 |
235
+ | ------ | ------ | ------ |
236
+ | [DSSM](nextrec/models/retrieval/dssm.py) | Learning deep structured semantic models for web search using clickthrough data | 已支持 |
237
+ | [DSSM v2](nextrec/models/retrieval/dssm_v2.py) | DSSM v2 - DSSM with pairwise training using BPR loss | 已支持 |
238
+ | [YouTube DNN](nextrec/models/retrieval/youtube_dnn.py) | Deep neural networks for youtube recommendations | 已支持 |
239
+ | [MIND](nextrec/models/retrieval/mind.py) | Multi-interest network with dynamic routing for recommendation at Tmall | 已支持 |
240
+ | [SDM](nextrec/models/retrieval/sdm.py) | Sequential recommender system based on hierarchical attention networks | 已支持 |
232
241
 
233
242
  ### 序列推荐模型
234
243
 
235
- | 模型 | 论文 | 年份 | 状态 |
236
- |------|------|------|------|
237
- | [SASRec](nextrec/models/sequential/sasrec.py) | Self-Attentive Sequential Recommendation | KDD 2018 | 开发中 |
238
- | [HSTU](nextrec/models/sequential/hstu.py) | Actions speak louder than words: Trillion-parameter sequential transducers for generative recommendations | arXiv 2024 | 已支持 |
244
+ | 模型 | 论文 | 状态 |
245
+ | ------ | ------ | ------ |
246
+ | [SASRec](nextrec/models/sequential/sasrec.py) | Self-Attentive Sequential Recommendation | 开发中 |
247
+ | [HSTU](nextrec/models/sequential/hstu.py) | Actions speak louder than words: Trillion-parameter sequential transducers for generative recommendations | 已支持 |
239
248
 
240
249
  ### 多任务模型
241
250
 
242
- | 模型 | 论文 | 年份 | 状态 |
243
- |------|------|------|------|
244
- | [MMOE](nextrec/models/multi_task/mmoe.py) | Modeling Task Relationships in Multi-task Learning | KDD 2018 | 已支持 |
245
- | [PLE](nextrec/models/multi_task/ple.py) | Progressive Layered Extraction | RecSys 2020 | 已支持 |
246
- | [ESMM](nextrec/models/multi_task/esmm.py) | Entire Space Multi-Task Model | SIGIR 2018 | 已支持 |
247
- | [ShareBottom](nextrec/models/multi_task/share_bottom.py) | Multitask Learning | - | 已支持 |
248
- | [POSO](nextrec/models/multi_task/poso.py) | POSO: Personalized Cold-start Modules for Large-scale Recommender Systems | 2021 | 已支持 |
251
+ | 模型 | 论文 | 状态 |
252
+ | ------ | ------ | ------ |
253
+ | [MMOE](nextrec/models/multi_task/mmoe.py) | Modeling Task Relationships in Multi-task Learning with Multi-gate Mixture-of-Experts | 已支持 |
254
+ | [PLE](nextrec/models/multi_task/ple.py) | Progressive Layered Extraction (PLE): A Novel Multi-Task Learning (MTL) Model for Personalized Recommendations | 已支持 |
255
+ | [ESMM](nextrec/models/multi_task/esmm.py) | Entire Space Multi-Task Model: An Effective Approach for Estimating Post-Click Conversion Rate | 已支持 |
256
+ | [ShareBottom](nextrec/models/multi_task/share_bottom.py) | Multitask Learning | 已支持 |
257
+ | [POSO](nextrec/models/multi_task/poso.py) | POSO: Personalized Cold Start Modules for Large-scale Recommender Systems | 已支持 |
258
+ | [PEPNet](nextrec/models/multi_task/pepnet.py) | PEPNet: Parameter and Embedding Personalized Network for Infusing with Personalized Prior Information | 已支持 |
259
+ | [APG](nextrec/models/multi_task/apg.py) | APG: Adaptive Parameter Generation Network for Click-Through Rate Prediction | 已支持 |
260
+ | [CrossStitch](nextrec/models/multi_task/cross_stitch.py) | Cross-Stitch Networks for Multi-Task Learning | 已支持 |
261
+ | [ESCM](nextrec/models/multi_task/escm.py) | ESCM²: Entire Space Counterfactual Multi-Task Model for Post-Click Conversion Rate Estimation | 已支持 |
262
+ | [HMOE](nextrec/models/multi_task/hmoe.py) | Improving multi-scenario learning to rank in e-commerce by exploiting task relationships in the label space | 已支持 |
249
263
 
250
264
  ### 生成式模型
251
265
 
252
- | 模型 | 论文 | 年份 | 状态 |
253
- |------|------|------|------|
254
- | [TIGER](nextrec/models/generative/tiger.py) | Recommender Systems with Generative Retrieval | NeurIPS 2023 | 开发中 |
266
+ | 模型 | 论文 | 状态 |
267
+ | ------ | ------ | ------ |
268
+ | [TIGER](nextrec/models/generative/tiger.py) | Recommender Systems with Generative Retrieval | 开发中 |
255
269
 
256
270
  ### 表征模型
257
271
 
258
- | 模型 | 论文 | 年份 | 状态 |
259
- |------|------|------|------|
260
- | [RQ-VAE](nextrec/models/representation/rqvae.py) | RQ-VAE: RQVAE for Generative Retrieval | - | 已支持 |
261
- | [BPR](nextrec/models/representation/bpr.py) | Bayesian Personalized Ranking | UAI 2009 | 开发中 |
262
- | [MF](nextrec/models/representation/mf.py) | Matrix Factorization Techniques for Recommender Systems | - | 开发中 |
263
- | [AutoRec](nextrec/models/representation/autorec.py) | AutoRec: Autoencoders Meet Collaborative Filtering | WWW 2015 | 开发中 |
264
- | [LightGCN](nextrec/models/representation/lightgcn.py) | LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation | SIGIR 2020 | 开发中 |
265
- | [S3Rec](nextrec/models/representation/s3rec.py) | S3-Rec: Self-Supervised Learning for Sequential Recommendation | CIKM 2020 | 开发中 |
266
- | [CL4SRec](nextrec/models/representation/cl4srec.py) | CL4SRec: Contrastive Learning for Sequential Recommendation | 2021 | 开发中 |
272
+ | 模型 | 论文 | 状态 |
273
+ | ------ | ------ | ------ |
274
+ | [RQ-VAE](nextrec/models/representation/rqvae.py) | Autoregressive Image Generation using Residual Quantization | 已支持 |
275
+ | [BPR](nextrec/models/representation/bpr.py) | Bayesian Personalized Ranking | 开发中 |
276
+ | [MF](nextrec/models/representation/mf.py) | Matrix Factorization Techniques for Recommender Systems | 开发中 |
277
+ | [AutoRec](nextrec/models/representation/autorec.py) | AutoRec: Autoencoders Meet Collaborative Filtering | 开发中 |
278
+ | [LightGCN](nextrec/models/representation/lightgcn.py) | LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation | 开发中 |
279
+ | [S3Rec](nextrec/models/representation/s3rec.py) | S3-Rec: Self-Supervised Learning for Sequential Recommendation | 开发中 |
280
+ | [CL4SRec](nextrec/models/representation/cl4srec.py) | CL4SRec: Contrastive Learning for Sequential Recommendation | 开发中 |
267
281
 
268
282
  ---
269
283
 
@@ -325,7 +339,7 @@ NextRec 的开发受到以下优秀项目的启发:
325
339
  @misc{nextrec,
326
340
  title = {NextRec},
327
341
  author = {Yang Zhou},
328
- year = {2025},
342
+ year = {2026},
329
343
  publisher = {GitHub},
330
344
  journal = {GitHub repository},
331
345
  howpublished = {\url{https://github.com/zerolovesea/NextRec}},