Update README.md
#4
by
dotREADYus
- opened
README.md
CHANGED
@@ -91,7 +91,8 @@ with torch.no_grad(), torch.cuda.amp.autocast():
|
|
91 |
image_features = F.normalize(image_features, dim=-1)
|
92 |
text_features = F.normalize(text_features, dim=-1)
|
93 |
|
94 |
-
|
|
|
95 |
|
96 |
zipped_list = list(zip(labels_list, [round(p.item(), 3) for p in text_probs[0]]))
|
97 |
print("Label probabilities: ", zipped_list)
|
|
|
91 |
image_features = F.normalize(image_features, dim=-1)
|
92 |
text_features = F.normalize(text_features, dim=-1)
|
93 |
|
94 |
+
logits = model.logit_scale.exp() * image_features @ text_features.T
|
95 |
+
probs = logits.softmax(dim=-1)
|
96 |
|
97 |
zipped_list = list(zip(labels_list, [round(p.item(), 3) for p in text_probs[0]]))
|
98 |
print("Label probabilities: ", zipped_list)
|