Skip to content

Commit

Permalink
fix doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
rittik9 committed Jan 9, 2025
1 parent 887be9d commit 0a56001
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
18 changes: 9 additions & 9 deletions src/torchmetrics/functional/multimodal/clip_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,15 @@ def clip_score(
>>> score.detach()
tensor(99.3556)
Example:
>>> from torchmetrics.functional.multimodal import clip_score
>>> score = clip_score(
... "28-year-old chef found dead in San Francisco mall",
... "A 28-year-old chef who recently moved to San Francisco was found dead.",
... "openai/clip-vit-base-patch16"
... )
>>> score.detach()
tensor(91.3950)
# Example:
# >>> from torchmetrics.functional.multimodal import clip_score
# >>> score = clip_score(
# ... "28-year-old chef found dead in San Francisco mall",
# ... "A 28-year-old chef who recently moved to San Francisco was found dead.",
# ... "openai/clip-vit-base-patch16"
# ... )
# >>> score.detach()
# tensor(91.3950)
"""
model, processor = _get_clip_model_and_processor(model_name_or_path)
Expand Down
14 changes: 7 additions & 7 deletions src/torchmetrics/multimodal/clip_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ class CLIPScore(Metric):
>>> score.detach().round()
tensor(100.)
Example:
>>> from torchmetrics.multimodal.clip_score import CLIPScore
>>> metric = CLIPScore(model_name_or_path="openai/clip-vit-base-patch16")
>>> score = metric("28-year-old chef found dead in San Francisco mall",
... "A 28-year-old chef who recently moved to San Francisco was found dead.")
>>> score.detach().round()
tensor(91.)
# Example:
# >>> from torchmetrics.multimodal.clip_score import CLIPScore
# >>> metric = CLIPScore(model_name_or_path="openai/clip-vit-base-patch16")
# >>> score = metric("28-year-old chef found dead in San Francisco mall",
# ... "A 28-year-old chef who recently moved to San Francisco was found dead.")
# >>> score.detach().round()
# tensor(91.)
"""

Expand Down

0 comments on commit 0a56001

Please sign in to comment.