financial-rag / src /utils /model_store.py
tolivert's picture
deploy: financial_rag streamlit app
4e316d6
Raw
History Blame Contribute Delete
959 Bytes
"""
Centralised model storage directory management.
All downloaded HuggingFace weights are stored under a single
`models/` directory at the project root. This module provides
`get_model_dir` to resolve and create per-model subdirectories,
keeping weight files out of source control and in a predictable
location for loaders.
"""
from pathlib import Path
# Project root is three levels up from this file: src/utils/model_store.py -> llm_hub/
_PROJECT_ROOT = Path(__file__).resolve().parent.parent.parent
MODELS_DIR = _PROJECT_ROOT / "models"
def get_model_dir(model_name: str) -> Path:
"""
Returns the canonical directory for a model's weights and tokenizer files.
Creates the directory if it doesn't exist.
Args:
model_name: e.g. "Qwen3-0.6B", "gemma-3-270m"
Returns:
Path to models/<model_name>/
"""
model_dir = MODELS_DIR / model_name
model_dir.mkdir(parents=True, exist_ok=True)
return model_dir