(self, device, model_name='openai/clip-vit-large-patch14')
| 12 | # laion/CLIP-ViT-bigG-14-laion2B-39B-b160k |
| 13 | class CLIP: |
| 14 | def __init__(self, device, model_name='openai/clip-vit-large-patch14'): |
| 15 | self.device = device |
| 16 | self.clip_model = CLIPModel.from_pretrained(model_name).to(self.device) |
| 17 | self.processor = CLIPProcessor.from_pretrained(model_name) |
| 18 | |
| 19 | def encode_image(self, image): |
| 20 | pixel_values = self.processor(images=image, return_tensors="pt").pixel_values.to(self.device) |
nothing calls this directly
no test coverage detected