fix: retry failed model inspections and preserve rejection evidence
Do not cache transient repository-list failures as empty weight sets. Deduplicate normalized file paths without lowering reported file sizes. Record whitelisted OOM evidence and bounded discovery diagnostics.
This commit is contained in:
@@ -377,6 +377,7 @@ def choose_candidate_for_gpu_detailed(
|
||||
require_official_config: bool = False,
|
||||
config_optimizer: SafeConfigOptimizer | None = None,
|
||||
excluded_frameworks: set[str] | None = None,
|
||||
rejection_details: list[dict[str, Any]] | None = None,
|
||||
) -> tuple[CandidateModel | None, str | None]:
|
||||
last_rejection_reason: str | None = None
|
||||
for task_type in task_types:
|
||||
@@ -473,6 +474,23 @@ def choose_candidate_for_gpu_detailed(
|
||||
)
|
||||
if not assessment.allowed:
|
||||
last_rejection_reason = assessment.reason
|
||||
if rejection_details is not None:
|
||||
rejection_details.append({
|
||||
"taskType": task_type,
|
||||
"framework": framework,
|
||||
"reason": assessment.reason,
|
||||
"metadata": {
|
||||
key: assessment.metadata[key]
|
||||
for key in (
|
||||
"modelType", "architectures", "quantizationMethod",
|
||||
"estimatedLoadBytes", "repositoryOnDiskBytes",
|
||||
"recursiveRepositoryBytes", "publishedSizeBytes",
|
||||
"gpuMemoryGiB", "gpuMemoryEvidence",
|
||||
"estimatedRequiredGiB", "memorySizingBasis",
|
||||
"maximumRepositorySizeGiB",
|
||||
) if key in assessment.metadata
|
||||
},
|
||||
})
|
||||
continue
|
||||
config_params = assessment.config_params
|
||||
warnings.extend(assessment.warnings)
|
||||
@@ -651,6 +669,14 @@ def process_model_for_candidates(
|
||||
"repoId": model.repo_id,
|
||||
"targetGpu": target_gpu,
|
||||
"reason": "preflight_predicted_oom",
|
||||
"preflightDetails": {
|
||||
"stage": "published_size_precheck",
|
||||
"publishedSizeBytes": model.file_size,
|
||||
"estimatedRequiredGiB": model.file_size / (1024**3) * MODEL_LOAD_OVERHEAD,
|
||||
"gpuMemoryGiB": memory_gib,
|
||||
"gpuMemoryEvidence": preflight_advisor.gpu_memory_evidence.get(target_gpu),
|
||||
"loadOverhead": MODEL_LOAD_OVERHEAD,
|
||||
},
|
||||
})
|
||||
continue
|
||||
|
||||
@@ -717,6 +743,7 @@ def process_model_for_candidates(
|
||||
for target_gpu, task_types, excluded_frameworks in pending_routes:
|
||||
if len(candidates) - before_count >= MAX_ROUTES_PER_MODEL:
|
||||
break
|
||||
rejection_details: list[dict[str, Any]] = []
|
||||
best, preflight_reason = choose_candidate_for_gpu_detailed(
|
||||
model=model,
|
||||
inspection=inspection,
|
||||
@@ -728,6 +755,7 @@ def process_model_for_candidates(
|
||||
require_official_config=official_registry is not None,
|
||||
config_optimizer=config_optimizer,
|
||||
excluded_frameworks=excluded_frameworks,
|
||||
rejection_details=rejection_details,
|
||||
)
|
||||
if best is None:
|
||||
reason = (
|
||||
@@ -738,7 +766,10 @@ def process_model_for_candidates(
|
||||
else "no_compatible_auto_template_or_framework"
|
||||
)
|
||||
)
|
||||
skipped.append({"repoId": model.repo_id, "targetGpu": target_gpu, "reason": reason})
|
||||
skipped.append({
|
||||
"repoId": model.repo_id, "targetGpu": target_gpu, "reason": reason,
|
||||
**({"preflightRejections": rejection_details} if rejection_details else {}),
|
||||
})
|
||||
continue
|
||||
record = candidate_to_record(best)
|
||||
if excluded_frameworks:
|
||||
@@ -1631,6 +1662,7 @@ def run_submission(
|
||||
"candidateModelsAfterStage": candidate_model_count(candidates),
|
||||
"skippedAdded": len(skipped) - skipped_before_stage,
|
||||
"failedAdded": len(stage_failed),
|
||||
"discoveryQueries": list(getattr(hf_discovery, "last_listing_diagnostics", [])),
|
||||
}
|
||||
scan_stages.append(stage_summary)
|
||||
print(
|
||||
|
||||
Reference in New Issue
Block a user