new tasks, devnet topup, cli, new model support
This commit is contained in:
@@ -734,11 +734,20 @@ def _detect_num_layers(model_id: str, cache_dir: Path | None = None) -> int | No
|
||||
"""Fetch num_hidden_layers from HuggingFace model config (downloads ~1 KB config.json only)."""
|
||||
try:
|
||||
from transformers import AutoConfig # type: ignore[import]
|
||||
|
||||
from .model_catalog import layers_from_config
|
||||
|
||||
cfg = AutoConfig.from_pretrained(
|
||||
model_id,
|
||||
cache_dir=str(cache_dir) if cache_dir is not None else None,
|
||||
)
|
||||
return int(cfg.num_hidden_layers)
|
||||
layers = layers_from_config(cfg)
|
||||
if layers is None:
|
||||
print(
|
||||
f" Warning: no layer count in {model_id} config "
|
||||
"(checked top level and text_config)", flush=True,
|
||||
)
|
||||
return layers
|
||||
except Exception as exc:
|
||||
print(f" Warning: could not read model config from HF: {exc}", flush=True)
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user