...
loss = tfa.losses.SigmoidFocalCrossEntropy(from_logits=True, reduction='auto')
l_bert = bert.BertModelLayer.from_params(bert_params, name='albert' if albert else "bert")
l_input_ids = tf.keras.layers.Input(shape=(max_seq_length,), dtype='int32', name="input_ids")
l_mask_ids = tf.keras.layers.Input(shape=(max_seq_length,), dtype='int32', name="mask_ids")
l_token_type_ids = tf.keras.layers.Input(shape=(max_seq_length,), dtype='int32', name="token_type_ids")
output = l_bert([l_input_ids, l_token_type_ids], mask=l_mask_ids)
logits = tf.keras.layers.Dense(num_labels, kernel_initializer=tf.keras.initializers.TruncatedNormal(bert_params.initializer_range))(output)
model = tf.keras.Model(inputs=[l_input_ids, l_mask_ids, l_token_type_ids], outputs=logits)
model.build(input_shape=(None, max_seq_length))
model.fit(...)
...
System information
Describe the bug
When using
tfa.losses.SigmoidFocalCrossEntropy(from_logits=True, reduction='auto')the model raised ValueError:ValueError: Found unexpected keys that do not correspond to any Model output: dict_keys(['class_name', 'config']). Expected: ['dense']Code to reproduce the issue
Other info / logs