Downloads · 30 days
12
8% of all-time downloads
utkubascakir/MultiEmbedTR
MultiEmbedTR is a machine learning model from utkubascakir. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for pytorch. The card lists the license as mit.
This repository contains a contrastively trained Turkish multimodal embedding model, combining a text encoder and a vision encoder with projection heads. The model is trained entirely on Turkish datasets (image–captio…
Downloads · 30 days
12
8% of all-time downloads
All-time downloads
156
Public
Parameters
226M
905 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors905 MB · 100%
From the Hugging Face model README
This repository contains a contrastively trained Turkish multimodal embedding model, combining a text encoder and a vision encoder with projection heads.
The model is trained entirely on Turkish datasets (image–caption and paraphrase), making it specifically tailored for Turkish multimodal applications.
newmindai/modernbert-base-tr-uncased-allnli-stsbfacebook/dinov2-basetext_dim=768, image_dim=768, embed_dim=7680.4 (inside ProjectionHead)use_mean_pooling_for_text=True){normalize}{frozen} (this release was trained with encoders NOT frozen)ituperceptron/image-captioning-turkishdogukanvzr/ml-paraphrase-trBoth datasets are in Turkish, aligning the model’s embedding space around Turkish multimodal signals.
Please check each dataset’s license and terms before downstream use.
pytorch_model.bin — PyTorch state_dictconfig.json — metadata (encoder IDs, dimensions, flags)model.py — custom model classes (required to load)Dataset: Test split created from ituperceptron/image-captioning-turkish
Average cosine similarity: 0.7934
Recall@K
<table> <tr><th>Direction</th><th>R@1</th><th>R@5</th><th>R@10</th></tr> <tr><td>Text → Image</td><td>0.9365</td><td>0.9913</td><td>0.9971</td></tr> <tr><td>Image → Text</td><td>0.9356</td><td>0.9927</td><td>0.9958</td></tr> </table> <details> <summary>Raw metrics (JSON)</summary>{
"avg_cosine_sim": 0.7934404611587524,
"recall_text_to_image": {
"R@1": 0.936458564763386,
"R@5": 0.9913352588313709,
"R@10": 0.9971117529437903
},
"recall_image_to_text": {
"R@1": 0.9355698733614752,
"R@5": 0.9926682959342369,
"R@10": 0.9957787158409243
}
}
</details>
Average cosine similarity: 0.7599
Recall@K
<table> <tr><th>Direction</th><th>R@1</th><th>R@5</th><th>R@10</th></tr> <tr><td>Text → Text</td><td>0.7198</td><td>0.9453</td><td>0.9824</td></tr> </table> <details> <summary>Raw metrics (JSON)</summary>{
"avg_cosine_sim": 0.7599335312843323,
"recall_text_to_text": {
"R@1": 0.719875500222321,
"R@5": 0.9453090262338817,
"R@10": 0.9824366385060027
}
}
</details>
import torch
import torch.nn.functional as F
from transformers import AutoModel, AutoTokenizer, AutoImageProcessor
from PIL import Image
device = "cuda" if torch.cuda.is_available() else "cpu"
model_name = "utkubascakir/MultiEmbedTR"
model = AutoModel.from_pretrained(model_name, trust_remote_code=True).to(device)
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
image_processor = AutoImageProcessor.from_pretrained(model_name, trust_remote_code=True)
model.eval()
# Text Embedding
texts = ["yeşil arka planlı bir kedi", "kumsalda bir köpek"]
text_inputs = tokenizer(
texts,
padding=True,
truncation=True,
return_tensors="pt"
).to(device)
with torch.no_grad():
text_embeds = model.encode_text(
input_ids=text_inputs["input_ids"],
attention_mask=text_inputs["attention_mask"]
)
print("Text embeddings shape:", text_embeds.shape)
# Image Embedding
img = Image.open("kedi.jpg").convert("RGB")
image_inputs = image_processor(
images=img,
return_tensors="pt"
).to(device)
with torch.no_grad():
image_embeds = model.encode_image(
pixel_values=image_inputs["pixel_values"]
)
print("Image embeddings shape:", image_embeds.shape)
similarity = F.cosine_similarity(text_embeds, image_embeds)
print("Cosine similarity:", similarity)
This release provides a Turkish multimodal embedding model, trained to produce aligned vector representations for text and images.
It has not been tested for specific downstream tasks (e.g., retrieval, classification).
No guarantees for bias/toxicity; please evaluate on your own target domain.
If you use this model, please cite this repository.