Skip to content

Commit

Permalink
Merge pull request #1188 from ncoop57/clip-image-check
Browse files Browse the repository at this point in the history
Change instance check to image instead of imagefile
  • Loading branch information
nreimers committed Oct 1, 2021
2 parents 75c6b2f + 603df3c commit ffd72ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sentence_transformers/models/CLIPModel.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from torch import nn
import transformers
import torch
from PIL import ImageFile
from PIL import Image


class CLIPModel(nn.Module):
Expand Down Expand Up @@ -56,7 +56,7 @@ def tokenize(self, texts):
image_text_info = []

for idx, data in enumerate(texts):
if isinstance(data, ImageFile.ImageFile): # An Image
if isinstance(data, Image.Image): # An Image
images.append(data)
image_text_info.append(0)
else: # A text
Expand Down

0 comments on commit ffd72ab

Please sign in to comment.