Optimize a BERT-Large FP32 Inference Container with TensorFlow*

ID 679167
Updated 6/15/2022
Version Latest



Pull Command

docker pull intel/language-modeling:tf-latest-bert-large-fp32-inference


This document has instructions for running BERT FP32 inference using Intel® Optimization for TensorFlow*.

BERT-Large Data

Download and unzip the BERT-Large uncased (whole word masking) model from the Google* BERT repository. Then, download the Stanford Question Answering Dataset (SQuAD) dataset file dev-v1.1.json into the wwm_uncased_L-24_H-1024_A-16 directory that was just unzipped.

wget https://storage.googleapis.com/bert_models/2019_05_30/wwm_uncased_L-24_H-1024_A-16.zip
unzip wwm_uncased_L-24_H-1024_A-16.zip

wget https://rajpurkar.github.io/SQuAD-explorer/dataset/dev-v1.1.json -P wwm_uncased_L-24_H-1024_A-16

Set the DATASET_DIR to point to that directory when running BERT-Large inference using the SQuAD data.

Quick Start Scripts

Script name Description
fp32_benchmark This script runs BERT-Large fp32 inference.
fp32_profile This script runs fp32 inference in profile mode.
fp32_accuracy This script runs BERT-Large fp32 inference in accuracy mode.


The BERT-Large FP32 inference model container includes the scripts and libraries needed to run BERT-Large FP32 inference. To run one of the quick start scripts using this container, you'll need to provide volume mounts for the, dataset, and an output directory where log files will be written.

The snippet below shows how to run a quick start script:

DATASET_DIR=<path to the dataset being used>
OUTPUT_DIR=<directory where log files will be saved>

docker run \
  --env http_proxy=${http_proxy} \
  --env https_proxy=${https_proxy} \
  --volume ${DATASET_DIR}:${DATASET_DIR} \
  --volume ${OUTPUT_DIR}:${OUTPUT_DIR} \
  --privileged --init -t \
  intel/language-modeling:tf-latest-bert-large-fp32-inference \
  /bin/bash ./quickstart/<SCRIPT NAME>.sh

Documentation and Sources

Get Started​
Docker* Repository
Main GitHub*
Release Notes
Get Started Guide

Code Sources
Report Issue

License Agreement

LEGAL NOTICE: By accessing, downloading or using this software and any required dependent software (the “Software Package”), you agree to the terms and conditions of the software license agreements for the Software Package, which may also include notices, disclaimers, or license terms for third party software included with the Software Package. Please refer to the license file for additional details.

View All Containers and Solutions 🡢