Skip to main content

Python function

generate_local_model_path

generate_local_model_path()

max.pipelines.lib.generate_local_model_path(repo_id, revision)

source

Generates the local filesystem path where a Hugging Face model repo is cached.

This function resolves the model from the local Hugging Face cache only. Missing snapshots should be pre-downloaded explicitly so tests without the requires-network tag do not silently fetch remote artifacts at runtime.

Parameters:

  • repo_id (str) – The Hugging Face repository ID in the format “org/model” (e.g. “HuggingFaceTB/SmolLM2-135M”)
  • revision (str) – The specific model revision hash to use, typically from a repo lock file

Returns:

The absolute path to the cached model files for the specified revision.

Return type:

str

Raises:

FileNotFoundError – If the model is not found in the local cache.