# Batch Inspection

Anything you'd do to one checkpoint interactively - index it, query it, check its statistics - often needs doing across many checkpoints at once: every checkpoint in a training run's history, every candidate in a sweep, every model in a shared cache. The [`tmorph`](/docs/cli-and-automation/tensormorph-cli) CLI is built for exactly this, since every command operates on a path and produces script-consumable output.

## Indexing many checkpoints ahead of time

```sh
for ckpt in checkpoints/*.safetensors; do
  tmorph index "$ckpt" --pyramids
done
```

Pre-indexing a batch this way means opening any of them later - interactively or from another script - skips the indexing cost entirely; see [File Formats](/docs/reference/file-formats) for why `.tmidx`/`.tmtiles` are safe to generate ahead of time and cache.

## Querying across a batch

Because `tmorph query` accepts the same [TQL](/docs/reference/expressions-and-queries) predicates used interactively, a question like "which of these checkpoints has any NaN" or "which layer's absmax grew the most across this sweep" is a loop over `tmorph query` calls, with results aggregated in whatever scripting language you're already using - not a question that requires opening each checkpoint in the desktop app one at a time.

## Turning a batch scan into a report

Combined with [Headless Rendering](/docs/cli-and-automation/headless-rendering), a batch inspection script can produce a visual report (heatmap thumbnails, distribution plots) for every checkpoint in a batch without any interactive session - useful for a nightly sweep summary, or for attaching evidence to an automated flag rather than just a pass/fail signal.

## Related resources

-   [Tensormorph CLI](/docs/cli-and-automation/tensormorph-cli) - the full command set batch scripts are built from.
-   [CI Validation](/docs/cli-and-automation/ci-validation) - the pass/fail-oriented counterpart to open-ended batch inspection.
-   [TQL: Expressions and Queries](/docs/reference/expressions-and-queries) - the query language shared between interactive and CLI use.
