models icon indicating copy to clipboard operation
models copied to clipboard

Segmentation model evaluate mode error.

Open weichen456 opened this issue 5 years ago • 6 comments

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 app.run(main) File "/home/pengsong5550/.local/lib/python3.7/site-packages/absl/app.py", line 303, in run _run_main(main, args) File "/home/pengsong5550/.local/lib/python3.7/site-packages/absl/app.py", line 251, in _run_main 2020-12-27 03:54:14.409732: W tensorflow/core/distributed_runtime/eager/remote_tensor_handle_data.cc:76] Unable to destroy remote tensor handles. If you are running a tf.function, it usually indicates some op in the graph gets an error: 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] sys.exit(main(argv)) File "models_v6/official/vision/beta/train.py", line 64, in main model_dir=model_dir) File "/home/pengsong5550/models_v6/official/core/train_lib.py", line 125, in run_experiment controller.evaluate(steps=params.trainer.validation_steps) File "/home/pengsong5550/models_v6/orbit/controller.py", line 260, in evaluate eval_output = self.evaluator.evaluate(steps_tensor) File "/home/pengsong5550/models_v6/orbit/standard_runner.py", line 280, in evaluate eval_iter, num_steps, state=outputs, reduce_fn=self.eval_reduce) File "/home/pengsong5550/models_v6/orbit/utils/loop_fns.py", line 76, in loop_fn state = reduce_fn(state, outputs) File "/home/pengsong5550/models_v6/official/core/base_trainer.py", line 357, in eval_reduce return self.task.aggregate_logs(state, step_outputs) File "/home/pengsong5550/models_v6/official/vision/beta/tasks/semantic_segmentation.py", line 255, in aggregate_logs step_outputs[self.miou_metric.name][1]) File "/home/pengsong5550/.local/lib/python3.7/site-packages/tensorflow/python/keras/utils/metrics_utils.py", line 90, in decorated update_op = update_state_fn(*args, **kwargs) File "/home/pengsong5550/.local/lib/python3.7/site-packages/tensorflow/python/keras/metrics.py", line 179, in update_state_fn return ag_update_state(*args, **kwargs) File "/home/pengsong5550/.local/lib/python3.7/site-packages/tensorflow/python/autograph/impl/api.py", line 674, in wrapper raise e.ag_error_metadata.to_exception(e) tensorflow.python.framework.errors_impl.InvalidArgumentError: in user code:

/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

weichen456 avatar Dec 27 '20 04:12 weichen456

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.

arashwan avatar Jan 09 '21 00:01 arashwan

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.

google-ml-butler[bot] avatar Jan 22 '21 07:01 google-ml-butler[bot]

Closing as stale. Please reopen if you'd like to work on this further.

google-ml-butler[bot] avatar Jan 29 '21 08:01 google-ml-butler[bot]

Are you satisfied with the resolution of your issue? Yes No

google-ml-butler[bot] avatar Jan 29 '21 08:01 google-ml-butler[bot]

This error still exists

evanatyourservice avatar Jul 07 '21 23:07 evanatyourservice

@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?

arashwan avatar Jul 07 '21 23:07 arashwan