initial structure implemented

docs -> _docs
This commit is contained in:
Oleksandr Bezdieniezhnykh
2025-12-01 14:20:56 +02:00
parent 9134c5db06
commit abc26d5c20
360 changed files with 3881 additions and 101 deletions
+5
View File
@@ -0,0 +1,5 @@
from .base import ModelManagerBase
from .model_manager import ModelManager
__all__ = ["ModelManagerBase", "ModelManager"]
+40
View File
@@ -0,0 +1,40 @@
from abc import ABC, abstractmethod
from typing import Optional, Any
import numpy as np
from models.config import ModelConfig
class ModelManagerBase(ABC):
@abstractmethod
async def load_model(self, config: ModelConfig) -> bool:
pass
@abstractmethod
async def unload_model(self, model_name: str) -> bool:
pass
@abstractmethod
async def get_model(self, model_name: str) -> Optional[Any]:
pass
@abstractmethod
async def run_inference(
self, model_name: str, inputs: dict[str, np.ndarray]
) -> dict[str, np.ndarray]:
pass
@abstractmethod
async def warmup_model(
self, model_name: str, iterations: int = 3
) -> bool:
pass
@abstractmethod
async def get_loaded_models(self) -> list[str]:
pass
@abstractmethod
async def get_model_info(self, model_name: str) -> Optional[dict]:
pass
+33
View File
@@ -0,0 +1,33 @@
from typing import Optional, Any
import numpy as np
from .base import ModelManagerBase
from models.config import ModelConfig
class ModelManager(ModelManagerBase):
async def load_model(self, config: ModelConfig) -> bool:
raise NotImplementedError
async def unload_model(self, model_name: str) -> bool:
raise NotImplementedError
async def get_model(self, model_name: str) -> Optional[Any]:
raise NotImplementedError
async def run_inference(
self, model_name: str, inputs: dict[str, np.ndarray]
) -> dict[str, np.ndarray]:
raise NotImplementedError
async def warmup_model(
self, model_name: str, iterations: int = 3
) -> bool:
raise NotImplementedError
async def get_loaded_models(self) -> list[str]:
raise NotImplementedError
async def get_model_info(self, model_name: str) -> Optional[dict]:
raise NotImplementedError