New Modules#

We are using NEW recommender and generator modules as examples to show the tour of adding new modules to RecBOT.

1. NEW Recommender#

Similar to standard Huggingface models, we need three elements for RecBOT modules.

1.1. Define the recommender#

  1. Define Config from recwizard.BaseConfig:


  1. Define Tokenizer from recwizard.BaseTokenizer


  1. Define Module from recwizard.BaseModule


Nice, we can initialize our NEW recommender now!


1.2. Train the recommender#

We follow the Huggingface Trainer to train the NEW recommender:


Also, we leave the flexiblity for the developers to train the models with any favorite strategies.

  1. Huggingface Training Script

  2. Lightning Training Script

  3. Native PyTorch Training Script

1.3. Save the recommender#

Now, we can tested our NEW recommender now, and share this as a pretrained model.

  1. Test our trained NEW recommender


  1. Save our trained NEW recommender locally


  1. Save our trained NEW recommender remotely


  1. Check we can use it:


NOTE: All the traditional (non conversational) generators can be created and shared in this way. Welcome to contribute traditional recommenders under this category!

2. NEW Generator#

Similar to standard Huggingface models, we need three elements for RecBOT modules.

2.1. Define the generator#

  1. Define Config from recwizard.BaseConfig:


  1. Define Tokenizer from recwizard.BaseTokenizer


  1. Define Module from recwizard.BaseModule


Nice, we can initialize our NEW generators now!


2.2. Train the generator#

We follow the Huggingface Trainer to train the NEW generator:


Also, we leave the flexiblity for the developers to train the generators with any favorite strategies.

  1. Huggingface Training Script

  2. Lightning Training Script

  3. Native PyTorch Training Script

2.3. Save the generator#

Now, we can tested our NEW generator now, and share this as a pretrained model.

  1. Test our trained NEW generator


  1. Save our trained NEW generator locally


  1. Save our trained NEW generator remotely


  1. Check we can use it: