Skip to main content

Module compat

Module compat 

Source
Expand description

Model-compatibility discovery for rlx-models.

Answers the same question llama.cpp and HuggingFace answer for their own ecosystems: can this runtime load and run this weights file? — but for rlx-models.

Mirrors two upstream behaviors so reports stay aligned with what users already expect from llama.cpp / HF:

  • GGUF required fields. llama.cpp’s loader (src/llama-model.cpp:: load_hparams, src/llama-vocab.cpp) treats general.architecture, <arch>.context_length, <arch>.embedding_length, <arch>.block_count, tokenizer.ggml.model, and tokenizer.ggml.tokens as mandatory. If any are missing the file isn’t runnable, regardless of arch support. The same predicate drives HuggingFace’s “compatible with llama.cpp” badge (huggingface.js/packages/tasks/src/local-apps.ts: isLlamaCppGgufModel = !!model.gguf?.context_length).

  • HF safetensors model_type. transformers resolves the model class from config.json::model_type (primary); architectures[] only disambiguates which head within that class. We follow the same precedence in crate::model_type_runner_name.

Structs§

CompatibilityReport
Structured report from check_path. Print directly via [Display] or serialize as JSON via CompatibilityReport::to_json.
GgufRequiredFields
llama.cpp’s load-time required GGUF metadata fields. All are read by load_hparams; missing any throws at load time.

Enums§

CompatSource
Where the arch identification came from.
CompatibilityStatus
Top-level compatibility verdict.

Functions§

check_hf_repo
Stub returned when the binary was built without the compat-net feature.
check_path
Compatibility report for a local weights path (file or directory).
looks_like_hf_repo
Heuristic: does s look like a HuggingFace repo id (org/name) rather than a local filesystem path? We use the same rule HF Hub clients do: exactly one /, no path separators leading the string, no extension suffix.
run_check
CLI entry point for rlx-run check <path-or-repo> [--json].