{"record":{"id":"eefddddd139f7781","repo":"tensorflow/models","slug":"steps-per-loop-should-be-positive-integer-eefddd","errorCode":null,"errorMessage":"steps_per_loop should be positive integer.","messagePattern":"steps_per_loop should be positive integer\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/legacy/detection/executor/distributed_executor.py","lineNumber":53,"sourceCode":"\nFLAGS = flags.FLAGS\n\nstrategy_flags_dict = hyperparams_flags.strategy_flags_dict\nhparam_flags_dict = hyperparams_flags.hparam_flags_dict\n\n\ndef _save_checkpoint(checkpoint, model_dir, checkpoint_prefix):\n  \"\"\"Saves model to model_dir with provided checkpoint prefix.\"\"\"\n\n  checkpoint_path = os.path.join(model_dir, checkpoint_prefix)\n  saved_path = checkpoint.save(checkpoint_path)\n  logging.info('Saving model as TF checkpoint: %s', saved_path)\n\n\ndef _steps_to_run(current_step, total_steps, steps_per_loop):\n  \"\"\"Calculates steps to run on device.\"\"\"\n  if steps_per_loop <= 0:\n    raise ValueError('steps_per_loop should be positive integer.')\n  return min(total_steps - current_step, steps_per_loop)\n\n\ndef _no_metric():\n  return None\n\n\ndef metrics_as_dict(metric):\n  \"\"\"Puts input metric(s) into a list.\n\n  Args:\n    metric: metric(s) to be put into the list. `metric` could be an object, a\n      list, or a dict of tf_keras.metrics.Metric or has the `required_method`.\n\n  Returns:\n    A dictionary of valid metrics.\n  \"\"\"\n  if isinstance(metric, tf_keras.metrics.Metric):","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/legacy/detection/executor/distributed_executor.py#L35-L71","documentation":"Error \"steps_per_loop should be positive integer.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/legacy/detection/executor/distributed_executor.py:53 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"}