Artifex/control_plane/model_studio/management/commands/modelstudio_dataset_audit.py

21 lines
896 B
Python
Raw Normal View History

2026-08-17 01:04:02 +07:00
import json
from django.core.management.base import BaseCommand, CommandError
from control_plane.model_studio.services import ModelStudioService
from control_plane.model_studio.models import TrainingProject
class Command(BaseCommand):
help = "Classify Guard dataset manifests and record provenance/contamination evidence without changing source data."
def add_arguments(self, parser):
parser.add_argument("--project", required=True, help="TrainingProject slug")
def handle(self, *args, **options):
project = TrainingProject.objects.filter(slug=options["project"]).first()
if project is None:
raise CommandError("TrainingProject not found.")
report = ModelStudioService().curate_guard_datasets(project)
self.stdout.write(json.dumps({key: report[key] for key in ["total", "valid", "warning", "blocked", "decision"]}, indent=2))