--- name: check-model description: >- Check model compatibility with xinfer before loading. Validates config.json, weight tensor shapes and naming, quantization format correctness, and multi-rank (tensor-parallel) divisibility. Use when the user asks to check, validate, audit, or verify a model will load correctly — from a HuggingFace URL/config, local path, or pasted tensor info. --- # Check Model — Pre-Load Compatibility Audit for xinfer ## Phase 0: Gather Model Information Collect model config and tensor info. Accept **any** of: | Input | How to use | |-------|-----------| | **HuggingFace config URL** | Fetch `config.json` from the URL (e.g. `https://huggingface.co//blob/main/config.json`) | | **HuggingFace model ID** | Fetch config from `https://huggingface.co//raw/main/config.json` | | **Local model path** | Read `/config.json` directly | | **Pasted config JSON** | Parse inline | | **Tensor info** | User pastes tensor names/shapes/dtypes from HuggingFace safetensor viewer or provides local weights | If tensor info is missing, ask the user to provide it. They can get it by clicking any `.safetensors` file in the HuggingFace model page and copying the tensor tree. For local models, extract tensor info with: ```python import json, struct, sys, glob, os path = sys.argv[1] for sf in sorted(glob.glob(os.path.join(path, "*.safetensors"))): with open(sf, "rb") as f: n = struct.unpack("