Skip to main content

resolve_model_source

Function resolve_model_source 

Source
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:

  1. Explicit GGUF alias -> exact cached/downloaded GGUF file.
  2. *.gguf file -> direct GGUF source.
  3. Existing local directory with valid weights -> direct source.
  4. HF cache hit -> cached source.
  5. (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).