IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Python function

generate_local_model_path

generate_local_model_path()

max.pipelines.weights.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.