pub async fn resolve_model_source(
model: &str,
cache_dir: &Path,
download: DownloadPolicy,
autosize: Option<(AutoSizeProfile, f32)>,
) -> Result<Resolved>Expand description
One-stop model resolution. Caller passes the user’s model arg
(alias / HF id / local dir / .gguf path), the HF cache dir, and a
download policy + autosize profile. Returns a resolved source.
Resolution order:
- Explicit GGUF alias -> exact cached/downloaded GGUF file.
*.gguffile -> direct GGUF source.- Existing local directory with valid weights -> direct source.
- HF cache hit -> cached source.
- (if
AutoDownload) HF download -> cached source.
On GPU backends the chat-profile autosizer fires once on the resolved
snapshot before returning, populating FERRUM_KV_MAX_BLOCKS etc.
apply_autosize=false skips it (used by bench which sets sizing
from --max-tokens etc. directly).