Skip to main content

Crate zsfm_hub

Crate zsfm_hub 

Source

Structs§

DownloadedRepo
ModelFiles
Paths to all local files needed for conversion.

Enums§

HubError
Typed Hub errors. Functions still return anyhow::Result at the boundary so callers keep one error type, but raise these variants so messages stay consistent and matchable via .to_string().

Constants§

FORMAT_PRIORITY
Checkpoint file extensions this tool knows how to read, in the order preferred when a repo ships more than one format and the caller doesn’t request a specific one.
MODEL_REPOS
Canonical HuggingFace repo per friendly model name. Single source of truth for CLI --model defaults and Python convert() dispatch, so the two cannot drift when defaults change.

Functions§

canonical_gguf_path
Where the canonical, always-F32 GGUF for repo_id lives once converted once. Every per-model convert command checks this path first: if present, it recasts straight from this cached GGUF to whatever dtype was requested instead of re-downloading and re-converting from HuggingFace.
default_repo_for
Look up the default repo for a friendly model name.
delete_cached_model
Delete a model’s cached files (canonical GGUF + config) and optionally an output GGUF. Shared by the zsfm CLI and the Python bindings so both report identical messages on stdout/stderr.
download_any_format
Download a repo’s checkpoint in whatever format it’s stored in (or a specific one, if format is given). Resolves HF’s standard sharding indices for safetensors and bin; for every other format, if more than one file matches, file_filter (a case-insensitive substring) is required to pick which ones — this avoids silently pulling every alternative quantization/variant of a multi-GB checkpoint.
download_file
Download (or locate from cache) a single arbitrary file from repo_id, resuming a partial download if one exists. For models that don’t fit the config.json + model.safetensors shape — e.g. Lag-Llama’s raw PyTorch Lightning .ckpt checkpoint.
download_model
Download (or locate from cache) config.json + model.safetensors[.index.json] for repo_id into model_dir.
download_model_prefixed
Same as download_model, but every remote path is joined under prefix first.
list_repo_files
List every file path in a repo at revision (default branch: "main").
log_status
Status logging that respects ZSFM_QUIET.
try_recast_from_cache
Shared cache-hit path for CLI + Python: recast from canonical F32 GGUF when present. Returns true when the caller can return early.
upload_repo
variant_gguf_path
Variant-aware cache path for multi-task repos (Mitra, TabFM): <model_dir>/<variant>-<task>/<owner>__<name>/model-f32.gguf. Centralizes the format!("mitra-{task}") logic duplicated in CLI + Python.