Skip to main content

Module model_cache

Module model_cache 

Source
Expand description

XDG-compliant model cache directory layout.

Resolution order for the model cache root:

  1. FRANKENSEARCH_MODEL_DIR — explicit override (CI, Docker, shared cache)
  2. FRANKENSEARCH_DATA_DIR — override data home for all frankensearch data
  3. XDG_DATA_HOME/frankensearch/models/ — XDG spec (Linux)
  4. ~/Library/Application Support/frankensearch/models/ — macOS (when XDG unset)
  5. ~/.local/share/frankensearch/models/ — POSIX fallback

Within the cache root, each model gets a base directory. Versioned subdirectories are also provisioned for forward-compatible migrations:

<root>/
  potion-base-128M/
  all-MiniLM-L6-v2/
    onnx/model.onnx
    tokenizer.json
    config.json
    manifest.json
  potion-base-128M/
    v1/
      model.safetensors
      tokenizer.json
      config.json
      manifest.json

Structs§

KnownModel
Metadata for a known model in the cache layout.
ModelCacheLayout
Description of the full cache directory tree.
ModelDirEntry
One model’s directory entry within the cache layout.

Constants§

ENV_DATA_DIR
Environment variable: override data home for all frankensearch data.
ENV_MODEL_DIR
Environment variable: explicit model cache directory override.
MODEL_CACHE_LAYOUT_VERSION
Schema version for the cache layout format.

Functions§

ensure_cache_layout
Ensure the cache layout directories exist on disk.
ensure_default_cache
Resolve the cache root and ensure all directories exist.
is_model_installed
Check whether a specific model appears installed (all expected files present).
known_models
Return all known models in the cache layout.
model_file_path
Resolve the expected path for a specific model file within the cache.
resolve_cache_root
Resolve the model cache root directory using the priority chain.