Image Feature Extraction
Transformers
Safetensors
pixtral_large4_vision
feature-extraction
vision
custom_code
Instructions to use immanuelpeter/PixtralViT-Large-4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use immanuelpeter/PixtralViT-Large-4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-feature-extraction", model="immanuelpeter/PixtralViT-Large-4", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("immanuelpeter/PixtralViT-Large-4", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Rewrite the card in the house template
Browse files11 unmodified lines121314151617181 unmodified line2021222324252627282930313233343536373839404142434445464748495051525354555657585960616263641 unmodified line666768697011 unmodified lines# PixtralViT-Large-4This repository packages the vision Tower and Projector from [Mistral Large 4](https://huggingface.co/mistralai/Mistral-Large-4-1T-A52B). Attribution notice: 2026 - Mistral.## Contents1 unmodified line|---|---|---|| `model.safetensors` | 272 | Pixtral vision encoder, from the parent's `vision_encoder.*` || `projector.safetensors` | 4 | `pre_mm_projector_norm`, `patch_merger` and `vision_language_adapter` || `modeling_pixtral_large4.py` | | `PixtralVisionModel` subclass with the parent's BF16 numeric order, for `trust_remote_code` || `projector.py`, `projector_config.json`, `config.json`, `preprocessor_config.json` | | Projector loader on HF `Mistral3MultiModalProjector`; vision config with `auto_map`; the parent's `PixtralImageProcessor` || `examples/inference.py` | | Tower, `merged` and `projected` features for one image || `export_manifest.json`, `.gitattributes` | | Source pin, tensor and file SHA256; Hub LFS rules || `LICENSE`, `NOTICE`, `LICENSE-CODE` | | Parent license and attribution; MIT for the Python files |## Architecture| Component | Details ||---|---|| Tower | 30 blocks, 2048 hidden, 16 heads of 128, SwiGLU 6144, RMSNorm, 14 px patches, axial 2D RoPE, no class token, no final norm || Projector | `RMSNorm(2048)`, 2x2 merge to 8192, `Linear(8192, 2048)`, then `Linear(2048, 6144)`, GELU, `Linear(6144, 6144)`, no biases |At 448 px the Tower gives 1,024 tokens of width 2048, `merged` (the patch-merger output) 256 tokensof width 2048, and `projected` 256 tokens of width 6144. The last Tower layer has three channels withRMS above 2.5e4; standardize channels before fitting a readout on it.## Usage```pythonfrom transformers import AutoModeltower = AutoModel.from_pretrained("immanuelpeter/PixtralViT-Large-4", trust_remote_code=True, dtype="bfloat16")```[`examples/inference.py`](examples/inference.py) crops an image to 448 x 448 and prints the Tower,`merged` and `projected` shapes. Use `trust_remote_code` for BF16 fidelity: stock `PixtralVisionModel`loads the same weights but rounds RoPE and attention differently in BF16.## ValidationEvery tensor equals the pinned parent bit for bit after undoing the RoPE row order. At 448 and 1540 pxthe supplied forward matches mistral-inference 1.6.0 bit for bit in FP32 and BF16 with the same attentionkernel; see the [parity evidence](https://github.com/immanuel-peter/vision-tower-bench/tree/main/results/diagnostics/mistral-large4-parity).## ReproductionThe [export script](https://github.com/immanuel-peter/vision-tower-bench/blob/main/scripts/export_mistral_large4_vision.py) range-reads the 276 vision tensors from the pinnedparent, reorders the `wq`/`wk` rows from interleaved to rotate-half, and writes this repository.## Credits1 unmodified line## LicenseThe weights keep the parent's [Mistral Ecosystem Open-Weight License](LICENSE), a modified MIT license: keep its noticein copies; a Model-as-a-Service business needs a commercial license from Mistral for commercial use. Python: MIT ([`LICENSE-CODE`](LICENSE-CODE)).11 unmodified lines12131415161718191 unmodified line21222324252627282930313233343536373839404142434445464748495051525354555657585960616263641 unmodified line666768697011 unmodified lines# PixtralViT-Large-4This repository packages the Tower and Projector from[Mistral Large 4](https://huggingface.co/mistralai/Mistral-Large-4-1T-A52B).## Contents1 unmodified line|---|---|---|| `model.safetensors` | 272 | Pixtral vision encoder, from the parent's `vision_encoder.*` || `projector.safetensors` | 4 | `pre_mm_projector_norm`, `patch_merger` and `vision_language_adapter` || `modeling_pixtral_large4.py` | | `PixtralVisionModel` subclass following the parent's numeric order || `projector.py`, `projector_config.json` | | Projector shapes and loader || `config.json`, `preprocessor_config.json` | | Vision configuration and `PixtralImageProcessor` settings || `export_manifest.json` | | Source pin, shard SHA256 and tensor name map || `LICENSE`, `LICENSE-CODE`, `NOTICE` | | Weight license, code license and attribution |## Architecture| Component | Details ||---|---|| Tower | 30 blocks, 2048 hidden, 16 heads of 128, SwiGLU 6144, RMSNorm (eps 1e-5), 14 px patches, axial 2D RoPE, no class token || Final norm | None. The last block's output is the raw residual stream || Projector | `RMSNorm(2048)`, 2x2 patch merge to 8192, `Linear(8192, 2048)`, then `Linear(2048, 6144)`, GELU, `Linear(6144, 6144)`, no biases |At 448 pixels the bench reports 1,024 Tower tokens of width 2048, 256 merged tokensof width 2048 and 256 projected tokens of width 6144.## UsageSee [`examples/inference.py`](examples/inference.py) for image feature extraction.`AutoModel.from_pretrained(..., trust_remote_code=True)` loads`modeling_pixtral_large4.py`, which follows the parent's BF16 numeric order; stock`PixtralVisionModel` loads the same weights but rounds differently there.## ValidationThe release tests compare all 276 tensors with the pinned parent checkpoint using`torch.equal`. Fixed-image Tower, merged and projected outputs also match themistral-inference 1.6.0 reference bit-for-bit in FP32 and BF16 at 448 and 1540pixels, in 80 of 80 comparisons. The parent itself drifts between BF16 and FP32at the deepest Stages; this release matches it in each precision.## ReproductionThe [export script](https://github.com/immanuel-peter/vision-tower-bench/blob/main/scripts/export_mistral_large4_vision.py)range-reads the 276 vision tensors from the shard the pinned index names, renamesthem to HF Pixtral names and reorders each `wq` and `wk` head from interleavedrotary pairs to rotate-half order. It writes the original BF16 tensors.## Credits1 unmodified line## LicenseThe weights keep the [Mistral Ecosystem Open-Weight License](LICENSE) from thesource model. The Python files are MIT; see [LICENSE-CODE](LICENSE-CODE).
README.md+27-27