This example is used to demonstrate how to convert a TensorFlow model with mix precision.
pip install -r requirements.txt
Note: Validated TensorFlow Version.
wget https://storage.googleapis.com/intel-optimized-tensorflow/models/v1_6/mobilenet_v1_1.0_224_frozen.pb
python test.py --dataset_location=/path/to/imagenet/
We can get a BF16 model using the Mixed Precision API.
from neural_compressor.config import MixedPrecisionConfig
from neural_compressor import mix_precision
from neural_compressor import Metric
top1 = Metric(k=1)
config = MixedPrecisionConfig()
mix_precision_model = mix_precision.fit(
model="./mobilenet_v1_1.0_224_frozen.pb",
config=config,
eval_dataloader=eval_dataloader,
eval_metric=top1)