I want to convert my model to TRT-INT8, however, when i get into converter.calibrate function, i get the error:
File “/usr/lib64/python2.7/site-packages/tensorflow_core/python/compiler/tensorrt/trt_convert.py”, line 612, in calibrate
fetches, feed_dict=feed_dict_fn() if feed_dict_fn else None)
File “/usr/lib64/python2.7/site-packages/tensorflow_core/python/client/session.py”, line 956, in run
run_metadata_ptr)
File “/usr/lib64/python2.7/site-packages/tensorflow_core/python/client/session.py”, line 1180, in _run
feed_dict_tensor, options, run_metadata)
File “/usr/lib64/python2.7/site-packages/tensorflow_core/python/client/session.py”, line 1359, in _do_run
run_metadata)
File “/usr/lib64/python2.7/site-packages/tensorflow_core/python/client/session.py”, line 1384, in _do_call
raise type(e)(node_def, op, message)
FailedPreconditionError: Table not initialized.
[[node index_to_string_Lookup (defined at usr/lib64/python2.7/site-packages/tensorflow_core/python/framework/ops.py:1748) ]]
Node index_to_string_Lookup is a output node of my model.
I googled this problem and get the an suggest to add sess.run(tf.tables_initializer()), so i change the calibrate func by add calibration_sess.run(tf.tables_initializer()):
with session.Session(
graph=self._calibration_graph,
config=self._session_config) as calibration_sess:
calibration_sess.run(tf.tables_initializer())
for _ in range(num_runs):
calibration_sess.run(
fetches, feed_dict=feed_dict_fn() if feed_dict_fn else None)
but i failed, how can i slove this problem?