🚀 MEXMA-SigLIP模型
MEXMA-SigLIP是一个高性能的零样本图像分类模型,它结合了多语言文本编码器和图像编码器,支持80种语言,在相关数据集上表现出色。
🚀 快速开始
模型概述
MEXMA-SigLIP结合了 MEXMA 多语言文本编码器和 SigLIP 模型中的图像编码器。这使我们能够获得一个支持80种语言的高性能CLIP模型。MEXMA-SigLIP在 Crossmodal-3600 数据集上,在商业友好型模型中达到了最先进的水平。
支持语言
属性 |
详情 |
支持语言 |
ar、kn、ka、af、kk、am、km、ky、ko、as、lo、az、ml、mr、be、mk、bn、my、bs、nl、bg、ca、no、cs、ne、ku、pl、cy、pt、da、ro、de、ru、el、sa、en、si、eo、sk、et、sl、eu、sd、fi、so、fr、es、gd、sr、ga、su、gl、sv、gu、sw、ha、ta、he、te、hi、th、hr、tr、hu、ug、hy、uk、id、ur、is、vi、it、xh、jv、zh、ja |
模型类型 |
zero-shot-image-classification |
新版本 |
visheratin/mexma-siglip2 |
使用示例
基础用法
from transformers import AutoModel, AutoTokenizer, AutoImageProcessor
from PIL import Image
import requests
import torch
model = AutoModel.from_pretrained("visheratin/mexma-siglip", torch_dtype=torch.bfloat16, trust_remote_code=True, optimized=True).to("cuda")
tokenizer = AutoTokenizer.from_pretrained("visheratin/mexma-siglip")
processor = AutoImageProcessor.from_pretrained("visheratin/mexma-siglip")
img = Image.open(requests.get("https://static.independent.co.uk/s3fs-public/thumbnails/image/2014/03/25/12/eiffel.jpg", stream=True).raw)
img = processor(images=img, return_tensors="pt")["pixel_values"]
img = img.to(torch.bfloat16).to("cuda")
with torch.inference_mode():
text = tokenizer(["кошка", "a dog", "एफिल टॉवर"], return_tensors="pt", padding=True).to("cuda")
image_logits, text_logits = model.get_logits(text["input_ids"], text["attention_mask"], img)
probs = image_logits.softmax(dim=-1)
print(probs)
📄 许可证
本项目采用MIT许可证。
🙏 致谢
感谢 ML Collective 和 Lambda 提供计算资源来训练该模型。