This project contains notebook-based experiments for multiple NewsRec models on the MIND dataset:
NRMS(nrms_MIND.ipynb)NAML(naml_MIND.ipynb)NPA(npa_MIND.ipynb)LSTUR(lstur_MIND.ipynb)DKN(dkn_MIND.ipynb)
It includes local preprocessing via prepare_data.py and a vendored recommenders package used by the notebooks.
.
├── README.md
├── requirements.txt
├── .gitignore
├── prepare_data.py
├── nrms_MIND.ipynb
├── naml_MIND.ipynb
├── npa_MIND.ipynb
├── lstur_MIND.ipynb
├── dkn_MIND.ipynb
├── recommenders/
│ └── ... model and data utilities used by notebooks
├── utils/
│ ├── *.yaml # tracked config files
│ └── *.pkl, *.npy # generated artifacts (ignored by git)
└── data/ # local dataset folder (ignored by git)
├── train/
│ ├── news.tsv
│ └── behaviors.tsv
└── valid/
├── news.tsv
└── behaviors.tsv
Important:
data/is intentionally not uploaded to GitHub.- generated files in
utils/(for example*.pkl,*.npy) are also not uploaded. - after cloning, users should create
data/locally and runpython prepare_data.py.
From project root:
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txtIf you use Apple Silicon (M1/M2/M3), you can install Metal acceleration:
pip install tensorflow-macos tensorflow-metalFor Linux/Windows users, skip this step.
If you use an NVIDIA GPU, install a CUDA-compatible TensorFlow build. Use the TensorFlow + CUDA versions that match your local NVIDIA driver and CUDA runtime.
A common setup flow is:
- Install/update NVIDIA driver
- Install CUDA and cuDNN versions compatible with your TensorFlow version
- Install TensorFlow in your environment
You can verify GPU visibility with:
python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"Expected structure:
data/
train/
news.tsv
behaviors.tsv
valid/
news.tsv
behaviors.tsv
prepare_data.py reads from:
data/train/news.tsvdata/train/behaviors.tsvdata/valid/news.tsv
Run:
python prepare_data.pyWhat this does:
- Builds dictionaries from your local
data/files - Tries to download official MIND utility resources from Hugging Face
- Falls back to random embedding initialization if download fails
- Writes artifacts into
utils/(for example*.pkl,*.npy)
Note: generated artifacts in utils/ are intentionally ignored by .gitignore.
Start Jupyter:
jupyter labThen open any of:
nrms_MIND.ipynbnaml_MIND.ipynbnpa_MIND.ipynblstur_MIND.ipynbdkn_MIND.ipynb
- Commit source code, configs (
utils/*.yaml), and notebooks. - Do not commit generated data/artifacts (
data/,utils/*.pkl,utils/*.npy, checkpoints). - If someone clones this repo, they can reproduce by:
- Installing dependencies
- Placing MIND files under
data/ - Running
python prepare_data.py - Running notebooks