tensorflow/models · error · ClassifierError
Checkpoint is missing required key 'model_state_dict'.
Error message
Checkpoint is missing required key 'model_state_dict'.
What it means
Error "Checkpoint is missing required key 'model_state_dict'." thrown in tensorflow/models.
Source
Thrown at official/projects/waste_identification_ml/model_inference_with_tracking/sam3_dinov3_tracking_pipeline/dinov3_classifier.py:157
checkpoint_path: pathlib.Path | str, device: torch.device
) -> dict[str, torch.Tensor]:
"""Loads the model state dict from a checkpoint file.
Args:
checkpoint_path: Filesystem path to the checkpoint.
device: Target device for `map_location`.
Returns:
The `model_state_dict` mapping from parameter name to tensor.
Raises:
ClassifierError: If the checkpoint is missing required keys.
"""
checkpoint = torch.load(
checkpoint_path, map_location=device, weights_only=True
)
if "model_state_dict" not in checkpoint:
raise ClassifierError(
"Checkpoint is missing required key 'model_state_dict'."
)
saved_state_dict = checkpoint["model_state_dict"]
if "head.weight" not in saved_state_dict:
raise ClassifierError(
"Checkpoint state dict is missing required key 'head.weight'."
)
return saved_state_dict
def _build_image_transform(config: config_loader.DINOv3Config) -> v2.Compose:
"""Builds the preprocessing pipeline used to feed PIL images to the model.
Args:
config: DINOv3 model configuration providing image size and normalization
statistics.
Returns:View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/projects/waste_identification_ml/model_inference_with_tracking/sam3_dinov3_tracking_pipeline/dinov3_classifier.py:157 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/10ca522be21b0970.
Report an issue: GitHub.