Sentence Similarity
sentence-transformers
Safetensors
Bengali
metaclip_2
trimmed
lbourdois commited on
Commit
baac882
·
verified ·
1 Parent(s): 93733dd

Update model card for Bengali

Browse files
Files changed (1) hide show
  1. README.md +92 -26
README.md CHANGED
@@ -1,26 +1,92 @@
1
- ---
2
- pipeline_tag: zero-shot-image-classification
3
- language: ben
4
- tags:
5
- - trimmed
6
- - vision-language
7
- - clip
8
- library_name: transformers
9
- base_model: facebook/metaclip-2-worldwide-m16-384
10
- base_model_relation: quantized
11
- datasets:
12
- - Lumberjackk/fineweb-2-trimming
13
- ---
14
-
15
- # metaclip-2-worldwide-m16-384-ben-32768
16
-
17
- This model is a 82.6% smaller version of [facebook/metaclip-2-worldwide-m16-384](https://huggingface.co/facebook/metaclip-2-worldwide-m16-384)
18
- optimized for Bengali via text vocabulary trimming.
19
-
20
- ## Model Statistics
21
- - **Original vocab size:** 901,629
22
- - **Trimmed vocab size:** 32,768
23
- - **Vocabulary reduction:** 96.4%
24
- - **Original params:** 538,547,201
25
- - **Trimmed params:** 93,690,369
26
- - **Size reduction:** 82.6%
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pipeline_tag: sentence-similarity
3
+ language: ben
4
+ license: cc-by-nc-4.0
5
+ tags:
6
+ - trimmed
7
+ library_name: sentence-transformers
8
+ base_model: facebook/metaclip-2-worldwide-m16-384
9
+ base_model_relation: quantized
10
+ datasets:
11
+ - lbourdois/fineweb-2-trimming
12
+ ---
13
+
14
+ # metaclip-2-worldwide-m16-384-ben-32768
15
+ This model is a **82.60% smaller** version of [facebook/metaclip-2-worldwide-m16-384](https://huggingface.co/facebook/metaclip-2-worldwide-m16-384) optimized for **Bengali** language via vocabulary size reduction using the [trimming](https://huggingface.co/blog/lbourdois/introduction-to-trimming) method.
16
+ This trimmed model should perform similarly to the original model with only 32,768 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.
17
+
18
+ ## Model Statistics
19
+ | Metric | Original | Trimmed | Reduction |
20
+ |--------|----------|---------|-----------|
21
+ | **Vocabulary size** | 901,629 tokens | 32,768 tokens | **96.37%** |
22
+ | **Model size** | 538,547,201 params | 93,690,369 params | **82.60%** |
23
+
24
+ ![image](https://raw.githubusercontent.com/lbourdois/blog/refs/heads/master/assets/images/Trimming/metaclip-2-worldwide-m16-384-32768.png)
25
+
26
+ ## Mining Dataset Statistics
27
+ - **Number of texts used for mining**: 200,000 texts
28
+ - **Dataset**: [lbourdois/fineweb-2-trimming](https://huggingface.co/datasets/lbourdois/fineweb-2-trimming)
29
+
30
+ ## Usage
31
+
32
+ #### Transformers (zero-shot image classification)
33
+ ```python
34
+ from transformers import pipeline
35
+
36
+ # load pipeline
37
+ image_classifier = pipeline(model="alphaedge-ai/metaclip-2-worldwide-m16-384-ben-32768", task="zero-shot-image-classification")
38
+
39
+ # load image and candidate labels
40
+ image = "http://images.cocodataset.org/val2017/000000039769.jpg"
41
+ candidate_labels = ["Potential label 1 in Bengali", "Potential label 2 in Bengali", "Potential label 3 in Bengali", "Potential label 4 in Bengali"]
42
+
43
+ # run inference
44
+ outputs = image_classifier(image, candidate_labels)
45
+ print(outputs)
46
+ ```
47
+
48
+ #### Sentence-transformers (texts-images similarity)
49
+ ```python
50
+ from sentence_transformers import SentenceTransformer
51
+
52
+ model = SentenceTransformer("alphaedge-ai/metaclip-2-worldwide-m16-384-ben-32768")
53
+
54
+ images = [
55
+ "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg",
56
+ "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg",
57
+ "https://huggingface.co/datasets/huggingface/cats-image/resolve/main/cats_image.jpeg"
58
+ ]
59
+ texts = ["Text 1 in Bengali", "Text 2 in Bengali", "Text 3 in Bengali", "Text 4 in Bengali"]
60
+
61
+ image_embeddings = model.encode(images)
62
+ text_embeddings = model.encode(texts)
63
+ print(image_embeddings.shape, text_embeddings.shape)
64
+
65
+ similarities = model.similarity(image_embeddings, text_embeddings)
66
+ print(similarities)
67
+ ```
68
+
69
+ ## Citations
70
+
71
+ #### Meta CLIP 2
72
+ ```
73
+ @misc{chuang2025metaclip2worldwide,
74
+ title={Meta CLIP 2: A Worldwide Scaling Recipe},
75
+ author={Yung-Sung Chuang and Yang Li and Dong Wang and Ching-Feng Yeh and Kehan Lyu and Ramya Raghavendra and James Glass and Lifei Huang and Jason Weston and Luke Zettlemoyer and Xinlei Chen and Zhuang Liu and Saining Xie and Wen-tau Yih and Shang-Wen Li and Hu Xu},
76
+ year={2025},
77
+ eprint={2507.22062},
78
+ archivePrefix={arXiv},
79
+ primaryClass={cs.CV},
80
+ url={https://arxiv.org/abs/2507.22062},
81
+ }
82
+ ```
83
+
84
+ #### Trimming blog post
85
+ ```
86
+ @misc{hf_blogpost_trimming,
87
+ title={Introduction to Trimming},
88
+ author={Loïck BOURDOIS and Tom AARSEN and Bram VANROY and Christopher AKIKI and Woojun JUNG and Manuel ROMERO and Prithiv SAKTHI},
89
+ year={2026},
90
+ url={https://huggingface.co/blog/lbourdois/introduction-to-trimming},
91
+ }
92
+ ```