{"record":{"id":"fb9c9331362d4538","repo":"tensorflow/models","slug":"repo-dir-must-be-a-non-empty-path","errorCode":null,"errorMessage":"repo_dir must be a non-empty path.","messagePattern":"repo_dir must be a non-empty path\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/waste_identification_ml/fine_tuning/Dinov3_image_classifier/models.py","lineNumber":94,"sourceCode":") -> nn.Module:\n  \"\"\"Loads a DINOv3 backbone via torch.hub from a local repository.\n\n  Args:\n    model_name: Name of the DINOv3 model variant (e.g., 'dinov3_vits16').\n    repo_dir: Path to the cloned Facebook DINOv3 repository.\n    weights: Optional path to a pretrained weights file. If None, the model is\n      loaded with random weights.\n\n  Returns:\n    The DINOv3 backbone model.\n\n  Raises:\n    ValueError: If `model_name` or `repo_dir` is falsy (empty or None).\n  \"\"\"\n  if not model_name:\n    raise ValueError(\"model_name must be a non-empty string.\")\n  if str(repo_dir) in (\"\", \".\"):\n    raise ValueError(\"repo_dir must be a non-empty path.\")\n\n  if weights is not None:\n    _LOGGER.info(\"Loading pretrained backbone weights from: %s\", weights)\n    return torch.hub.load(\n        str(repo_dir),\n        model_name,\n        source=\"local\",\n        weights=str(weights),\n    )\n\n  _LOGGER.info(\"No pretrained weights path given. Loading with random weights.\")\n  return torch.hub.load(str(repo_dir), model_name, source=\"local\")\n\n\nclass Dinov3Classification(nn.Module):\n  \"\"\"DINOv3 backbone with a linear classification head.\n\n  The feature vector fed to the classification head is controlled by the","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/waste_identification_ml/fine_tuning/Dinov3_image_classifier/models.py#L76-L112","documentation":"Guard in load_model rejecting a repo_dir whose string form is '' or '.'. torch.hub.load requires a real path to the cloned Facebook DINOv3 repository; '.' would make hub try to import the pipeline's own working directory as the model repo, producing confusing downstream failures, so the guard blocks it early. Indicates the repo path was never configured, or Path('') was passed (pathlib normalizes it to '.').","triggerScenarios":"Thrown at official/projects/waste_identification_ml/fine_tuning/Dinov3_image_classifier/models.py:94 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Clone the DINOv3 repository and point repo_dir at its absolute path","Ensure the repo-directory config value is set and not an empty string (Path('') becomes '.')","Pass an explicit absolute path to avoid cwd-relative '.' resolution"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}