feat: dynamically clean incompatible architectures
This commit is contained in:
@@ -22,6 +22,16 @@ ERROR_LINE_PATTERN = re.compile(
|
||||
r"找不到空闲卡|不支持|暂不支持|不兼容|请换用|请更换)",
|
||||
re.IGNORECASE,
|
||||
)
|
||||
MODEL_TYPE_NOT_RECOGNIZED_PATTERN = re.compile(
|
||||
r"model\s+type\s+[`'\"](?P<model_type>[A-Za-z0-9_.-]+)[`'\"]\s+but\s+"
|
||||
r"(?:Transformers\s+)?does\s+not\s+recognize\s+this\s+architecture",
|
||||
re.IGNORECASE,
|
||||
)
|
||||
MODEL_ARCHITECTURES_NOT_SUPPORTED_PATTERN = re.compile(
|
||||
r"Model\s+architectures?\s*(?P<architectures>\[[^\]\n]{1,500}\])\s+"
|
||||
r"(?:are|is)\s+not\s+supported\s+for\s+now",
|
||||
re.IGNORECASE,
|
||||
)
|
||||
|
||||
|
||||
def fetch_and_classify_failure_log(
|
||||
@@ -94,6 +104,13 @@ def classify_failure_archive(
|
||||
observed_memory_gib = _extract_observed_gpu_memory_gib(error_lines)
|
||||
if report_code == "PREFLIGHT_OOM" and observed_memory_gib is not None:
|
||||
result["failureObservedGpuMemoryGiB"] = observed_memory_gib
|
||||
unsupported_architectures, unsupported_model_types = _extract_unsupported_architectures(
|
||||
error_lines
|
||||
)
|
||||
if unsupported_architectures:
|
||||
result["failureUnsupportedArchitectures"] = unsupported_architectures
|
||||
if unsupported_model_types:
|
||||
result["failureUnsupportedModelTypes"] = unsupported_model_types
|
||||
if classification.needs_llm and llm_classifier is not None and llm_classifier.enabled:
|
||||
llm_decision = llm_classifier.classify_failure(
|
||||
task_context=dict(task_context or {}),
|
||||
@@ -146,3 +163,21 @@ def _extract_observed_gpu_memory_gib(error_lines: list[str]) -> float | None:
|
||||
if 0 < value <= 1024:
|
||||
return value
|
||||
return None
|
||||
|
||||
|
||||
def _extract_unsupported_architectures(
|
||||
error_lines: list[str],
|
||||
) -> tuple[list[str], list[str]]:
|
||||
architectures: set[str] = set()
|
||||
model_types: set[str] = set()
|
||||
for line in error_lines:
|
||||
for match in MODEL_TYPE_NOT_RECOGNIZED_PATTERN.finditer(line):
|
||||
value = match.group("model_type").strip()
|
||||
if value:
|
||||
model_types.add(value)
|
||||
for match in MODEL_ARCHITECTURES_NOT_SUPPORTED_PATTERN.finditer(line):
|
||||
for value in re.findall(r"['\"]([^'\"]+)['\"]", match.group("architectures")):
|
||||
value = value.strip()
|
||||
if value:
|
||||
architectures.add(value)
|
||||
return sorted(architectures, key=str.casefold), sorted(model_types, key=str.casefold)
|
||||
|
||||
Reference in New Issue
Block a user