immanuelpeter commited on
Commit
6a172a3
·
verified ·
1 Parent(s): 1526fc5

Tighten model card

Browse files
Files changed (1) hide show
  1. README.md +12 -16
README.md CHANGED
@@ -14,46 +14,42 @@ base_model:
14
 
15
  # Hy4-Flash-Vision
16
 
17
- This repository packages the vision Tower and Projector from [Hy4 flash](https://huggingface.co/tencent/Hy4-flash). The Tower was initialized from [SigLIP 2 So400m](https://huggingface.co/google/siglip2-so400m-patch14-384) and trained further with the language model. Tencent extended its learned position table to 128 x 128 so it takes native-resolution input from 512 to 2048 px.
18
 
19
  ## Contents
20
 
21
  | File | Tensors | What it holds |
22
  |---|---|---|
23
- | `model.safetensors` | 441 | The parent's `vit.*` tensors with the prefix `vit.` removed: 435 Tower and 6 Projector (`perceive.*`) |
24
- | `modeling_hy4_flash_vision.py` | | Standalone Tower and Projector, loaded with `trust_remote_code` |
25
  | `config.json` | | Vision configuration |
26
- | `export_manifest.json` | | Source pin, source shards, tensor counts and the vision reference |
27
- | `LICENSE`, `LICENSE-CODE`, `NOTICE` | | Weight license, code license and attribution |
28
 
29
  ## Architecture
30
 
31
  | Component | Details |
32
  |---|---|
33
- | Tower | 27 pre-norm blocks, 1152 hidden, MLP 4304, 16 heads, exact GELU, LayerNorm eps 1e-5, biases on every Linear |
34
- | Patches | 16 x 16 pixels, patch embedding with bias |
35
- | Positions | Learned absolute only. The 128 x 128 table (`[16385, 1152]`, row 0 unused) is interpolated bilinearly with `scale_factor = (size + 0.1) / 128` and `align_corners=False` |
36
- | Output | No final norm and no class or register tokens: the last block feeds the Projector |
37
- | Projector | RMSNorm (eps 1e-5), `Conv2d(1152, 4608, 2, stride 2)`, GELU, `Conv2d(4608, 3072, 1)`, then a learned `image_newline` token after each row |
38
 
39
- Pixels are normalized with mean and std 0.5. At 512 x 512 the Tower gives 1024 tokens of width 1152, the 2x2 merge 256 tokens of width 4608, and the Projector 256 tokens of width 3072, the language model's hidden size, plus 16 newline tokens.
40
 
41
  ## Usage
42
 
43
- See [`examples/inference.py`](examples/inference.py) for image feature extraction. `AutoModel.from_pretrained(..., trust_remote_code=True)` loads `modeling_hy4_flash_vision.py`; its `pooler_output` is the Projector output with the newline tokens.
44
 
45
  ## Validation
46
 
47
- The [parity check](https://github.com/immanuel-peter/vision-tower-bench/blob/main/vtb/parity/hy4_flash.py) compares every released tensor with the pinned parent using `torch.equal`. It then compares the Tower depths, the merge and the Projector with the `hy_v4_flash` vision classes in transformers [PR #50903](https://github.com/huggingface/transformers/pull/50903), run on the parent's tensors. FP32 on CPU is bit-exact. BF16 on CUDA is within the parity tolerance.
48
 
49
  ## Reproduction
50
 
51
- The [export script](https://github.com/immanuel-peter/vision-tower-bench/blob/main/vtb/adapters/hy4_flash.py) range-reads the 441 `vit.*` tensors from 20 of the parent's 148 shards and writes the original BF16 tensors.
52
 
53
  ## Credits
54
 
55
- Tencent released the Hy4 flash weights. Google released SigLIP2. The vision forward follows the Hugging Face transformers implementation.
56
 
57
  ## License
58
 
59
- Weights are under the [Tencent Hy License, Version 1.0](LICENSE), the license of the source model. Section 10 adds terms for large Model-as-a-Service businesses and applies to every recipient. `modeling_hy4_flash_vision.py` and `examples/inference.py` are MIT; see [`LICENSE-CODE`](LICENSE-CODE) and [`NOTICE`](NOTICE).
 
14
 
15
  # Hy4-Flash-Vision
16
 
17
+ This repository packages the vision Tower and Projector from [Hy4 flash](https://huggingface.co/tencent/Hy4-flash), initialized from [SigLIP 2 So400m](https://huggingface.co/google/siglip2-so400m-patch14-384) and extended to native resolutions from 512 to 2048 px.
18
 
19
  ## Contents
20
 
21
  | File | Tensors | What it holds |
22
  |---|---|---|
23
+ | `model.safetensors` | 441 | 435 Tower and 6 Projector (`perceive.*`) tensors from `vit.*` |
24
+ | `modeling_hy4_flash_vision.py` | | Standalone Tower and Projector (`trust_remote_code=True`) |
25
  | `config.json` | | Vision configuration |
26
+ | `export_manifest.json` | | Source pin, shards and tensor counts |
 
27
 
28
  ## Architecture
29
 
30
  | Component | Details |
31
  |---|---|
32
+ | Tower | 27 blocks, 1152 hidden, 4304 MLP, 16 heads, patch size 16, GELU, learned 128 x 128 absolute positions |
33
+ | Projector | RMSNorm, `Conv2d(1152, 4608, 2, stride 2)`, GELU, `Conv2d(4608, 3072, 1)`, learned `image_newline` per row |
 
 
 
34
 
35
+ At 512 px this gives 1024 Tower tokens (1152-d), 256 merged tokens (4608-d), and 256 projected tokens (3072-d) plus 16 newline tokens.
36
 
37
  ## Usage
38
 
39
+ See [`examples/inference.py`](examples/inference.py) for image feature extraction. `AutoModel.from_pretrained(..., trust_remote_code=True)` loads `modeling_hy4_flash_vision.py`.
40
 
41
  ## Validation
42
 
43
+ The [parity check](https://github.com/immanuel-peter/vision-tower-bench/blob/main/vtb/parity/hy4_flash.py) verifies all 441 tensors against the pinned parent with `torch.equal` and compares forward outputs against the `hy_v4_flash` reference in Transformers [PR #50903](https://github.com/huggingface/transformers/pull/50903).
44
 
45
  ## Reproduction
46
 
47
+ The [export script](https://github.com/immanuel-peter/vision-tower-bench/blob/main/vtb/adapters/hy4_flash.py) range-reads the 441 `vit.*` tensors from the pinned parent and writes the original BF16 tensors.
48
 
49
  ## Credits
50
 
51
+ Tencent released the Hy4 flash weights; Google released SigLIP 2. The vision forward follows Hugging Face Transformers.
52
 
53
  ## License
54
 
55
+ Weights use the [Tencent Hy License, Version 1.0](LICENSE) (Section 10 adds terms for large Model-as-a-Service businesses). Code is [MIT](LICENSE-CODE); see [NOTICE](NOTICE) for attribution.