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

Fix: correct metrics argument format in model.compile #280

Merged
merged 1 commit into from
Jan 8, 2025

Conversation

yclian0528
Copy link
Contributor

This PR fixes a ValueError occurring when calling model.compile() in hockey_stick_tester.py with TensorFlow/Keras 2.15.0 (from requirements.txt). The metrics argument should be passed as a list, tuple, or dict, but it was originally passed as a single object. The fix updates the code to pass the metrics argument as a list, resolving the error.

Original error message:

ValueError: Expected `metrics` argument to be a list, tuple, or dict. Received instead: metrics=<BinaryAccuracy name=binary_accuracy> of type <class 'keras.src.metrics.accuracy_metrics.BinaryAccuracy'>"

Resolved a ValueError caused by passing a single metric object to the `metrics` argument of `model.compile`. Updated it to a list containing `tf.keras.metrics.BinaryAccuracy` to comply with Keras requirements.

Error message:
ValueError: Expected `metrics` argument to be a list, tuple, or dict.
@miracvbasaran
Copy link
Collaborator

Thanks for the PR!

@miracvbasaran miracvbasaran merged commit d23c270 into google:main Jan 8, 2025
7 of 8 checks passed
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

Successfully merging this pull request may close these issues.

2 participants