Addons: Keras model save using WeightedKappaLoss errors, not json serializable

Created on 16 Jul 2020  路  3Comments  路  Source: tensorflow/addons

Describe the bug

Keras model compiled with WeightedKappaLoss errors when saving, "TypeError: ('Not JSON Serializable:', tf.float32)"

Code to reproduce the issue

model = Sequential()

model._set_inputs(tf.keras.Input((256,256,3)))
model.add(layers.Dense(6, activation='softmax'))

model.compile(Adam(lr=1e-3), tfa.losses.WeightedKappaLoss(num_classes=6, weightage='quadratic'))
model.save('test')
bug losses

Most helpful comment

@WindQAQ Thanks for fixing this! What is the release cycle like for this repo? I can use from master from now but would be useful to know when the next release would likely get tagged

Hi @ConnorBarnhill, we might pin tensorflow-addons 0.11 to tensorFlow 2.3. If you want to try the new stuff on master branch, you can use our daily build via pip install tfa-nightly. Thank you again for reporting the issue. We really appreciate it!

All 3 comments

Thanks for reporting this! It's because tf.dtypes.DType cannot be serializable. IMO, we should not set this as attribute. I'll submit a PR for this. Thank you again for the input.

@WindQAQ Thanks for fixing this! What is the release cycle like for this repo? I can use from master from now but would be useful to know when the next release would likely get tagged

@WindQAQ Thanks for fixing this! What is the release cycle like for this repo? I can use from master from now but would be useful to know when the next release would likely get tagged

Hi @ConnorBarnhill, we might pin tensorflow-addons 0.11 to tensorFlow 2.3. If you want to try the new stuff on master branch, you can use our daily build via pip install tfa-nightly. Thank you again for reporting the issue. We really appreciate it!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ididhmc picture ididhmc  路  4Comments

seanpmorgan picture seanpmorgan  路  3Comments

pikaliov picture pikaliov  路  3Comments

seanpmorgan picture seanpmorgan  路  3Comments

seanpmorgan picture seanpmorgan  路  4Comments