tensorflow/models · error · ValueError
model_name must be a non-empty string.
Error message
model_name must be a non-empty string.
What it means
Error "model_name must be a non-empty string." thrown in tensorflow/models.
Source
Thrown at official/projects/waste_identification_ml/fine_tuning/Dinov3_image_classifier/models.py:92
repo_dir: pathlib.Path,
weights: pathlib.Path | None = None,
) -> 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.View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/projects/waste_identification_ml/fine_tuning/Dinov3_image_classifier/models.py:92 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/b7bd08fa5bcf0e98.
Report an issue: GitHub.