From 0a560013768176771a4b1a987b62abbe5ed6f169 Mon Sep 17 00:00:00 2001 From: rittik9 Date: Thu, 9 Jan 2025 18:24:50 +0000 Subject: [PATCH] fix doctests --- .../functional/multimodal/clip_score.py | 18 +++++++++--------- src/torchmetrics/multimodal/clip_score.py | 14 +++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/torchmetrics/functional/multimodal/clip_score.py b/src/torchmetrics/functional/multimodal/clip_score.py index ad990c1bc26..1b735e53b13 100644 --- a/src/torchmetrics/functional/multimodal/clip_score.py +++ b/src/torchmetrics/functional/multimodal/clip_score.py @@ -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) diff --git a/src/torchmetrics/multimodal/clip_score.py b/src/torchmetrics/multimodal/clip_score.py index 961dd8498db..ab8621c0ca6 100644 --- a/src/torchmetrics/multimodal/clip_score.py +++ b/src/torchmetrics/multimodal/clip_score.py @@ -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.) """