Skip to content

Commit 1daa4c1

Browse files
nikhil-skNikhil Kulkarni
and
Nikhil Kulkarni
authored
Fix: Don't load default model in MME mode (#130)
* Fix: Don't load default model in MME mode * Remove whitespace from blank line * Fix flake8 issue in other file * Remove --model specification from MME test * Trigger build * Upgrade sagemaker and torch package * Unpin sagemaker in tox * Pin protobuf version * Update protobuf version for python3.6 * Trigger build * Revert dependency changes, keep only test dep changes * Trigger build * Revert version change when setting env variables * Trigger build * Trigger build Co-authored-by: Nikhil Kulkarni <[email protected]>
1 parent 0513c7a commit 1daa4c1

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

src/sagemaker_pytorch_serving_container/torchserve.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,13 @@ def start_torchserve(handler_service=DEFAULT_HANDLER_SERVICE):
9090
TS_CONFIG_FILE,
9191
"--log-config",
9292
DEFAULT_TS_LOG_FILE,
93-
"--models",
94-
DEFAULT_TS_MODEL_NAME + "=" + environment.model_dir
9593
]
9694

95+
default_model_path_args = ["--models", DEFAULT_TS_MODEL_NAME + "=" + environment.model_dir]
96+
97+
if not ENABLE_MULTI_MODEL:
98+
ts_torchserve_cmd += default_model_path_args
99+
97100
print(ts_torchserve_cmd)
98101

99102
logger.info(ts_torchserve_cmd)

test/unit/test_model_server.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ def test_start_torchserve_default_service_handler_multi_model(
104104
torchserve.TS_CONFIG_FILE,
105105
"--log-config",
106106
torchserve.DEFAULT_TS_LOG_FILE,
107-
"--models",
108-
"model=/opt/ml/model"
109107
]
110108

111109
subprocess_popen.assert_called_once_with(ts_model_server_cmd)

test/utils/file_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
def make_tarfile(script, model, output_path, filename="model.tar.gz", script_path=None):
2020
output_filename = os.path.join(output_path, filename)
2121
with tarfile.open(output_filename, "w:gz") as tar:
22-
if(script_path):
22+
if (script_path):
2323
tar.add(script, arcname=os.path.join(script_path, os.path.basename(script)))
2424
else:
2525
tar.add(script, arcname=os.path.basename(script))

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ deps =
7070
six
7171
future
7272
pyyaml
73+
protobuf == 3.19.6
7374

7475
[testenv:flake8]
7576
basepython = python3

0 commit comments

Comments
 (0)