{"record":{"id":"40e6a6608cfe9b0f","repo":"tensorflow/models","slug":"eval-metric-being-checked-against-stop-conditions","errorCode":null,"errorMessage":"Eval metric being checked against stop conditions must be a number.","messagePattern":"Eval metric being checked against stop conditions must be a number\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/utils/misc/model_helpers.py","lineNumber":46,"sourceCode":"\n  Args:\n    stop_threshold: float, the threshold above which a model should stop\n      training.\n    eval_metric: float, the current value of the relevant metric to check.\n\n  Returns:\n    True if training should stop, False otherwise.\n\n  Raises:\n    ValueError: if either stop_threshold or eval_metric is not a number\n  \"\"\"\n  if stop_threshold is None:\n    return False\n\n  if not isinstance(stop_threshold, numbers.Number):\n    raise ValueError(\"Threshold for checking stop conditions must be a number.\")\n  if not isinstance(eval_metric, numbers.Number):\n    raise ValueError(\"Eval metric being checked against stop conditions \"\n                     \"must be a number.\")\n\n  if eval_metric >= stop_threshold:\n    logging.info(\"Stop threshold of {} was passed with metric value {}.\".format(\n        stop_threshold, eval_metric))\n    return True\n\n  return False\n\n\ndef generate_synthetic_data(input_shape,\n                            input_value=0,\n                            input_dtype=None,\n                            label_shape=None,\n                            label_value=0,\n                            label_dtype=None):\n  \"\"\"Create a repeating dataset with constant values.\n","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/utils/misc/model_helpers.py#L28-L64","documentation":"Error \"Eval metric being checked against stop conditions must be a number.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/utils/misc/model_helpers.py:46 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}