Thank for your greatest work!
i was tring to train a hit-gan model on one singel A100,
but i am not very familiar with tensorflow framework,
after i run the comand :
is there any steps i made that is wrong? Could you please offer some advice ?
python run.py --mode=train --dataset=ffhq/256
--train_batch_size=2 --train_steps=500000
--image_crop_size=256 --image_crop_proportion=1.0
--save_every_n_steps=1000
--latent_dim=512 --generator_lr=0.00005
--discriminator_lr=0.00005 --channel_multiplier=2
--use_consistency_regularization=True
--data_dir ./ffhq_tfrecords --model_dir ./output
--use_tpu=False
Log:
WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/hi_t_generator/Reshape:0' shape=(2, 4, 16, 512) dtype=float32>, <tf.Tensor 'while/hi_t_generator/sequential_1/batch_normalization/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
W0228 20:50:19.474379 140426522629888 sequential.py:366] Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/hi_t_generator/Reshape:0' shape=(2, 4, 16, 512) dtype=float32>, <tf.Tensor 'while/hi_t_generator/sequential_1/batch_normalization/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/hi_t_generator/Reshape_2:0' shape=(2, 16, 16, 512) dtype=float32>, <tf.Tensor 'while/hi_t_generator/sequential_1/batch_normalization/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
W0228 20:50:20.280509 140426522629888 sequential.py:366] Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/hi_t_generator/Reshape_2:0' shape=(2, 16, 16, 512) dtype=float32>, <tf.Tensor 'while/hi_t_generator/sequential_1/batch_normalization/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/hi_t_generator/Reshape_4:0' shape=(2, 16, 64, 256) dtype=float32>, <tf.Tensor 'while/hi_t_generator/sequential_1/batch_normalization/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
W0228 20:50:20.650825 140426522629888 sequential.py:366] Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/hi_t_generator/Reshape_4:0' shape=(2, 16, 64, 256) dtype=float32>, <tf.Tensor 'while/hi_t_generator/sequential_1/batch_normalization/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/hi_t_generator/Reshape_6:0' shape=(2, 64, 64, 128) dtype=float32>, <tf.Tensor 'while/hi_t_generator/sequential_1/batch_normalization/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
W0228 20:50:21.114238 140426522629888 sequential.py:366] Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/hi_t_generator/Reshape_6:0' shape=(2, 64, 64, 128) dtype=float32>, <tf.Tensor 'while/hi_t_generator/sequential_1/batch_normalization/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/hi_t_generator/position_embedding_5/add:0' shape=(2, 128, 128, 64) dtype=float32>, <tf.Tensor 'while/hi_t_generator/sequential_1/batch_normalization/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
W0228 20:50:21.439471 140426522629888 sequential.py:366] Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/hi_t_generator/position_embedding_5/add:0' shape=(2, 128, 128, 64) dtype=float32>, <tf.Tensor 'while/hi_t_generator/sequential_1/batch_normalization/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/hi_t_generator/position_embedding_6/add:0' shape=(2, 256, 256, 64) dtype=float32>, <tf.Tensor 'while/hi_t_generator/sequential_1/batch_normalization/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
W0228 20:50:21.661504 140426522629888 sequential.py:366] Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/hi_t_generator/position_embedding_6/add:0' shape=(2, 256, 256, 64) dtype=float32>, <tf.Tensor 'while/hi_t_generator/sequential_1/batch_normalization/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/Reshape_3:0' shape=(2, 4, 16, 512) dtype=float32>, <tf.Tensor 'while/sequential_13/batch_normalization_3/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
W0228 20:50:27.076365 140426522629888 sequential.py:366] Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/Reshape_3:0' shape=(2, 4, 16, 512) dtype=float32>, <tf.Tensor 'while/sequential_13/batch_normalization_3/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/Reshape_5:0' shape=(2, 16, 16, 512) dtype=float32>, <tf.Tensor 'while/sequential_13/batch_normalization_3/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
W0228 20:50:27.416526 140426522629888 sequential.py:366] Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/Reshape_5:0' shape=(2, 16, 16, 512) dtype=float32>, <tf.Tensor 'while/sequential_13/batch_normalization_3/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/Reshape_7:0' shape=(2, 16, 64, 256) dtype=float32>, <tf.Tensor 'while/sequential_13/batch_normalization_3/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
W0228 20:50:27.912703 140426522629888 sequential.py:366] Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/Reshape_7:0' shape=(2, 16, 64, 256) dtype=float32>, <tf.Tensor 'while/sequential_13/batch_normalization_3/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/Reshape_9:0' shape=(2, 64, 64, 128) dtype=float32>, <tf.Tensor 'while/sequential_13/batch_normalization_3/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
W0228 20:50:28.204938 140426522629888 sequential.py:366] Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/Reshape_9:0' shape=(2, 64, 64, 128) dtype=float32>, <tf.Tensor 'while/sequential_13/batch_normalization_3/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/position_embedding_12/add:0' shape=(2, 128, 128, 64) dtype=float32>, <tf.Tensor 'while/sequential_13/batch_normalization_3/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
W0228 20:50:28.492619 140426522629888 sequential.py:366] Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/position_embedding_12/add:0' shape=(2, 128, 128, 64) dtype=float32>, <tf.Tensor 'while/sequential_13/batch_normalization_3/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/position_embedding_13/add:0' shape=(2, 256, 256, 64) dtype=float32>, <tf.Tensor 'while/sequential_13/batch_normalization_3/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
W0228 20:50:28.661950 140426522629888 sequential.py:366] Layers in a Sequential model should only have a single input tensor, but we receive a <class 'tuple'> input: (<tf.Tensor 'while/position_embedding_13/add:0' shape=(2, 256, 256, 64) dtype=float32>, <tf.Tensor 'while/sequential_13/batch_normalization_3/FusedBatchNormV3:0' shape=(2, 1, 16, 512) dtype=float32>)
Consider rewriting this model with the Functional API.
INFO:tensorflow:Error reported to Coordinator: in user code:
File "/home/platform/sq/pro2022/hit-gan-main/trainers/gan_trainer.py", line 222, in _train_one_step *
self._update_ema_model()
File "/home/platform/sq/pro2022/hit-gan-main/trainers/gan_trainer.py", line 131, in _update_ema_model *
moving_averages.update_ema_variables(self.ema_generator.variables,
File "/home/platform/sq/pro2022/hit-gan-main/utils/moving_averages.py", line 73, in update_ema_variables *
replica_context.merge_call(_update_all_in_cross_replica_context_fn,
RuntimeError: in user code:
File "/home/platform/sq/pro2022/hit-gan-main/trainers/gan_trainer.py", line 222, in _train_one_step *
self._update_ema_model()
File "/home/platform/sq/pro2022/hit-gan-main/trainers/gan_trainer.py", line 131, in _update_ema_model *
moving_averages.update_ema_variables(self.ema_generator.variables,
File "/home/platform/sq/pro2022/hit-gan-main/utils/moving_averages.py", line 73, in update_ema_variables *
replica_context.merge_call(_update_all_in_cross_replica_context_fn,
RuntimeError: `merge_call` called while defining a new graph or a tf.function. This can often happen if the function `fn` passed to `strategy.run()` contains a nested `@tf.function`, and the nested `@tf.function` contains a synchronization point, such as aggregating gradients (e.g, optimizer.apply_gradients), or if the function `fn` uses a control flow statement which contains a synchronization point in the body. Such behaviors are not yet supported. Instead, please avoid nested `tf.function`s or control flow statements that may potentially cross a synchronization boundary, for example, wrap the `fn` passed to `strategy.run` or the entire `strategy.run` inside a `tf.function` or move the control flow out of `fn`. If you are subclassing a `tf.keras.Model`, please avoid decorating overridden methods `test_step` and `train_step` in `tf.function`.
Traceback (most recent call last):
File "run.py", line 190, in
app.run(main)
File "/home/platform/anaconda3/envs/GPEN/lib/python3.7/site-packages/absl/app.py", line 312, in run
_run_main(main, args)
File "/home/platform/anaconda3/envs/GPEN/lib/python3.7/site-packages/absl/app.py", line 258, in _run_main
sys.exit(main(argv))
File "run.py", line 179, in main
trainer.train()
File "/home/platform/sq/pro2022/hit-gan-main/trainers/base_trainer.py", line 210, in train
train_multiple_steps(iterator)
File "/home/platform/anaconda3/envs/GPEN/lib/python3.7/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/home/platform/anaconda3/envs/GPEN/lib/python3.7/site-packages/tensorflow/python/framework/func_graph.py", line 1129, in autograph_handler
raise e.ag_error_metadata.to_exception(e)
RuntimeError: in user code:
File "/home/platform/sq/pro2022/hit-gan-main/trainers/base_trainer.py", line 201, in train_multiple_steps *
self.strategy.run(self._train_one_step, args=(next(iterator),))
File "/home/platform/sq/pro2022/hit-gan-main/trainers/gan_trainer.py", line 222, in _train_one_step *
self._update_ema_model()
File "/home/platform/sq/pro2022/hit-gan-main/trainers/gan_trainer.py", line 131, in _update_ema_model *
moving_averages.update_ema_variables(self.ema_generator.variables,
File "/home/platform/sq/pro2022/hit-gan-main/utils/moving_averages.py", line 73, in update_ema_variables *
replica_context.merge_call(_update_all_in_cross_replica_context_fn,
RuntimeError: `merge_call` called while defining a new graph or a tf.function. This can often happen if the function `fn` passed to `strategy.run()` contains a nested `@tf.function`, and the nested `@tf.function` contains a synchronization point, such as aggregating gradients (e.g, optimizer.apply_gradients), or if the function `fn` uses a control flow statement which contains a synchronization point in the body. Such behaviors are not yet supported. Instead, please avoid nested `tf.function`s or control flow statements that may potentially cross a synchronization boundary, for example, wrap the `fn` passed to `strategy.run` or the entire `strategy.run` inside a `tf.function` or move the control flow out of `fn`. If you are subclassing a `tf.keras.Model`, please avoid decorating overridden methods `test_step` and `train_step` in `tf.function`.