Instructions to use alphaedge-ai/metaclip-2-worldwide-m16-384-epo-32768 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use alphaedge-ai/metaclip-2-worldwide-m16-384-epo-32768 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("alphaedge-ai/metaclip-2-worldwide-m16-384-epo-32768") 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
Trimmed MetaCLIP-2 text vocab for Esperanto
Browse files- README.md +6 -34
- config.json +1 -1
- model.safetensors +2 -2
- tokenizer.json +0 -9
README.md
CHANGED
|
@@ -14,41 +14,13 @@ datasets:
|
|
| 14 |
|
| 15 |
# metaclip-2-worldwide-m16-384-epo-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 Esperanto
|
| 19 |
-
[Lumberjackk/fineweb-2-trimming](https://huggingface.co/datasets/Lumberjackk/fineweb-2-trimming).
|
| 20 |
-
|
| 21 |
-
Only the **text encoder** vocabulary and embeddings are trimmed.
|
| 22 |
-
The **vision encoder** is kept identical to the original.
|
| 23 |
|
| 24 |
## Model Statistics
|
| 25 |
-
- **Original
|
| 26 |
-
- **Trimmed
|
| 27 |
- **Vocabulary reduction:** 96.4%
|
| 28 |
-
- **Original
|
| 29 |
-
- **Trimmed
|
| 30 |
- **Size reduction:** 82.6%
|
| 31 |
-
|
| 32 |
-
## Usage
|
| 33 |
-
|
| 34 |
-
```python
|
| 35 |
-
from transformers import AutoProcessor, AutoModel
|
| 36 |
-
import torch
|
| 37 |
-
|
| 38 |
-
model = AutoModel.from_pretrained("provisoirement/metaclip-2-worldwide-m16-384-epo-32768")
|
| 39 |
-
processor = AutoProcessor.from_pretrained("provisoirement/metaclip-2-worldwide-m16-384-epo-32768")
|
| 40 |
-
|
| 41 |
-
# Text-only encoding
|
| 42 |
-
texts = ["a photo of a cat", "a photo of a dog"]
|
| 43 |
-
inputs = processor(text=texts, return_tensors="pt", padding=True)
|
| 44 |
-
with torch.inference_mode():
|
| 45 |
-
text_features = model.get_text_features(**inputs)
|
| 46 |
-
|
| 47 |
-
# Image + text (standard CLIP usage)
|
| 48 |
-
# from PIL import Image
|
| 49 |
-
# image = Image.open("image.jpg")
|
| 50 |
-
# inputs = processor(images=image, text=texts, return_tensors="pt", padding=True)
|
| 51 |
-
# with torch.inference_mode():
|
| 52 |
-
# outputs = model(**inputs)
|
| 53 |
-
# logits_per_image = outputs.logits_per_image
|
| 54 |
-
```
|
|
|
|
| 14 |
|
| 15 |
# metaclip-2-worldwide-m16-384-epo-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 Esperanto 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%
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
| 21 |
"num_attention_heads": 8,
|
| 22 |
"num_hidden_layers": 12,
|
| 23 |
"projection_dim": 512,
|
| 24 |
-
"vocab_size":
|
| 25 |
},
|
| 26 |
"transformers_version": "4.57.1",
|
| 27 |
"vision_config": {
|
|
|
|
| 21 |
"num_attention_heads": 8,
|
| 22 |
"num_hidden_layers": 12,
|
| 23 |
"projection_dim": 512,
|
| 24 |
+
"vocab_size": 32768
|
| 25 |
},
|
| 26 |
"transformers_version": "4.57.1",
|
| 27 |
"vision_config": {
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:acc9e60667f62287c900ca8bbdc5431e398f7b5b1ad9c937141f07cb45403441
|
| 3 |
+
size 374808820
|
tokenizer.json
CHANGED
|
@@ -61,15 +61,6 @@
|
|
| 61 |
"rstrip": false,
|
| 62 |
"normalized": false,
|
| 63 |
"special": true
|
| 64 |
-
},
|
| 65 |
-
{
|
| 66 |
-
"id": 32768,
|
| 67 |
-
"content": "<image_soft_token>",
|
| 68 |
-
"single_word": false,
|
| 69 |
-
"lstrip": false,
|
| 70 |
-
"rstrip": false,
|
| 71 |
-
"normalized": true,
|
| 72 |
-
"special": false
|
| 73 |
}
|
| 74 |
],
|
| 75 |
"normalizer": {
|
|
|
|
| 61 |
"rstrip": false,
|
| 62 |
"normalized": false,
|
| 63 |
"special": true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
}
|
| 65 |
],
|
| 66 |
"normalizer": {
|