Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoin committed Jan 4, 2024
1 parent bb136f6 commit 9f23f39
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions clip_retrieval/load_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(self, model_path):
import deepsparse # pylint: disable=import-outside-toplevel

##### Fix for two-input models
from deepsparse.clip import CLIPTextPipeline
from deepsparse.clip import CLIPTextPipeline # pylint: disable=import-outside-toplevel

def custom_process_inputs(self, inputs):
if not isinstance(inputs.text, list):
Expand Down Expand Up @@ -101,7 +101,7 @@ def encode_text(self, text):
embeddings = self.textual_model(text=text).text_embeddings[0]
return torch.from_numpy(embeddings)

def forward(self, *args, **kwargs):
def forward(self, *args, **kwargs): # pylint: disable=unused-argument
return NotImplemented


Expand All @@ -115,10 +115,10 @@ def load_deepsparse(clip_model):
# Compile the model with DeepSparse
model = DeepSparseWrapper(model_path=model_folder)

from deepsparse.clip.constants import CLIP_RGB_MEANS, CLIP_RGB_STDS
from deepsparse.clip.constants import CLIP_RGB_MEANS, CLIP_RGB_STDS # pylint: disable=import-outside-toplevel

def process_image(image):
image = model.visual_model._preprocess_transforms(image.convert("RGB"))
image = model.visual_model._preprocess_transforms(image.convert("RGB")) # pylint: disable=protected-access
image_array = np.array(image)
image_array = image_array.transpose(2, 0, 1).astype("float32")
image_array /= 255.0
Expand Down

0 comments on commit 9f23f39

Please sign in to comment.