tensorflow/models · error · ValueError
Eval metric being checked against stop conditions must be a
Error message
Eval metric being checked against stop conditions must be a number.
What it means
Error "Eval metric being checked against stop conditions must be a number." thrown in tensorflow/models.
Source
Thrown at official/utils/misc/model_helpers.py:46
Args:
stop_threshold: float, the threshold above which a model should stop
training.
eval_metric: float, the current value of the relevant metric to check.
Returns:
True if training should stop, False otherwise.
Raises:
ValueError: if either stop_threshold or eval_metric is not a number
"""
if stop_threshold is None:
return False
if not isinstance(stop_threshold, numbers.Number):
raise ValueError("Threshold for checking stop conditions must be a number.")
if not isinstance(eval_metric, numbers.Number):
raise ValueError("Eval metric being checked against stop conditions "
"must be a number.")
if eval_metric >= stop_threshold:
logging.info("Stop threshold of {} was passed with metric value {}.".format(
stop_threshold, eval_metric))
return True
return False
def generate_synthetic_data(input_shape,
input_value=0,
input_dtype=None,
label_shape=None,
label_value=0,
label_dtype=None):
"""Create a repeating dataset with constant values.
View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/utils/misc/model_helpers.py:46 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24).
Data as JSON: /api/errors/40e6a6608cfe9b0f.
Report an issue: GitHub.