# Recreate the tiny random SAM 3 fixture The [export script](export_tiny_sam3.py) constructs a randomly initialized `Sam3Model` from [Transformers 5.24.1](https://github.com/huggingface/transformers/tree/e68083bdf4035ba6d75976a3b7ce15c98a61f278) and seed 1800. It generates its own five-token vocabulary and RGB input. The three FP32 graphs target ONNX opset 18. Download the script and [the pinned dependencies](requirements-export.txt) to the same directory. With Python 3.13 in a virtual environment: ```sh python -m pip install -r requirements-export.txt HF_HUB_OFFLINE=1 python export_tiny_sam3.py ./rebuilt ``` The command exports the graphs and loader metadata under `rebuilt/`, and writes `expected.json` next to that directory. It checks every graph with the ONNX checker and compares all five model outputs for `cat` and `truck` against the original Python forward pass using ONNX Runtime CPU. With the listed toolchain on macOS ARM64, two independent runs produced identical SHA-256 digests: | Graph | Bytes | SHA-256 | | --- | ---: | --- | | `onnx/vision_encoder.onnx` | 110306 | `46a00e57d23b15e012789828924621dddc55a2e2978bfe7785cbbcfb72e68b99` | | `onnx/text_encoder.onnx` | 32710 | `817ca92336ea102cff8bc5a927d005393a8ad87c2d9b16ef4caea97bb0ad4d89` | | `onnx/prompt_decoder.onnx` | 230009 | `796858207e70df5000ff7a9b599d20b6e4fee6f716e6b8f9d5e8658aaa0778c7` | Transformers.js tests can load the fixture from this repository's default branch with `dtype: 'fp32'`. The fixed input shape is `[1, 3, 28, 28]`, the token sequence has length 32, and the detector returns three queries per image.