This is the github repository for paper Generative Representational Learning of Foundation Models for Recommendation.
- Install dependencies
pip install -r requirements.txt- Install GradCache
cd training/GradCache
pip install -e .
cd ../..- Environment Setup
This project requires modifications to specific packages for training and inference environments.
For Training Environment:
- Replace
transformers/models/llama/modeling_llama.pywithenv/Training Environment/transformers/modeling_llama.py - Replace
peft/tuners/lora/model.pywithenv/Training Environment/peft/model.py - Apply similar replacements for other files in the Training Environment folder
For Inference Environment:
- Replace files similarly using the
env/Inference Environment/versions
Here is a simplified command to run the program. For more detailed parameter settings, please refer to the corresponding configuration file.
python scripts/run_script.py \
--base_model_path /path/to/base/model \
--train_data_path /path/to/train/data \
--output_dir /path/to/outputFor Generative Tasks:
python scripts/run_inference_eval_gen.py \
--base_model_path /path/to/base/model \
--peft_path /path/to/trained/adapter \
--test_data_path /path/to/test/dataFor Embedding Tasks:
python scripts/run_inference_eval_emb.py \
--base_model_path /path/to/base/model \
--peft_path /path/to/trained/adapter \
--test_data_path /path/to/test/datapython merge/merge_moe.pyThe Dataset is available in https://huggingface.co/datasets/Anonqwq/RecFound.
The TMoLE model checkpoint is available in https://huggingface.co/Anonqwq/RecFound-7B. You can load the module on Mistral-7B-v0.3-Instruct after getting ready for the environment.
Built upon:
MIT License