fix model registration and anouncement. added console panel
This commit is contained in:
@@ -64,6 +64,17 @@ def _load_model_metadata() -> dict[str, dict]:
|
||||
_MODEL_METADATA = _load_model_metadata()
|
||||
|
||||
|
||||
def _local_model_path(hf_repo: str, cache_dir: Path | None) -> Path | None:
|
||||
if cache_dir is None:
|
||||
return None
|
||||
if (cache_dir / "config.json").exists():
|
||||
return cache_dir
|
||||
candidate = cache_dir / hf_repo.split("/")[-1]
|
||||
if (candidate / "config.json").exists():
|
||||
return candidate
|
||||
return None
|
||||
|
||||
|
||||
CURATED_MODELS: list[ModelPreset] = [
|
||||
ModelPreset(
|
||||
name="Qwen2.5-0.5B-Instruct",
|
||||
@@ -215,9 +226,11 @@ def model_metadata_for(
|
||||
try:
|
||||
from transformers import AutoConfig # type: ignore[import]
|
||||
|
||||
local_model = _local_model_path(hf_repo, cache_dir)
|
||||
load_source = str(local_model) if local_model is not None else hf_repo
|
||||
cfg = AutoConfig.from_pretrained(
|
||||
hf_repo,
|
||||
cache_dir=str(cache_dir) if cache_dir is not None else None,
|
||||
load_source,
|
||||
cache_dir=str(cache_dir) if cache_dir is not None and local_model is None else None,
|
||||
)
|
||||
# Composite configs (VLM/MoE) nest decoder fields in text_config.
|
||||
text_cfg = getattr(cfg, "text_config", None) or cfg
|
||||
|
||||
Reference in New Issue
Block a user