Spaces:
Sleeping
Sleeping
File size: 1,251 Bytes
fa3d628 | 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 34 35 36 37 38 39 40 41 42 | """Centralise les contrats des deux modeles runtime du projet."""
from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from scripts.mlflow_config import DEFAULT_MLFLOW_TRACKING_URI, PROJECT_ROOT
DEFAULT_MODELS_DIR = PROJECT_ROOT / "artifacts" / "models"
@dataclass(frozen=True)
class RuntimeModelSpec:
"""Decrit un modele runtime attendu par l'API finale."""
role: str
registered_model_name: str
output_model_path: Path
output_metadata_path: Path
HISTORICAL_RUNTIME_MODEL_SPEC = RuntimeModelSpec(
role="historical",
registered_model_name="p1_historical_pipeline",
output_model_path=DEFAULT_MODELS_DIR / "p1_historical_pipeline.joblib",
output_metadata_path=DEFAULT_MODELS_DIR / "p1_historical_metadata.json",
)
SIMULATION_RUNTIME_MODEL_SPEC = RuntimeModelSpec(
role="simulation",
registered_model_name="p23_simulation_pipeline",
output_model_path=DEFAULT_MODELS_DIR / "p23_simulation_pipeline.joblib",
output_metadata_path=DEFAULT_MODELS_DIR / "p23_simulation_metadata.json",
)
RUNTIME_MODEL_SPECS = {
HISTORICAL_RUNTIME_MODEL_SPEC.role: HISTORICAL_RUNTIME_MODEL_SPEC,
SIMULATION_RUNTIME_MODEL_SPEC.role: SIMULATION_RUNTIME_MODEL_SPEC,
}
|