Wasserstein GAN in Swift for TensorFlow

I just open-sourced my Wasserstein GAN implementation in Swift for TensorFlow on GitHub. I have also written a Medium article on this work.

Y’all can simply run it in Google Colaboratory. Please go and check it out! And I hope this might interest you too @clattner! :smile:


Do you have some example images of what it produced?

1 Like

Great work Rahul, I love it! Your blog post is also a really great summary. I’d love to see some example generated images too

1 Like

Awesome work, @rahulbhalley! Are you interested in adding it to our official model garden?

1 Like

I want to show generated images but I think there is some problem with generatorModel update so images are not generating well. I am trying to fix it. I am really sorry for this [some unknown] problem in my code.

I would definitely love to contribute to Swift model garden. But there is some problem in training of generatorModel I think & images aren’t generating good after some steps.

The problem is I can’t shut down gradient computation in criticModel during generatorModel train step as output of generatorModel goes into criticModel. In case of criticModel training step I could shut down grad computation in generatorModel by simply calling .withoutDerivative() but there must be some way to stop grad computation of specific model itself so that I can restrict criticModel from computing gradients.

Possible solution: To run forward pass of criticModel, after generatorModel forward pass, in some Context.trainingPhase = .inference to stop grad computes. Will this work to shut down gradient updates of criticModel letting grad computes only for generatorModel?

@rxwei I’d like to have some help if you are free to make WGAN train nicely so that I can contribute to Swift model garden. :slightly_smiling_face:

It’s not actually good yet but I’m working on it. I’ll present them generated images back in here once I fix a little bug in my code. :slightly_smiling_face:

1 Like