class_docstr: Test class for `CLIPScore` metric.
class_docstr_tok: ["Test","class","for","`","CLIPScore","`","metric","."]
docstr: Test that warning is given on long captions but metric still works.
docstr_tok: ["Test","that","warning","is","given","on","long","captions","but","metric","still","works","."]
code: def test_warning_on_long_caption(self, inputs, model_name_or_path):
      """Test that warning is given on long captions but metric still works."""
      metric = CLIPScore(model_name_or_path=model_name_or_path)
      preds, target = inputs
      target[0] = [
          target[0][0],
          "A 28-year-old chef who recently moved to San Francisco was found dead. "
          * 100,
      ]
      with pytest.warns(
          UserWarning,
          match="Encountered caption longer than max_position_embeddings=77. Will truncate captions to this length.*",
      ):
          metric.update(preds[0], target[0])
  
imports: from functools import partial
  from typing import List, NamedTuple
  import matplotlib
  import matplotlib.pyplot
  import pytest
  import torch
  from torch import Tensor
  from torchmetrics.functional.multimodal.clip_score import clip_score
  from torchmetrics.multimodal.clip_score import CLIPScore
  from torchmetrics.utilities.imports import _TRANSFORMERS_GREATER_EQUAL_4_10
  from transformers import CLIPModel
  from transformers import CLIPProcessor
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester
  from unittests.text.helpers import skip_on_connection_issues
label_desc: Use image node_id 7 for calling the TestCLIPScore obj's underlying member method code with example usage: obj.test_warning_on_long_caption(inputs, model_name_or_path) without return types