Unable to evaluate TFOD model using model_main_tf2.py

I am facing issues when I run the model_main_tf2 script for evaluating the object detection model, it throws in weird errors like this below

Operation defined at: (most recent call last)

File “/mnt/batch/tasks/shared/LS_root/mounts/clusters/yadavdgv-singlegpu/code/Users/yadavdgv/datasets_folder/images/data/Tensorflow/workspace/training_demo/model_main_tf2.py”, line 220, in
tf.compat.v1.app.run()

File “/anaconda/envs/tensorflow/lib/python3.9/site-packages/absl/app.py”, line 308, in run
_run_main(main, args)

File “/anaconda/envs/tensorflow/lib/python3.9/site-packages/absl/app.py”, line 254, in _run_main
sys.exit(main(argv))

File “/mnt/batch/tasks/shared/LS_root/mounts/clusters/yadavdgv-singlegpu/code/Users/yadavdgv/datasets_folder/images/data/Tensorflow/workspace/training_demo/model_main_tf2.py”, line 185, in main
model_lib_v2.eval_continuously(

File “/anaconda/envs/tensorflow/lib/python3.9/site-packages/object_detection/model_lib_v2.py”, line 1158, in eval_continuously
eager_eval_loop(

File “/anaconda/envs/tensorflow/lib/python3.9/site-packages/object_detection/model_lib_v2.py”, line 939, in eager_eval_loop
eval_features) = strategy.run(

File “/anaconda/envs/tensorflow/lib/python3.9/site-packages/object_detection/model_lib_v2.py”, line 910, in compute_eval_dict
losses_dict, prediction_dict = _compute_losses_and_predictions_dicts(

File “/anaconda/envs/tensorflow/lib/python3.9/site-packages/object_detection/model_lib_v2.py”, line 130, in _compute_losses_and_predictions_dicts
losses_dict = model.loss(

File “/anaconda/envs/tensorflow/lib/python3.9/site-packages/object_detection/meta_architectures/faster_rcnn_meta_arch.py”, line 2267, in loss
loss_dict = self._loss_rpn(

File “/anaconda/envs/tensorflow/lib/python3.9/site-packages/object_detection/meta_architectures/faster_rcnn_meta_arch.py”, line 2323, in _loss_rpn
(batch_cls_targets, batch_cls_weights, batch_reg_targets,

File “/anaconda/envs/tensorflow/lib/python3.9/site-packages/object_detection/core/target_assigner.py”, line 510, in batch_assign
for anchors, gt_boxes, gt_class_targets, gt_weights in zip(

File “/anaconda/envs/tensorflow/lib/python3.9/site-packages/object_detection/core/target_assigner.py”, line 512, in batch_assign
(cls_targets, cls_weights,

File “/anaconda/envs/tensorflow/lib/python3.9/site-packages/object_detection/core/target_assigner.py”, line 202, in assign
reg_targets = self._create_regression_targets(anchors,

File “/anaconda/envs/tensorflow/lib/python3.9/site-packages/object_detection/core/target_assigner.py”, line 259, in _create_regression_targets
matched_gt_boxes = match.gather_based_on_match(

File “/anaconda/envs/tensorflow/lib/python3.9/site-packages/object_detection/core/matcher.py”, line 214, in gather_based_on_match
gathered_tensor = self._gather_op(input_tensor, gather_indices)

File “/anaconda/envs/tensorflow/lib/python3.9/site-packages/object_detection/utils/ops.py”, line 1031, in matmul_gather_on_zeroth_axis
gathered_result_flattened = tf.matmul(indicator_matrix, params2d)

Function call stack:
compute_eval_dict → compute_eval_dict
exception.
INFO:tensorflow:A replica probably exhausted all examples. Skipping pending examples on other replicas.
I0810 13:28:00.401749 139635434980608 model_lib_v2.py:943] A replica probably exhausted all examples. Skipping pending examples on other replicas.
Traceback (most recent call last):
File “/mnt/batch/tasks/shared/LS_root/mounts/clusters/yadavdgv-singlegpu/code/Users/yadavdgv/datasets_folder/bearingexpert_images/data/Tensorflow/workspace_bearings/training_demo/model_main_tf2.py”, line 220, in
tf.compat.v1.app.run()
File “/anaconda/envs/tensorflow/lib/python3.9/site-packages/tensorflow/python/platform/app.py”, line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File “/anaconda/envs/tensorflow/lib/python3.9/site-packages/absl/app.py”, line 308, in run
_run_main(main, args)
File “/anaconda/envs/tensorflow/lib/python3.9/site-packages/absl/app.py”, line 254, in _run_main
sys.exit(main(argv))
File “/mnt/batch/tasks/shared/LS_root/mounts/clusters/yadavdgv-singlegpu/code/Users/yadavdgv/datasets_folder/bearingexpert_images/data/Tensorflow/workspace_bearings/training_demo/model_main_tf2.py”, line 185, in main
model_lib_v2.eval_continuously(
File “/anaconda/envs/tensorflow/lib/python3.9/site-packages/object_detection/model_lib_v2.py”, line 1158, in eval_continuously
eager_eval_loop(
File “/anaconda/envs/tensorflow/lib/python3.9/site-packages/object_detection/model_lib_v2.py”, line 1009, in eager_eval_loop
for evaluator in evaluators:
TypeError: ‘NoneType’ object is not iterable

Was able to fix the issue, since the error lay with no CUDA devices being available, so did
export CUDA_VISIBLE_DEVICES=-1 to evaluate on CPU, while running it on the separate terminal with training.