-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Describe the bug
I'm trying to set the serving_port for my local sagemaker session as I can't use the default port 8080. The model/container correctly deploys but when trying to run inference the requests via predictor.predict(data) the request still hits localhost:8080, instead of the serving_port.
This seems to be due to the fact that predictor calls
response = self.sagemaker_session.sagemaker_runtime_client.invoke_endpoint(**request_args)
but the sagemaker_runtime_client does not have the correct serving_port set.
To reproduce
from sagemaker import LocalSession
session = LocalSession()
session.config = {
'local': {
'local_code': True,
'serving_port': 7554
}
}
print(session.sagemaker_runtime_client.serving_port)
This will print the default port 8080, rather than the specified serving_port. The problem is that when the sagemaker_runtime_client = LocalSagemakerRuntimeClient(self.config) is set inside LocalSession._initialize(), self.config is yet not specified. However there is no way to specify the config before said initialization happens.
Expected behavior
The code snippet above should print 7554
System information
A description of your system. Please provide:
- SageMaker Python SDK version: 2.36.0
Additional context
You can work around the problem by manually replacing the runtime client, like:
session = LocalSession()
session.config = {
'local': {
'local_code': True,
'serving_port': 7554
}
}
session.sagemaker_runtime_client = LocalSagemakerRuntimeClient(session.config)