OpenCLIP
PyTorch
clip
Files changed (1) hide show
  1. README.md +2 -1
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
- text_probs = torch.sigmoid(image_features @ text_features.T * model.logit_scale.exp() + model.logit_bias)
 
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)