Run Intel® AI Reference Models in a Jupyter Notebook

March 20, 2025 · View on GitHub

This Jupyter notebook helps you choose and run a comparison between two models from the Intel® AI Reference Models repo using Intel® Optimizations for TensorFlow*. When you run the notebook, it installs required package dependencies, displays information about your platform, lets you choose the two models to compare, runs those models, and finally displays a performance comparison chart.

Supported Models

Intel® Data Center CPU Workloads

ModelFrameworkModeSupported Precisions
ResNet 50v1.5 Sapphire RapidsTensorFlowInferenceInt8 FP32 BFloat16 BFloat32
ResNet 50v1.5 Sapphire RapidsTensorFlowTrainingFP32 BFloat16 BFloat32
ResNet 50PyTorchInferenceInt8 FP32 BFloat16 BFloat32
ResNet 50PyTorchTrainingFP32 BFloat16 BFloat32
Vision TransformerPyTorchInferenceFP32 BFloat16 BFloat32 FP16 INT8
3D U-NetTensorFlowInferenceFP32 BFloat16 Int8
BERT large Sapphire RapidsTensorflowInferenceFP32 BFloat16 Int8 BFloat32
BERT large Sapphire RapidsTensorflowTrainingFP32 BFloat16 BFloat32
BERT large (Hugging Face)TensorFlowInferenceFP32 FP16 BFloat16 BFloat32
BERT largePyTorchInferenceFP32 Int8 BFloat16 BFloat32
BERT largePyTorchTrainingFP32 BFloat16 BFloat32
DistilBERT basePyTorchInferenceFP32 BF32 BF16Int8-FP32 Int8-BFloat16 BFloat32
RNN-TPyTorchInferenceFP32 BFloat16 BFloat32
RNN-TPyTorchTrainingFP32 BFloat16 BFloat32
GPTJ 6BPyTorchInferenceFP32 FP16 BFloat16 BF32 INT8
ChatGLMv3 6BPyTorchInferenceFP32 FP16 BFloat16 BF32 INT8
BERTTensorFlowInferenceFP32
Mask R-CNNPyTorchInferenceFP32 BFloat16 BFloat32
Mask R-CNNPyTorchTrainingFP32 BFloat16 BFloat32
SSD-ResNet34PyTorchInferenceFP32 Int8 BFloat16 BFloat32
SSD-ResNet34PyTorchTrainingFP32 BFloat16 BFloat32
Yolo V7PyTorchInferenceInt8 FP32 FP16 BFloat16 BFloat32
Wide & DeepTensorFlowInferenceFP32
DLRMPyTorchInferenceFP32 Int8 BFloat16 BFloat32
DLRMPyTorchTrainingFP32 BFloat16 BFloat32
DLRM v2PyTorchInferenceFP32 FP16 BFloat16 BFloat32 Int8
Stable DiffusionTensorFlowInferenceFP32 BFloat16 FP16
Stable DiffusionPyTorchInferenceFP32 BFloat16 FP16 BFloat32 Int8-FP32 Int8-BFloat16
Stable DiffusionPyTorchTrainingFP32 BFloat16 FP16 BFloat32
Latent Consistency Models(LCM)PyTorchInferenceFP32 BFloat16 FP16 BFloat32 Int8-FP32 Int8-BFloat16
GraphSAGETensorFlowInferenceFP32 BFloat16 FP16 Int8 BFloat32

Intel® Data Center CPU Workloads

ModelFrameworkModePlatformSupported Precisions
ResNet 50v1.5TensorFlowInferenceFlex SeriesFloat32 TF32 Float16 BFloat16 Int8
ResNet 50 v1.5TensorFlowTrainingMax SeriesBFloat16 FP32
ResNet 50 v1.5PyTorchInferenceFlex Series, Max Series, Arc SeriesInt8 FP32 FP16 TF32
ResNet 50 v1.5PyTorchTrainingMax Series, Arc SeriesBFloat16 TF32 FP32
DistilBERTPyTorchInferenceFlex Series, Max SeriesFP32 FP16 BF16 TF32
DLRM v1PyTorchInferenceFlex SeriesFP16 FP32
SSD-MobileNet*PyTorchInferenceArc SeriesINT8 FP16 FP32
EfficientNetPyTorchInferenceFlex SeriesFP16 BF16 FP32
EfficientNetTensorFlowInferenceFlex SeriesFP16
FBNetPyTorchInferenceFlex SeriesFP16 BF16 FP32
Wide Deep Large DatasetTensorFlowInferenceFlex SeriesFP16
YOLO V5PyTorchInferenceFlex SeriesFP16
BERT largePyTorchInferenceMax Series, Arc SeriesBFloat16 FP32 FP16
BERT largePyTorchTrainingMax Series, Arc SeriesBFloat16 FP32 TF32
BERT largeTensorFlowTrainingMax SeriesBFloat16 TF32 FP32
DLRM v2PyTorchInferenceMax SeriesFP32 BF16
DLRM v2PyTorchTrainingMax SeriesFP32 TF32 BF16
3D-UnetPyTorchInferenceMax SeriesFP16 INT8 FP32
3D-UnetTensorFlowTrainingMax SeriesBFloat16 FP32
Stable DiffusionPyTorchInferenceFlex Series, Max Series, Arc SeriesFP16 FP32
Stable DiffusionTensorFlowInferenceFlex SeriesFP16 FP32
Mask R-CNNTensorFlowInferenceFlex SeriesFP32 Float16
Mask R-CNNTensorFlowTrainingMax SeriesFP32 BFloat16
Swin TransformerPyTorchInferenceFlex SeriesFP16
FastPitchPyTorchInferenceFlex SeriesFP16
UNet++PyTorchInferenceFlex SeriesFP16
RNN-TPyTorchInferenceMax SeriesFP16 BF16 FP32
RNN-TPyTorchTrainingMax SeriesFP32 BF16 TF32
IFRNetPyTorchInferenceFlex SeriesFP16
RIFEPyTorchInferenceFlex SeriesFP16

Environment Setup

Instead of installing or updating packages system-wide, it's a good idea to install project-specific Python packages in a Python virtual environment localized to your project. The Python virtualenv package lets you do just that. Using virtualenv is optional, but recommended.

The jupyter notebook runs on Ubuntu distribution for Linux.

  1. Virtualenv Python Environment Install virtualenv on Ubuntu using these commands:

    sudo apt-get update
    sudo apt-get install python-dev python-pip
    sudo pip install -U virtualenv  # system-wide install
    

    Activate virtual environment using the following command:

    virtualenv -p python ai_ref_models
    source ai_ref_models/bin/activate
    
  2. Jupyter Notebook Support:

    Install Jupyter notebook support with the command:

       pip install notebook
    

    Refer to the Installing Jupyter guide for details.

How to Run the Notebook

  1. Clone the Intel® AI Reference Models repo:
    git clone https://github.com/IntelAI/models.git
    
  2. Launch the Jupyter notebook server: jupyter notebook --ip=0.0.0.0
  3. Follow the instructions to open the URL with the token in your browser, something like this: http://127.0.0.1:8888/tree?token=<token>
  4. Browse to the models/notebooks/ folder
  5. Click the AI_Reference_Models notebook file - AI_Reference_Models.ipynb.
  6. Read the instructions and run through each notebook cell, in order, ending with a display of the analysis results. Note that some cells prompt you for input, such as selecting the model number you'd like to run.
  7. When done, you should deactivate the virtualenv, if you used one, with the command: deactivate