Skip to content

Commit d2d90d1

Browse files
committed
Fix pytype complaints by simplifying code
Signed-off-by: M Q <mingmelvinq@nvidia.com>
1 parent 807e9f8 commit d2d90d1

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

monai/deploy/core/models/triton_model.py

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ def __init__(self, path: str, name: str = ""):
117117
"""
118118
super().__init__(path, name)
119119

120-
model_path: Path = Path(path)
121-
self._name = model_path.stem
122-
self._model_config = parse_triton_config_pbtxt(model_path / "config.pbtxt")
120+
self._model_path: Path = Path(path)
121+
self._name = self._model_path.stem
122+
self._model_config = parse_triton_config_pbtxt(self._model_path / "config.pbtxt")
123123
# The model name in the config.pbtxt, if present, must match the model folder name.
124124
if self._model_config.name and self._model_config.name.casefold() != self._name.casefold():
125125
raise ValueError(
@@ -154,7 +154,7 @@ def connect(self, netloc: str, **kwargs):
154154
@property
155155
def model_config(self):
156156
if not self._model_config: # not expected to happen with the current implementation.
157-
self._model_config = parse_triton_config_pbtxt(self.path / "config.pbtxt")
157+
self._model_config = parse_triton_config_pbtxt(self._model_path / "config.pbtxt")
158158
return self._model_config
159159

160160
@property
@@ -171,24 +171,6 @@ def predictor(self):
171171

172172
@classmethod
173173
def accept(cls, path: str) -> tuple[bool, str]:
174-
return cls.accept_local(path)
175-
176-
@classmethod
177-
def accept_remote(cls, path: str) -> tuple[bool, str]:
178-
# Check if the path is a valid Triton URL and also if the server is live
179-
# This function is not yet fully implemneted or used, as it is meant to be used for
180-
# dynamically querying the server for the model config instead of the local config.pbtxt file.
181-
if path and not bool(re.search(r"\s", path)) and not Path(path).is_dir():
182-
# Let's assume that the path is a url netloc, but
183-
# for host:port, urlparse will parse it to
184-
# (scheme='localhost', netloc='', path='80', params='', query='', fragment='')
185-
# and for host only, path='localhost'
186-
url = urlparse(path)
187-
if url.scheme or url.path or url.netloc:
188-
return True, cls.model_type
189-
190-
@classmethod
191-
def accept_local(cls, path: str) -> tuple[bool, str]:
192174
model_folder: Path = Path(path)
193175

194176
# The path should be a folder path, for an individual model, and must have the config.pbtxt file.

0 commit comments

Comments
 (0)