Skip to content

Commit

Permalink
Merge pull request #9 from anyangml/fix/clip-ut
Browse files Browse the repository at this point in the history
Fix: exp calc
  • Loading branch information
anyangml authored Jun 19, 2024
2 parents bba2c48 + caabfff commit a430dc8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/ci_ut.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ jobs:
uses: codecov/codecov-action@v4
with:
verbose: true
directory: clip
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion clip/clip/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ def forward(self, text, image):
embd_image = F.normalize(self.img_proj(encoded_image), dim=1) # (B, D)

# scaled pairwise cosine similarities (B, B)
logits = torch.mm(embd_text, embd_image.T) * torch.exp(self.temperature)
logits = torch.mm(embd_text, embd_image.T) * np.exp(self.temperature)

return logits, logits.T # text, image

0 comments on commit a430dc8

Please sign in to comment.