JoeiBanana's picture
Upload batch 1/8
36f1ad5 verified
Raw
History Blame
904 Bytes
import json
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parents[3]
MODELS_DIR = BASE_DIR / "models"
class ModelRegistry:
def __init__(self, registry_path: Path):
if not registry_path.exists():
raise FileNotFoundError(f"Registry not found: {registry_path}")
with open(registry_path, "r", encoding="utf-8") as f:
self.registry = json.load(f)
self.base_model_path = Path(self.registry["base_model_path"])
self.adapters = self.registry["adapters"]
def get_base_model(self) -> Path:
return self.base_model_path
def get_adapter(self, name: str) -> Path:
if name not in self.adapters:
raise KeyError(f"Adapter '{name}' not found in registry")
return Path(self.adapters[name])
REGISTRY = ModelRegistry(
registry_path=MODELS_DIR / "registry.json"
)