fix: lowercase remote Hugging Face model IDs in ModelConfig and routes to prevent caching mismatches with Unsloth
This commit is contained in:
parent
774c9b17fd
commit
7862e70211
3 changed files with 16 additions and 3 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -21,6 +21,7 @@ environment.yaml
|
|||
unsloth_compiled_cache/
|
||||
|
||||
# ML artifacts (large files)
|
||||
feature/
|
||||
outputs/
|
||||
exports/
|
||||
/datasets/
|
||||
|
|
@ -71,3 +72,5 @@ studio/backend/tests/
|
|||
log_rtx.txt
|
||||
log.txt
|
||||
setup_leo.sh
|
||||
server.pid
|
||||
*.log
|
||||
|
|
|
|||
|
|
@ -290,6 +290,10 @@ async def get_model_config(
|
|||
This endpoint wraps the backend load_model_defaults function.
|
||||
"""
|
||||
try:
|
||||
from utils.models.model_config import is_local_path
|
||||
if not is_local_path(model_name):
|
||||
model_name = model_name.lower()
|
||||
|
||||
logger.info(f"Getting model config for: {model_name}")
|
||||
from utils.models.model_config import detect_audio_type
|
||||
# Load model defaults from backend
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@ MODEL_NAME_MAPPING = {
|
|||
_REVERSE_MODEL_MAPPING = {}
|
||||
for canonical_file, model_names in MODEL_NAME_MAPPING.items():
|
||||
for model_name in model_names:
|
||||
_REVERSE_MODEL_MAPPING[model_name] = canonical_file
|
||||
_REVERSE_MODEL_MAPPING[model_name.lower()] = canonical_file
|
||||
|
||||
def load_model_config(model_name: str, use_auth: bool = False, token: Optional[str] = None):
|
||||
"""
|
||||
|
|
@ -1234,8 +1234,8 @@ def load_model_defaults(model_name: str) -> Dict[str, Any]:
|
|||
defaults_dir = script_dir / "assets" / "configs" / "model_defaults"
|
||||
|
||||
# First, check if model is in the mapping
|
||||
if model_name in _REVERSE_MODEL_MAPPING:
|
||||
canonical_file = _REVERSE_MODEL_MAPPING[model_name]
|
||||
if model_name.lower() in _REVERSE_MODEL_MAPPING:
|
||||
canonical_file = _REVERSE_MODEL_MAPPING[model_name.lower()]
|
||||
# Search in subfolders and root
|
||||
for config_path in defaults_dir.rglob(canonical_file):
|
||||
if config_path.is_file():
|
||||
|
|
@ -1400,6 +1400,12 @@ class ModelConfig:
|
|||
identifier = f"unsloth/{identifier}"
|
||||
path = identifier
|
||||
|
||||
# Enforce lowercase for remote Hugging Face identifiers to prevent cache duplication
|
||||
# Hugging Face Hub APIs are case-insensitive remotely, but case-sensitive locally (repo_folder_name).
|
||||
if not is_local:
|
||||
identifier = identifier.lower()
|
||||
path = path.lower()
|
||||
|
||||
# Auto-detect GGUF models (check before LoRA/vision detection)
|
||||
if is_local:
|
||||
gguf_file = detect_gguf_model(path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue