{"record":{"id":"a5709d115cbd2c00","repo":"tensorflow/models","slug":"threshold-for-checking-stop-conditions-must-be-a-n","errorCode":null,"errorMessage":"Threshold for checking stop conditions must be a number.","messagePattern":"Threshold for checking stop conditions must be a number\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/utils/misc/model_helpers.py","lineNumber":44,"sourceCode":"def past_stop_threshold(stop_threshold, eval_metric):\n  \"\"\"Return a boolean representing whether a model should be stopped.\n\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):","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/utils/misc/model_helpers.py#L26-L62","documentation":"Error \"Threshold for checking stop conditions must be a number.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/utils/misc/model_helpers.py:44 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"}