class_docstr: Test CLIP model
code: def test_models(self):
      img = torch.rand(1, 3, 224, 224).to(self.device)
      text = ["test text"]
  
      model = clip.create_model(
          model_name="clip_vit_b16",
          pretrained=False,
          device=self.device,
      )
      image_features = model.encode_image(img)
      text_features = model.encode_text(text, device=self.device)
      self.assertTrue(image_features.shape, (1, 512))
      self.assertTrue(text_features.shape, (1, 512))
      logits_per_img, logits_per_text = model(img, text)
      self.assertEqual(logits_per_img.shape, (1, 1))
      self.assertEqual(logits_per_text.shape, (1, 1))
  
      model = clip.create_model(
          model_name="clip_vit_b32",
          pretrained=False,
          device=self.device,
      )
      image_features = model.encode_image(img)
      text_features = model.encode_text(
          text, multilingual=False, device=self.device
      )
      self.assertEqual(image_features.shape, (1, 512))
      self.assertEqual(text_features.shape, (1, 512))
      logits_per_img, logits_per_text = model(img, text)
      self.assertEqual(logits_per_img.shape, (1, 1))
      self.assertEqual(logits_per_text.shape, (1, 1))
  
      model = clip.create_model(
          model_name="clip_resnet_r50",
          pretrained=False,
          device=self.device,
      )
      image_features = model.encode_image(img)
      text_features = model.encode_text(text, device=self.device)
      self.assertEqual(image_features.shape, (1, 1024))
      self.assertEqual(text_features.shape, (1, 1024))
      logits_per_img, logits_per_text = model(img, text)
      self.assertEqual(logits_per_img.shape, (1, 1))
      self.assertEqual(logits_per_text.shape, (1, 1))
  
      model = clip.create_model(
          model_name="clip_resnet_r101",
          pretrained=False,
          device=self.device,
      )
      image_features = model.encode_image(img)
      text_features = model.encode_text(text, device=self.device)
      self.assertTrue(image_features.shape, (1, 512))
      self.assertTrue(text_features.shape, (1, 512))
      logits_per_img, logits_per_text = model(img, text)
      self.assertEqual(logits_per_img.shape, (1, 1))
      self.assertEqual(logits_per_text.shape, (1, 1))
  
imports: import unittest
  import torch
  from towhee.models import clip
label_desc: Use image node_id 2 for calling the TestClip obj's underlying member method code with example usage: obj.test_models() without return types