Instructions to use immanuelpeter/Inkling-2-Small-Vision with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- timm
How to use immanuelpeter/Inkling-2-Small-Vision with timm:
import timm model = timm.create_model("hf-hub:immanuelpeter/Inkling-2-Small-Vision", pretrained=True) - PerceptionEncoder
How to use immanuelpeter/Inkling-2-Small-Vision with PerceptionEncoder:
# Use any PE model as a vision encoder import core.vision_encoder.pe as pe model = pe.VisionTransformer.from_config("immanuelpeter/Inkling-2-Small-Vision", pretrained=True) - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -25,33 +25,27 @@ This repository packages the vision Tower and Projector from [Inkling 2 Small](h
|
|
| 25 |
| `export_manifest.json` | | Source pin, tensor counts and the vision reference |
|
| 26 |
| `LICENSE` | | Apache-2.0 |
|
| 27 |
|
| 28 |
-
All tensors are the parent's BF16 values, unchanged.
|
| 29 |
-
|
| 30 |
## Architecture
|
| 31 |
|
| 32 |
| Component | Details |
|
| 33 |
|---|---|
|
| 34 |
-
| Tower | 23 blocks,
|
| 35 |
-
|
|
| 36 |
-
| Positions | Learned 32 x 32 grid plus a class-token embedding, and 2D RoPE (theta 10000, interleaved pairs, x then y, patches offset by one, class token at 0) |
|
| 37 |
-
| Merge | 2x2 neighbouring patch tokens concatenated top-left, top-right, bottom-left, bottom-right, class token excluded, 4096 wide |
|
| 38 |
| Projector | `Linear(4096, 4096)`, exact GELU, `Linear(4096, 4608)`, no biases |
|
| 39 |
|
| 40 |
The native resolution is 640 px, a 32 x 32 patch grid. There the Tower gives 1024 patch tokens of width 1024, the merge 256 tokens of width 4096, and the Projector 256 tokens of width 4608, the language model's hidden size.
|
| 41 |
|
| 42 |
-
The parent normalizes pixels with the CLIP mean and standard deviation, rounds to BF16, maps the result to [-1, 1] and rounds to BF16 again. `normalize` in `inkling2_vision.py` does the same.
|
| 43 |
-
|
| 44 |
## Usage
|
| 45 |
|
| 46 |
-
See [`examples/inference.py`](examples/inference.py)
|
| 47 |
|
| 48 |
## Validation
|
| 49 |
|
| 50 |
-
The [parity check](https://github.com/immanuel-peter/vision-tower-bench/blob/main/vtb/parity/pe.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 eager per-image reference in vLLM's Inkling 2 vision
|
| 51 |
|
| 52 |
## Reproduction
|
| 53 |
|
| 54 |
-
The [export](https://github.com/immanuel-peter/vision-tower-bench/blob/main/vtb/adapters/pe.py)
|
| 55 |
|
| 56 |
## Credits
|
| 57 |
|
|
|
|
| 25 |
| `export_manifest.json` | | Source pin, tensor counts and the vision reference |
|
| 26 |
| `LICENSE` | | Apache-2.0 |
|
| 27 |
|
|
|
|
|
|
|
| 28 |
## Architecture
|
| 29 |
|
| 30 |
| Component | Details |
|
| 31 |
|---|---|
|
| 32 |
+
| Tower | 23 blocks, 1024 hidden, 16 heads, patch size 20, 2D RoPE, exact GELU, LayerScale |
|
| 33 |
+
| Token compression | 2x2 spatial grouping of 1024-wide patches to 4096, no learned parameters |
|
|
|
|
|
|
|
| 34 |
| Projector | `Linear(4096, 4096)`, exact GELU, `Linear(4096, 4608)`, no biases |
|
| 35 |
|
| 36 |
The native resolution is 640 px, a 32 x 32 patch grid. There the Tower gives 1024 patch tokens of width 1024, the merge 256 tokens of width 4096, and the Projector 256 tokens of width 4608, the language model's hidden size.
|
| 37 |
|
|
|
|
|
|
|
| 38 |
## Usage
|
| 39 |
|
| 40 |
+
See [`examples/inference.py`](examples/inference.py) for image feature extraction.
|
| 41 |
|
| 42 |
## Validation
|
| 43 |
|
| 44 |
+
The [parity check](https://github.com/immanuel-peter/vision-tower-bench/blob/main/vtb/parity/pe.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 eager per-image reference in vLLM's Inkling 2 vision [test](https://github.com/vllm-project/vllm/pull/67325), run on the parent's tensors.
|
| 45 |
|
| 46 |
## Reproduction
|
| 47 |
|
| 48 |
+
The [export script](https://github.com/immanuel-peter/vision-tower-bench/blob/main/vtb/adapters/pe.py) reads the `model.visual.*` tensors from the pinned parent and writes the original BF16 tensors.
|
| 49 |
|
| 50 |
## Credits
|
| 51 |
|