Safetensors sharded-weight integrity tutorial
Tested: Windows, Python 3.11.7, safetensors 0.7.0, numpy 1.24.4.
No GPU or external API is required. No real model weights are included.

Install in a virtual environment:
  python -m pip install safetensors==0.7.0 numpy==1.24.4

Create a synthetic fixture (the demo-model directory must not already exist):
  python make_demo.py

Create a baseline only from a known-good, trusted source:
  python check_model.py demo-model --write-manifest reference.json

Verify:
  python check_model.py demo-model --manifest reference.json

Without a baseline, only structure and indexed tensor keys are checked:
  python check_model.py demo-model

Exit codes: 0 = checks requested passed; 1 = file check failed;
2 = invalid input / configuration / baseline creation failure.
Without --manifest, exit code 0 does NOT establish byte integrity.
Unreferenced *.safetensors files produce WARN, not failure.

Scope: standard model.safetensors.index.json plus its referenced shards.
The --index option selects an alternative index filename.
Config, tokenizer, adapters, code and other artifacts are not covered.
Symlinks are followed, for compatibility with local HF caches. Only check
directories you control and trust. This is not a filesystem sandbox.
Stop downloads, synchronization and modifications before checking.

SHA-256 matching proves equality to the provided baseline, not model safety
or the identity of its publisher. Keep baseline provenance and revision
records separately. Do not generate a trusted baseline from suspect files.
The demo is not an inference-ready pretrained model.
