Sentence Similarity
sentence-transformers
Safetensors
Filipino
metaclip_2
trimmed
lbourdois commited on
Commit
bd40497
·
verified ·
1 Parent(s): 2d6b417

Update model card for Filipino

Browse files
Files changed (1) hide show
  1. README.md +93 -26
README.md CHANGED
@@ -1,26 +1,93 @@
1
- ---
2
- pipeline_tag: zero-shot-image-classification
3
- language: fil
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-fil-16384
16
-
17
- This model is a 84.2% smaller version of [facebook/metaclip-2-worldwide-m16-384](https://huggingface.co/facebook/metaclip-2-worldwide-m16-384)
18
- optimized for Filipino via text vocabulary trimming.
19
-
20
- ## Model Statistics
21
- - **Original vocab size:** 901,629
22
- - **Trimmed vocab size:** 16,384
23
- - **Vocabulary reduction:** 98.2%
24
- - **Original params:** 538,547,201
25
- - **Trimmed params:** 85,301,761
26
- - **Size reduction:** 84.2%
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pipeline_tag: sentence-similarity
3
+ language: fil
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-fil-16384
15
+ This model is a **84.16% smaller** version of [facebook/metaclip-2-worldwide-m16-384](https://huggingface.co/facebook/metaclip-2-worldwide-m16-384) optimized for **Filipino** 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 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.
17
+
18
+ ## Model Statistics
19
+ | Metric | Original | Trimmed | Reduction |
20
+ |--------|----------|---------|-----------|
21
+ | **Vocabulary size** | 901,629 tokens | 16,384 tokens | **98.18%** |
22
+ | **Model size** | 538,547,201 params | 85,301,761 params | **84.16%** |
23
+
24
+ ![image](https://raw.githubusercontent.com/lbourdois/blog/refs/heads/master/assets/images/Trimming/metaclip-2-worldwide-m16-384-16384.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
33
+ #### Transformers (zero-shot image classification)
34
+ ```python
35
+ from transformers import pipeline
36
+
37
+ # load pipeline
38
+ image_classifier = pipeline(model="alphaedge-ai/metaclip-2-worldwide-m16-384-fil-16384", task="zero-shot-image-classification")
39
+
40
+ # load image and candidate labels
41
+ image = "http://images.cocodataset.org/val2017/000000039769.jpg"
42
+ candidate_labels = ["Potential label 1 in Filipino", "Potential label 2 in Filipino", "Potential label 3 in Filipino", "Potential label 4 in Filipino"]
43
+
44
+ # run inference
45
+ outputs = image_classifier(image, candidate_labels)
46
+ print(outputs)
47
+ ```
48
+
49
+ #### Sentence-transformers (texts-images similarity)
50
+ ```python
51
+ from sentence_transformers import SentenceTransformer
52
+
53
+ model = SentenceTransformer("alphaedge-ai/metaclip-2-worldwide-m16-384-fil-16384")
54
+
55
+ images = [
56
+ "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg",
57
+ "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg",
58
+ "https://huggingface.co/datasets/huggingface/cats-image/resolve/main/cats_image.jpeg"
59
+ ]
60
+ texts = ["Text 1 in Filipino", "Text 2 in Filipino", "Text 3 in Filipino", "Text 4 in Filipino"]
61
+
62
+ image_embeddings = model.encode(images)
63
+ text_embeddings = model.encode(texts)
64
+ print(image_embeddings.shape, text_embeddings.shape)
65
+
66
+ similarities = model.similarity(image_embeddings, text_embeddings)
67
+ print(similarities)
68
+ ```
69
+
70
+ ## Citations
71
+
72
+ #### Meta CLIP 2
73
+ ```
74
+ @misc{chuang2025metaclip2worldwide,
75
+ title={Meta CLIP 2: A Worldwide Scaling Recipe},
76
+ 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},
77
+ year={2025},
78
+ eprint={2507.22062},
79
+ archivePrefix={arXiv},
80
+ primaryClass={cs.CV},
81
+ url={https://arxiv.org/abs/2507.22062},
82
+ }
83
+ ```
84
+
85
+ #### Trimming blog post
86
+ ```
87
+ @misc{hf_blogpost_trimming,
88
+ title={Introduction to Trimming},
89
+ author={Loïck BOURDOIS and Tom AARSEN and Bram VANROY and Christopher AKIKI and Woojun JUNG and Manuel ROMERO and Prithiv SAKTHI},
90
+ year={2026},
91
+ url={https://huggingface.co/blog/lbourdois/introduction-to-trimming},
92
+ }
93
+ ```