immanuelpeter commited on
Commit
d5c6ce3
·
verified ·
1 Parent(s): 0f0835a

Rewrite the card in the house template

Browse files
Files changed (1) hide show
  1. README.md +27 -27
README.md CHANGED
@@ -12,7 +12,8 @@ base_model:
12
 
13
  # PixtralViT-Large-4
14
 
15
- This repository packages the vision Tower and Projector from [Mistral Large 4](https://huggingface.co/mistralai/Mistral-Large-4-1T-A52B). Attribution notice: 2026 - Mistral.
 
16
 
17
  ## Contents
18
 
@@ -20,45 +21,44 @@ This repository packages the vision Tower and Projector from [Mistral Large 4](h
20
  |---|---|---|
21
  | `model.safetensors` | 272 | Pixtral vision encoder, from the parent's `vision_encoder.*` |
22
  | `projector.safetensors` | 4 | `pre_mm_projector_norm`, `patch_merger` and `vision_language_adapter` |
23
- | `modeling_pixtral_large4.py` | | `PixtralVisionModel` subclass with the parent's BF16 numeric order, for `trust_remote_code` |
24
- | `projector.py`, `projector_config.json`, `config.json`, `preprocessor_config.json` | | Projector loader on HF `Mistral3MultiModalProjector`; vision config with `auto_map`; the parent's `PixtralImageProcessor` |
25
- | `examples/inference.py` | | Tower, `merged` and `projected` features for one image |
26
- | `export_manifest.json`, `.gitattributes` | | Source pin, tensor and file SHA256; Hub LFS rules |
27
- | `LICENSE`, `NOTICE`, `LICENSE-CODE` | | Parent license and attribution; MIT for the Python files |
28
 
29
  ## Architecture
30
 
31
  | Component | Details |
32
  |---|---|
33
- | Tower | 30 blocks, 2048 hidden, 16 heads of 128, SwiGLU 6144, RMSNorm, 14 px patches, axial 2D RoPE, no class token, no final norm |
34
- | Projector | `RMSNorm(2048)`, 2x2 merge to 8192, `Linear(8192, 2048)`, then `Linear(2048, 6144)`, GELU, `Linear(6144, 6144)`, no biases |
 
35
 
36
- At 448 px the Tower gives 1,024 tokens of width 2048, `merged` (the patch-merger output) 256 tokens
37
- of width 2048, and `projected` 256 tokens of width 6144. The last Tower layer has three channels with
38
- RMS above 2.5e4; standardize channels before fitting a readout on it.
39
 
40
  ## Usage
41
 
42
- ```python
43
- from transformers import AutoModel
44
-
45
- tower = AutoModel.from_pretrained("immanuelpeter/PixtralViT-Large-4", trust_remote_code=True, dtype="bfloat16")
46
- ```
47
-
48
- [`examples/inference.py`](examples/inference.py) crops an image to 448 x 448 and prints the Tower,
49
- `merged` and `projected` shapes. Use `trust_remote_code` for BF16 fidelity: stock `PixtralVisionModel`
50
- loads the same weights but rounds RoPE and attention differently in BF16.
51
 
52
  ## Validation
53
 
54
- Every tensor equals the pinned parent bit for bit after undoing the RoPE row order. At 448 and 1540 px
55
- the supplied forward matches mistral-inference 1.6.0 bit for bit in FP32 and BF16 with the same attention
56
- kernel; see the [parity evidence](https://github.com/immanuel-peter/vision-tower-bench/tree/main/results/diagnostics/mistral-large4-parity).
 
 
57
 
58
  ## Reproduction
59
 
60
- The [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 pinned
61
- parent, reorders the `wq`/`wk` rows from interleaved to rotate-half, and writes this repository.
 
 
62
 
63
  ## Credits
64
 
@@ -66,5 +66,5 @@ Mistral AI released the Mistral Large 4 weights and the mistral-inference refere
66
 
67
  ## License
68
 
69
- The weights keep the parent's [Mistral Ecosystem Open-Weight License](LICENSE), a modified MIT license: keep its notice
70
- in copies; a Model-as-a-Service business needs a commercial license from Mistral for commercial use. Python: MIT ([`LICENSE-CODE`](LICENSE-CODE)).
 
12
 
13
  # PixtralViT-Large-4
14
 
15
+ This repository packages the Tower and Projector from
16
+ [Mistral Large 4](https://huggingface.co/mistralai/Mistral-Large-4-1T-A52B).
17
 
18
  ## Contents
19
 
 
21
  |---|---|---|
22
  | `model.safetensors` | 272 | Pixtral vision encoder, from the parent's `vision_encoder.*` |
23
  | `projector.safetensors` | 4 | `pre_mm_projector_norm`, `patch_merger` and `vision_language_adapter` |
24
+ | `modeling_pixtral_large4.py` | | `PixtralVisionModel` subclass following the parent's numeric order |
25
+ | `projector.py`, `projector_config.json` | | Projector shapes and loader |
26
+ | `config.json`, `preprocessor_config.json` | | Vision configuration and `PixtralImageProcessor` settings |
27
+ | `export_manifest.json` | | Source pin, shard SHA256 and tensor name map |
28
+ | `LICENSE`, `LICENSE-CODE`, `NOTICE` | | Weight license, code license and attribution |
29
 
30
  ## Architecture
31
 
32
  | Component | Details |
33
  |---|---|
34
+ | Tower | 30 blocks, 2048 hidden, 16 heads of 128, SwiGLU 6144, RMSNorm (eps 1e-5), 14 px patches, axial 2D RoPE, no class token |
35
+ | Final norm | None. The last block's output is the raw residual stream |
36
+ | Projector | `RMSNorm(2048)`, 2x2 patch merge to 8192, `Linear(8192, 2048)`, then `Linear(2048, 6144)`, GELU, `Linear(6144, 6144)`, no biases |
37
 
38
+ At 448 pixels the bench reports 1,024 Tower tokens of width 2048, 256 merged tokens
39
+ of width 2048 and 256 projected tokens of width 6144.
 
40
 
41
  ## Usage
42
 
43
+ See [`examples/inference.py`](examples/inference.py) for image feature extraction.
44
+ `AutoModel.from_pretrained(..., trust_remote_code=True)` loads
45
+ `modeling_pixtral_large4.py`, which follows the parent's BF16 numeric order; stock
46
+ `PixtralVisionModel` loads the same weights but rounds differently there.
 
 
 
 
 
47
 
48
  ## Validation
49
 
50
+ The release tests compare all 276 tensors with the pinned parent checkpoint using
51
+ `torch.equal`. Fixed-image Tower, merged and projected outputs also match the
52
+ mistral-inference 1.6.0 reference bit-for-bit in FP32 and BF16 at 448 and 1540
53
+ pixels, in 80 of 80 comparisons. The parent itself drifts between BF16 and FP32
54
+ at the deepest Stages; this release matches it in each precision.
55
 
56
  ## Reproduction
57
 
58
+ The [export script](https://github.com/immanuel-peter/vision-tower-bench/blob/main/scripts/export_mistral_large4_vision.py)
59
+ range-reads the 276 vision tensors from the shard the pinned index names, renames
60
+ them to HF Pixtral names and reorders each `wq` and `wk` head from interleaved
61
+ rotary pairs to rotate-half order. It writes the original BF16 tensors.
62
 
63
  ## Credits
64
 
 
66
 
67
  ## License
68
 
69
+ The weights keep the [Mistral Ecosystem Open-Weight License](LICENSE) from the
70
+ source model. The Python files are MIT; see [LICENSE-CODE](LICENSE-CODE).