This is a demonstration of the BERT4Rec model from the BERT4Rec paper.
graph TD
A[User] -->|list: input watch history| B[Black Panther 2017, The Avengers 2012, ... Spider-Man 3]
A[User] -->|int: top n recommendations| B1[3]
B --> |convert movie strings to indices| B2[113, 22, .. 598]
B2 --> C{BERT4Rec Movies Recommender}
B1 --> C{BERT4Rec Movies Recommender}
C -->|list: integer| D1[13, 976, 49]
D1 --> |convert indices to movie strings| D[Thor: Ragnarok 2017, Deadpool 2 2018, Incredibles 2]
Tested on NVIDIA RTX 3070 with CUDA 11.6 and Python 3.9.13
python -m venv venv
For Linux
source venv/bin/activate
For Powershell
.\venv\Scripts\activate
pip install -r requirements.txt
- Download the movies dataset from here.
- Store the unzipped data in data folder.
- Run the following command to train the model:
python3 recommender/training.py --data_csv_path <path-to-the-data>
docker build . -t recommender
docker run recommender sh -c "python3.8 -m pytest"