File size: 986 Bytes
e317d56
 
 
 
 
 
 
 
 
 
 
 
 
46cc63a
 
 
 
 
 
 
e317d56
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""Load inference model catalog from configs/model_catalog.yaml."""

from __future__ import annotations

from pathlib import Path
from typing import Any

import yaml

PROJECT_ROOT = Path(__file__).resolve().parents[2]
CATALOG_PATH = PROJECT_ROOT / "configs" / "model_catalog.yaml"

_DEFAULT_CATALOG: dict[str, dict[str, Any]] = {
    "Meta-Feature Stacking (Production)": {
        "type": "meta_stack",
        "description": "Hybrid meta-feature stacking (Notebook 14).",
        "accuracy": "F1 0.805",
        "production_default": True,
        "model_path": "models/production_final/meta_stack_final.joblib",
        "requires": "uv sync --extra hf",
    },
}


def load_model_catalog() -> dict[str, dict[str, Any]]:
    if not CATALOG_PATH.exists():
        return dict(_DEFAULT_CATALOG)
    with CATALOG_PATH.open(encoding="utf-8") as f:
        data = yaml.safe_load(f) or {}
    if not isinstance(data, dict) or not data:
        return dict(_DEFAULT_CATALOG)
    return data