Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
rittik9 committed Dec 20, 2024
1 parent c6c433e commit a33d69a
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/torchmetrics/functional/multimodal/clip_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,8 @@ def _clip_score_update(
source_modality = _detect_modality(source)
target_modality = _detect_modality(target)

if source_modality == "image":
source_data = _process_image_data(source)
else:
source_data = _process_text_data(source)
if target_modality == "image":
target_data = _process_image_data(target)
else:
target_data = _process_text_data(target)
source_data = _process_image_data(source) if source_modality == "image" else _process_text_data(source)
target_data = _process_image_data(target) if target_modality == "image" else _process_text_data(target)

# Verify matching lengths
if len(source_data) != len(target_data):
Expand Down

0 comments on commit a33d69a

Please sign in to comment.