Fix ignore auto detected platform when passing config.pbtxt with platform entry

This commit is contained in:
allegroai 2023-09-23 17:40:54 +03:00
parent 083635c803
commit 96b335e3c2
3 changed files with 31 additions and 2 deletions

6
.gitignore vendored
View File

@ -13,6 +13,9 @@ build/
# JetBrains IDE
.idea/
.vscode/
tests/huggingface
# Generated by MacOS
.DS_Store
@ -20,6 +23,9 @@ build/
# Generated by Windows
Thumbs.db
# Virtual environment
.venv
# Applications
*.app
*.exe

View File

@ -6,15 +6,22 @@ from pathlib import Path
from clearml.model import Framework
from clearml_serving.serving.model_request_processor import ModelRequestProcessor, CanaryEP
from clearml_serving.serving.endpoints import ModelMonitoring, ModelEndpoint, EndpointMetricLogging
from clearml_serving.serving.model_request_processor import ModelRequestProcessor, CanaryEP
from clearml_serving.version import __version__
# noinspection PyBroadException
try:
from clearml.backend_api import Session
Session.add_client(__package__.partition(".")[0].replace("_", "-"), __version__) # noqa
except Exception:
pass
verbosity = False
answer_yes = False
def verify_session_version(request_processor):
from clearml_serving.version import __version__
current_v = float('.'.join(str(__version__).split(".")[:2]))
stored_v = float('.'.join(str(request_processor.get_version()).split(".")[:2]))
if stored_v != current_v:

View File

@ -359,6 +359,22 @@ class TritonHelper(object):
for i, s in enumerate(endpoint.output_name or []):
config_dict.put("output.{}.name".format(i), "\"{}\"".format(s))
# check if we have platform in the auxiliary config pbtxt
if platform and final_config_pbtxt:
# noinspection PyBroadException
try:
final_config_pbtxt_dict = ConfigFactory.parse_string(final_config_pbtxt)
# if we found it, null the requested platform and use the auxiliary config pbtxt platform `value`
if final_config_pbtxt_dict.get("platform", None):
print(
"WARNING: ignoring auto-detecetd `platform={}` "
"and using auxiliary pbtxt `platform={}`".format(
str(platform).lower(), final_config_pbtxt_dict.get("platform")))
platform = None
except Exception:
# we failed parsing the auxiliary pbtxt
pass
if platform and not config_dict.get("platform", None) and not config_dict.get("backend", None):
platform = str(platform).lower()
if platform.startswith("tensorflow") or platform.startswith("keras"):