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#
Define
Config
fromrecwizard.BaseConfig
:
Define
Tokenizer
fromrecwizard.BaseTokenizer
Define
Module
fromrecwizard.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.
Huggingface
Training ScriptLightning
Training ScriptNative
PyTorch
Training Script
1.3. Save the recommender#
Now, we can tested our NEW recommender now, and share this as a pretrained model.
Test our trained NEW recommender
Save our trained NEW recommender locally
Save our trained NEW recommender remotely
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#
Define
Config
fromrecwizard.BaseConfig
:
Define
Tokenizer
fromrecwizard.BaseTokenizer
Define
Module
fromrecwizard.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.
Huggingface
Training ScriptLightning
Training ScriptNative
PyTorch
Training Script
2.3. Save the generator#
Now, we can tested our NEW generator now, and share this as a pretrained model.
Test our trained NEW generator
Save our trained NEW generator locally
Save our trained NEW generator remotely
Check we can use it: