tensorflow/models · error · ValueError

repo_dir must be a non-empty path.

Error message

repo_dir must be a non-empty path.

What it means

Error "repo_dir must be a non-empty path." thrown in tensorflow/models.

Source

Thrown at official/projects/waste_identification_ml/fine_tuning/Dinov3_image_classifier/models.py:94

) -> nn.Module:
  """Loads a DINOv3 backbone via torch.hub from a local repository.

  Args:
    model_name: Name of the DINOv3 model variant (e.g., 'dinov3_vits16').
    repo_dir: Path to the cloned Facebook DINOv3 repository.
    weights: Optional path to a pretrained weights file. If None, the model is
      loaded with random weights.

  Returns:
    The DINOv3 backbone model.

  Raises:
    ValueError: If `model_name` or `repo_dir` is falsy (empty or None).
  """
  if not model_name:
    raise ValueError("model_name must be a non-empty string.")
  if str(repo_dir) in ("", "."):
    raise ValueError("repo_dir must be a non-empty path.")

  if weights is not None:
    _LOGGER.info("Loading pretrained backbone weights from: %s", weights)
    return torch.hub.load(
        str(repo_dir),
        model_name,
        source="local",
        weights=str(weights),
    )

  _LOGGER.info("No pretrained weights path given. Loading with random weights.")
  return torch.hub.load(str(repo_dir), model_name, source="local")


class Dinov3Classification(nn.Module):
  """DINOv3 backbone with a linear classification head.

  The feature vector fed to the classification head is controlled by the

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/waste_identification_ml/fine_tuning/Dinov3_image_classifier/models.py:94 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24). Data as JSON: /api/errors/fb9c9331362d4538. Report an issue: GitHub.