addons
                                
                                 addons copied to clipboard
                                
                                    addons copied to clipboard
                            
                            
                            
                        AdamW weight_decay cannot be model.saved() TypeError: Unable to serialize
TypeError: Unable to serialize 1.0000000656873453e-05 to JSON. Unrecognized type <class 'tensorflow.python.framework.ops.EagerTensor'>.
https://stackoverflow.com/questions/69882263/tf-keras-callbacks-modelcheckpoint-type-error-unable-to-serialize-1-0000000656
wd is directly copy-&-pasted from:
https://www.tensorflow.org/addons/api_docs/python/tfa/optimizers/AdamW
step = tf.Variable(0, trainable=False)
schedule = tf.optimizers.schedules.PiecewiseConstantDecay(
    [10000, 15000], [1e-0, 1e-1, 1e-2])
# lr and wd can be a function or a tensor
lr = 1e-1 * schedule(step)
wd = lambda: 1e-4 * schedule(step)
# ...
optimizer = tfa.optimizers.AdamW(learning_rate=lr, weight_decay=wd)
On stackoverflow, there is a workaround (kind of hackish). But I'm wondering:
- can this be fixed directly here?
- is there a better proper workaround?
Thanks.