Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance Clip_Score to calculate similarities between same modalities #2875

Open
wants to merge 75 commits into
base: master
Choose a base branch
from

Conversation

rittik9
Copy link
Contributor

@rittik9 rittik9 commented Dec 19, 2024

What does this PR do?

Fixes #2865

Before submitting
  • Was this discussed/agreed via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?
PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃


📚 Documentation preview 📚: https://torchmetrics--2875.org.readthedocs.build/en/2875/

@mergify mergify bot removed the has conflicts label Dec 19, 2024
@rittik9 rittik9 changed the title Enhance Clip_Score to calculate similarities between same modalities Enhance Clip_Score to calculate similarities between same modalities [WIP] Dec 19, 2024
Copy link

codecov bot commented Dec 19, 2024

Codecov Report

Attention: Patch coverage is 12.06897% with 51 lines in your changes missing coverage. Please review.

Project coverage is 32%. Comparing base (e690bbd) to head (1156b18).

❗ There is a different number of reports uploaded between BASE (e690bbd) and HEAD (1156b18). Click for more details.

HEAD has 210 uploads less than BASE
Flag BASE (e690bbd) HEAD (1156b18)
gpu 3 0
unittest 3 0
torch2.0.1+cpu 12 3
python3.10 36 9
Windows 12 3
cpu 68 17
macOS 16 4
torch2.0.1 8 2
torch2.6.0+cpu 8 2
python3.11 16 4
torch2.6.0 4 1
python3.12 12 3
torch2.5.0 4 1
torch2.5.0+cpu 12 3
Linux 40 10
torch2.4.1+cpu 8 2
torch2.1.2+cpu 4 1
torch2.2.2+cpu 4 1
torch2.3.1+cpu 4 1
python3.9 4 1
Additional details and impacted files
@@           Coverage Diff            @@
##           master   #2875     +/-   ##
========================================
- Coverage      69%     32%    -37%     
========================================
  Files         346     332     -14     
  Lines       19142   18995    -147     
========================================
- Hits        13230    6056   -7174     
- Misses       5912   12939   +7027     

src/torchmetrics/functional/multimodal/clip_score.py Outdated Show resolved Hide resolved
src/torchmetrics/functional/multimodal/clip_score.py Outdated Show resolved Hide resolved
src/torchmetrics/functional/multimodal/clip_score.py Outdated Show resolved Hide resolved
@rittik9
Copy link
Contributor Author

rittik9 commented Jan 7, 2025

@Borda I am planning to add some tests for new feature (calculate clip score in same modality). I am trying to understand how the reference metric should be.

@rittik9 rittik9 changed the title Enhance Clip_Score to calculate similarities between same modalities [WIP] Enhance Clip_Score to calculate similarities between same modalities Jan 9, 2025
@mergify mergify bot added the ready label Jan 9, 2025

txt_features = model.get_text_features(
processed_input["input_ids"].to(device), processed_input["attention_mask"].to(device)
device = torch.device("cpu")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Borda I changed this device assigning part a little bit. Can you please check it once..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend CLIP Score to image-to-image and text-to-text similarity
2 participants