Skip to content

Commit

Permalink
Update mypy.
Browse files Browse the repository at this point in the history
  • Loading branch information
rom1504 committed Jan 6, 2024
1 parent db198e3 commit c14bf7a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
16 changes: 8 additions & 8 deletions clip_retrieval/clip_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import enum
import json
from pathlib import Path
from typing import Dict, List
from typing import Dict, List, Optional

import requests

Expand Down Expand Up @@ -55,9 +55,9 @@ def __init__(

def query(
self,
text: str = None,
image: str = None,
embedding_input: list = None,
text: Optional[str] = None,
image: Optional[str] = None,
embedding_input: Optional[list] = None,
) -> List[Dict]:
"""
Given text or image/s, search for other captions/images that are semantically similar.
Expand Down Expand Up @@ -95,10 +95,10 @@ def query(

def __search_knn_api__(
self,
text: str = None,
image: str = None,
image_url: str = None,
embedding_input: list = None,
text: Optional[str] = None,
image: Optional[str] = None,
image_url: Optional[str] = None,
embedding_input: Optional[list] = None,
) -> List:
"""
This function is used to send the request to the knn service.
Expand Down
3 changes: 3 additions & 0 deletions clip_retrieval/load_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ def encode_text(self, text):
with autocast(device_type=self.device.type, dtype=self.dtype):
return self.inner_model.get_text_features(text)

def forward(self, *args, **kwargs):
return self.inner_model(*args, **kwargs)


class OpenClipWrapper(nn.Module):
"""
Expand Down
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
img2dataset
black==22.3.0
mypy==0.950
mypy==1.8.0
pylint==2.13.4
pytest-cov==3.0.0
pytest-xdist==2.5.0
Expand Down

0 comments on commit c14bf7a

Please sign in to comment.