davidADSP / Generative_Deep_Learning_2nd_Edition

The official code repository for the second edition of the O'Reilly book Generative Deep Learning: Teaching Machines to Paint, Write, Compose and Play.
https://www.oreilly.com/library/view/generative-deep-learning/9781098134174/
Apache License 2.0
1.11k stars 418 forks source link

Issue with AdamW on Apple M1 #15

Open sigma-andex opened 1 year ago

sigma-andex commented 1 year ago

There seems to be a problem when trying to run the denoising diffusion models on Apple Silicon. This seems to be the related keras issue: https://github.com/keras-team/tf-keras/issues/176 See also: https://developer.apple.com/forums/thread/729732

I was able to get it running using the legacy.Adam optimizer:

ddm.compile(
    # optimizer=optimizers.experimental.AdamW(
    #     learning_rate=LEARNING_RATE, weight_decay=WEIGHT_DECAY
    # ),
    optimizer=optimizers.legacy.Adam(
        learning_rate=LEARNING_RATE
    ),
    loss=losses.mean_absolute_error,
)

Not sure how this effects the quality of this model though...