Skip to content

Introducing Torch-RecHub ​

Torch-RecHub implements retrieval, ranking, multi-task and generative recommendation models in PyTorch. A good first experiment is to train DeepFM on the bundled ad-click sample and see how it turns one ad impression into a click probability. Quick start

Torch-RecHub banner

Framework architecture ​

Torch-RecHub framework architecture

When you bring your own data, three parts of the code matter first. Feature definitions tell the model how to read each column. For example, item_id looks up a row in an embedding table, while price goes in as a number. The model's forward method combines those inputs. The trainer reads batches, computes validation metrics and saves weights. To change how a model scores an example, start with its forward method. Feature definitions · Training and evaluation

Choose a model for your task ​

What do you need to do?Where to start
Select a short list of candidates for each user from a large catalogRetrieve candidates with DSSM
Order existing candidates by how likely the user is to clickRank candidates with DeepFM
Learn from both click and purchase labels on the same impressionMulti-task learning
Predict the next item from a sequence of timestamped interactionsSequential and generative models

You can run the introductory examples on a CPU. For an NVIDIA GPU, AMD GPU or Huawei Ascend NPU, install the PyTorch build that matches the device. After training, you can export a ranker to ONNX for inference. With a two-tower model, you can also compute user and item vectors separately for retrieval. Installation · Serving example