# Scanning files and Hugging Face models The `scan` command accepts files, folders, Hugging Face addresses and lists of targets. You can mix them in one command. ## Files and folders on your disk Scan one file: ```bash gguf-radar scan ./model.gguf ``` Scan every GGUF file in a folder and in its subfolders: ```bash gguf-radar scan ./models/ ``` GGUF Radar also reads the chat template files that Safetensors and PyTorch models keep next to their weights. These files are `tokenizer_config.json`, `chat_template.json` and `chat_template.jinja`, and the files `additional_chat_templates/.jinja`, which version 5 of the Transformers library loads as named templates. The files `default.jinja` and `file.jinja` set the default template in that library, and llama.cpp asks for `tool_use`, so these three files are always read. Of the other files, at most 16 are read, and a folder with more files gets the finding `too_many_chat_templates`. The findings of such a file name the key `chat_template.`, and the key `chat_template` for `default.jinja` and `file.jinja`. A template file is read only if it is a regular file. A device or a pipe gives `ERROR`. A `.jinja` file is read up to 4 MiB, and a `tokenizer_config.json` or `chat_template.json` file is read completely up to 16 MiB, because the Transformers library reads it without a limit. A longer file is not given `CLEAN` and not `ERROR`. It gets the finding `chat_template_too_large` and the verdict `SUSPICIOUS`, and the part that was not read is not checked. A longer `.jinja` file is still analyzed up to its limit. A local scan and a scan of a repository use the same code for this. A JSON file of 16 MiB that holds many small objects needs about 500 MB of memory while it is parsed, and the memory grows with the number of workers. You can scan one of them directly, and a folder scan picks them up automatically. A file can hold several templates, and they are checked within the limits that [How the checks work](how-it-works.md#named-templates) describes. ## Models on Hugging Face You can name a Hugging Face model in three ways: ```bash # The repository address gguf-radar scan https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct-GGUF # The address of one file in the repository gguf-radar scan https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct-GGUF/blob/main/qwen2.5-0.5b-instruct-q4_k_m.gguf # The short owner/name form gguf-radar scan Qwen/Qwen2.5-0.5B-Instruct-GGUF ``` To scan one fixed version of a repository, put a branch name, a tag or a commit hash after `tree/`: ```bash gguf-radar scan https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct-GGUF/tree/9217f5db79a29953eb74d5343926648285ec7e67 ``` GGUF Radar does not download the whole model. It reads only the beginning of each GGUF file, where the metadata and the chat template are stored, and the end of the file, where hidden data is usually appended. A scan of a model that is many gigabytes in size downloads only a few megabytes. GGUF Radar checks every GGUF file in a repository, whatever the file is called. A later part of a split model is a GGUF file with its own header and its own end, so it is checked too. Use `--max-files` to limit the number of files that are checked in one repository. When the limit leaves files out, the output lists how many and which files were not checked, and the JSON report lists them in `files_not_scanned`. The repository is then reported as `ERROR`, with exit code 1, and never as `CLEAN`, because it was not checked completely. A finding in the files that were checked still gives `SUSPICIOUS` or `MALICIOUS`. ## Many targets at once Put one target on each line of a text file. A target can be a Hugging Face address, an owner/name pair or a local path. Lines that start with `#` and empty lines are ignored. ```text # Models to check before the release https://huggingface.co/owner/model-a owner/model-b ./local-models/candidate.gguf ``` Then pass the file with `--list`: ```bash gguf-radar scan --list targets.txt ``` GGUF Radar scans several targets at the same time. The default is four at once, and `--workers` changes it. ## Hugging Face tokens Public models need no token. You need a Hugging Face token for private or gated models, and it also helps when you scan many models, because Hugging Face allows more requests to signed-in users. Pass the token on the command line or set it in the environment: ```bash gguf-radar scan --token hf_your_token owner/private-model HF_TOKEN=hf_your_token gguf-radar scan owner/private-model ``` If `HF_TOKEN` is set but you want an anonymous scan, add `--no-token`. When GGUF Radar cannot read the chat template of a gated model, it reports `ERROR` for that model. It never reports such a model as `CLEAN`. ## Saving a report Add `--json` and a file name to save the full result as JSON: ```bash gguf-radar scan ./models/ --json report.json ``` Use `--json -` to print only the JSON to the terminal. [Understanding the results](results.md) describes the fields in the report. ## Other options | Option | What it does | | --- | --- | | `--timeout` | Sets how many seconds to wait for each request to Hugging Face. The default is 30. | | `--no-color` | Turns off colored output. | GGUF Radar writes control characters from model files and repositories, such as the escape character, in a visible form like `\x1b`. This applies to file names, errors, findings and metadata values, so that a file cannot change what your terminal shows. The JSON report escapes all non-ASCII characters, so it stays valid and unambiguous. Run `gguf-radar scan --help` to see every option.