Skip to content

Commit

Permalink
add random seed in doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
rittik9 committed Jan 10, 2025
1 parent 579d200 commit 1571f8c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/torchmetrics/multimodal/clip_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ class CLIPScore(Metric):
>>> from torch import randint
>>> from torchmetrics.multimodal.clip_score import CLIPScore
>>> metric = CLIPScore(model_name_or_path="openai/clip-vit-base-patch16")
>>> score = metric(randint(255, (3, 224, 224)), "a photo of a cat")
>>> image = torch.randint(255, (3, 224, 224), generator=torch.Generator().manual_seed(42))
>>> score = metric(image, "a photo of a cat")
>>> score.detach().round()
tensor(25.)
tensor(24.)
Example:
>>> import torch
Expand Down

0 comments on commit 1571f8c

Please sign in to comment.