Unlike most CLIP-like multomodal models, this model shares 4 layers between the text and visual encoder to allow for more data- and parameter-efficient training.
Also unlike most models, UForm provides checkpoints compatible with PyTorch, ONNX, and CoreML, covering the absolute majority of AI-capable devices, with pre-quantized weights and inference code.
If you need a larger, more accurate, or multilingual model, check our
HuggingFace Hub.
For more details on running the model, check out the
UForm GitHub repository.
For all evaluations, the multimodal part was used unless otherwise stated.
Recall@1, Recall@5, and Recall@10 on the
COCO-SM dataset:
For a deeper comparison of output ranking check the following table for the Normalized Discounted Cumulative Gains for the first 20 results - NDCG@20:
1from uform import get_model, Modality
2
3import requests
4from io import BytesIO
5from PIL import Image
6
7model_name = 'unum-cloud/uform3-image-text-multilingual-base'
8modalities = [Modality.TEXT_ENCODER, Modality.IMAGE_ENCODER]
9processors, models = get_model(model_name, modalities=modalities)
10
11model_text = models[Modality.TEXT_ENCODER]
12model_image = models[Modality.IMAGE_ENCODER]
13processor_text = processors[Modality.TEXT_ENCODER]
14processor_image = processors[Modality.IMAGE_ENCODER]
1text = 'a cityscape bathed in the warm glow of the sun, with varied architecture and a towering, snow-capped mountain rising majestically in the background'
2image_url = 'https://media-cdn.tripadvisor.com/media/photo-s/1b/28/6b/53/lovely-armenia.jpg'
3image_url = Image.open(BytesIO(requests.get(image_url).content))
4
5image_data = processor_image(image)
6text_data = processor_text(text)
7image_features, image_embedding = model_image.encode(image_data, return_features=True)
8text_features, text_embedding = model_text.encode(text_data, return_features=True)