feat: add durable success-first modelhub agent
This commit is contained in:
@@ -492,6 +492,7 @@ class OutcomeTracker:
|
||||
framework_groups: dict[str, list[dict[str, Any]]] = defaultdict(list)
|
||||
combo_groups: dict[tuple[str, str, str], list[dict[str, Any]]] = defaultdict(list)
|
||||
profile_groups: dict[tuple[str, str, str, str, str], list[dict[str, Any]]] = defaultdict(list)
|
||||
sized_profile_groups: dict[tuple[str, str, str, str, str, int], list[dict[str, Any]]] = defaultdict(list)
|
||||
|
||||
for record in terminal:
|
||||
gpu = record.get("targetGpu") or "unknown"
|
||||
@@ -505,6 +506,13 @@ class OutcomeTracker:
|
||||
if model_type:
|
||||
quantization = str(profile.get("quantizationMethod") or "none").strip()
|
||||
profile_groups[(gpu, fw, tt, model_type, quantization)].append(record)
|
||||
try:
|
||||
load_bytes = max(1, int(profile.get("estimatedLoadBytes") or 0))
|
||||
except (TypeError, ValueError):
|
||||
load_bytes = 0
|
||||
if load_bytes > 0:
|
||||
size_bucket = int(load_bytes).bit_length() - 1
|
||||
sized_profile_groups[(gpu, fw, tt, model_type, quantization, size_bucket)].append(record)
|
||||
|
||||
gpu_summaries = {gpu: _summarize(records) for gpu, records in gpu_groups.items()}
|
||||
framework_summaries = {fw: _summarize(records) for fw, records in framework_groups.items()}
|
||||
@@ -561,6 +569,19 @@ class OutcomeTracker:
|
||||
"lastTerminalAt": last_terminal_at.isoformat() if last_terminal_at else None,
|
||||
}
|
||||
|
||||
sized_profile_combination_stats: dict[str, dict[str, Any]] = {}
|
||||
for (gpu, fw, tt, model_type, quantization, size_bucket), records in sized_profile_groups.items():
|
||||
key = f"{gpu}|{fw}|{tt}|{model_type}|{quantization}|{size_bucket}"
|
||||
sized_profile_combination_stats[key] = {
|
||||
"targetGpu": gpu,
|
||||
"framework": fw,
|
||||
"taskType": tt,
|
||||
"modelType": model_type,
|
||||
"quantizationMethod": quantization,
|
||||
"loadSizeLog2Bucket": size_bucket,
|
||||
**_summarize(records),
|
||||
}
|
||||
|
||||
warnings: list[str] = []
|
||||
for gpu, summary in gpu_summaries.items():
|
||||
if summary["decisionTotal"] >= 4 and summary["decisionFailureRate"] >= 0.5:
|
||||
@@ -607,6 +628,7 @@ class OutcomeTracker:
|
||||
"recentCombinationStats": recent_combination_stats,
|
||||
"profileCombinationStats": profile_combination_stats,
|
||||
"recentProfileCombinationStats": recent_profile_combination_stats,
|
||||
"sizedProfileCombinationStats": sized_profile_combination_stats,
|
||||
"architectureCompatibilityBlocks": architecture_blocks,
|
||||
"architectureCompatibilitySummary": {
|
||||
"activeBlockCount": len(architecture_blocks),
|
||||
|
||||
Reference in New Issue
Block a user