{"record":{"id":"2f6dc367d1e81991","repo":"tensorflow/models","slug":"trainer-and-evaluator-should-not-both-be-none","errorCode":null,"errorMessage":"`trainer` and `evaluator` should not both be `None`.","messagePattern":"`trainer` and `evaluator` should not both be `None`\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"orbit/controller.py","lineNumber":183,"sourceCode":"        will be set to `summary_dir`. If both `summary_dir` and\n        `eval_summary_dir` are `None`, no eval summaries will be written.\n      summary_manager: Instance of the summary manager. If set, the\n        `summary_dir` will be ignored. Otherwise the summary manager will be\n        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(","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/orbit/controller.py#L165-L201","documentation":"Error \"`trainer` and `evaluator` should not both be `None`.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at orbit/controller.py:183 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide at least one of trainer or evaluator to the Controller.","Pass a trainer for training runs or an evaluator for eval-only runs."],"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"}