Skip to content

Commit 9ae8f8d

Browse files
authored
Use sharp logits
1 parent 2df5d36 commit 9ae8f8d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ft-D-eval-model-on-my-finetune-dataset.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def evaluate_model(model, data_loader):
8888
text_embeddings = F.normalize(text_embeddings, p=2, dim=1)
8989

9090
# Compute cosine similarity with temperature scaling
91-
logits_per_image = torch.matmul(image_embeddings, text_embeddings.T) / model.logit_scale.exp()
91+
logits_per_image = torch.matmul(image_embeddings, text_embeddings.T) * model.logit_scale.exp()
9292

9393
_, top_indices = logits_per_image.topk(1, dim=-1)
9494

0 commit comments

Comments
 (0)