mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
parent
8e05ad326b
commit
7cc6f822a3
@ -1371,8 +1371,19 @@ class FlavaModel(FlavaPreTrainedModel):
|
||||
>>> inputs = processor(text=["a photo of a cat"], images=image, return_tensors="pt", padding=True)
|
||||
|
||||
>>> outputs = model(**inputs)
|
||||
>>> logits_per_image = outputs.contrastive_logits_per_image # this is the image-text similarity score
|
||||
>>> probs = logits_per_image.softmax(dim=1) # we can take the softmax to get the label probabilities
|
||||
|
||||
>>> image_embeddings = outputs.image_embeddings
|
||||
>>> text_embeddings = outputs.text_embeddings
|
||||
>>> multimodal_embeddings = outputs.multimodal_embeddings
|
||||
|
||||
>>> outputs.image_embeddings.shape
|
||||
torch.Size([1, 197, 768])
|
||||
|
||||
>>> text_embeddings.shape
|
||||
torch.Size([1, 7, 768])
|
||||
|
||||
>>> multimodal_embeddings.shape
|
||||
torch.Size([1, 205, 768])
|
||||
```
|
||||
"""
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user