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

Compatibility Issues with tf.keras.metrics.F1Score on Python 3.9 and 3.10 #224

Open
rizoudal opened this issue Jul 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@rizoudal
Copy link

With the recent update where TensorFlow Addons deprecated support for F1Score and by using the F1Score function of tf.keras, problems arise. Specifically, the num_classes parameter is no longer supported in the tf.keras.metrics.F1Score.

After updating the code to import F1Score from tf.keras and removing the num_classes parameter, the following errors occur during testing on GitHub Actions with Python versions 3.9 and 3.10:

ValueError: Tensor conversion requested dtype float32 for Tensor with dtype int64: <tf.Tensor 'IteratorGetNext:1' shape=(None, None) dtype=int64>

and/or

ValueError: Tensor conversion requested dtype float32 for Tensor with dtype uint8: <tf.Tensor 'IteratorGetNext:1' shape=(None, None) dtype=uint8>

Errors occur in the following tests:

• tests/test_automl_block_train.py
• tests/test_automl_block_pred.py

Please review and address this issue to maintain compatibility with the new tf.keras metric implementations.

Thank you!

@muellerdo
Copy link
Member

Maybe the following could be a solution:

in data_processing/data_generator.py

in line 296:

batch_stack[1].extend(np.float32(self.labels[index_array]))

add np.float32() cast to labels

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants