"""Decision Index engine for Cloudflare/clef-flash, so it runs on our exact suite and hardware. Run with: python -m decision_index run --engine clef_engine:ClefEngine ... The model card reports Decision Index 0.2.1 from Cloudflare's own run; our suite is 0.3 without HLE. Comparing on the same harness is the only fair way to say "we match clef-flash". """ import sys import torch from decision_index.engines import Engine class ClefEngine(Engine): name = "clef-flash" def __init__(self, repo="Cloudflare/clef-flash", **options): super().__init__(**options) from huggingface_hub import snapshot_download path = snapshot_download(repo) sys.path.insert(0, path) from joint_schema_model import load_release_model, systemone self.model, self.processor = load_release_model(path, device="cuda") self.systemone = systemone self.provenance = {"repo": repo, "path": path} def synchronize(self): torch.cuda.synchronize() def __call__(self, state, questions): with torch.inference_mode(): response = self.systemone(self.model, self.processor, {"model": "clef-flash", "state": state, "questions": questions}) return {"model": self.name, "answers": response["answers"]}, None