Segmentation model evaluate mode error.
Prerequisites
Please answer the following questions for yourself before submitting an issue.
- [x] I am using the latest TensorFlow Model Garden release and TensorFlow 2.
- [x] I am reporting the issue to the correct repository. (Model Garden official or research directory)
- [x] I checked to make sure that this issue has not been filed already.
1. The entire URL of the file you are using
https://github.com/tensorflow/models/tree/master/official/vision/beta/train.py
2. Describe the bug
It works well with experiment 'seg_deeplabv3plus_cityscapes' on tpuv3-8 device with set mode to train but faild to work when I set the mode to eval. It shows that
_I1227 03:53:58.609310 140105914853184 train_lib.py:115] Starts to execute mode: eval
I1227 03:53:58.611576 140105914853184 controller.py:255] eval | step: 92685 | running 31 steps of evaluation...
eval | step: 92685 | running 31 steps of evaluation...
Traceback (most recent call last):
File "models_v6/official/vision/beta/train.py", line 68, in
/home/pengsong5550/models_v6/official/vision/beta/evaluation/segmentation_metrics.py:68 update_state *
predictions = tf.concat(predictions, axis=0)
/home/pengsong5550/.local/lib/python3.7/site-packages/tensorflow/python/util/dispatch.py:206 wrapper **
return target(*args, **kwargs)
/home/pengsong5550/.local/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py:1765 concat
return gen_array_ops.concat_v2(values=values, axis=axis, name=name)
/home/pengsong5550/.local/lib/python3.7/site-packages/tensorflow/python/ops/gen_array_ops.py:1193 concat_v2
_ops.raise_from_not_ok_status(e, name)
/home/pengsong5550/.local/lib/python3.7/site-packages/tensorflow/python/framework/ops.py:6870 raise_from_not_ok_status
six.raise_from(core._status_to_exception(e.code, message), None)
<string>:3 raise_from
InvalidArgumentError: 9 root error(s) found.
(0) Invalid argument: {{function_node __inference_eval_step_27564}} Compilation failure: Reshape's input dynamic dimension is decomposed into multiple output dynamic dimensions, but the constraint is ambiguous and XLA can't infer the output dimension %reshape.1875 = f32[2,2,2,32,64,512]{5,4,3,2,1,0} reshape(f32[<=8,32,64,512]{3,2,1,0} %convolution.1874), metadata={op_type="BatchToSpaceND" op_name="segmentation_model/dilated_res_net/bottleneck_block_13/conv2d_2/Conv2D/BatchToSpaceND"}.
TPU compilation failed
[[{{node tpu_compile_succeeded_assert/_14560536699636151667/_7}}]]
[[cluster_eval_step/control_after/_1/_641]]
(1) Invalid argument: {{function_node __inference_eval_step_27564}} Compilation failure: Reshape's input dynamic dimension is decomposed into multiple output dynamic dimensions, but the constraint is ambiguous and XLA can't infer the output dimension %reshape.1875 = f32[2,2,2,32,64,512]{5,4,3,2,1,0} reshape(f32[<=8,32,64,512]{3,2,1,0} %convolution.1874), metadata={op_type="BatchToSpaceND" op_name="segmentation_model/dilated_res_net/bottleneck_block_13/conv2d_2/Conv2D/BatchToSpaceND"}.
TPU compilation failed
[[{{node tpu_compile_succeeded_assert/_14560536699636151667/_7}}]]
[[TPUReplicate/_compile/_8454392216736383026/_6/_322]]
(2) Invalid argument: {{function_node __inference_eval_step_27564}} Compilation failure: Reshape's input dynamic dimension is decomposed into multiple output dynamic dimensions, but the constraint is ambiguous and XLA can't infer the output dimension %reshape.1875 = f32[2,2,2,32,64,512]{5,4,3,2,1,0} reshape(f32[<=8,32,64,512]{3,2,1,0} %convolution.1874), metadata={op_type="BatchToSpaceND" op_name="segmentation_model/dilated_res_net/bottleneck_block_13/conv2d_2/Conv2D/BatchToSpaceND"}.
TPU compilation failed
[[{{node tpu_compile_succeeded_assert/_14560536699636151667/_7}}]]
[[cluster_eval_step/control_after/_1/_561]]
(3) Invalid argument: {{function_node __inference_eval_step_27564}} Compilation failure: Reshape's input dynamic dimension is decomposed into multiple output dynamic dimensions, but the constraint is ambiguous and XLA can't infer the output dimension %reshape.1875 = f32[2,2,2,32,64,512]{5,4,3,2,1,0} reshape(f32[<=8,32,64,512]{3,2,1,0} %convolution.1874), metadata={op_type="BatchToSpaceND" op_name="segmentation_model/dilated_res_net/bottleneck_block_13/conv2d_2/Conv2D/BatchToSpaceND"}.
TPU compilation failed
[[{{node tpu_compile_succeeded_assert/_14560536699636151667/_7}}]]
[[cluster_eval_step/control_after/_1/_477]]
(4) Invalid argument: {{function_node __inference_eval_step_27564}} Compilation failure: Reshape's input dynamic dimension is decomposed into multiple output dynamic dimensions, but the constraint is ambiguous and XLA can't infer the output dimension %reshape.1875 = f32[2,2,2,32,64,512]{5,4,3,2,1,0} reshape(f32[<=8,32,64,512]{3,2,1,0} %convolution.1874), metadata={op_type="BatchToSpaceND" op_name="segmentation_model/dilated_res_net/bottleneck_block_13/conv2d_2/Conv2D/BatchToSpaceND"}.
TPU compilation ... [truncated] [Op:ConcatV2] name: concat
Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/home/pengsong5550/.local/lib/python3.7/site-packages/tensorflow/python/distribute/tpu_strategy.py", line 738, in async_wait context.async_wait() File "/home/pengsong5550/.local/lib/python3.7/site-packages/tensorflow/python/eager/context.py", line 2381, in async_wait context().sync_executors() File "/home/pengsong5550/.local/lib/python3.7/site-packages/tensorflow/python/eager/context.py", line 648, in sync_executors pywrap_tfe.TFE_ContextSyncExecutors(self._context_handle) tensorflow.python.framework.errors_impl.InvalidArgumentError: 9 root error(s) found. (0) Invalid argument: {{function_node __inference_eval_step_27564}} Compilation failure: Reshape's input dynamic dimension is decomposed into multiple output dynamic dimensions, but the constraint is ambiguous and XLA can't infer the output dimension %reshape.1875 = f32[2,2,2,32,64,512]{5,4,3,2,1,0} reshape(f32[<=8,32,64,512]{3,2,1,0} %convolution.1874), metadata={op_type="BatchToSpaceND" op_name="segmentation_model/dilated_res_net/bottleneck_block_13/conv2d_2/Conv2D/BatchToSpaceND"}. TPU compilation failed [[{{node tpu_compile_succeeded_assert/_14560536699636151667/_7}}]] [[cluster_eval_step/control_after/_1/_641]] (1) Invalid argument: {{function_node __inference_eval_step_27564}} Compilation failure: Reshape's input dynamic dimension is decomposed into multiple output dynamic dimensions, but the constraint is ambiguous and XLA can't infer the output dimension %reshape.1875 = f32[2,2,2,32,64,512]{5,4,3,2,1,0} reshape(f32[<=8,32,64,512]{3,2,1,0} %convolution.1874), metadata={op_type="BatchToSpaceND" op_name="segmentation_model/dilated_res_net/bottleneck_block_13/conv2d_2/Conv2D/BatchToSpaceND"}. TPU compilation failed [[{{node tpu_compile_succeeded_assert/_14560536699636151667/_7}}]] [[TPUReplicate/_compile/_8454392216736383026/_6/_322]] (2) Invalid argument: {{function_node __inference_eval_step_27564}} Compilation failure: Reshape's input dynamic dimension is decomposed into multiple output dynamic dimensions, but the constraint is ambiguous and XLA can't infer the output dimension %reshape.1875 = f32[2,2,2,32,64,512]{5,4,3,2,1,0} reshape(f32[<=8,32,64,512]{3,2,1,0} %convolution.1874), metadata={op_type="BatchToSpaceND" op_name="segmentation_model/dilated_res_net/bottleneck_block_13/conv2d_2/Conv2D/BatchToSpaceND"}. TPU compilation failed [[{{node tpu_compile_succeeded_assert/_14560536699636151667/_7}}]] [[cluster_eval_step/control_after/_1/_561]] (3) Invalid argument: {{function_node __inference_eval_step_27564}} Compilation failure: Reshape's input dynamic dimension is decomposed into multiple output dynamic dimensions, but the constraint is ambiguous and XLA can't infer the output dimension %reshape.1875 = f32[2,2,2,32,64,512]{5,4,3,2,1,0} reshape(f32[<=8,32,64,512]{3,2,1,0} %convolution.1874), metadata={op_type="BatchToSpaceND" op_name="segmentation_model/dilated_res_net/bottleneck_block_13/conv2d_2/Conv2D/BatchToSpaceND"}. TPU compilation failed [[{{node tpu_compile_succeeded_assert/_14560536699636151667/_7}}]] [[cluster_eval_step/control_after/_1/_477]] (4) Invalid argument: {{function_node _inference_eval_step_27564}} Compilation failure: Reshape's input dynamic dimension is decomposed into multiple output dynamic dimensions, but the constraint is ambiguous and XLA can't infer the output dimension %reshape.1875 = f32[2,2,2,32,64,512]{5,4,3,2,1,0} reshape(f32[<=8,32,64,512]{3,2,1,0} %convolution.1874), metadata={op_type="BatchToSpaceND" op_name="segmentation_model/dilated_res_net/bottleneck_block_13/conv2d_2/Conv2D/BatchToSpaceND"}. TPU compilation ... [truncated] WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.iter W1227 03:54:14.961107 140105914853184 util.py:161] Unresolved object in checkpoint: (root).optimizer.iter WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.decay W1227 03:54:14.961367 140105914853184 util.py:161] Unresolved object in checkpoint: (root).optimizer.decay WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.momentum W1227 03:54:14.961489 140105914853184 util.py:161] Unresolved object in checkpoint: (root).optimizer.momentum WARNING:tensorflow:A checkpoint was restored (e.g. tf.train.Checkpoint.restore or tf.keras.Model.load_weights) but not all checkpointed values were used. See above for specific issues. Use expect_partial() on the load status object, e.g. tf.train.Checkpoint.restore(...).expect_partial(), to silence these warnings, or use assert_consumed() to make the check explicit. See https://www.tensorflow.org/guide/checkpoint#loading_mechanics for details. W1227 03:54:14.961649 140105914853184 util.py:169] A checkpoint was restored (e.g. tf.train.Checkpoint.restore or tf.keras.Model.load_weights) but not all checkpointed values were used. See above for specific issues. Use expect_partial() on the load status object, e.g. tf.train.Checkpoint.restore(...).expect_partial(), to silence these warnings, or use assert_consumed() to make the check explicit. See https://www.tensorflow.org/guide/checkpoint#loading_mechanics for details. 2020-12-27 03:54:15.624241: W ./tensorflow/core/distributed_runtime/eager/destroy_tensor_handle_node.h:57] Ignoring an error encountered when deleting remote tensors handles: Invalid argument: Unable to find the relevant tensor remote_handle: Op ID: 18449, Output num: 39 Additional GRPC error information from remote target /job:worker/replica:0/task:0: :{"created":"@1609041255.613707222","description":"Error received from peer ipv4:10.83.22.90:8470","file":"external/com_github_grpc_grpc/src/core/lib/surface/call.cc","file_line":1056,"grpc_message":"Unable to find the relevant tensor remote_handle: Op ID: 18449, Output num: 39","grpc_status":3}
3. Steps to reproduce
just set the mode to eval when experiment is 'seg_deeplabv3plus_cityscapes' scripy like: python3 models/official/vision/beta/train.py --tpu=tpu2 --model_dir=gs://cityscapes --mode=eval --experiment=seg_deeplabv3plus_cityscapes
4. Expected behavior
work well and report the evaluated miou.
5. Additional context
6. System information
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): linux debian google cloud instance
- Mobile device name if the issue happens on a mobile device:
- TensorFlow installed from (source or binary): install from binary
- TensorFlow version (use command below): tf-nighly-2.5.0.dev20201226
- Python version: 3.7.3
- Bazel version (if compiling from source):
- GCC/Compiler version (if compiling from source):
- CUDA/cuDNN version: no
- GPU model and memory: no
Is validation data properly located? Can you make sure validation data is processed and located correctly at the validation input_path. Also make sure there are no files other than tfrecords at the validation input_path.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you.
Closing as stale. Please reopen if you'd like to work on this further.
This error still exists
@evanatyourservice I wasn't able to reproduce the error. Are you using the latest tf release 2.6? Are you using the latest official release? Can you list here the config printed when running the eval?