mstar.utils.hf_snapshot

mstar.utils.hf_snapshot#

Resolving a Hugging Face repo id to a local snapshot directory.

Not model-specific: every model that reads a pipeline snapshot’s component configs needs it, so it lives here rather than in one model’s config module.

Functions

resolve_snapshot_dir(model_path_hf[, ...])

Local snapshot directory of a pipeline repo: a local path is used as-is, a hub id resolves through the HF cache (configs + weights of every component, offline when HF_HUB_OFFLINE is set).

mstar.utils.hf_snapshot.resolve_snapshot_dir(model_path_hf, cache_dir=None, allow_patterns=None)[source]#

Local snapshot directory of a pipeline repo: a local path is used as-is, a hub id resolves through the HF cache (configs + weights of every component, offline when HF_HUB_OFFLINE is set).

allow_patterns limits a download to the components the model serves, for repos that ship alternatives (a second transformer, a prompt enhancer) the deployment never loads.

Parameters:
  • model_path_hf (str)

  • cache_dir (str | None)

  • allow_patterns (list[str] | None)

Return type:

Path