Downloads · 30 days
17
20% of all-time downloads
unum-cloud/uform-vl-english-small-gpu-fp32
uform-vl-english-small-gpu-fp32 is a feature extraction model from unum-cloud. Use it when you need embeddings to search or compare text. It is set up for transformers. The card lists the license as apache-2.0.
<h1 align="center"UForm</h1 <h3 align="center" Multi-Modal Inference Library<br/ For Semantic Search Applications<br/ </h3
Downloads · 30 days
17
20% of all-time downloads
All-time downloads
85
Public
Repo size
234 MB
Likes
0
Public
Click a slice to open those files.
.onnx234 MB · 100%
From the Hugging Face model README
UForm is a Multi-Modal Modal Inference package, designed to encode Multi-Lingual Texts, Images, and, soon, Audio, Video, and Documents, into a shared vector space!
This is model card of the English only model with:
If you need Multilingual model, check this.
The following metrics were obtained with multimodal re-ranking (text-to-image retrieval):
| Dataset | Recall@1 | Recall@5 | Recall@10 |
|---|---|---|---|
| Zero-Shot Flickr | 0.565 | 0.790 | 0.860 |
| Zero-Shot MS-COCO | 0.281 | 0.525 | 0.645 |
ImageNet-Top1: 0.361
ImageNet-Top5: 0.608
pip install uform[onnx-gpu]
To load the model:
import uform
model, processor = uform.get_model_onnx('unum-cloud/uform-vl-english-small', device='gpu', dtype='fp32')
To encode data:
from PIL import Image
text = 'a small red panda in a zoo'
image = Image.open('red_panda.jpg')
image_data = processor.preprocess_image(image)
text_data = processor.preprocess_text(text)
image_features, image_embedding = model.encode_image(image_data, return_features=True)
text_features, text_embedding = model.encode_text(text_data, return_features=True)
score, joint_embedding = model.encode_multimodal(
image_features=image_features,
text_features=text_features,
attention_mask=text_data['attention_mask'],
return_scores=True
)
There are two options to calculate semantic compatibility between an image and a text: cosine similarity and Matching Score.
The similarity will belong to the [-1, 1] range, 1 meaning the absolute match.
Pros:
Cons:
Unlike cosine similarity, unimodal embedding are not enough.
Joint embedding will be needed and the resulting score will belong to the [0, 1] range, 1 meaning the absolute match.
Pros:
Cons: