--- license: apache-2.0 library_name: transformers.js tags: - sam3 - onnx - tiny-random --- # Tiny random SAM 3 ONNX This small SAM 3 model is used in Transformers.js tests to check that the model loads and that reusing image or text features produces the same outputs as a fresh run. The weights are randomly initialized with `Sam3Config` and `Sam3Model` from [Transformers 5.24.1](https://github.com/huggingface/transformers/tree/e68083bdf4035ba6d75976a3b7ce15c98a61f278), using PyTorch 2.8.0 and seed 1800. The three FP32 ONNX opset 18 files total 373,025 bytes. The fixed batch size is 1, image size is 28 × 28, text length is 32, hidden size is 16, and the detector has 3 queries. | File | Inputs | Outputs | |---|---|---| | `onnx/vision_encoder.onnx` | `pixel_values` | `fpn_hidden_state_0`, `fpn_hidden_state_1`, `fpn_hidden_state_2` | | `onnx/text_encoder.onnx` | `input_ids`, `attention_mask` | `text_features` | | `onnx/prompt_decoder.onnx` | The three feature levels, `text_features`, `attention_mask` | `pred_masks`, `pred_boxes`, `pred_logits`, `presence_logits`, `semantic_seg` | The included tokenizer recognizes `cat` and `truck`. These prompts produce distinguishable numeric outputs for regression tests. This fixture has no trained segmentation capability. Use `AutoProcessor.from_pretrained(modelId)` and `AutoModel.from_pretrained(modelId, { dtype: 'fp32' })` with a Transformers.js build that supports `Sam3Model`. The [export recipe](EXPORT.md) includes the script, pinned Python dependencies, and expected graph digests. --- Test fixture by [Maksim Popkov](https://huggingface.co/ai-babai).