A Lighting Pytorch Framework for Recommendation System, Easy-to-use and Easy-to-extend.
Project description
Torch-RecHub
中文Wiki站
查看最新研发进度,认领感兴趣的研发任务,学习rechub模型复现心得,加入rechub共建者团队等
安装
#稳定版
pip install torch-rechub
#最新版
1. git clone https://github.com/datawhalechina/torch-rechub.git
2. cd torch-rechub
3. python setup.py install
核心定位
易用易拓展,聚焦复现业界实用的推荐模型,以及泛生态化的推荐场景
主要特性
-
scikit-learn风格易用的API(fit、predict),即插即用
-
模型训练与模型定义解耦,易拓展,可针对不同类型的模型设置不同的训练机制
-
接受pandas的DataFrame、Dict数据输入,上手成本低
-
高度模块化,支持常见Layer,容易调用组装成新模型
-
LR、MLP、FM、FFM、CIN
-
target-attention、self-attention、transformer
-
-
支持常见排序模型
- WideDeep、DeepFM、DIN、DCN、xDeepFM等
-
支持常见召回模型
- DSSM、YoutubeDNN、YoutubeDSSM、FacebookEBR、MIND等
-
丰富的多任务学习支持
-
SharedBottom、ESMM、MMOE、PLE、AITM等模型
-
GradNorm、UWL、MetaBanlance等动态loss加权机制
-
-
聚焦更生态化的推荐场景
-
冷启动
-
延迟反馈
- 去偏
-
-
支持丰富的训练机制
-
对比学习
-
蒸馏学习
-
-
第三方高性能开源Trainer支持(Pytorch Lighting)
-
更多模型正在开发中
快速使用
单任务排序
from torch_rechub.models.ranking import WideDeep, DeepFM, DIN
from torch_rechub.trainers import CTRTrainer
from torch_rechub.basic.utils import DataGenerator
dg = DataGenerator(x, y)
train_dataloader, val_dataloader, test_dataloader = dg.generate_dataloader()
model = DeepFM(deep_features=deep_features, fm_features=fm_features, mlp_params={"dims": [256, 128], "dropout": 0.2, "activation": "relu"})
ctr_trainer = CTRTrainer(model)
ctr_trainer.fit(train_dataloader, val_dataloader)
auc = ctr_trainer.evaluate(ctr_trainer.model, test_dataloader)
多任务排序
from torch_rechub.models.multi_task import SharedBottom, ESMM, MMOE, PLE, AITM
from torch_rechub.trainers import MTLTrainer
model = MMOE(features, task_types, n_expert=3, expert_params={"dims": [64,32,16]}, tower_params_list=[{"dims": [8]}, {"dims": [8]}])
ctr_trainer = MTLTrainer(model)
ctr_trainer.fit(train_dataloader, val_dataloader)
auc = ctr_trainer.evaluate(ctr_trainer.model, test_dataloader)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
torch-rechub-0.0.2.tar.gz
(33.1 kB
view details)
File details
Details for the file torch-rechub-0.0.2.tar.gz
.
File metadata
- Download URL: torch-rechub-0.0.2.tar.gz
- Upload date:
- Size: 33.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 291395b2bba77980db4b47cd43e93e0322bde830454337a60c30e2a5ebc92451 |
|
MD5 | 47fbc355879966b9ba46725c245febb0 |
|
BLAKE2b-256 | 9b42db9c67c70a57ddcc377bb6244b0b4099ee3480dd784d3a2668c7a7c1b71b |