Skip to content

Latest commit

 

History

History
99 lines (80 loc) · 4.1 KB

File metadata and controls

99 lines (80 loc) · 4.1 KB

Wide and Deep using a large dataset inference

Description

This document has instructions for running Wide and Deep using a large dataset inference using Intel-optimized TensorFlow.

Datasets

Follow instructions to download and preprocess the Large Kaggle Display Advertising Challenge Dataset.

Then, set the DATASET_DIR to point to this directory when running Wide and Deep using a large dataset:

export DATASET_DIR=/home/<user>/dataset/eval_preprocessed_eval.tfrecords

Quick Start Scripts

Script name Description
online_inference.sh Runs online inference (batch_size=1). The NUM_OMP_THREADS environment variable and the hyperparameters num-intra-threads, num-inter-threads can be tuned for best performance. If NUM_OMP_THREADS is not set, it will default to 1.
accuracy.sh Measures the model accuracy (batch_size=1000).

Run the model

Setup your environment using the instructions below, depending on if you are using AI Kit:

Setup using AI Kit Setup without AI Kit

AI Kit does not currently support wide and deep large ds

To run without AI Kit you will need:

  • Python 3.7 or newer
  • intel-tensorflow>=2.5.0
  • numactl
  • git
  • wget
  • A clone of the Model Zoo repo
    git clone https://github.com/IntelAI/models.git

After completing the setup, download the pretrained model frozen graph and save the path to the PRETRAINED_MODEL envionment variable.

# FP32 Pretrained Model
wget https://storage.googleapis.com/intel-optimized-tensorflow/models/v1_8/wide_deep_fp32_pretrained_model.pb
export PRETRAINED_MODEL=$(pwd)/wide_deep_fp32_pretrained_model.pb

# Int8 Pretrained Model
wget https://storage.googleapis.com/intel-optimized-tensorflow/models/v1_8/wide_deep_int8_pretrained_model.pb
export PRETRAINED_MODEL=$(pwd)/wide_deep_int8_pretrained_model.pb

Set the environment variables and run quickstart script. See the list of quickstart scripts for details on the different options.

# cd to your model zoo directory
cd models

export DATASET_DIR=<path to TF records file>
export PRECISION=<set the precision to "int8" or "fp32">
export OUTPUT_DIR=<path to the directory where log files will be written>
export PRETRAINED_MODEL=<path to the frozen graph>
# For a custom batch size, set env var `BATCH_SIZE` or it will run with a default value.
export BATCH_SIZE=<customized batch size value>

# Run inference with an accuracy check
./quickstart/recommendation/tensorflow/wide_deep_large_ds/inference/cpu/accuracy.sh

# Run online inference and set NUM_OMP_THREADS
export NUM_OMP_THREADS=1
./quickstart/recommendation/tensorflow/wide_deep_large_ds/inference/cpu/online_inference.sh \
--num-intra-threads 1 --num-inter-threads 1

Additional Resources