Wide & Deep Recommender model.
To train your model using mixed or TF32 precision with Tensor Cores or using FP32, perform the following steps using the default parameters of the Wide & Deep model on the Outbrain dataset. For the specifics concerning training and inference, see the Advanced section.
- Clone the repository.
git clone https://github.com/NVIDIA/DeepLearningExamples
cd DeepLearningExamples/TensorFlow/Recommendation/WideAndDeep
- Download the Outbrain dataset.
The Outbrain dataset can be downloaded from Kaggle (requires Kaggle account).
Unzip the downloaded archive e.g. to /raid/outbrain/orig and set the HOST_OUTBRAIN_PATH variable to the parent directory:
HOST_OUTBRAIN_PATH=/raid/outbrain
- Build the Wide & Deep Tensorflow NGC container.
docker build . -t wide_deep
- Start an interactive session in the NGC container to run preprocessing/training/inference.
docker run --runtime=nvidia --privileged --rm -ti -v ${HOST_OUTBRAIN_PATH}:/outbrain wide_deep /bin/bash
- Start preprocessing.
bash scripts/preproc.sh 4096
The result of preprocessing scripts are prebatched TFRecords. The argument to the script is the prebatch size (4096 is the default).
- Start training.
Single GPU:
python -m trainer.task --gpu
8 GPU:
mpiexec --allow-run-as-root --bind-to socket -np 8 python -m trainer.task --gpu --hvd
If you want to run validation or inference, you can either use the checkpoint obtained from the training commands above, or download the pretrained checkpoint from NGC.
In order to download the checkpoint from NGC, visit ngc.nvidia.com website and
browse the available models.
Download the checkpoint files and unzip them to some path, e.g. to /raid/outbrain/checkpoints/
(which is the default path for storing the checkpoints during training).
- Start validation/evaluation.
In order to validate the checkpoint on the evaluation set, run the task.py script with --evaluate flag:
python -m trainer.task --gpu --evaluate --model_dir /outbrain/checkpoints
- Start inference/predictions.
In order to run inference and predict the results, run the task.py
script with --predict flag:
python -m trainer.task --gpu --predict --model_dir /outbrain/checkpoints