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

ValueError: decay is deprecated in the new Keras optimizer, pleasecheck the docstring for valid arguments, or use the legacy optimizer, e.g., tf.keras.optimizers.legacy.SGD. #38

Open
MrIzzat opened this issue May 17, 2024 · 0 comments

Comments

@MrIzzat
Copy link

MrIzzat commented May 17, 2024

The model creation part of the course at 3:31:00 raises some errors due to the new versions of TensorFlow changing some things around with how optimizers work. I recommend modifying the simpsons.py file as specified by this answer here.

The issue is specifically with this code in the tutorial:

model = canaro.models.createSimpsonsModel(IMG_SIZE=imageSize, channels=channels, output_dim=len(characters),
                                         loss='binary_crossentropy', decay=1e-7, learning_rate=0.001, momentum=0.9,
                                         nesterov=True)

Which can be fixed by adding this line in the simpsons.py file right before the return line:

import tensorflow as tf
lr_schedule = tf.keras.optimizers.schedules.ExponentialDecay(
    initial_learning_rate=0.01,
    decay_steps=10000,
    decay_rate=0.9)
optimizer = tf.keras.optimizers.Adam(learning_rate=lr_schedule)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant