NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
SIM for TensorFlow2
Resource
NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
SIM for TensorFlow2

Search-based Interest Model (SIM) is a system for predicting user behavior given sequences of previous interactions.

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 SIM model on the Amazon Reviews dataset. For the specifics concerning training and inference, refer to the Advanced section.

  1. Clone the repository.

    git clone https://github.com/NVIDIA/DeepLearningExamples
    cd DeepLearningExamples/TensorFlow2/Recommendation/SIM
    
  2. Build the SIM Tensorflow2 container.

    docker build -t sim_tf2 .
    
  3. Start an interactive session in the NGC container to run preprocessing, training, or inference (Amazon Books dataset can be mounted if it has already been downloaded, otherwise, refer to point 4). The SIM TensorFlow2 container can be launched with:

    docker run --runtime=nvidia -it --rm --ipc=host --security-opt seccomp=unconfined -v ${AMAZON_DATASET_PATH}:${RAW_DATASET_PATH} sim_tf2 bash
    
  4. (Optional) Download Amazon Books dataset:

    scripts/download_amazon_books_2014.sh
    export RAW_DATASET_PATH=/data/amazon_books_2014
    
  5. Start preprocessing.

    For details of the required file format and certain preprocessing parameters refer to BYO dataset.

    python preprocessing/sim_preprocessing.py \
     --amazon_dataset_path ${RAW_DATASET_PATH} \
     --output_path ${PARQUET_PATH}
    
    python preprocessing/parquet_to_tfrecord.py \
     --amazon_dataset_path ${PARQUET_PATH} \
     --tfrecord_output_dir ${TF_RECORD_PATH}
    
  6. Start training (${GPU} is an arbitrary number of GPUs to be used).

    mpiexec --allow-run-as-root --bind-to socket -np ${GPU} python main.py \
     --dataset_dir ${TF_RECORD_PATH} \
     --mode train \
     --model_type sim \
     --embedding_dim 16 \
     --drop_remainder \
     --optimizer adam \
     --lr 0.01 \
     --epochs 3 \
     --global_batch_size 131072 \
     --amp
    
  7. Start inference.

    mpiexec --allow-run-as-root --bind-to socket -np ${GPU} python main.py \
     --dataset_dir ${TF_RECORD_PATH} \
     --mode inference \
     --model_type sim \
     --embedding_dim 16 \
     --global_batch_size 131072 \
     --amp
    

For the explanation of output logs, refer to Log format section.

Now that you have your model trained and evaluated, you can choose to compare your training results with our Training accuracy results. You can also choose to benchmark your performance to Training performance benchmark, or Inference performance benchmark. Following the steps in these sections will ensure that you achieve the same accuracy and performance results as stated in the Results section.

NVIDIA uses cookies to improve your experience on our web site. We and our third-party partners also use cookies and other tools to collect and record information you provide as well as information about your interactions with our websites for performance improvement, analytics, and to assist in marketing efforts. By clicking "Accept All", you consent to our use of cookies and other tools as described in our Cookie Policy. You can manage your cookie settings by clicking on "Manage Settings." By continuing to use this site or by clicking one of the buttons below, you agree to our Terms of Service (which contains important waivers). Please see our Privacy Policy for more information on our privacy practices.