nextrec 0.4.5__tar.gz → 0.4.7__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.
- {nextrec-0.4.5 → nextrec-0.4.7}/.github/workflows/tests.yml +0 -15
- nextrec-0.4.7/PKG-INFO +376 -0
- nextrec-0.4.5/README_zh.md → nextrec-0.4.7/README.md +41 -22
- nextrec-0.4.5/README.md → nextrec-0.4.7/README_en.md +41 -17
- nextrec-0.4.7/assets/nextrec_diagram.png +0 -0
- nextrec-0.4.7/dataset/ecommerce_task.csv +10001 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/docs/rtd/conf.py +1 -1
- nextrec-0.4.7/nextrec/__version__.py +1 -0
- nextrec-0.4.7/nextrec/basic/callback.py +413 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/basic/features.py +4 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/basic/layers.py +103 -24
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/basic/metrics.py +71 -1
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/basic/model.py +285 -186
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/data/data_processing.py +1 -3
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/loss/loss_utils.py +73 -4
- nextrec-0.4.7/nextrec/models/generative/__init__.py +16 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/generative/hstu.py +110 -57
- nextrec-0.4.7/nextrec/models/generative/rqvae.py +826 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/match/dssm.py +5 -4
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/match/dssm_v2.py +4 -3
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/match/mind.py +5 -4
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/match/sdm.py +5 -4
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/match/youtube_dnn.py +5 -4
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/ranking/masknet.py +1 -1
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/utils/config.py +38 -1
- nextrec-0.4.7/nextrec/utils/embedding.py +46 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/utils/initializer.py +4 -4
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/utils/synthetic_data.py +19 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/NextRec-CLI.md +4 -4
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/NextRec-CLI_zh.md +2 -2
- {nextrec-0.4.5 → nextrec-0.4.7}/pyproject.toml +3 -1
- {nextrec-0.4.5 → nextrec-0.4.7}/requirements.txt +2 -0
- nextrec-0.4.7/test/test_base_model_regularization.py +42 -0
- nextrec-0.4.7/test/test_generative_models.py +890 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/test/test_layers.py +80 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/tutorials/example_ranking_din.py +0 -1
- nextrec-0.4.7/tutorials/notebooks/en/Build semantic ID with RQ-VAE.ipynb +827 -0
- nextrec-0.4.7/tutorials/notebooks/zh//344/275/277/347/224/250RQ-VAE/346/236/204/345/273/272/350/257/255/344/271/211ID.ipynb +827 -0
- nextrec-0.4.5/PKG-INFO +0 -357
- nextrec-0.4.5/assets/nextrec_diagram_en.png +0 -0
- nextrec-0.4.5/assets/nextrec_diagram_zh.png +0 -0
- nextrec-0.4.5/nextrec/__version__.py +0 -1
- nextrec-0.4.5/nextrec/basic/callback.py +0 -35
- nextrec-0.4.5/nextrec/models/ranking/__init__.py +0 -0
- nextrec-0.4.5/nextrec/utils/embedding.py +0 -18
- {nextrec-0.4.5 → nextrec-0.4.7}/.github/workflows/publish.yml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/.gitignore +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/.readthedocs.yaml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/CODE_OF_CONDUCT.md +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/CONTRIBUTING.md +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/LICENSE +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/MANIFEST.in +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/assets/Feature Configuration.png +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/assets/Model Parameters.png +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/assets/Training Configuration.png +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/assets/Training logs.png +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/assets/logo.png +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/assets/mmoe_tutorial.png +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/assets/test data.png +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/dataset/ctcvr_task.csv +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/dataset/match_task.csv +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/dataset/movielens_100k.csv +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/dataset/multitask_task.csv +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/dataset/ranking_task.csv +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/docs/en/Getting started guide.md +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/docs/rtd/Makefile +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/docs/rtd/index.md +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/docs/rtd/make.bat +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/docs/rtd/modules.rst +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/docs/rtd/nextrec.basic.rst +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/docs/rtd/nextrec.data.rst +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/docs/rtd/nextrec.loss.rst +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/docs/rtd/nextrec.rst +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/docs/rtd/nextrec.utils.rst +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/docs/rtd/requirements.txt +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/docs/zh//345/277/253/351/200/237/344/270/212/346/211/213.md" +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/__init__.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/basic/__init__.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/basic/activation.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/basic/loggers.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/basic/session.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/cli.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/data/__init__.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/data/batch_utils.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/data/data_utils.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/data/dataloader.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/data/preprocessor.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/loss/__init__.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/loss/listwise.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/loss/pairwise.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/loss/pointwise.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/generative/tiger.py +0 -0
- {nextrec-0.4.5/nextrec/models/generative → nextrec-0.4.7/nextrec/models/match}/__init__.py +0 -0
- {nextrec-0.4.5/nextrec/models/match → nextrec-0.4.7/nextrec/models/multi_task}/__init__.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/multi_task/esmm.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/multi_task/mmoe.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/multi_task/ple.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/multi_task/poso.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/multi_task/share_bottom.py +0 -0
- {nextrec-0.4.5/nextrec/models/multi_task → nextrec-0.4.7/nextrec/models/ranking}/__init__.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/ranking/afm.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/ranking/autoint.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/ranking/dcn.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/ranking/dcn_v2.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/ranking/deepfm.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/ranking/dien.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/ranking/din.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/ranking/fibinet.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/ranking/fm.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/ranking/pnn.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/ranking/widedeep.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/models/ranking/xdeepfm.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/utils/__init__.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/utils/device.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/utils/distributed.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/utils/feature.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/utils/file.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/utils/model.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/utils/optimizer.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec/utils/tensor.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/feature_config.yaml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/model_configs/afm.yaml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/model_configs/autoint.yaml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/model_configs/dcn.yaml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/model_configs/deepfm.yaml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/model_configs/din.yaml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/model_configs/esmm.yaml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/model_configs/fibinet.yaml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/model_configs/fm.yaml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/model_configs/masknet.yaml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/model_configs/mmoe.yaml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/model_configs/ple.yaml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/model_configs/pnn.yaml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/model_configs/poso.yaml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/model_configs/share_bottom.yaml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/model_configs/widedeep.yaml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/model_configs/xdeepfm.yaml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/predict_config.yaml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/nextrec_cli_preset/train_config.yaml +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/pytest.ini +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/scripts/format_code.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/test/__init__.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/test/conftest.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/test/run_tests.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/test/test_losses.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/test/test_match_models.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/test/test_multitask_models.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/test/test_preprocessor.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/test/test_ranking_models.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/test/test_utils.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/test_requirements.txt +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/tutorials/distributed/example_distributed_training.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/tutorials/distributed/example_distributed_training_large_dataset.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/tutorials/example_match_dssm.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/tutorials/example_multitask.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/tutorials/movielen_match_dssm.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/tutorials/movielen_ranking_deepfm.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/tutorials/notebooks/en/Hands on dataprocessor.ipynb +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/tutorials/notebooks/en/Hands on nextrec.ipynb +0 -0
- /nextrec-0.4.5/tutorials/notebooks/zh/Hands on dataprocessor.ipynb → /nextrec-0.4.7/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" +0 -0
- /nextrec-0.4.5/tutorials/notebooks/zh/Hands on nextrec.ipynb → /nextrec-0.4.7/tutorials/notebooks/zh//345/277/253/351/200/237/345/205/245/351/227/250nextrec.ipynb" +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/tutorials/run_all_match_models.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/tutorials/run_all_multitask_models.py +0 -0
- {nextrec-0.4.5 → nextrec-0.4.7}/tutorials/run_all_ranking_models.py +0 -0
|
@@ -46,21 +46,6 @@ jobs:
|
|
|
46
46
|
python -c "import torch; print(f'PyTorch version: {torch.__version__}')"
|
|
47
47
|
python -c "import nextrec; print('NextRec imported successfully')"
|
|
48
48
|
|
|
49
|
-
- name: Format codebase
|
|
50
|
-
run: |
|
|
51
|
-
python scripts/format_code.py
|
|
52
|
-
|
|
53
|
-
- name: Run tutorial multi-task models
|
|
54
|
-
run: |
|
|
55
|
-
python tutorials/run_all_multitask_models.py
|
|
56
|
-
|
|
57
|
-
- name: Run tutorial ranking models
|
|
58
|
-
run: |
|
|
59
|
-
python tutorials/run_all_ranking_models.py
|
|
60
|
-
|
|
61
|
-
- name: Run tutorial match models
|
|
62
|
-
run: |
|
|
63
|
-
python tutorials/run_all_match_models.py
|
|
64
49
|
|
|
65
50
|
- name: Run match model tests
|
|
66
51
|
run: |
|
nextrec-0.4.7/PKG-INFO
ADDED
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nextrec
|
|
3
|
+
Version: 0.4.7
|
|
4
|
+
Summary: A comprehensive recommendation library with match, ranking, and multi-task learning models
|
|
5
|
+
Project-URL: Homepage, https://github.com/zerolovesea/NextRec
|
|
6
|
+
Project-URL: Repository, https://github.com/zerolovesea/NextRec
|
|
7
|
+
Project-URL: Documentation, https://github.com/zerolovesea/NextRec/blob/main/README.md
|
|
8
|
+
Project-URL: Issues, https://github.com/zerolovesea/NextRec/issues
|
|
9
|
+
Author-email: zerolovesea <zyaztec@gmail.com>
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ctr,deep-learning,match,pytorch,ranking,recommendation
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Requires-Dist: numpy<2.0,>=1.21; sys_platform == 'linux' and python_version < '3.12'
|
|
23
|
+
Requires-Dist: numpy<3.0,>=1.26; sys_platform == 'linux' and python_version >= '3.12'
|
|
24
|
+
Requires-Dist: numpy>=1.23.0; sys_platform == 'win32'
|
|
25
|
+
Requires-Dist: numpy>=1.24.0; sys_platform == 'darwin'
|
|
26
|
+
Requires-Dist: pandas<2.0,>=1.5; sys_platform == 'linux' and python_version < '3.12'
|
|
27
|
+
Requires-Dist: pandas<2.3.0,>=2.1.0; sys_platform == 'win32'
|
|
28
|
+
Requires-Dist: pandas>=2.0.0; sys_platform == 'darwin'
|
|
29
|
+
Requires-Dist: pandas>=2.1.0; sys_platform == 'linux' and python_version >= '3.12'
|
|
30
|
+
Requires-Dist: pyarrow<13.0.0,>=10.0.0; sys_platform == 'linux' and python_version < '3.12'
|
|
31
|
+
Requires-Dist: pyarrow<15.0.0,>=12.0.0; sys_platform == 'win32'
|
|
32
|
+
Requires-Dist: pyarrow>=12.0.0; sys_platform == 'darwin'
|
|
33
|
+
Requires-Dist: pyarrow>=16.0.0; sys_platform == 'linux' and python_version >= '3.12'
|
|
34
|
+
Requires-Dist: pyyaml>=6.0
|
|
35
|
+
Requires-Dist: scikit-learn<2.0,>=1.2; sys_platform == 'linux' and python_version < '3.12'
|
|
36
|
+
Requires-Dist: scikit-learn>=1.3.0; sys_platform == 'darwin'
|
|
37
|
+
Requires-Dist: scikit-learn>=1.3.0; sys_platform == 'linux' and python_version >= '3.12'
|
|
38
|
+
Requires-Dist: scikit-learn>=1.3.0; sys_platform == 'win32'
|
|
39
|
+
Requires-Dist: scipy<1.12,>=1.8; sys_platform == 'linux' and python_version < '3.12'
|
|
40
|
+
Requires-Dist: scipy>=1.10.0; sys_platform == 'darwin'
|
|
41
|
+
Requires-Dist: scipy>=1.10.0; sys_platform == 'win32'
|
|
42
|
+
Requires-Dist: scipy>=1.11.0; sys_platform == 'linux' and python_version >= '3.12'
|
|
43
|
+
Requires-Dist: torch>=2.0.0
|
|
44
|
+
Requires-Dist: torchvision>=0.15.0
|
|
45
|
+
Requires-Dist: tqdm>=4.65.0
|
|
46
|
+
Requires-Dist: transformers>=4.38.0
|
|
47
|
+
Provides-Extra: dev
|
|
48
|
+
Requires-Dist: jupyter>=1.0.0; extra == 'dev'
|
|
49
|
+
Requires-Dist: matplotlib>=3.7.0; extra == 'dev'
|
|
50
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
|
|
51
|
+
Requires-Dist: pytest-html>=3.2.0; extra == 'dev'
|
|
52
|
+
Requires-Dist: pytest-mock>=3.11.0; extra == 'dev'
|
|
53
|
+
Requires-Dist: pytest-timeout>=2.1.0; extra == 'dev'
|
|
54
|
+
Requires-Dist: pytest-xdist>=3.3.0; extra == 'dev'
|
|
55
|
+
Requires-Dist: pytest>=7.4.0; extra == 'dev'
|
|
56
|
+
Requires-Dist: seaborn>=0.12.0; extra == 'dev'
|
|
57
|
+
Description-Content-Type: text/markdown
|
|
58
|
+
|
|
59
|
+
<p align="center">
|
|
60
|
+
<img align="center" src="assets/logo.png" width="40%">
|
|
61
|
+
<p>
|
|
62
|
+
|
|
63
|
+
<div align="center">
|
|
64
|
+
|
|
65
|
+

|
|
66
|
+

|
|
67
|
+

|
|
68
|
+

|
|
69
|
+
|
|
70
|
+
中文文档 | [English Version](README_en.md)
|
|
71
|
+
|
|
72
|
+
**统一、高效、可扩展的推荐系统框架**
|
|
73
|
+
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
## 目录
|
|
77
|
+
|
|
78
|
+
- [简介](#简介)
|
|
79
|
+
- [NextRec进展](#NextRec进展)
|
|
80
|
+
- [安装](#安装)
|
|
81
|
+
- [架构](#架构)
|
|
82
|
+
- [5分钟快速上手](#5分钟快速上手)
|
|
83
|
+
- [命令行工具 NextRec-CLI](#命令行工具)
|
|
84
|
+
- [兼容平台](#兼容平台)
|
|
85
|
+
- [支持模型](#支持模型)
|
|
86
|
+
- [贡献指南](#贡献指南)
|
|
87
|
+
|
|
88
|
+
## 简介
|
|
89
|
+
|
|
90
|
+
NextRec是一个基于PyTorch的现代推荐系统框架,旨在为研究工程团队提供快速的建模、训练与评估流。框架内置丰富的模型库、数据处理工具和工程化训练组件。此外提供了易上手的接口,命令行工具及教程,推荐算法学习者能以最快速度了解模型架构,复现学术论文并进行训练和部署。
|
|
91
|
+
|
|
92
|
+
## Why NextRec
|
|
93
|
+
- **多场景推荐能力**:覆盖排序(CTR/CVR)、召回、多任务学习、生成式召回等推荐/营销模型,持续跟进业界进展。
|
|
94
|
+
- **统一的特征工程与数据流水线**:NextRec框架提供了统一的特征定义、可持久化的数据处理、批处理优化,符合工业大数据Spark/Hive场景下,基于离线特征的模型训练推理流程。
|
|
95
|
+
- **友好的工程体验**:支持多种格式数据(`csv/parquet/pathlike`)的流式处理/分布式训练/推理与可视化指标监控,方便业务算法工程师和推荐算法学习者快速复现实验。
|
|
96
|
+
- **灵活的命令行工具**:支持通过命令行和配置文件,一键启动训练和推理进程,方便快速实验迭代和敏捷部署。
|
|
97
|
+
- **高效训练与评估**:内置多种优化器、学习率调度、早停、模型检查点与详细的日志管理,开箱即用。
|
|
98
|
+
|
|
99
|
+
## NextRec近期进展
|
|
100
|
+
|
|
101
|
+
- **12/12/2025** 在v0.4.7中加入了[RQ-VAE](/nextrec/models/generative/rqvae.py)模块。配套的[数据集](/dataset/ecommerce_task.csv)和[代码](tutorials/notebooks/zh/使用RQ-VAE构建语义ID.ipynby)已经同步在仓库中
|
|
102
|
+
- **07/12/2025** 发布了NextRec CLI命令行工具,它允许用户根据配置文件进行一键训练和推理,我们提供了相关的[教程](/nextrec_cli_preset/NextRec-CLI_zh.md)和[教学代码](/nextrec_cli_preset)
|
|
103
|
+
- **03/12/2025** NextRec获得了100颗🌟!感谢大家的支持
|
|
104
|
+
- **06/12/2025** 在v0.4.1中支持了单机多卡的分布式DDP训练,并且提供了配套的[代码](tutorials/distributed)
|
|
105
|
+
- **23/11/2025** 在v0.2.2中对basemodel进行了逻辑上的大幅重构和流程统一,并且对listwise/pairwise/pointwise损失进行了统一
|
|
106
|
+
- **11/11/2025** NextRec v0.1.0发布,我们提供了10余种Ranking模型,4种多任务模型和4种召回模型,以及统一的训练/日志/指标管理系统
|
|
107
|
+
|
|
108
|
+
## 架构
|
|
109
|
+
|
|
110
|
+
NextRec采用模块化工程设计,核心组件包括:统一特征驱动的BaseModel架构;独立Layer模块;支持训练推理的统一的DataLoader;命令行工具NextCLI等。
|
|
111
|
+
|
|
112
|
+

|
|
113
|
+
|
|
114
|
+
## 安装
|
|
115
|
+
|
|
116
|
+
开发者可以通过`pip install nextrec`快速安装NextRec的最新版本,环境要求为Python 3.10+(对于需要使用CUDA加速的开发者,建议安装对应版本的pytorch)。如果需要执行示例代码,则需要先拉取仓库:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
git clone https://github.com/zerolovesea/NextRec.git
|
|
120
|
+
cd NextRec/
|
|
121
|
+
pip install nextrec # or pip install -e .
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## 示例代码
|
|
125
|
+
|
|
126
|
+
我们在`tutorials/` 目录提供了多个示例,覆盖排序、召回、多任务、数据处理等场景:
|
|
127
|
+
|
|
128
|
+
- [movielen_ranking_deepfm.py](/tutorials/movielen_ranking_deepfm.py) - movielen 100k数据集上的 DeepFM 模型训练示例
|
|
129
|
+
- [example_ranking_din.py](/tutorials/example_ranking_din.py) - 电商数据集上的DIN 深度兴趣网络训练示例
|
|
130
|
+
- [example_multitask.py](/tutorials/example_multitask.py) - 电商数据集上的ESMM多任务学习训练示例
|
|
131
|
+
- [movielen_match_dssm.py](/tutorials/example_match_dssm.py) - 基于movielen 100k数据集训练的 DSSM 召回模型示例
|
|
132
|
+
|
|
133
|
+
- [example_distributed_training.py](/tutorials/distributed/example_distributed_training.py) - 使用NextRec进行单机多卡训练的代码示例
|
|
134
|
+
|
|
135
|
+
- [run_all_ranking_models.py](/tutorials/run_all_ranking_models.py) - 快速校验所有排序模型的可用性
|
|
136
|
+
- [run_all_multitask_models.py](/tutorials/run_all_multitask_models.py) - 快速校验所有多任务模型的可用性
|
|
137
|
+
- [run_all_match_models.py](/tutorials/run_all_match_models.py) - 快速校验所有召回模型的可用性
|
|
138
|
+
|
|
139
|
+
如果想了解更多NextRec框架的细节,我们还提供了Jupyter notebook来帮助你了解:
|
|
140
|
+
|
|
141
|
+
- [如何上手NextRec框架](/tutorials/notebooks/zh/Hands%20on%20nextrec.ipynb)
|
|
142
|
+
- [如何使用数据处理器进行数据预处理](/tutorials/notebooks/zh/Hands%20on%20dataprocessor.ipynb)
|
|
143
|
+
- [使用RQ-VAE构建语义ID](/tutorials/notebooks/zh/使用RQ-VAE构建语义ID.ipynb)
|
|
144
|
+
|
|
145
|
+
## 5分钟快速上手
|
|
146
|
+
|
|
147
|
+
我们提供了详细的上手指南和配套数据集,帮助您熟悉NextRec框架的不同功能。我们在`datasets/`路径下提供了一个来自电商场景的测试数据集,数据示例如下:
|
|
148
|
+
|
|
149
|
+
| user_id | item_id | dense_0 | dense_1 | dense_2 | dense_3 | dense_4 | dense_5 | dense_6 | dense_7 | sparse_0 | sparse_1 | sparse_2 | sparse_3 | sparse_4 | sparse_5 | sparse_6 | sparse_7 | sparse_8 | sparse_9 | sequence_0 | sequence_1 | label |
|
|
150
|
+
|--------|---------|-------------|-------------|-------------|------------|-------------|-------------|-------------|-------------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------|-----------------------------------------------------------|-----------------------------------------------------------|-------|
|
|
151
|
+
| 1 | 7817 | 0.14704075 | 0.31020382 | 0.77780896 | 0.944897 | 0.62315375 | 0.57124174 | 0.77009535 | 0.3211029 | 315 | 260 | 379 | 146 | 168 | 161 | 138 | 88 | 5 | 312 | [170,175,97,338,105,353,272,546,175,545,463,128,0,0,0] | [368,414,820,405,548,63,327,0,0,0,0,0,0,0,0] | 0 |
|
|
152
|
+
| 1 | 3579 | 0.77811223 | 0.80359334 | 0.5185201 | 0.91091245 | 0.043562356 | 0.82142705 | 0.8803686 | 0.33748195 | 149 | 229 | 442 | 6 | 167 | 252 | 25 | 402 | 7 | 168 | [179,48,61,551,284,165,344,151,0,0,0,0,0,0,0] | [814,0,0,0,0,0,0,0,0,0,0,0,0,0,0] | 1 |
|
|
153
|
+
|
|
154
|
+
接下来我们将用一个简短的示例,展示如何使用NextRec训练一个DIN(Deep Interest Network)模型。您也可以直接执行`python tutorials/example_ranking_din.py`来执行训练推理代码。
|
|
155
|
+
|
|
156
|
+
开始训练以后,你可以在`nextrec_logs/din_tutorial`路径下查看详细的训练日志。
|
|
157
|
+
|
|
158
|
+
```python
|
|
159
|
+
import pandas as pd
|
|
160
|
+
from nextrec.models.ranking.din import DIN
|
|
161
|
+
from nextrec.basic.features import DenseFeature, SparseFeature, SequenceFeature
|
|
162
|
+
|
|
163
|
+
df = pd.read_csv('dataset/ranking_task.csv')
|
|
164
|
+
|
|
165
|
+
for col in df.columns and 'sequence' in col: # csv默认将列表读取成文本,我们需要将其转化为对象
|
|
166
|
+
df[col] = df[col].apply(lambda x: eval(x) if isinstance(x, str) else x)
|
|
167
|
+
|
|
168
|
+
# 我们需要将不同特征进行定义
|
|
169
|
+
dense_features = [DenseFeature(name=f'dense_{i}', input_dim=1) for i in range(8)]
|
|
170
|
+
|
|
171
|
+
sparse_features = [SparseFeature(name='user_id', embedding_name='user_emb', vocab_size=int(df['user_id'].max() + 1), embedding_dim=32), SparseFeature(name='item_id', embedding_name='item_emb', vocab_size=int(df['item_id'].max() + 1), embedding_dim=32),]
|
|
172
|
+
|
|
173
|
+
sparse_features.extend([SparseFeature(name=f'sparse_{i}', embedding_name=f'sparse_{i}_emb', vocab_size=int(df[f'sparse_{i}'].max() + 1), embedding_dim=32) for i in range(10)])
|
|
174
|
+
|
|
175
|
+
sequence_features = [
|
|
176
|
+
SequenceFeature(name='sequence_0', vocab_size=int(df['sequence_0'].apply(lambda x: max(x)).max() + 1), embedding_dim=32, padding_idx=0, embedding_name='item_emb'),
|
|
177
|
+
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'),]
|
|
178
|
+
|
|
179
|
+
mlp_params = {
|
|
180
|
+
"dims": [256, 128, 64],
|
|
181
|
+
"activation": "relu",
|
|
182
|
+
"dropout": 0.3,
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
model = DIN(
|
|
186
|
+
dense_features=dense_features,
|
|
187
|
+
sparse_features=sparse_features,
|
|
188
|
+
sequence_features=sequence_features,
|
|
189
|
+
mlp_params=mlp_params,
|
|
190
|
+
attention_hidden_units=[80, 40],
|
|
191
|
+
attention_activation='sigmoid',
|
|
192
|
+
attention_use_softmax=True,
|
|
193
|
+
target=['label'], # 目标变量
|
|
194
|
+
device='mps',
|
|
195
|
+
embedding_l1_reg=1e-6,
|
|
196
|
+
embedding_l2_reg=1e-5,
|
|
197
|
+
dense_l1_reg=1e-5,
|
|
198
|
+
dense_l2_reg=1e-4,
|
|
199
|
+
session_id="din_tutorial", # 实验id,用于存放训练日志
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
# 编译模型,设置优化器和损失函数
|
|
203
|
+
model.compile(
|
|
204
|
+
optimizer = "adam",
|
|
205
|
+
optimizer_params = {"lr": 1e-3, "weight_decay": 1e-5},
|
|
206
|
+
loss = "focal",
|
|
207
|
+
loss_params={"gamma": 2.0, "alpha": 0.25},
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
model.fit(
|
|
211
|
+
train_data=df,
|
|
212
|
+
metrics=['auc', 'gauc', 'logloss'], # 添加需要查看的指标
|
|
213
|
+
epochs=3,
|
|
214
|
+
batch_size=512,
|
|
215
|
+
shuffle=True,
|
|
216
|
+
user_id_column='user_id' # 用于计算GAUC的id列
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
# 训练完成后进行指标评估
|
|
220
|
+
metrics = model.evaluate(
|
|
221
|
+
df,
|
|
222
|
+
metrics=['auc', 'gauc', 'logloss'],
|
|
223
|
+
batch_size=512,
|
|
224
|
+
user_id_column='user_id'
|
|
225
|
+
)
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## 命令行工具
|
|
229
|
+
|
|
230
|
+
NextRec 提供了强大的命令行界面,支持通过 YAML 配置文件进行模型训练和预测。详细的 CLI 文档请参见:
|
|
231
|
+
|
|
232
|
+
- [NextRec CLI 使用指南](/nextrec_cli_preset/NextRec-CLI_zh.md) - 完整的 CLI 使用文档
|
|
233
|
+
- [NextRec CLI 配置文件示例](/nextrec_cli_preset/) - CLI 使用配置文件示例
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
# 训练模型
|
|
237
|
+
nextrec --mode=train --train_config=path/to/train_config.yaml
|
|
238
|
+
|
|
239
|
+
# 运行预测
|
|
240
|
+
nextrec --mode=predict --predict_config=path/to/predict_config.yaml
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
> 截止当前版本0.4.7,NextRec CLI支持单机训练,分布式训练相关功能尚在开发中。
|
|
244
|
+
|
|
245
|
+
## 兼容平台
|
|
246
|
+
|
|
247
|
+
当前最新版本为0.4.7,所有模型和测试代码均已在以下平台通过验证,如果开发者在使用中遇到兼容问题,请在issue区提出错误报告及系统版本:
|
|
248
|
+
|
|
249
|
+
| 平台 | 配置 |
|
|
250
|
+
|------|------|
|
|
251
|
+
| MacOS latest| MacBook Pro M4 Pro 24G内存 |
|
|
252
|
+
| Ubuntu latest| AutoDL 4070D 双卡 |
|
|
253
|
+
| Ubuntu 24.04| NVIDIA TITAN V 5卡 |
|
|
254
|
+
| CentOS 7 | Intel Xeon 5138Y 96核 377G内存 |
|
|
255
|
+
|
|
256
|
+
## 支持模型
|
|
257
|
+
|
|
258
|
+
### 排序模型
|
|
259
|
+
|
|
260
|
+
| 模型 | 论文 | 年份 | 状态 |
|
|
261
|
+
|------|------|------|------|
|
|
262
|
+
| [FM](nextrec/models/ranking/fm.py) | Factorization Machines | ICDM 2010 | 已支持 |
|
|
263
|
+
| [AFM](nextrec/models/ranking/afm.py) | Attentional Factorization Machines: Learning the Weight of Feature Interactions via Attention Networks | IJCAI 2017 | 已支持 |
|
|
264
|
+
| [DeepFM](nextrec/models/ranking/deepfm.py) | DeepFM: A Factorization-Machine based Neural Network for CTR Prediction | IJCAI 2017 | 已支持 |
|
|
265
|
+
| [Wide&Deep](nextrec/models/ranking/widedeep.py) | Wide & Deep Learning for Recommender Systems | DLRS 2016 | 已支持 |
|
|
266
|
+
| [xDeepFM](nextrec/models/ranking/xdeepfm.py) | xDeepFM: Combining Explicit and Implicit Feature Interactions | KDD 2018 | 已支持 |
|
|
267
|
+
| [FiBiNET](nextrec/models/ranking/fibinet.py) | FiBiNET: Combining Feature Importance and Bilinear Feature Interaction for CTR Prediction | RecSys 2019 | 已支持 |
|
|
268
|
+
| [PNN](nextrec/models/ranking/pnn.py) | Product-based Neural Networks for User Response Prediction | ICDM 2016 | 已支持 |
|
|
269
|
+
| [AutoInt](nextrec/models/ranking/autoint.py) | AutoInt: Automatic Feature Interaction Learning | CIKM 2019 | 已支持 |
|
|
270
|
+
| [DCN](nextrec/models/ranking/dcn.py) | Deep & Cross Network for Ad Click Predictions | ADKDD 2017 | 已支持 |
|
|
271
|
+
| [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 | 已支持 |
|
|
272
|
+
| [DIN](nextrec/models/ranking/din.py) | Deep Interest Network for Click-Through Rate Prediction | KDD 2018 | 已支持 |
|
|
273
|
+
| [DIEN](nextrec/models/ranking/dien.py) | Deep Interest Evolution Network for Click-Through Rate Prediction | AAAI 2019 | 已支持 |
|
|
274
|
+
| [MaskNet](nextrec/models/ranking/masknet.py) | MaskNet: Introducing Feature-wise Gating Blocks for High-dimensional Sparse Recommendation Data | 2020 | 已支持 |
|
|
275
|
+
|
|
276
|
+
### 召回模型
|
|
277
|
+
|
|
278
|
+
| 模型 | 论文 | 年份 | 状态 |
|
|
279
|
+
|------|------|------|------|
|
|
280
|
+
| [DSSM](nextrec/models/match/dssm.py) | Learning Deep Structured Semantic Models | CIKM 2013 | 已支持 |
|
|
281
|
+
| [DSSM v2](nextrec/models/match/dssm_v2.py) | DSSM with pairwise BPR-style optimization | - | 已支持 |
|
|
282
|
+
| [YouTube DNN](nextrec/models/match/youtube_dnn.py) | Deep Neural Networks for YouTube Recommendations | RecSys 2016 | 已支持 |
|
|
283
|
+
| [MIND](nextrec/models/match/mind.py) | Multi-Interest Network with Dynamic Routing | CIKM 2019 | 已支持 |
|
|
284
|
+
| [SDM](nextrec/models/match/sdm.py) | Sequential Deep Matching Model | - | 已支持 |
|
|
285
|
+
|
|
286
|
+
### 多任务模型
|
|
287
|
+
|
|
288
|
+
| 模型 | 论文 | 年份 | 状态 |
|
|
289
|
+
|------|------|------|------|
|
|
290
|
+
| [MMOE](nextrec/models/multi_task/mmoe.py) | Modeling Task Relationships in Multi-task Learning | KDD 2018 | 已支持 |
|
|
291
|
+
| [PLE](nextrec/models/multi_task/ple.py) | Progressive Layered Extraction | RecSys 2020 | 已支持 |
|
|
292
|
+
| [ESMM](nextrec/models/multi_task/esmm.py) | Entire Space Multi-Task Model | SIGIR 2018 | 已支持 |
|
|
293
|
+
| [ShareBottom](nextrec/models/multi_task/share_bottom.py) | Multitask Learning | - | 已支持 |
|
|
294
|
+
| [POSO](nextrec/models/multi_task/poso.py) | POSO: Personalized Cold-start Modules for Large-scale Recommender Systems | 2021 | 已支持 |
|
|
295
|
+
|
|
296
|
+
### 生成式模型
|
|
297
|
+
|
|
298
|
+
| 模型 | 论文 | 年份 | 状态 |
|
|
299
|
+
|------|------|------|------|
|
|
300
|
+
| [TIGER](nextrec/models/generative/tiger.py) | Recommender Systems with Generative Retrieval | NeurIPS 2023 | 开发中 |
|
|
301
|
+
| [HSTU](nextrec/models/generative/hstu.py) | Hierarchical Sequential Transduction Units | - | 已支持 |
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## 贡献指南
|
|
306
|
+
|
|
307
|
+
我们欢迎任何形式的贡献!
|
|
308
|
+
|
|
309
|
+
### 如何贡献
|
|
310
|
+
|
|
311
|
+
1. Fork 本仓库
|
|
312
|
+
2. 创建特性分支 (`git checkout -b feature/AmazingFeature`)
|
|
313
|
+
3. 提交更改 (`git commit -m 'Add some AmazingFeature'`)
|
|
314
|
+
4. 推送到分支 (`git push origin feature/AmazingFeature`)
|
|
315
|
+
5. 创建 Pull Request
|
|
316
|
+
|
|
317
|
+
> 在提交 PR 之前,请运行 `python test/run_tests.py` 和 `python scripts/format_code.py` 确保所有测试通过并统一代码风格。
|
|
318
|
+
|
|
319
|
+
### 代码规范
|
|
320
|
+
|
|
321
|
+
- 遵循 PEP 8 Python 代码风格
|
|
322
|
+
- 为新增功能补充单元测试
|
|
323
|
+
- 同步更新相关文档
|
|
324
|
+
|
|
325
|
+
### 报告错误
|
|
326
|
+
|
|
327
|
+
在 [Issues](https://github.com/zerolovesea/NextRec/issues) 页面提交问题时,请包含:
|
|
328
|
+
|
|
329
|
+
- 错误描述
|
|
330
|
+
- 重现步骤
|
|
331
|
+
- 期望行为
|
|
332
|
+
- 实际行为
|
|
333
|
+
- 环境信息(Python 版本、PyTorch 版本等)
|
|
334
|
+
|
|
335
|
+
## 许可证
|
|
336
|
+
|
|
337
|
+
本项目采用 [Apache 2.0 许可证](./LICENSE)。
|
|
338
|
+
|
|
339
|
+
## 联系方式
|
|
340
|
+
|
|
341
|
+
- **GitHub Issues**: [提交问题](https://github.com/zerolovesea/NextRec/issues)
|
|
342
|
+
- **邮箱**: zyaztec@gmail.com
|
|
343
|
+
|
|
344
|
+
## 致谢
|
|
345
|
+
|
|
346
|
+
NextRec 的开发受到以下优秀项目的启发:
|
|
347
|
+
|
|
348
|
+
- [torch-rechub](https://github.com/datawhalechina/torch-rechub) - 灵活且易于扩展的推荐系统框架
|
|
349
|
+
- [FuxiCTR](https://github.com/reczoo/FuxiCTR) - 可配置、可调优、可复现的 CTR 预测库
|
|
350
|
+
- [RecBole](https://github.com/RUCAIBox/RecBole) - 统一、全面、高效的推荐库
|
|
351
|
+
|
|
352
|
+
感谢开源社区的所有贡献者!
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
## 引用
|
|
356
|
+
|
|
357
|
+
如果您在研究或工作中使用了本框架,欢迎引用本项目:
|
|
358
|
+
|
|
359
|
+
```bibtex
|
|
360
|
+
@misc{nextrec,
|
|
361
|
+
title = {NextRec},
|
|
362
|
+
author = {Yang Zhou},
|
|
363
|
+
year = {2025},
|
|
364
|
+
publisher = {GitHub},
|
|
365
|
+
journal = {GitHub repository},
|
|
366
|
+
howpublished = {\url{https://github.com/zerolovesea/NextRec}},
|
|
367
|
+
note = {A unified, efficient, and extensible PyTorch-based recommendation library}
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
<div align="center">
|
|
373
|
+
|
|
374
|
+
**[返回顶部](#nextrec)**
|
|
375
|
+
|
|
376
|
+
</div>
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|

|
|
8
8
|

|
|
9
9
|

|
|
10
|
-

|
|
11
11
|
|
|
12
|
-
[English Version](
|
|
12
|
+
中文文档 | [English Version](README_en.md)
|
|
13
13
|
|
|
14
14
|
**统一、高效、可扩展的推荐系统框架**
|
|
15
15
|
|
|
@@ -18,39 +18,44 @@
|
|
|
18
18
|
## 目录
|
|
19
19
|
|
|
20
20
|
- [简介](#简介)
|
|
21
|
+
- [NextRec进展](#NextRec进展)
|
|
21
22
|
- [安装](#安装)
|
|
22
23
|
- [架构](#架构)
|
|
23
24
|
- [5分钟快速上手](#5分钟快速上手)
|
|
24
|
-
- [命令行工具](#命令行工具)
|
|
25
|
+
- [命令行工具 NextRec-CLI](#命令行工具)
|
|
25
26
|
- [兼容平台](#兼容平台)
|
|
26
27
|
- [支持模型](#支持模型)
|
|
27
28
|
- [贡献指南](#贡献指南)
|
|
28
29
|
|
|
29
30
|
## 简介
|
|
30
31
|
|
|
31
|
-
NextRec是一个基于PyTorch
|
|
32
|
+
NextRec是一个基于PyTorch的现代推荐系统框架,旨在为研究工程团队提供快速的建模、训练与评估流。框架内置丰富的模型库、数据处理工具和工程化训练组件。此外提供了易上手的接口,命令行工具及教程,推荐算法学习者能以最快速度了解模型架构,复现学术论文并进行训练和部署。
|
|
32
33
|
|
|
33
34
|
## Why NextRec
|
|
34
|
-
|
|
35
|
-
- **统一的特征工程与数据流水线**:NextRec框架提供了统一的特征定义、可持久化的数据处理、并对批处理进行了优化,符合工业大数据Spark/Hive场景下,基于离线特征的模型训练推理流程。
|
|
36
35
|
- **多场景推荐能力**:覆盖排序(CTR/CVR)、召回、多任务学习、生成式召回等推荐/营销模型,持续跟进业界进展。
|
|
37
|
-
-
|
|
36
|
+
- **统一的特征工程与数据流水线**:NextRec框架提供了统一的特征定义、可持久化的数据处理、批处理优化,符合工业大数据Spark/Hive场景下,基于离线特征的模型训练推理流程。
|
|
37
|
+
- **友好的工程体验**:支持多种格式数据(`csv/parquet/pathlike`)的流式处理/分布式训练/推理与可视化指标监控,方便业务算法工程师和推荐算法学习者快速复现实验。
|
|
38
38
|
- **灵活的命令行工具**:支持通过命令行和配置文件,一键启动训练和推理进程,方便快速实验迭代和敏捷部署。
|
|
39
39
|
- **高效训练与评估**:内置多种优化器、学习率调度、早停、模型检查点与详细的日志管理,开箱即用。
|
|
40
40
|
|
|
41
|
-
##
|
|
41
|
+
## NextRec近期进展
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
- **12/12/2025** 在v0.4.7中加入了[RQ-VAE](/nextrec/models/generative/rqvae.py)模块。配套的[数据集](/dataset/ecommerce_task.csv)和[代码](tutorials/notebooks/zh/使用RQ-VAE构建语义ID.ipynby)已经同步在仓库中
|
|
44
|
+
- **07/12/2025** 发布了NextRec CLI命令行工具,它允许用户根据配置文件进行一键训练和推理,我们提供了相关的[教程](/nextrec_cli_preset/NextRec-CLI_zh.md)和[教学代码](/nextrec_cli_preset)
|
|
45
|
+
- **03/12/2025** NextRec获得了100颗🌟!感谢大家的支持
|
|
46
|
+
- **06/12/2025** 在v0.4.1中支持了单机多卡的分布式DDP训练,并且提供了配套的[代码](tutorials/distributed)
|
|
47
|
+
- **23/11/2025** 在v0.2.2中对basemodel进行了逻辑上的大幅重构和流程统一,并且对listwise/pairwise/pointwise损失进行了统一
|
|
48
|
+
- **11/11/2025** NextRec v0.1.0发布,我们提供了10余种Ranking模型,4种多任务模型和4种召回模型,以及统一的训练/日志/指标管理系统
|
|
44
49
|
|
|
45
|
-
|
|
50
|
+
## 架构
|
|
46
51
|
|
|
47
|
-
|
|
52
|
+
NextRec采用模块化工程设计,核心组件包括:统一特征驱动的BaseModel架构;独立Layer模块;支持训练推理的统一的DataLoader;命令行工具NextCLI等。
|
|
48
53
|
|
|
49
|
-
|
|
54
|
+

|
|
50
55
|
|
|
51
56
|
## 安装
|
|
52
57
|
|
|
53
|
-
开发者可以通过`pip install nextrec`快速安装NextRec的最新版本,环境要求为Python 3.10
|
|
58
|
+
开发者可以通过`pip install nextrec`快速安装NextRec的最新版本,环境要求为Python 3.10+(对于需要使用CUDA加速的开发者,建议安装对应版本的pytorch)。如果需要执行示例代码,则需要先拉取仓库:
|
|
54
59
|
|
|
55
60
|
```bash
|
|
56
61
|
git clone https://github.com/zerolovesea/NextRec.git
|
|
@@ -67,6 +72,8 @@ pip install nextrec # or pip install -e .
|
|
|
67
72
|
- [example_multitask.py](/tutorials/example_multitask.py) - 电商数据集上的ESMM多任务学习训练示例
|
|
68
73
|
- [movielen_match_dssm.py](/tutorials/example_match_dssm.py) - 基于movielen 100k数据集训练的 DSSM 召回模型示例
|
|
69
74
|
|
|
75
|
+
- [example_distributed_training.py](/tutorials/distributed/example_distributed_training.py) - 使用NextRec进行单机多卡训练的代码示例
|
|
76
|
+
|
|
70
77
|
- [run_all_ranking_models.py](/tutorials/run_all_ranking_models.py) - 快速校验所有排序模型的可用性
|
|
71
78
|
- [run_all_multitask_models.py](/tutorials/run_all_multitask_models.py) - 快速校验所有多任务模型的可用性
|
|
72
79
|
- [run_all_match_models.py](/tutorials/run_all_match_models.py) - 快速校验所有召回模型的可用性
|
|
@@ -75,6 +82,7 @@ pip install nextrec # or pip install -e .
|
|
|
75
82
|
|
|
76
83
|
- [如何上手NextRec框架](/tutorials/notebooks/zh/Hands%20on%20nextrec.ipynb)
|
|
77
84
|
- [如何使用数据处理器进行数据预处理](/tutorials/notebooks/zh/Hands%20on%20dataprocessor.ipynb)
|
|
85
|
+
- [使用RQ-VAE构建语义ID](/tutorials/notebooks/zh/使用RQ-VAE构建语义ID.ipynb)
|
|
78
86
|
|
|
79
87
|
## 5分钟快速上手
|
|
80
88
|
|
|
@@ -174,16 +182,17 @@ nextrec --mode=train --train_config=path/to/train_config.yaml
|
|
|
174
182
|
nextrec --mode=predict --predict_config=path/to/predict_config.yaml
|
|
175
183
|
```
|
|
176
184
|
|
|
177
|
-
> 截止当前版本0.4.
|
|
185
|
+
> 截止当前版本0.4.7,NextRec CLI支持单机训练,分布式训练相关功能尚在开发中。
|
|
178
186
|
|
|
179
187
|
## 兼容平台
|
|
180
188
|
|
|
181
|
-
当前最新版本为0.4.
|
|
189
|
+
当前最新版本为0.4.7,所有模型和测试代码均已在以下平台通过验证,如果开发者在使用中遇到兼容问题,请在issue区提出错误报告及系统版本:
|
|
182
190
|
|
|
183
191
|
| 平台 | 配置 |
|
|
184
192
|
|------|------|
|
|
185
193
|
| MacOS latest| MacBook Pro M4 Pro 24G内存 |
|
|
186
194
|
| Ubuntu latest| AutoDL 4070D 双卡 |
|
|
195
|
+
| Ubuntu 24.04| NVIDIA TITAN V 5卡 |
|
|
187
196
|
| CentOS 7 | Intel Xeon 5138Y 96核 377G内存 |
|
|
188
197
|
|
|
189
198
|
## 支持模型
|
|
@@ -201,7 +210,7 @@ nextrec --mode=predict --predict_config=path/to/predict_config.yaml
|
|
|
201
210
|
| [PNN](nextrec/models/ranking/pnn.py) | Product-based Neural Networks for User Response Prediction | ICDM 2016 | 已支持 |
|
|
202
211
|
| [AutoInt](nextrec/models/ranking/autoint.py) | AutoInt: Automatic Feature Interaction Learning | CIKM 2019 | 已支持 |
|
|
203
212
|
| [DCN](nextrec/models/ranking/dcn.py) | Deep & Cross Network for Ad Click Predictions | ADKDD 2017 | 已支持 |
|
|
204
|
-
| [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 |
|
|
213
|
+
| [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 | 已支持 |
|
|
205
214
|
| [DIN](nextrec/models/ranking/din.py) | Deep Interest Network for Click-Through Rate Prediction | KDD 2018 | 已支持 |
|
|
206
215
|
| [DIEN](nextrec/models/ranking/dien.py) | Deep Interest Evolution Network for Click-Through Rate Prediction | AAAI 2019 | 已支持 |
|
|
207
216
|
| [MaskNet](nextrec/models/ranking/masknet.py) | MaskNet: Introducing Feature-wise Gating Blocks for High-dimensional Sparse Recommendation Data | 2020 | 已支持 |
|
|
@@ -265,21 +274,15 @@ nextrec --mode=predict --predict_config=path/to/predict_config.yaml
|
|
|
265
274
|
- 实际行为
|
|
266
275
|
- 环境信息(Python 版本、PyTorch 版本等)
|
|
267
276
|
|
|
268
|
-
---
|
|
269
|
-
|
|
270
277
|
## 许可证
|
|
271
278
|
|
|
272
279
|
本项目采用 [Apache 2.0 许可证](./LICENSE)。
|
|
273
280
|
|
|
274
|
-
---
|
|
275
|
-
|
|
276
281
|
## 联系方式
|
|
277
282
|
|
|
278
283
|
- **GitHub Issues**: [提交问题](https://github.com/zerolovesea/NextRec/issues)
|
|
279
284
|
- **邮箱**: zyaztec@gmail.com
|
|
280
285
|
|
|
281
|
-
---
|
|
282
|
-
|
|
283
286
|
## 致谢
|
|
284
287
|
|
|
285
288
|
NextRec 的开发受到以下优秀项目的启发:
|
|
@@ -290,6 +293,22 @@ NextRec 的开发受到以下优秀项目的启发:
|
|
|
290
293
|
|
|
291
294
|
感谢开源社区的所有贡献者!
|
|
292
295
|
|
|
296
|
+
|
|
297
|
+
## 引用
|
|
298
|
+
|
|
299
|
+
如果您在研究或工作中使用了本框架,欢迎引用本项目:
|
|
300
|
+
|
|
301
|
+
```bibtex
|
|
302
|
+
@misc{nextrec,
|
|
303
|
+
title = {NextRec},
|
|
304
|
+
author = {Yang Zhou},
|
|
305
|
+
year = {2025},
|
|
306
|
+
publisher = {GitHub},
|
|
307
|
+
journal = {GitHub repository},
|
|
308
|
+
howpublished = {\url{https://github.com/zerolovesea/NextRec}},
|
|
309
|
+
note = {A unified, efficient, and extensible PyTorch-based recommendation library}
|
|
310
|
+
}
|
|
311
|
+
```
|
|
293
312
|
---
|
|
294
313
|
|
|
295
314
|
<div align="center">
|