{"record":{"id":"bbe61ba362e366af","repo":"tensorflow/models","slug":"model-directory-must-be-specified","errorCode":null,"errorMessage":"Model directory must be specified.","messagePattern":"Model directory must be specified\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"official/legacy/xlnet/training_utils.py","lineNumber":107,"sourceCode":"        model checkpoint. Model checkpoint will be saved and evaluation will be\n        conducted if evaluation dataset is provided.\n      run_eagerly: Whether to run training eagerly.\n\n  Returns:\n      Last training step logits if training happens, otherwise returns None.\n  Raises:\n    TypeError: if model directory is not specified.\n  \"\"\"\n  required_arguments = [\n      train_input_fn, total_training_steps, steps_per_loop, optimizer,\n      learning_rate_fn, save_steps\n  ]\n  if [arg for arg in required_arguments if arg is None]:\n    raise ValueError(\"`train_input_fn`, `total_training_steps`, \"\n                     \"`steps_per_loop`, `optimizer`, `save_steps` and \"\n                     \"`learning_rate_fn` are required parameters.\")\n  if not model_dir:\n    raise TypeError(\"Model directory must be specified.\")\n  train_iterator = data_utils.get_input_iterator(train_input_fn, strategy)\n  if not tf.io.gfile.exists(model_dir):\n    tf.io.gfile.mkdir(model_dir)\n  # Create summary writers\n  summary_dir = os.path.join(model_dir, \"summaries\")\n  if not tf.io.gfile.exists(summary_dir):\n    tf.io.gfile.mkdir(summary_dir)\n  train_summary_writer = None\n  eval_summary_writer = None\n  if eval_fn:\n    eval_summary_writer = tf.summary.create_file_writer(\n        os.path.join(summary_dir, \"eval\"))\n  if steps_per_loop >= _MIN_SUMMARY_STEPS:\n    # Only writes summary when the stats are collected sufficiently over\n    # enough steps.\n    train_summary_writer = tf.summary.create_file_writer(\n        os.path.join(summary_dir, \"train\"))\n","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/legacy/xlnet/training_utils.py#L89-L125","documentation":"Error \"Model directory must be specified.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/legacy/xlnet/training_utils.py:107 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"}