ImportError: cannot import name 'calibration_tensorfile'

While trying to export a SSD model to INT8, it is required to generate the cal.tensorfile so I followed the docs and sample notebooks and used below command to generate:

!tlt-int8-tensorfile ssd \
    --cal_image_dir /dataset/images \
    --cal_data_file exported_model/cal.tensorfile


Using TensorFlow backend.
2021-03-17 07:21:00.029695: I tensorflow/stream_executor/platform/default/] Successfully opened dynamic library
WARNING:tensorflow:Deprecation warnings have been disabled. Set TF_ENABLE_DEPRECATION_WARNINGS=1 to re-enable them.
Traceback (most recent call last):
  File "/usr/local/bin/tlt-int8-tensorfile", line 8, in <module>
  File "/home/vpraveen/.cache/dazel/_dazel_vpraveen/216c8b41e526c3295d3b802489ac2034/execroot/ai_infra/bazel-out/k8-fastbuild/bin/magnet/packages/iva/build_wheel.runfiles/ai_infra/iva/common/", line 41, in main
ImportError: cannot import name 'calibration_tensorfile'

Any alternate method to export SSD model in INT8 will be helpful.


Are you running TLT 2.0 or TLT 3.0?

Hey Morganh, I am running TLT 3.0 DP

I have resolved the issue. It seems TLT 3.0 handles the calibration data generation automatically.
This command worked for me.

ssd export --gpu_index=1 \
            -m retrained_model/weights/ssd_resnet18_epoch_014.tlt \
            -o exported_model/ssd_resnet18_epoch_014_int8.etlt \
            -e specs/retrain.txt \
            -k $KEY \
            --data_type int8 \
            --cal_image_dir /dataset/images \
            --batches 10 \
            --cal_cache_file exported_model/cal.bin \
            --cal_data_file exported_model/cal.tensorfile