feat(provenance): govern source snapshots and data inputs
This commit is contained in:
@@ -9,6 +9,7 @@ from app.services.segmentation_adapter import (
|
||||
SamSegmentationAdapter,
|
||||
YoloSegmentationAdapter,
|
||||
)
|
||||
from app.services.runtime_model_provenance_service import RuntimeModelProvenanceService
|
||||
from app.services.yolo_adapter import YoloDetectionAdapter
|
||||
from app.core.errors import AppError
|
||||
|
||||
@@ -144,9 +145,24 @@ class ModelRegistryService:
|
||||
elif not model_path.exists() or not model_path.is_file():
|
||||
limitation = "YOLO_SEG_MODEL_PATH does not point to an existing local model file. GeoIntel will not download segmentation model weights automatically."
|
||||
else:
|
||||
configured = True
|
||||
status = "configured"
|
||||
limitation = "Configured for local YOLO segmentation inference over an existing raster tile manifest."
|
||||
try:
|
||||
RuntimeModelProvenanceService.validate_for_runtime(
|
||||
model_path=model_path,
|
||||
model_id=settings.yolo_seg_model_id,
|
||||
task_type="segmentation",
|
||||
expected_model_version=settings.yolo_seg_model_version,
|
||||
allowed_frameworks=("ultralytics/pytorch", "ultralytics", "pytorch"),
|
||||
)
|
||||
except AppError as exc:
|
||||
status = "contract_incomplete"
|
||||
limitation = (
|
||||
"Configured YOLO segmentation weights are not runnable until their immutable "
|
||||
f"runtime provenance sidecar validates: {exc.message}"
|
||||
)
|
||||
else:
|
||||
configured = True
|
||||
status = "configured"
|
||||
limitation = "Configured for local YOLO segmentation inference over an existing raster tile manifest."
|
||||
|
||||
return DetectionModelCapability(
|
||||
model_id=settings.yolo_seg_model_id,
|
||||
@@ -186,9 +202,24 @@ class ModelRegistryService:
|
||||
elif not model_path.exists() or not model_path.is_file():
|
||||
limitation = "SAM_MODEL_PATH does not point to an existing local model file. GeoIntel will not download segmentation model weights automatically."
|
||||
else:
|
||||
configured = True
|
||||
status = "configured"
|
||||
limitation = "Configured for local class-agnostic SAM segmentation over an existing raster tile manifest."
|
||||
try:
|
||||
RuntimeModelProvenanceService.validate_for_runtime(
|
||||
model_path=model_path,
|
||||
model_id=settings.sam_model_id,
|
||||
task_type="segmentation",
|
||||
expected_model_version=settings.sam_model_version,
|
||||
allowed_frameworks=("ultralytics/sam", "sam", "ultralytics", "pytorch"),
|
||||
)
|
||||
except AppError as exc:
|
||||
status = "contract_incomplete"
|
||||
limitation = (
|
||||
"Configured SAM weights are not runnable until their immutable runtime provenance "
|
||||
f"sidecar validates: {exc.message}"
|
||||
)
|
||||
else:
|
||||
configured = True
|
||||
status = "configured"
|
||||
limitation = "Configured for local class-agnostic SAM segmentation over an existing raster tile manifest."
|
||||
|
||||
return DetectionModelCapability(
|
||||
model_id=settings.sam_model_id,
|
||||
@@ -233,9 +264,24 @@ class ModelRegistryService:
|
||||
status = "accelerator_unavailable"
|
||||
limitation = exc.message
|
||||
else:
|
||||
configured = True
|
||||
status = "configured"
|
||||
limitation = "Configured for local YOLO inference over an existing raster tile manifest within its validated area scope."
|
||||
try:
|
||||
RuntimeModelProvenanceService.validate_for_runtime(
|
||||
model_path=model_path,
|
||||
model_id=settings.yolo_model_id,
|
||||
task_type="object_detection",
|
||||
expected_model_version=settings.yolo_model_version,
|
||||
allowed_frameworks=("ultralytics/pytorch", "ultralytics", "pytorch"),
|
||||
)
|
||||
except AppError as exc:
|
||||
status = "contract_incomplete"
|
||||
limitation = (
|
||||
"Configured YOLO weights are not runnable until their immutable runtime provenance "
|
||||
f"sidecar validates: {exc.message}"
|
||||
)
|
||||
else:
|
||||
configured = True
|
||||
status = "configured"
|
||||
limitation = "Configured for local YOLO inference over an existing raster tile manifest within its validated area scope."
|
||||
|
||||
return DetectionModelCapability(
|
||||
model_id=settings.yolo_model_id,
|
||||
|
||||
Reference in New Issue
Block a user