Optimize a BERT-Large Bfloat16 Inference Container with Tensorflow*

Published: 01/08/2021  

Last Updated: 06/15/2022

Pull Command

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


This document has instructions for running BERT bfloat16 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


This script runs BERT-Large bfloat16 inference.


This script runs bfloat16 inference in profile mode.


This script runs BERT-Large bfloat16 inference in accuracy mode.


The BERT-Large bfloat16 inference model container includes the scripts and libraries needed to run BERT-Large bfloat16 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-bfloat16-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.

Related Containers and Solutions

BERT-Large Bfloat16 Inference TensorFlow Model Package

View All Containers and Solutions 🡢

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.