Instructions to use alphaedge-ai/siglip2-giant-opt-patch16-384-tgk-16384 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use alphaedge-ai/siglip2-giant-opt-patch16-384-tgk-16384 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("alphaedge-ai/siglip2-giant-opt-patch16-384-tgk-16384") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
File size: 3,872 Bytes
d0a8a6d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | ---
pipeline_tag: zero-shot-image-classification
language: tgk
license: apache-2.0
tags:
- trimmed
library_name: sentence-transformers
base_model: google/siglip2-giant-opt-patch16-384
base_model_relation: quantized
datasets:
- lbourdois/fineweb-2-trimming
---
# siglip2-giant-opt-patch16-384-tgk-16384
This model is a **14.75%** smaller version of [google/siglip2-giant-opt-patch16-384](https://huggingface.co/google/siglip2-giant-opt-patch16-384) optimized for **Tajik** language via vocabulary size reduction using the [trimming](https://huggingface.co/blog/lbourdois/introduction-to-trimming) method.
This trimmed model should perform similarly to the original model with only 16,384 tokens and a much smaller memory footprint. However, it may not perform well for other languages as tokens not commonly used in the selected languages were removed from the vocabulary.
## Model Statistics
| Metric | Original | Trimmed | Reduction |
|--------|----------|---------|-----------|
| **Vocabulary size** | 256,000 tokens | 16,384 tokens | **93.60%** |
| **Model size** | 1,871,885,426 params | 1,595,847,794 params | **14.75%** |

## Mining Dataset Statistics
- **Number of texts used for mining**: 200,000 texts
- **Dataset**: [lbourdois/fineweb-2-trimming](https://huggingface.co/datasets/lbourdois/fineweb-2-trimming)
## Usage
#### Transformers (zero-shot image classification)
```python
from transformers import pipeline
# load pipeline
image_classifier = pipeline(model="alphaedge-ai/siglip2-giant-opt-patch16-384-tgk-16384", task="zero-shot-image-classification")
# load image and candidate labels
image = "http://images.cocodataset.org/val2017/000000039769.jpg"
candidate_labels = ["Potential label 1 in Tajik", "Potential label 2 in Tajik", "Potential label 3 in Tajik", "Potential label 4 in Tajik"]
# run inference
outputs = image_classifier(image, candidate_labels)
print(outputs)
```
#### Sentence-transformers (texts-images similarity)
```python
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("alphaedge-ai/siglip2-giant-opt-patch16-384-tgk-16384")
images = [
"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg",
"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg",
"https://huggingface.co/datasets/huggingface/cats-image/resolve/main/cats_image.jpeg"
]
texts = ["Text 1 in Tajik", "Text 2 in Tajik", "Text 3 in Tajik", "Text 4 in Tajik"]
image_embeddings = model.encode(images)
text_embeddings = model.encode(texts)
print(image_embeddings.shape, text_embeddings.shape)
similarities = model.similarity(image_embeddings, text_embeddings)
print(similarities)
```
## Citations
#### SigLIP 2
```
@misc{tschannen2025siglip2multilingualvisionlanguage,
title={SigLIP 2: Multilingual Vision-Language Encoders with Improved Semantic Understanding, Localization, and Dense Features},
author={Michael Tschannen and Alexey Gritsenko and Xiao Wang and Muhammad Ferjad Naeem and Ibrahim Alabdulmohsin and Nikhil Parthasarathy and Talfan Evans and Lucas Beyer and Ye Xia and Basil Mustafa and Olivier Hénaff and Jeremiah Harmsen and Andreas Steiner and Xiaohua Zhai},
year={2025},
eprint={2502.14786},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2502.14786},
}
```
#### Trimming blog post
```
@misc{hf_blogpost_trimming,
title={Introduction to Trimming},
author={Loïck BOURDOIS and Tom AARSEN and Bram VANROY and Christopher AKIKI and Woojun JUNG and Manuel ROMERO and Prithiv SAKTHI},
year={2026},
url={https://huggingface.co/blog/lbourdois/introduction-to-trimming},
}
``` |