keras-io icon indicating copy to clipboard operation
keras-io copied to clipboard

"Denoising Diffusion Implicit Model" example broken in Colab

Open jorgejgnz opened this issue 3 years ago • 0 comments
trafficstars

The Colab notebook that exemplifies the implementation of DDIM in Keras does not work using default configuration.

Error in training cell:

AttributeError                            Traceback (most recent call last)
[<ipython-input-17-12d5033d5855>](https://localhost:8080/#) in <module>
      6 # optimizer=tfa.optimizers.AdamW
      7 model.compile(
----> 8     optimizer=keras.optimizers.experimental.AdamW(
      9         learning_rate=learning_rate, weight_decay=weight_decay
     10     ),

AttributeError: module 'keras.api._v2.keras.optimizers' has no attribute 'experimental'

Using:

  • Tensorflow 2.9.0
  • Keras 2.9.0

EDIT:

It can be fixed by installing the library that includes AdamW optimizer as it's not installed by default in Colab:

!pip install tf-nightly

But this arises a new error on checkpoint callback:

---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)

[<ipython-input-9-12d5033d5855>](https://localhost:8080/#) in <module>
     33     callbacks=[
     34         keras.callbacks.LambdaCallback(on_epoch_end=model.plot_images),
---> 35         checkpoint_callback,
     36     ],
     37 )

1 frames

[/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py](https://localhost:8080/#) in error_handler(*args, **kwargs)
     65             return fn(*args, **kwargs)
     66         except Exception as e:
---> 67             filtered_tb = _process_traceback_frames(e.__traceback__)
     68             # To get the full stack trace, call:
     69             # `tf.debugging.disable_traceback_filtering()`

[<ipython-input-8-7570dd8bce01>](https://localhost:8080/#) in train_step(self, images)
    112 
    113         gradients = tape.gradient(noise_loss, self.network.trainable_weights)
--> 114         self.optimizer.apply_gradients(zip(gradients, self.network.trainable_weights))
    115 
    116         self.noise_loss_tracker.update_state(noise_loss)

TypeError: in user code:


    TypeError: tf___process_kwargs() takes 2 positional arguments but 4 were given

jorgejgnz avatar Sep 01 '22 17:09 jorgejgnz