Skip to content

Commit c14bf7a

Browse files
committed
Update mypy.
1 parent db198e3 commit c14bf7a

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

clip_retrieval/clip_client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import enum
55
import json
66
from pathlib import Path
7-
from typing import Dict, List
7+
from typing import Dict, List, Optional
88

99
import requests
1010

@@ -55,9 +55,9 @@ def __init__(
5555

5656
def query(
5757
self,
58-
text: str = None,
59-
image: str = None,
60-
embedding_input: list = None,
58+
text: Optional[str] = None,
59+
image: Optional[str] = None,
60+
embedding_input: Optional[list] = None,
6161
) -> List[Dict]:
6262
"""
6363
Given text or image/s, search for other captions/images that are semantically similar.
@@ -95,10 +95,10 @@ def query(
9595

9696
def __search_knn_api__(
9797
self,
98-
text: str = None,
99-
image: str = None,
100-
image_url: str = None,
101-
embedding_input: list = None,
98+
text: Optional[str] = None,
99+
image: Optional[str] = None,
100+
image_url: Optional[str] = None,
101+
embedding_input: Optional[list] = None,
102102
) -> List:
103103
"""
104104
This function is used to send the request to the knn service.

clip_retrieval/load_clip.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ def encode_text(self, text):
3333
with autocast(device_type=self.device.type, dtype=self.dtype):
3434
return self.inner_model.get_text_features(text)
3535

36+
def forward(self, *args, **kwargs):
37+
return self.inner_model(*args, **kwargs)
38+
3639

3740
class OpenClipWrapper(nn.Module):
3841
"""

requirements-test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
img2dataset
22
black==22.3.0
3-
mypy==0.950
3+
mypy==1.8.0
44
pylint==2.13.4
55
pytest-cov==3.0.0
66
pytest-xdist==2.5.0

0 commit comments

Comments
 (0)