CheckTensors

CheckTensors validates every tensor in the GGUF file during load. Adds noticeable startup time but catches corrupted or truncated models early — cleaner than a mysterious runtime error later.

Quick reference

Type bool?
Default null (false — no validation)
Category Model loading
Field on ModelInferenceParameters.CheckTensors

What it does

  • null or false — default. Skip validation; trust the GGUF file.
  • true — walk every tensor, verify shape and data consistency. Fails early with a clear error if the file is corrupted.

Validation can add 10-30 seconds to startup on a 7B model; longer on larger models. Not intended for production. Use when you have a suspicion about file integrity.

When to change it

Scenario Value
Default null
First-run validation after download from an untrusted source true
Debugging a corrupted GGUF suspicion true
Production (after validation passed once) null

Example

var preset = new Qwen25Preset();
preset.BaseModelInferenceParameters.CheckTensors = true;
// Startup takes longer; validates every tensor against shape + data consistency.

using var api = AsposeLLMApi.Create(preset);

Interactions

  • UseMemoryMapping — validation walks mapped or read-in data; either mode works.
  • GpuLayers — validation happens on host memory before offload.

What’s next