manicman1999/StyleGAN2-Tensorflow-2.0

Can you make this work with Tensorflow 2.4.1 and above with tf.distribute.MirroredStrategy()

Opened this issue · 2 comments

I almost give up that it keep posing error after error running with tf.distribute.MirroredStrategy().

ValueError: in user code:

<ipython-input-43-fa18d8117b40>:554 train_step  *
    gradients_of_generator = gen_tape.gradient(gen_loss, self.GAN.GM.trainable_variables)
C:\Users\ThuSi\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\eager\backprop.py:1064 gradient  **
    flat_sources = [_handle_or_self(x) for x in flat_sources]
C:\Users\ThuSi\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\eager\backprop.py:1064 <listcomp>
    flat_sources = [_handle_or_self(x) for x in flat_sources]
C:\Users\ThuSi\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\eager\backprop.py:729 _handle_or_self
    return x.handle
C:\Users\ThuSi\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\distribute\values.py:639 handle
    raise ValueError("`handle` is not available outside the replica context"

ValueError: `handle` is not available outside the replica context or a `tf.distribute.Strategy.update()` call.

Can you make this work with Tensorflow 2.4.1 and above with tf.distribute.MirroredStrategy()

Thanks,
Steve

Hi! I'm currently in the middle of updating this code to work with multi-GPU machines and adaptive discriminator augmentation; keep an eye out for that!

Hi, where are you on this? Do you have some idea on when the MirroredStrategy() will work?