{"record":{"id":"3768f9726bd9b9e0","repo":"tensorflow/models","slug":"steps-per-loop-is-required-when-trainer-is-pro","errorCode":null,"errorMessage":"`steps_per_loop` is required when `trainer` is provided.","messagePattern":"`steps_per_loop` is required when `trainer` is provided\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"orbit/controller.py","lineNumber":187,"sourceCode":"        created internally for TensorBoard summaries by default from the\n        `summary_dir`.\n      eval_summary_manager: Instance of the eval summary manager. If set, the\n        `eval_summary_dir` will be ignored. Otherwise the eval summary manager\n        will be created internally for TensorBoard summaries by default from the\n        `eval_summary_dir`.\n\n    Raises:\n      ValueError: If both `trainer` and `evaluator` are `None`.\n      ValueError: If `steps_per_loop` is not a positive integer or a callable.\n      ValueError: If `summary_interval` is not a positive integer or is not\n        divisible by `steps_per_loop`.\n    \"\"\"\n    if trainer is None and evaluator is None:\n      raise ValueError(\"`trainer` and `evaluator` should not both be `None`.\")\n\n    if trainer is not None:\n      if steps_per_loop is None:\n        raise ValueError(\n            \"`steps_per_loop` is required when `trainer` is provided.\")\n      elif not callable(steps_per_loop) and (\n          not isinstance(steps_per_loop, int) or steps_per_loop < 1):\n        raise ValueError(\n            f\"`steps_per_loop` ({steps_per_loop}) must be a positive integer \"\n            \"or a callable.\")\n\n      if summary_interval is not None:\n        if summary_interval <= 0:\n          raise ValueError(\n              f\"`summary_interval` ({summary_interval}) must be larger than 0.\")\n        elif not callable(steps_per_loop) and (summary_interval % steps_per_loop\n                                               != 0):\n          raise ValueError(\n              f\"`summary interval` ({summary_interval}) must be a multiple \"\n              f\"of `steps_per_loop` ({steps_per_loop}).\")\n\n    if not isinstance(global_step, tf.Variable):","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/orbit/controller.py#L169-L205","documentation":"Error \"`steps_per_loop` is required when `trainer` is provided.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at orbit/controller.py:187 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass steps_per_loop when constructing the Controller with a trainer.","Set steps_per_loop to the number of steps executed per train loop iteration."],"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"}