Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling PyTorch as backend for the GAN training step #9

Open
mbarbetti opened this issue Jul 2, 2024 · 0 comments
Open

Enabling PyTorch as backend for the GAN training step #9

mbarbetti opened this issue Jul 2, 2024 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed python Pull requests that update Python code

Comments

@mbarbetti
Copy link
Owner

Starting from the v0.2.0 release PIDGAN is compatible with the new multi-backend Keras 3.

Keras 3 is a full rewrite of Keras that enables you to run your Keras workflows on top of either JAX, TensorFlow, or PyTorch, and that unlocks brand new large-scale model training and deployment capabilities.

At the moment, training GAN models is only possible by using the TensorFlow backend. For example, if we look at lines 173-183 of the Keras3-based GAN class, we have

def train_step(self, *args, **kwargs):
  if keras.backend.backend() == "tensorflow":
    return self._tf_train_step(*args, **kwargs)
  elif keras.backend.backend() == "torch":
     raise NotImplementedError("`train_step()` not implemented for the PyTorch backend")
  elif keras.backend.backend() == "jax":
     raise NotImplementedError("`train_step()` not implemented for the Jax backend")

The goal of this issue is to implement the train_step() also for the PyTorch backend. In addition to the "plain" training step, also the Lipschitz regularization functions should be adapted to rely on the PyTorch backend.

@mbarbetti mbarbetti added enhancement New feature or request help wanted Extra attention is needed python Pull requests that update Python code labels Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed python Pull requests that update Python code
Projects
None yet
Development

No branches or pull requests

1 participant