Move README.md
#1
by
tytskiy
- opened
- benchmarks/README.md +124 -0
benchmarks/README.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Reproducibility Guide
|
| 2 |
+
|
| 3 |
+
## Overview
|
| 4 |
+
|
| 5 |
+
This part of repo contains the implementation and experiments. This guide will help you reproduce the results using Docker or manual installation.
|
| 6 |
+
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
## Docker Setup (Recommended)
|
| 10 |
+
|
| 11 |
+
### 1. Build Docker Image
|
| 12 |
+
|
| 13 |
+
```bash
|
| 14 |
+
docker build -t yambda-image .
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
### 2. Run Container with GPU Support
|
| 18 |
+
|
| 19 |
+
```bash
|
| 20 |
+
docker run --gpus all \
|
| 21 |
+
--runtime=nvidia \
|
| 22 |
+
-it \
|
| 23 |
+
-v </absolute/path/to/local/data>:/yambda/data \
|
| 24 |
+
yambda-image
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
## Data Organization
|
| 30 |
+
|
| 31 |
+
Create following structure in mounted data directory:
|
| 32 |
+
|
| 33 |
+
```bash
|
| 34 |
+
data/
|
| 35 |
+
├── flat/
|
| 36 |
+
│ └── 50m/
|
| 37 |
+
│ ├── likes.parquet
|
| 38 |
+
│ ├── listens.parquet
|
| 39 |
+
│ └── ...
|
| 40 |
+
└── sequential/
|
| 41 |
+
└── 50m/
|
| 42 |
+
├── likes.parquet
|
| 43 |
+
├── listens.parquet
|
| 44 |
+
└── ...
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
Note:
|
| 48 |
+
Sequential data is only needed for sasrec. You can build it from flat using scripts/transform2sequential.py or download
|
| 49 |
+
|
| 50 |
+
---
|
| 51 |
+
|
| 52 |
+
## Running Experiments
|
| 53 |
+
|
| 54 |
+
### General Usage
|
| 55 |
+
|
| 56 |
+
```bash
|
| 57 |
+
# For example random_rec
|
| 58 |
+
|
| 59 |
+
cd models/random_rec/
|
| 60 |
+
|
| 61 |
+
# Show help for main script
|
| 62 |
+
python main.py --help
|
| 63 |
+
|
| 64 |
+
# Basic execution
|
| 65 |
+
python main.py
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
### Specific Methods
|
| 69 |
+
|
| 70 |
+
#### BPR/ALS
|
| 71 |
+
|
| 72 |
+
```bash
|
| 73 |
+
cd models/bpr_als
|
| 74 |
+
|
| 75 |
+
python main.py --model bpr
|
| 76 |
+
python main.py --model als
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
#### SASRec
|
| 80 |
+
|
| 81 |
+
```bash
|
| 82 |
+
cd models/sasrec
|
| 83 |
+
|
| 84 |
+
# Training
|
| 85 |
+
python train.py --exp_name exp1
|
| 86 |
+
|
| 87 |
+
# Evaluation
|
| 88 |
+
python eval.py --exp_name exp1
|
| 89 |
+
```
|
| 90 |
+
---
|
| 91 |
+
|
| 92 |
+
## Manual Installation (Not Recommedned)
|
| 93 |
+
|
| 94 |
+
### 1. Install Core Dependencies
|
| 95 |
+
|
| 96 |
+
```bash
|
| 97 |
+
pip install torch torchvision torchaudio
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
### 2. Install Implicit (CUDA 11.8 required)
|
| 101 |
+
|
| 102 |
+
Implicit works only with cuda<12. See reasons [here](https://github.com/NVIDIA/nvidia-docker/issues/700#issuecomment-381073278)
|
| 103 |
+
|
| 104 |
+
```bash
|
| 105 |
+
CUDACXX=/usr/local/cuda-11.8/bin/nvcc \
|
| 106 |
+
pip install implicit
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
### 3. Install SANSA
|
| 110 |
+
|
| 111 |
+
```bash
|
| 112 |
+
sudo apt-get install libsuitesparse-dev
|
| 113 |
+
git clone https://github.com/glami/sansa.git
|
| 114 |
+
cd sansa && \
|
| 115 |
+
SUITESPARSE_INCLUDE_DIR=/usr/include/suitesparse \
|
| 116 |
+
SUITESPARSE_LIBRARY_DIR=/usr/lib \
|
| 117 |
+
pip install .
|
| 118 |
+
```
|
| 119 |
+
|
| 120 |
+
### 4. Install Project Package
|
| 121 |
+
|
| 122 |
+
```bash
|
| 123 |
+
pip install . # In root directory
|
| 124 |
+
```
|